2017-01-19
| 00:23 | ridcully_ | 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:44 | osfameron | is there a way to stop an (iterate) on a condition? |
| 02:44 | osfameron | e.g. an equivalent of (reduced) ? |
| 02:45 | osfameron | I 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:46 | rhg135 | You don't stop a lazy sequence iirc |
| 02:47 | rhg135 | You just stop consuming it |
| 02:47 | osfameron | nah, reductions is a lazy sequence, and can also be terminated by (reduce) |
| 02:47 | osfameron | it's up to a given sequence whether it wants to terminate or not |
| 02:48 | osfameron | e.g. you can produce a finite range lazily too |
| 02:48 | rhg135 | take-while |
| 02:49 | osfameron | yeah, that'd probably be the simplest way to implement what I want |
| 02:49 | osfameron | of course take-while also returns a lazy-seq :D |
| 02:51 | osfameron | thanks for suggestion, saves me implementing something more complex in meantime |
| 03:01 | BigSafari | im 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:03 | dysfun | BigSafari: i don't think you can pass extra readers to the cookie store |
| 03:06 | BigSafari | im 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:08 | rhg135 | int if you like being vague |
| 03:08 | BigSafari | nice one :-) |
| 03:08 | dysfun | you can convert it to an instant |
| 03:09 | dysfun | instants have a built in reader tag |
| 03:09 | dysfun | but make sure to put it into UTC first :) |
| 04:42 | m1dnight2 | Im 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:43 | dysfun | well macros don't 'hold' anything |
| 04:43 | m1dnight2 | https://hastebin.com/ogonihazok.rb |
| 04:43 | m1dnight2 | I 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:43 | dysfun | why is vars a macro? it can be a function |
| 04:44 | m1dnight2 | So 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:44 | m1dnight2 | It's a technique I need for another larger macro |
| 04:44 | dysfun | yeah, 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:44 | m1dnight2 | Basically, 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:45 | m1dnight2 | But 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:46 | dysfun | sure, but you're effectively calling (vars '[x y z]) because they're not evaluated to start with |
| 04:46 | m1dnight2 | Rabble, my explanation is not clear enough, sorry |
| 04:46 | m1dnight2 | Euh, I think I have a more telling example. I'll be back sec :p |
| 04:46 | dysfun | as will i in a couple of minutes |