This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-15
Channels
- # adventofcode (10)
- # babashka (28)
- # beginners (27)
- # calva (5)
- # cljs-dev (7)
- # clojure (134)
- # clojuredesign-podcast (3)
- # clojurescript (7)
- # cryogen (3)
- # cursive (12)
- # datomic (8)
- # devops (2)
- # figwheel (1)
- # fulcro (1)
- # graalvm (2)
- # jobs (6)
- # malli (2)
- # off-topic (43)
- # pathom (1)
- # reagent (4)
- # shadow-cljs (11)
tweaked a bit. now exposed is: * main/ctx-atom - atom of ctx in babashka.main/main's let * main/start-repl! - babashka.impl.repl/start-repl!
$ lein bb
Babashka v0.0.42-SNAPSHOT REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.
user=> (def a 1)
#'user/a
user=> (main/start-repl! @main/ctx-atom)
Babashka v0.0.42-SNAPSHOT REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.
user=> a
1
user=> (def b 2)
#'user/b
user=> b
2
user=> :repl/quit
nil
user=> b
2
user=> :repl/quit
$
may be this is a bug?
$ ./bb
Babashka v0.0.42-SNAPSHOT REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.
user=> `{:a 1}
java.lang.Long cannot be cast to java.util.Map$Entry [at line 1, column 1]
with lein:
$ lein bb
Babashka v0.0.42-SNAPSHOT REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.
user=> `{:a 1}
class java.lang.Long cannot be cast to class java.util.Map$Entry (java.lang.Long and java.util.Map$Entry are in module java.base of loader 'bootstrap') [at line 1, column 1
I think it is. I want to revise syntax quote anyway since it doesn’t support nesting right now
I've found correctly implementing syntax quotes is one of the harder parts of writing a lisp
@plexus I have the same experience. I recently found out that syntax-quote is a property of the reader and not so much of the compiler, so I might move it from sci to edamame, if possible
I'm now in progress of moving syntax-quote to edamame, but this is only to fix the
``x
nested stuff, which is not that commonly usedmay be another thing?
$ lein bb
Babashka v0.0.42-SNAPSHOT REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.
user=> (defn caller
[a-map]
((get a-map :a-fn)))
#'user/caller
user=> (defmacro hash-test
[]
`(let [a-fn# (fn [] :smile)]
(caller {:a-fn a-fn#})))
#'user/hash-test
user=> (hash-test)
Could not resolve symbol: a-fn# [at line 7, column 21]
borkdude@MBP2019 ~/Dropbox/dev/clojure/babashka/sci (nested-syntax-quote) $ lein run "$(cat /tmp/test.clj)"
:smile
was surprised to find out that in clojure (read-string "`8") is not the same as (read-string "'8")
$ rlwrap lein bb
user=> `(let [x# 1] `~x#)
(clojure.core/let [x__11641__auto__ 1] x__11641__auto__)
btw, this is a nice way to inspect what clojure actually generates while reading syntax quotes:
'`[1 2 3]
(clojure.core/apply clojure.core/vector (clojure.core/seq (clojure.core/concat (clojure.core/list 1) (clojure.core/list 2) (clojure.core/list 3))))
i've been using read-string
:
(read-string "'`[1 2 3]")
user=> (quote (clojure.core/apply clojure.core/vector (clojure.core/seq (clojure.core/concat (clojure.core/list 1) (clojure.core/list 2) (clojure.core/list 3)))))
The point is that you can just paste this in the REPL:
user=> '`[1 2 3]
(clojure.core/apply clojure.core/vector (clojure.core/seq (clojure.core/concat (clojure.core/list 1) (clojure.core/list 2) (clojure.core/list 3))))
bb 0.0.42: support for nested syntax quotes... because people use 'em 🙂 https://github.com/borkdude/babashka/releases/tag/v0.0.42