Fork me on GitHub
Drew Verlee01:06:17

random thought. Iā€™m working my way though 4clojure. I was playing with clojure.spec to. I could create specs for the 4clojure problems and run them against ppls submitted solutions. I wonder what we could find out from that.


Sigh. very nub question, here goes. Still getting used to data structures. I'm getting this as params from compojure/ring as a POST:

{image {:filename avatar.jpg, :content-type image/jpeg, :tempfile #object[ 0x47a213e8 /tmp/ring-multipart-4338227995799003474.tmp], :size 28460}} 
I'm just trying to get the filename, and tempfile, but I can't seem to figure it out, I do (get params :image) or (get params :filename) and whatever else and it's always returning nil. Please someone wack me with a clue-by-four?


welp. never stop trying, heh. it was (get params "image"). Nice little touch there šŸ˜„


@eslachance You seem to be using println or similar to print your data structure. When it's data, it's better to use prn, which prints strings with quotes. Like: {"image" {:filename "avatar.jpg",,,}} Then it would maybe be more obvious to use (get params "image"). Also, check out get-in.


Thanks for the tip, madstap!


@noisesmith, thanks. Just to see if I understand, it could work with: (testmacro {:a 1 :b 2} '(1 2 3)) but not with (def t {:a 1 :b 2}) (testmacro t '(1 2 3))


Welp, I'm pretty happy with the way this turned out!


Will have to make a little readme and instructions for ShareX but otherwise, it's a great start for a little project šŸ˜„