Fork me on GitHub

What are the benefits of using keyword over string? In particular, in a map?

Drew Verlee13:11:42

@itaied One difference i know is that a keyword can be used as a function call to a map: ((:foo {:foo :bar}) {:bar :car}) => :car


hi there, anyone knows, if it is possible to run a function in the repl and get some kind of verbose output of all the steps? something like bash -x for bash-scripts?


there's also profilers - a profiler can show you a lot of information about what ran (available for java or javascript)


alright, thanks, I once saw something that felt easier like this but I hardly recall any name or something (maybe 'analyze'??)


Hey everyone, needing some advice. I plan on learning Clojure, but is it ideal as a first programming language? If so, where would be a good place to start. Some background info: I'm a frontend dev, know HTML, CSS, very little JS. Thanks!


I thought about maybe starting with Racket.


there's a trade-off, racket is designed for learning, and very well suited to be a first language, but clojurescript directly integrates with your existing skills


but clojurescript is designed to be pragmatic for people that know it well, with less consideration to difficulty of learning


and in no way is optimized to be a first language (whereas racket is explicitly designed to be a first language)


Perfect, thanks!


Hi, I have a beginner question about spec:

ios:cljs.user=> (require '[clojure.spec.alpha :as s])

ios:cljs.user=> (s/def ::my-int int?)

ios:cljs.user=> (s/def ::my-map (s/keys :req-un [::my-int]))

;; But if i try to def the keys, it fails. Why doesn't that substitution work? 

ios:cljs.user=> (def the-keys [::my-int])
ios:cljs.user=> (s/def ::my-map (s/keys :req-un the-keys))
----  Could not Analyze  <cljs form>   line:1  column:17  ----

  Don't know how to create ISeq from: clojure.lang.Symbol

  1  (s/def ::my-map (s/keys :req-un the-keys))

----  Analysis Error  ----


Why does that second one fail? Shouldn't the-keys be my list of [::my-int]?


@hoopes it's because s/def is a macro and gets the-keys unevaluated (that is just symbol the-keys, not the vector). Your problem is pretty similar to this one:


gah - i see. thanks very much for the pointer!


yeah, looks like plum.csv/->record