#clojure log - Jan 19 2017

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0: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

2:44 osfameron: is there a way to stop an (iterate) on a condition?

2:44 e.g. an equivalent of (reduced) ?

2:45 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...

2:46 rhg135: You don't stop a lazy sequence iirc

2:47 You just stop consuming it

2:47 osfameron: nah, reductions is a lazy sequence, and can also be terminated by (reduce)

2:47 it's up to a given sequence whether it wants to terminate or not

2:48 e.g. you can produce a finite range lazily too

2:48 rhg135: take-while

2:49 osfameron: yeah, that'd probably be the simplest way to implement what I want

2:49 of course take-while also returns a lazy-seq :D

2:51 thanks for suggestion, saves me implementing something more complex in meantime

3: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?

3:03 dysfun: BigSafari: i don't think you can pass extra readers to the cookie store

3: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?

3:08 rhg135: int if you like being vague

3:08 BigSafari: nice one :-)

3:08 dysfun: you can convert it to an instant

3:09 instants have a built in reader tag

3:09 but make sure to put it into UTC first :)

4: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

4:43 dysfun: well macros don't 'hold' anything

4:43 m1dnight2: https://hastebin.com/ogonihazok.rb

4:43 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

4:43 dysfun: why is vars a macro? it can be a function

4: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)

4:44 It's a technique I need for another larger macro

4: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

4: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

4:45 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

4:46 dysfun: sure, but you're effectively calling (vars '[x y z]) because they're not evaluated to start with

4:46 m1dnight2: Rabble, my explanation is not clear enough, sorry

4:46 Euh, I think I have a more telling example. I'll be back sec :p

4:46 dysfun: as will i in a couple of minutes

Logging service provided by n01se.net