This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-01
Channels
- # announcements (3)
- # babashka (20)
- # beginners (77)
- # calva (27)
- # cider (5)
- # clara (3)
- # clj-kondo (9)
- # cljs-dev (4)
- # cljsrn (5)
- # clojure (26)
- # clojure-europe (32)
- # clojure-italy (5)
- # clojure-nl (3)
- # clojure-uk (5)
- # clojurescript (25)
- # clojureverse-ops (4)
- # core-async (49)
- # cursive (15)
- # data-science (1)
- # datahike (4)
- # datomic (3)
- # docker (1)
- # events (1)
- # helix (5)
- # holy-lambda (3)
- # introduce-yourself (1)
- # jobs (1)
- # kaocha (2)
- # lsp (15)
- # malli (42)
- # off-topic (18)
- # pathom (18)
- # pedestal (12)
- # polylith (7)
- # rdf (1)
- # re-frame (22)
- # reitit (2)
- # releases (1)
- # remote-jobs (1)
- # rewrite-clj (33)
- # shadow-cljs (85)
- # spacemacs (3)
- # vim (12)
- # xtdb (29)
Thanks @borkdude. Works like a charm:
(defn hl:update-bb-tasks
" \033[0;31m>\033[0m Update \033[0;31m:sha\033[0m of \033[0;31mio.github.FieryCod/holy-lambda-babashka-tasks\033[0m to latest stable version"
[]
(print-task "hl:update-bb-tasks")
(let [new-version (new-available-tasks-version)]
(if (= new-version TASKS_VERSION_SHA)
(hpr "You're using the latest tasks :sha. No update necessary!")
(do
(hpr "Updating from tasks version:" (accent TASKS_VERSION_SHA) "to:" (accent (new-available-tasks-version)))
(let [edn (r/parse-string BB_EDN_STRING)]
(spit "bb.edn" (r/update-in edn [:deps 'io.github.FieryCod/holy-lambda-babashka-tasks]
(fn [x]
(if-not (:sha (r/sexpr x))
x
(assoc (r/sexpr x) :sha new-version))))))))))
I need IPersistentList
type in babashka: @borkdude
You can add it somewhere here: https://github.com/babashka/babashka/blob/71b8d7fd3756750005c9923c033a31aa663c9dd2/src/babashka/impl/classes.clj#L363
Btw do you think I can use clojure.lang.PersistenList in this example instead:
(extend-protocol RingResponseBody
ByteArrayInputStream
(to-hl-response-body [^ByteArrayInputStream body]
{:body (new String ^bytes (.encode ^Base64$Encoder @base64-encoder (.readAllBytes body)))
:encoded? true})
InputStream
(to-hl-response-body [^InputStream body]
{:body (new String ^bytes (.encode ^Base64$Encoder @base64-encoder (.readAllBytes body)))
:encoded? true})
File
(to-hl-response-body [^File body]
{:body (new String ^bytes (.encode ^Base64$Encoder @base64-encoder ^bytes (Files/readAllBytes (.toPath body))))
:encoded? true})
String
(to-hl-response-body [^String body]
{:body body
:encoded? false})
URL
(to-hl-response-body [^URL body]
{:body (new String ^bytes (.encode ^Base64$Encoder @base64-encoder ^bytes (.readAllBytes (.getInputStream (.openConnection body)))))
:encoded? true})
IPersistentSet
(to-hl-response-body [^IPersistentSet body]
{:body body
:encoded? false})
PersistentVector
(to-hl-response-body [^PersistentVector body]
{:body body
:encoded? false})
IPersistentMap
(to-hl-response-body [^IPersistentMap body]
{:body body
:encoded? false})
IPersistentList
(to-hl-response-body [^IPersistentList body]
{:body body
:encoded? false})
ISeq
(to-hl-response-body [^ISeq body]
{:body (s/join "\n" (map str body))
:encoded? false})
Object
(to-hl-response-body [^Object body]
{:body (str body)
:encoded? false})
nil
(to-hl-response-body [_]
{:body nil
:encoded? false}))
Yeah. That way I would not need to specify PersistentVector Set etc 😄
Thx for the merge
Trying to install babashka with homebrew on M1 Mac yields the following error: Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)! Please create a new installation in /opt/homebrew using one of the “Alternative Installs” from: https://docs.brew.sh/Installation
This seems to be a policy of homebrew or mac, not much babashka can do about this I think?
a quick google search turns up this: <https://stackoverflow.com/questions/64963370/error-cannot-install-in-homebrew-on-arm-processor-in-intel-default-prefix-usr> - definitely a function of brew and hardware architectures
how do you usually deal with file names in spaces? I have file names that I'd like to put as args to a shell/sh
call
@benjamin.schwerdtner You can provide separate strings or quote the file name with single quotes
Some defrecord tweaks coming up soon.
1) The printing of a record is more like in JVM Clojure.
2) You can read the printed record back as a record using read-string
like in Clojure.
3) You can override toString
$ ./bb -e "(defrecord A [x] Object (toString [this] (str :dude))) (prn (->A 1)) (println (str (->A 1)))"
#user.A{:x 1}
:dude