Last active
July 29, 2021 10:29
-
-
Save myguidingstar/77340c5b145e1e657ca693dbe2e997fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns helloworld.core) | |
;; two identical code blocks | |
;; first one is at top level | |
(let [{:keys [a-b a_b]} {:a-b 0 :a_b 1}] [a-b a_b]) | |
;; second one nested inside a function call | |
(println (let [{:keys [a-b a_b]} {:a-b 0 :a_b 1}] [a-b a_b])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compiled by ClojureScript 1.10.866 {:optimizations :none} | |
goog.provide('helloworld.core'); | |
goog.require('cljs.core'); | |
var map__528_529 = new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"a-b","a-b",-1660985764),(0),new cljs.core.Keyword(null,"a_b","a_b",-1795286609),(1)], null); | |
var map__528_530__$1 = cljs.core.__destructure_map.call(null,map__528_529); | |
var a_b_531 = cljs.core.get.call(null,map__528_530__$1,new cljs.core.Keyword(null,"a-b","a-b",-1660985764)); | |
var a_b_532 = cljs.core.get.call(null,map__528_530__$1,new cljs.core.Keyword(null,"a_b","a_b",-1795286609)); | |
new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [a_b_531,a_b_532], null); | |
cljs.core.println.call(null,(function (){var map__533 = new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"a-b","a-b",-1660985764),(0),new cljs.core.Keyword(null,"a_b","a_b",-1795286609),(1)], null); | |
var map__533__$1 = cljs.core.__destructure_map.call(null,map__533); | |
var a_b = cljs.core.get.call(null,map__533__$1,new cljs.core.Keyword(null,"a-b","a-b",-1660985764)); | |
var a_b = cljs.core.get.call(null,map__533__$1,new cljs.core.Keyword(null,"a_b","a_b",-1795286609)); | |
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [a_b,a_b], null); | |
})()); | |
//# sourceMappingURL=core.js.map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:deps {org.clojure/clojurescript {:mvn/version "1.10.866"}}} |
The same result with macroexpanded version using let*
, so we can eliminate the case that something is wrong with cljs.core/let
macro:
(let* [m {:a-b 0, :a_b 1}
a-b
(cljs.core/get m :a-b)
a_b
(cljs.core/get m :a_b)]
[a-b a_b])
(println
(let* [m {:a-b 0, :a_b 1}
a-b
(cljs.core/get m :a-b)
a_b
(cljs.core/get m :a_b)]
[a-b a_b]))
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the setup is similar to the clojurescript official guide https://clojurescript.org/guides/quick-start
Compiled with
clj -M --main cljs.main --compile helloworld.core