Fork me on GitHub
#beginners
<
2017-05-24
>
mobileink20:05:31

@drewverlee don't forget about kw args: (foo 0 1 :x 2)

mobileink20:05:18

forget about bitcoin. blockchain technology is general. also a magical wtf? what is clojure doing with it?

mobileink20:05:59

https://blockstack.org is blowing my little gray cell.

noisesmith20:05:47

clojure isn’t appropriate for stuff that is intentionally CPU intensive like that, it’s easier to write java that does numerics efficiently than it is to make clojure do so

mobileink20:05:42

(sorry! thought i was on #off-topic )

bj20:05:04

I need a macro that takes a hashmap and an expression, and stores the expression as the key in a new hash-map and the evaluation of the expression as its value. So, for example

(bla {} (+ 1 1)) ; should yield {([clojure.core/+] 1 1) 2} 
This is what I've got so far
(defmacro bla
  [hm expr]
  `(assoc ~hm (list ~@expr) ~expr))
Is this the right approach?

noisesmith20:05:24

you need to quote the first expansion of expr

noisesmith20:05:36

and (list @x) is just x

noisesmith20:05:50

but you want ~‘x

bj20:05:37

So I try this

(defmacro bla
  [hm expr]
  `(assoc ~hm ~'expr ~expr))
But I get Unable to resolve symbol: expr in this context

noisesmith20:05:01

oh, right, sorry, ‘~x

bj20:05:16

Ah ha! Thank you.