#clojure logs

2017-01-19

00:23ridcully_WorldsEndless: another reason against figwheel in production: it demands optimizations to be set to be off - you end up with a gazillion files in the megabytes for your javascript
02:44osfameronis there a way to stop an (iterate) on a condition?
02:44osfamerone.g. an equivalent of (reduced) ?
02:45osfameronI was going to say "the docs for iterate don't mention anything" but then again, the docs for *reduce* don't mention this either...
02:46rhg135You don't stop a lazy sequence iirc
02:47rhg135You just stop consuming it
02:47osfameronnah, reductions is a lazy sequence, and can also be terminated by (reduce)
02:47osfameronit's up to a given sequence whether it wants to terminate or not
02:48osfamerone.g. you can produce a finite range lazily too
02:48rhg135take-while
02:49osfameronyeah, that'd probably be the simplest way to implement what I want
02:49osfameronof course take-while also returns a lazy-seq :D
02:51osfameronthanks for suggestion, saves me implementing something more complex in meantime
03:01BigSafariim storing a cookie in ring middleware cookie-store. the data i store is a hashmap with a joda.datetime object inside. but the reader is having trouble reading the cookie back in, because the reader does not know hos to parse the datetime object. error: No reader function for tag object. can i define a reader function for such an object?
03:03dysfunBigSafari: i don't think you can pass extra readers to the cookie store
03:06BigSafariim just storing a hashmap from a database record, which includes a joda datetime. is there a better format for the datetime which is supported by the reader?
03:08rhg135int if you like being vague
03:08BigSafarinice one :-)
03:08dysfunyou can convert it to an instant
03:09dysfuninstants have a built in reader tag
03:09dysfunbut make sure to put it into UTC first :)
04:42m1dnight2Im trying to make two macros: one that holds a symbol (I think?) which represents a variable, and then one that injects that symbol into another macro. But Im finding it hard to make it work
04:43dysfunwell macros don't 'hold' anything
04:43m1dnight2https://hastebin.com/ogonihazok.rb
04:43m1dnight2I can't realy explain it well :p But what I'm trying to achieve is something I need for another macro. This is a minimal test case
04:43dysfunwhy is vars a macro? it can be a function
04:44m1dnight2So as I understand it, the vars macro takes a symbol and turns that into a regular clojure value. Then I want to take that value and turn it into an AST again (I call the values that are parameters to the macro "AST"s)
04:44m1dnight2It's a technique I need for another larger macro
04:44dysfunyeah, but what i mean is the outer macro stops the forms from being evaluated, then it's just regular clojure data that can be passed to functions, which can use the same tricks
04:44m1dnight2Basically, I have a macro "create-actor" and that will expand to a blueprint for an actor. And when I call (spawn actordef) I want to construct a function from that
04:45m1dnight2But if I call (vars [x y z]) as a function, it will evaluate x y and z, and those are not supposed to be bound
04:46dysfunsure, but you're effectively calling (vars '[x y z]) because they're not evaluated to start with
04:46m1dnight2Rabble, my explanation is not clear enough, sorry
04:46m1dnight2Euh, I think I have a more telling example. I'll be back sec :p
04:46dysfunas will i in a couple of minutes