#clojure log - Jul 17 2014

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

1:31 tuft: do you guys use :pre and :post?

1:31 arrdem: all the time

1:32 tuft: ok thanks =)

1:33 arrdem: If you have environmental conditions, like dynamic variables that need to be bound, atoms that need to have values and arguments with explicit types :pre is awesome. I don't tend to use :post as much because typically I'd just be typechecking a return value, which is trivial.

1:34 https://github.com/clojure/tools.emitter.jvm/commit/32b1d01abd259fe4053389e98915aac0a763bb07

1:34 tuft: this particular use case is just testing two numeric parameters

3:03 kenrestivo: is there some way using the chronicle (flatland) library to get it to use the local time zone?

3:03 it uses joda time. it doesn't seem to take parameters to tell it what time zone to use.... could it require poking at some global singleton in the underlying java library?

3:05 ah never mind found it. yes it does, apparently http://joda-time.sourceforge.net/apidocs/org/joda/time/DateTimeZone.html#setDefault%28org.joda.time.DateTimeZone%29

3:23 _eric: if I have a (loop) that doesn't have a (recur) in one branch, will it continue to loop or will it drop out?

3:23 amalloy: try it and see, _eric

3:34 luxbock: does there exist an API documentation for all the functions of cljs.core that are not part of clojure.core?

3:34 I'm trying to find if there's a predicate function for telling js-objects apart from Clojure maps

3:37 Glenjamin: i'm fairly sure objects don't pass map?

3:38 luxbock: is there a way to test for something being a js-object specifically though?

3:39 Glenjamin: everything is a js object

3:39 Bronsa`: luxbock: there's a object? predicate

3:40 Glenjamin: orly

3:40 i wish one of the bots had a cljs repl handy

3:41 luxbock: Bronsa: ah yeah perfect

3:42 augustl: https://github.com/krukow/clj-ds - 0.0.4, still at Clojure 1.5.1 - is anyone actively maintaining a stand-alone version of Clojure's data structures? :)

3:44 Glenjamin: Bronsa: is that fairly new? both himera and cljsfiddle are erroring saying there's no object?

3:47 Bronsa: Glenjamin: no idea.

3:49 Glenjamin: https://github.com/clojure/clojurescript/commit/a8797e4c6b9395c061170aa75da41414290fedf9

3:51 Glenjamin: cheers

3:51 i guess thats a reasonable implementation

3:52 chamomile: hi - new to clojure and trying to make a simple static site generator, i don't know the specifics for serving valid http, what clojure libs can i learn from?

3:53 Glenjamin: https://github.com/mmcgrana/ring/blob/master/SPEC might be worth a look

3:59 chamomile: thanks Glenjamin,

3:59 augustl: chamomile: you could look at a static stite generator :) https://github.com/magnars/stasis

4:02 Glenjamin: (object? #js {}) ;=> #<false>

4:02 chamomile: augustl: thanks, i find clojure confusing sometimes when i'm trying to do something i've never done before

4:02 this will help

4:07 Bronsa: Glenjamin: that returns true on my repl

4:14 Glenjamin: I think I need a better repl

4:14 augustl: repl-ace it with a better one

4:15 Glenjamin: Is there a good "run this and get a cli repl" for cljs?

4:26 razum2um: how can I iterate over java object which implements Iterable ?

4:28 Bronsa: Glenjamin: I use script/repljs from the cljs repo

4:28 razum2um: oh. found it - iterator-seq, sorry

4:37 hhenkel: Hi all, I'm wondering if there is a better / more elegant way to achieve this: https://www.refheap.com/88274

4:38 The idea is to merge data depending on if it is allready within a datastructure or not.

4:39 TEttinger: hhenkel, this came up not long ago

4:40 hhenkel: TEttinger: okay, any reference where I could find something about it?

4:40 TEttinger: well your problem uh... doesn't seem like it makes sense yet to me

4:40 not sure if it's the same

4:41 I wrote a snippet to handle extracting stuff out of nested maps

4:42 hhenkel: TEttinger: The idea / problem I'm trying to solve is that I got some configuration from config files and other parts that get evaluated dynamicaly.

4:42 TEttinger: The configuration parts are from the same "type", therefore I want them to merge them in a datastructure to process them.

4:43 TEttinger: hm, http://clojure-log.n01se.net/ is out of date

4:43 ok, but there are some problems with your pseudocode

4:44 hhenkel: I updated it, as I saw the list definition was wrong

4:44 TEttinger: well => (merge a {:bla (merge (:bla a) {:1 (concat ((:bla a) :1) (:1 b))})})

4:44 (:bla a) -- what is a?

4:45 it's in the lists

4:45 hhenkel: Ah, okay sorry it is not clearly named.

4:45 a is in this case the def a.

4:45 I'll update the names, one sec

4:47 TEttinger: Okay, things should be clearer now

5:19 TEttinger: So any idea?

5:19 TEttinger: sorry haven't checked yet, was debugging my own stuff

5:21 hhenkel: okay

5:21 TEttinger: this seems like it would be very hard to do in a general way

5:21 the :1 being under :bla and not under :bla could be problematic

5:22 hhenkel: TEttinger: That is not much of an issue. I'll check if the key is allready available in an if and depending on the outcome I execute one or the other.

5:23 I'm more interested to find out if there is a better / smarter way to do the merging.

5:23 TEttinger: I'm going to fall asleep soon, so smarter is not in my domain right now :)

5:25 hhenkel: TEttinger: okay, no problem.

5:25 hyPiRion: hhenkel: let me have a look

5:25 hhenkel: hyPiRion: https://www.refheap.com/88274

5:26 hyPiRion: thanks

5:31 hhenkel: I suppose you want the option to have the config maps add in new keys over time?

5:31 Eh, that was poorly worded. If you add in new keys for new functionality, you shouldn't have to manually handle merging of those, I meant.

5:32 hhenkel: hyPiRion: Yes exactely. Current situation is that I got static config via files. I now implemented something to do automatic lookup resulting in more config items (as they are of the same type as the static ones).

5:36 hyPiRion: I'm afk for the next 30 min, lunch...

5:36 hyPiRion: hhenkel: alright

5:38 hhenkel: well, here's what I came up with just now. https://www.refheap.com/88275 -- it's sort of a stripped down version of how Lein does the profile merging

6:23 hhenkel: hyPiRion: Oh, that looks promising. I'll try out that.

6:36 hyPiRion: That works like a charm! Are you involved in lein or why did you get the idea to be inspired by it?

7:01 luxbock: is importing types supported in ClojureSciprt? I'd like to use them for Schema-validation

7:02 but I'm getting warnings when I try to do it like how I'd do it in regular Clojure

7:03 ah, found it: "ClojureScript types and records should be brought in with :use or :require :refer, not :imported"

7:04 hyPiRion: hhenkel: sorry, went out for lunch as well. Yeah, I'm one of the "regulars" on Lein

7:05 noidi: I wonder if there's anyone who prefers that `some` returns the value of the predicate and not the item matching the predicate

7:06 I keep reaching for `some` only to realize that I need `(first (filter ...))` to do what I want

7:10 razum2um: I have a strange cast issue with calling a method accepting a generic: https://gist.github.com/razum2um/432181a0689e5c447b09 any ideas how it happens?

7:10 hyPiRion: noidi: yeah, I think it has actually been discussed whether or not to include a ffilter function in core, but don't quote me on that

7:15 Glenjamin: so, what's the deal with clojure-in-clojure for cljs - is there somewhere i can help contribute?

7:50 rurumate: &(clojure.set/union #{1} [2])

7:50 lazybot: ⇒ #{1 2}

7:50 rurumate: &(clojure.set/union #{1} [2 3])

7:50 lazybot: ⇒ [2 3 1]

7:51 nobodyzzz: but why? =(

7:54 oh it does (reduce conj longer_seq shorter_seq)

8:02 instilled: hi! how can i represent an empty character in clojure? something like \empty

8:02 ?

8:03 rurumate: do you mean \space?

8:03 you can represent any char by its unicode sequence ofc

8:03 instilled: nope. i would like to replace \space with \empty (\u0000).

8:04 rurumate: you want to remove spaces?

8:04 instilled: exactly.

8:04 rurumate: so "this has spaces" would become "thishasspaces"?

8:04 instilled: yup!

8:04 rurumate: ok, that's different. how would you do it in java?

8:05 instilled: ' ' -> ''

8:05 rurumate: doesn't look java to me

8:06 noidi: ,(clojure.string/replace "foo bar baz" \space \u0000)

8:06 clojurebot: "foo

8:06 instilled: well, then i go with regexps… i thought there was maybe a way to do it without regexp (or filter).

8:06 rurumate: you can use a stringbuilder ofc

8:06 regexp are extremely slow, avoid them in perf critical code

8:06 &(.indexOf "myString" (int \space))

8:06 lazybot: ⇒ -1

8:07 rurumate: you can check if it has the character first. .indexOf is very fast

8:07 instilled: rurumate: i'll do that then. cheers a lot!

8:08 nobodyzzz: (clojure.string/string "foo bar baz")

8:08 ,(clojure.string/trim "foo bar baz")

8:08 clojurebot: "foo bar baz"

8:08 instilled: `(.replace "ab c" " " "")

8:08 ,(.replace "ab c" " " "")

8:08 clojurebot: "abc"

8:08 nobodyzzz: ,(clojure.string/trim "foo bar baz" " " "")

8:08 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: string/trim>

8:09 nobodyzzz: ,(clojure.string/replace "foo bar baz" " " "")

8:09 clojurebot: "foobarbaz"

8:10 rurumate: wait, I think I got something for you

8:11 instilled: https://www.refheap.com/88278

8:12 you can call (space-first) in a loop and build the string in a stringbuilder

8:14 instilled: rurumate: that looks nice :) I'll keep it simple for now with (.replace "some string" " " ""). that does work well.

8:14 rurumate: something like this (untested): (loop [sb (StringBuilder) s "this has spaces"] (if-let [token (space-first s) (do (.append sb token) (recur (space-rest s)) (.toString db))

8:15 or move the sb to a surrounding let

8:15 one moment..

8:19 instilled: https://www.refheap.com/88279

8:20 try (remove-spaces "this has spaces") -> "thishasspaces"

8:20 ElroyJetson: I've got CIDER and leiningen installed. I would appreciate some help on getting my feet wet from here as I have described here - http://www.reddit.com/r/emacs/comments/2ay4z0/clojure_baby_steps/

8:21 instilled: rurumate: cheers!

8:23 pyrtsa: rurumate: FYI, your code runs 2x slower than (clojure.core/replace lorem " " "") on a "Lorem ipsum ..." string of 446 characters (68 spaces).

8:24 rurumate: really? how did you test it?

8:25 oh it's clojure.core replace w/o rexexp. I didn't know that existed.

8:25 in that case instilled you should probable use clojure.core/replace

8:25 hyPiRion: uh, replace takes a map and a collection

8:26 ,(replace {\a \b \c \d} "acca")

8:26 clojurebot: (\b \d \d \b)

8:26 hyPiRion: not entirely what you want

8:26 rurumate: &(clojure.core/replace "a b c" " " "")

8:26 lazybot: clojure.lang.ArityException: Wrong number of args (3) passed to: core$replace

8:26 rurumate: umm

8:26 instilled: rurumate: yeah. i'll go with that!

8:27 hyPiRion: maybe you just meant .replace

8:27 instilled: ,(replace "abc def" " " "")

8:27 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core/replace>

8:27 instilled: ,(.replace "abc def" " " "")

8:27 clojurebot: "abcdef"

8:27 rurumate: so java.lang.String.replace is the way to go apparently

8:27 instilled: does exactly that.

8:36 pyrtsa: rurumate: I tested it by wrapping inside (time (dotimes [_ 100000] ...)), resulting in ~2300 ms (yours) vs. ~1100 ms (clojure.string).

8:37 rurumate: ok, thanks for testing. I hope it's still faster than a regexp.

8:38 pyrtsa: (time (dotimes [_ 100000] (str/replace lorem " " ""))) ;;=> "Elapsed time: 1032.865 msecs"

8:38 (time (dotimes [_ 100000] (str/replace lorem #" " ""))) ;;=> "Elapsed time: 1187.55 msecs"

8:38 (time (dotimes [_ 100000] (str/replace lorem #" +" ""))) ;;=> "Elapsed time: 1585.51 msecs"

8:38 Certainly depends on the regular expression, but still no.

8:39 mpenet: well regex is faster for me too

8:39 (clojure.string/replace "foo bar baz" #"\s+" "") vs " "

8:40 in that case at least (microbenchmarks ftw)

8:40 pyrtsa: Microbenchmarks indeed. :)

8:41 mpenet: without the + in the regex it is a bit faster too

9:11 boxed: ,(= (eval 'str) str)

9:11 clojurebot: true

9:11 boxed: ,(= (type (eval 'str)) (type str))

9:11 clojurebot: true

9:11 boxed: ,(var str)

9:11 clojurebot: #'clojure.core/str

9:11 boxed: ,(var (eval 'str))

9:11 clojurebot: #<CompilerException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol, compiling:(NO_SOURCE_PATH:0:0)>

9:12 boxed: wtf? can someone explain that to me?

9:12 pyrtsa: var is a special form.

9:13 stuartsierra1: ,(eval 'str)

9:13 clojurebot: #<core$str clojure.core$str@1be9101>

9:14 stuartsierra1: ,(var str)

9:14 clojurebot: #'clojure.core/str

9:14 stuartsierra1: ,(resolve 'str)

9:14 clojurebot: #'clojure.core/str

9:14 pyrtsa: The var special form treats its argument like a macro does. That's why "(eval 'str)" looks like a PersistentList to it, a list containing the symbol "eval" and the quoted str.

9:15 And the argument must be a Symbol, so thus the error.

9:25 hhenkel: I'm trying to cast a LazySeq into an array but I keep getting an error: java.lang.IllegalArgumentException: array element type mismatch

9:26 I got "(into-array String attributes)" with attributes as LazySeq.

9:26 How must I cast this?

9:28 zoldar: hhenkel: are you sure that all elements in your lazyseq are strings?

9:30 hhenkel: zoldar: I would say so: https://www.refheap.com/88280

9:36 Is there a way to debug on which element the code is failing?

9:36 zoldar: ^^

9:37 I tried to use only one attribute and the code is allready failing.

9:38 mpenet: try to trace the `type` of your attribute

9:39 hhenkel: mpenet: I just did that, it gives me "TRACE attributes: java.lang.String" with (trace "attributes" (type (first (:attributes request))))

9:40 mpenet: hhenkel: maybe gist your code

9:40 ,(into-array String (map identity ["a"]))

9:40 clojurebot: #<String[] [Ljava.lang.String;@a5d82a>

9:40 mpenet: should work

9:40 (type (map identity ["a"]))

9:40 ,(type (map identity ["a"]))

9:40 clojurebot: clojure.lang.LazySeq

9:49 hhenkel: mpenet: For what is identity in your example?

9:49 It does not work for me

9:50 mpenet: I'm checking if I could provide some small example.

9:53 mpenet: https://www.refheap.com/88283

9:56 mpenet: Okay, I gues I found the error. I moved the trace to the function that recieves the values and there I see that only the first value is handed over, not the complete seq.

9:57 mpenet: hhenkel: identity is just one way to make a lazyseq out of ["a"]

10:06 stevenfx: Hey

10:07 Is anyone having any problems with deps problem with clojure 1.6 not being avaliable

10:07 ?

10:10 I keep getting https://www.refheap.com/88284

10:11 might just be my network

10:24 ok I must be living under a rock because today is the first day I see the new clojars.org design :)

10:24 looks amazing

12:06 ptcek: Is it right that prismatic fnk / defnk does not support input schemas?

12:34 andyf_: hiredman: Ping

12:38 hiredman: andyf_: hello

12:38 I mean

12:38 andyf_: pong

12:39 andyf_: In the github issue for Eastwood about selective disabling of warnings, you mention marker macros, "but those have issues"

12:40 I wanted to find out what issues you meant, since I was considering using a marker macro for this purpose

12:41 hiredman: you couldn't only have a dev dependency on eastwood then

12:42 andyf_: Meaning you need to require the namespace defining the macro, yes?

12:42 hiredman: right

12:42 which could be a distinct "slim" depdency or something

12:43 andyf_: What if that were in a tiny project doing almost nothing but defining that macro?

12:44 technomancy: this sounds like a textbook example for why metadata is useful?

12:44 andyf_: technomancy: I'm considering that, but you cannot put it on everything

12:45 ambroseb_: andyf_: org.clojure/core.typed.rt is basically that for core.typed

12:45 andyf_: A macro can wrap any expression

12:45 MrJones98: mikerod: thanks for the help yesterday - turned out to be a bunch of issues jumbled together. the primary problem was interaction in the repl and reloading namespaces

12:45 technomancy: andyf_: what's an example of a valid source form that would generate a warning but not be IObj or IMeta?

12:45 Bronsa: a macro can be a no-op only for functions tohough, if you have (macro1 (macro2 ..)) macro2 will not be invisible to macro1

12:45 xk05: civilian airliner shot down over eastern ukraine

12:46 Bronsa: technomancy: a keyword

12:46 technomancy: eastwood has a misspelled-keyword linter

12:46 technomancy: huh

12:46 ^:eastwood/ignore (identity :not-a-typo) =)

12:46 mikerod: MrJones98: no problem. I'm glad you got it sorted out. I know there can certainly be issues when matching on types, when those types are being dynamically reloaded into the runtime.

12:47 technomancy: Bronsa: can't you just move the metadata up to the form containing the keyword though?

12:47 Bronsa: technomancy: that might work, yes

12:47 andyf_: technomancy: A marker macro can leave compiled byte code unmodified, I believe

12:47 Bronsa: technomancy: actually no

12:47 technomancy: it has the same issues as using a macro

12:48 technomancy: e.g. if your keyword is an argument to a macro that expects a keyword literal

12:48 technomancy: I see

12:48 MrJones98: mikerod: yeah - you provided the sanity check that it wasn’t a misuse of the library but something possibly more insidious

12:48 technomancy: Bronsa: actually no, I don't

12:48 just attach the metadata to the macro call

12:48 and the linter shouldn't descend into it, right?

12:48 andyf_: Bronsa: I'm not expecting people will want to disable keyword warnings that way, necessarily, but I wouldn't want to disallow it

12:48 technomancy: (forget the identity bit)

12:49 Bronsa: andyf_: I think at this point having evaluated all the possibile solutions metadata seems like the best one. we can use a gloabal table of keywords to ignore

12:49 technomancy: ^{:eastwood/ignore-keywords #{:foo}} (macro ... :foo ..) ?

12:50 technomancy: right

12:50 or just ^:eastwood/ignore-keywords if you are lazy and sacrifice granularity

12:50 andyf_: Bronsa: Do you have any concerns about a marker macro other than the need to require its definition?

12:50 Bronsa: andyf_: yes. it wont work in some cases

12:50 18:43:34 <Bronsa> a macro can be a no-op only for functions tohough, if you have (macro1 (macro2 ..)) macro2 will not be invisible to macro1


12:50 andyf_: ^

12:51 andyf_: silly example, (for [x (range) (eastwood-ignore :when) (even? x)] x)

12:51 that won't work

12:52 andyf_: Sorry if I am being dense here, but if macro2 is defined to expand only to its 1 arg , what can go wrong there?

12:53 technomancy: andyf_: just saw the eastwood ticket about re-using JVMs; are you aware of :eval-in :nrepl?

12:53 andyf_: Ok, but that example doesn't work equally for metadata, either

12:53 Bronsa: andyf_: (defmacro x [y] (if (= :y y) 1 2)) (x :y) (x (do :y)) will produce different results

12:55 andyf_: correct, there's no way to wrap a form in an "invisible" way, if the form is used inside a macro call it will always be problematic

12:55 andyf_: what technomancy suggested might be the best solution -- attaching the :ignore metadata on a previous form

12:56 andyf_: Back in a few mins

12:57 ben-o: hi. any advice on how to print lazy seqs? I have a clojure.lang.LazySeq and i'm trying to force eval and print to file. but the file only prints the lazy seq object id.

12:58 i've tried doall, map prn

13:07 nkoza: ben-o: (prn my-lazy-seq) should work

13:09 ben-o: nkoza: thanks but that doesn't seem to work

13:09 nkoza: ben-o: can you create a gist with your code?

13:11 johnwalker: when you use xml->, is there any way to assert that all predicates are true?

13:12 i'd like to get an error if an element isn't found

13:15 ben-o: nkoza: https://gist.github.com/BenjyO238/6aae961f81bf565cbc8a

13:15 thanks

13:18 GoodBobK: Hi, possibly stupid question. I'm looking at https://github.com/swannodette/om/blob/master/src/om/core.cljs, line 566-568:

13:18 (cond

13:18 (nil? m)

13:18 (let [shared (or (:shared m) (get-shared *parent*))

13:18 What's the point of (:shared m) when in this branch m is nil?

13:21 nkoza: ben-o: you need to use pr-str instead of prn

13:22 ben-o: prn prints the lazy-seq to standard ouput and returns nil, then spit is taking that nil value

13:22 ben-o: pr-str prints the lazy-seq to an string and returns that string, use it.

13:23 andyf_: Sorry to drop out on folks when you were helping me out there. Work intrudes. Will read the discussion and bring it up again later if I have more questions. Thanks!

13:24 ben-o: nkoza: thanks! works now. appreciate your help.

13:25 mi6x3m: hey guys, what is the most convenient way to get a list of all symbols used by a function?

13:25 right now I use (filter symbol? (flatten (read (source-fn

13:25 nkoza: GoodBobK: seems there is no point, you should blame on that line to notify dnolen about it

13:26 mi6x3m: also, is there an elegant way to strip the namespace in a qualified symbol?

13:26 GoodBobK: nkoza: thanks

13:27 nkoza: mi6x3m: I only found (-> 'ns/sym name symbol)

13:27 tvanhens: In datalog, if I have a set of names-to-check, and a set of names-in-db, how would I query for all names-to-check which are not already contained in names-in-db?

13:28 mi6x3m: nkoza: ah! it seems name ignores the ns qualifier

13:28 thanks

14:03 rurumate: can anyone give an example of what reduced and reduced? are doing?

14:03 &(reduced 1)

14:03 lazybot: java.lang.RuntimeException: Unable to resolve symbol: reduced in this context

14:03 rurumate: ok that's fail

14:04 ambrosebs: ,reduced

14:04 clojurebot: #<core$reduced clojure.core$reduced@3002b9>

14:04 ambrosebs: a Reduced is a special wrapper value that terminates a reduce early

14:05 boxed: how do I make clojure drop into a repl when the process throws an uncaught exception?

14:05 razum2um: does anybody knows why it happens: https://gist.github.com/razum2um/432181a0689e5c447b09 ?

14:05 rurumate: but why can lazybot not resolve it?

14:05 technomancy: boxed: I think ritz does that

14:05 rurumate: and what is it good for? example?

14:07 ambrosebs: &*clojure-version*

14:07 lazybot: ⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}

14:07 technomancy: huh, is reduced a special form?

14:07 ambrosebs: ,*clojure-version*

14:07 clojurebot: {:major 1, :minor 6, :incremental 0, :qualifier nil}

14:07 ambrosebs: I mean it's treated specially in reduce

14:07 boxed: technomancy: hmm.. the docs on that seems… lacking. Referring to a presentation from a conj the first thing makes the baby jesus cry

14:08 ambrosebs: oh and it was introduced in 1.5.1

14:08 technomancy: boxed: yeah, it's unfortunate

14:08 ambrosebs: or 1.5.0

14:13 Bronsa: technomancy: reduces is just a regular function

14:15 technomancy: it wraps the value in a clojure.lang.Reduced, when reduce is handled a c.l.Reduced as its accum it short circuits

14:15 technomancy: yeah, I didn't expect lazybot to have such an old version

14:18 mikerod: I didn't realize that binding conveyance worked for lazyseq's produced in the scope of dynamically bound vars.

14:18 has this been the case for long in clj?

14:18 I also, don't think I fully understand how this works. I wasn't wanting to dig around to understand it. I have observed that something like `with-redefs-fn` doesn't play nice with laziness.

14:19 tbaldridge: laziness and dynamic bindings of any kind is just wrong

14:20 mikerod: tbaldridge: hmm

14:20 tbaldridge: it apparently works to some degree

14:20 I think the problem with statements like that is that things sometimes end up being lazy when you dont' expect, just due to the "lazy when it can be" behavior in clj.

14:21 tbaldridge: dynamic bindings say "do this within this timeframe", laziness says "do this later". Hilarity ensues

14:21 right so the default should be, avoid binding an with-redefs

14:21 *and

14:21 mikerod: In reality, the issue is that dynamic bindings are just nasty. If you write a fn and it has lazy behavior, but uses some fn deeper down the stack that references a dynamic var, you'd have to just know about that and be defensive/force eagerness.

14:22 trptcolin: or use bound-fn*

14:22 mikerod: tbaldridge: yes, avoidance...

14:22 trptcolin: I was unaware of bound-fn, pretty cool

14:23 my main point is, it looks like dynamic bindings were working with a lazy seq

14:23 I didn't think it did. Now I'm curious how/why/and is it reliable.

14:23 Not that I really intend to utilize it.

14:23 tbaldridge: they do, sometimes...

14:24 mikerod: tbaldridge: so this is one of those things that are hit-or-miss and hard to identify the scenarios where it fails?

14:24 tbaldridge: no, it makes perfect sense if you know about things like chunked-seqs

14:24 mikerod: I have observed that with-redefs just fails on some pretty simple cases. I'm thinking it doesn't work at all, but perhaps that is also a flawed assumption. Then again with-redefs is not really a "main" code sort of construct to use.

14:25 tbaldridge: I know about them to some degree.

14:25 I guess not enough though, since I don't see the lines clearly drawn at the moment. :)

14:25 tbaldridge: I personally think that if you're using dynamic vars, or with-redefs, you should really try to restructure your code, there's just no reason to use those.

14:26 mikerod: tbaldridge: with-redefs - I agree should be reserved for trying to mock in tests and only if that's the "best you can do".

14:26 dynamic vars, are more often used.

14:26 tbaldridge: don't even use it for mocks, use protocols are pass your components into your functions

14:26 mikerod: I'm not a big fan. I see why people start using them to avoid the "pass this argument to everyone" issue.

14:27 tbaldridge: Well, unfortunately we cannot always be in control of every fn we interact with to fix them all. :P

14:27 I agree with the design principle of not using them though.

14:27 tbaldridge: At this point I've been using clojure professionally for about 2 years, and have never used with-redefs and have only used dynamic vars once or twice in production code.

14:29 augustl: is there a set operation for "replace existing" instead of "don't add if exists"?

14:29 mikerod: I've been using it professionally for about 2 now too. I have had to deal with essentially 1 dynamic var, that is prevalent though. I've used with-redefs to mock away some nasty Java interop stuff and to mock something involved with the dynamic var.

14:29 augustl: set as in sets, not "set/update" :)

14:31 seems disjoin does just that

14:32 eh no, disjoin just removes it

14:32 amalloy: augustl: what would it mean to replace an item in a set with another object just like it?

14:33 augustl: yeah I suppose my set usage is a bit weird.. The hash code for the items i add to the set isn't for the complete value, so the idea is to replace the old value with the updated value, and find it in the set based on the hash code..

14:33 suppose I shouldn't use sets

14:33 clojurebot: Excuse me?

14:34 augustl: a PersistentTreeMap probably makes more sense (I need sorting), that I can just assoc into

14:35 amalloy: yeah, that's a map

14:35 not a set

14:37 augustl: in hindsight that makes so much sense that I'm embarrassed :) Implementing an object with hashCode instead of just using a map with keys instead of hashCode.. :)

14:41 kenrestivo: i'm using https://github.com/flatland/chronicle , and having fits trying to figure out how to make it be time zone aware, i.e. for hours

14:41 Fare: hi

14:42 how do I access a data file in a clojure jar and/or make sure it's included in the jar?

14:42 kenrestivo: it produces times that are in UTC. so if you tell it {:hour [0]}, it produces 7am (here, PST8PDT)

14:42 Fare: at compile and/or at runtime

14:43 trptcolin: time zone awareness is a myth. like dry land.

14:43 mi6x3m: Fare: I doubt at run time you know that you are running from a jar :)

14:43 technomancy: Fare: check out the resources/ dir and clojure.java.io/resource

14:43 kenrestivo: amalloy: and i suspect you might know a little something about this

14:44 amalloy: just give it a different start time than t/now, and it adds in increments. for example, iirc t/local-now is a thing

14:44 kenrestivo: amalloy: perfect, thanks

14:46 amalloy: kenrestivo: if that works, please put it in the readme for me

14:47 Fare: technomancy, wonderful!

14:47 (inc technomancy)

14:47 lazybot: ⇒ 121

14:47 kenrestivo: amalloy: will do. it does using l/local-now. now i have to patch moments to make it use l/local-now instead of t/now

14:49 Raynes: if you're interested in such a patch, that is

14:51 amalloy: local-now is probably a better default, but it would be better to take that kind of thing as a config option. (let [scheduler (moments/scheduler t/local-now)] (schedule-every scheduler executor 1000 #(println 'hi))) would be a nice thing to be able to write

14:52 or perhaps that scheduler contains an executor as well, whatever

14:57 kenrestivo: it contains a ScheduledThreadPoolExecutor, which is even more special

14:59 amalloy_: kenrestivo: well, i was suggesting you define a new "scheduler" thing, which contains t/now or t/local-now. then you can fold the executor into that as well, so you don't even have to pass any more arguments

15:00 celwell: I have a map with an arbitrary number of levels of nesting, and I'm trying to get all of the submaps that contain a specific value for a specific key ":xtype". Been trying to use postwalk, but the furthest I can get is to println each of the desired submaps. I just need to get them into a list at this point, but I'm stuck. Any thoughts?

15:05 justin_smith: celwell: perhaps tree-seq

15:05 otherwise, you could conj onto an atom with a vector or hash-map in it, but tree-seq is likely simpler

15:06 postwalk is helpful to make a variation on a tree, but to extract subtrees, tree-seq is likely the right thing

15:07 celwell: justin_smith: if i conj onto an atom, isn't that considered a less 'clojure' way of doing it?

15:07 justin_smith: I'll check out tree-seq though

15:07 PigDude: how do i test if a value implements some protocol?

15:09 trptcolin: satisfies?

15:11 justin_smith: celwell: indeed, but sometimes doing an algorithm in terms of a well scoped mutation (won't leak out and change behaviour outside that let block or in other threads) is much simpler than forcing it to be immutable

15:19 augustl: anyone happen to know why Clojure's data structures aren't in a separate lib, cljs style (mori)?

15:19 stuartsierra: mori came *after* ClojureScript.

15:20 bbloom: i think he's asking about the jvm structures

15:20 augustl: you don't need them packaged up nicely on the jvm

15:20 stuartsierra: I know people use them from Jav.

15:20 *Java

15:20 augustl: bbloom: true, but the current version of PersistentHashMap requires the runtime to be initialized

15:20 and who knows what might happen in the future, etc

15:21 stuartsierra: Someone's probably ported them already.

15:21 augustl: there's https://github.com/krukow/clj-ds but it doesn't seem to be actively maintained

15:22 bbloom: augustl: do you need them to be CLOJURE'S or just you want persistent array mapped tries?

15:22 http://pcollections.org/ maybe?

15:23 see also: http://stackoverflow.com/questions/20834721/what-libraries-provide-persistent-data-structures/20834722

15:23 augustl: well I want something that's actively maintained and tuned and awesome :) And the ones in Clojure are actively maintained. Seems like clj-dns and pcollections doesn't have all that many users

15:24 I've chosen clj-ds, that works for me. Mostly just curious why JVM Clojure hasn't split it like cljs has :)

15:24 bbloom: augustl: how actively do they really need to be maintained? i mean, the only major change to the clojure ones were hashing fixes

15:24 augustl: and perhaps that's just a couple of patches/contributions away

15:25 bbloom: but i mean, they are "done" in many senses

15:25 augustl: does pcollections have transients?

15:25 it's not mentioned anywhere as far as I can tell

15:25 bbloom: no idea, found that at random

15:25 *shrug*

15:26 augustl: the real question is why aren't all JVM devs using a persistent data structure lib ;)

15:27 stuartsierra: I think Guava has some.

15:27 bbloom: last i checked, guava only had "unmodifiable" not persistent

15:27 augustl: ah, I thought guava only had COW and unmodifiable

15:27 stuartsierra: ah, ok

15:28 bbloom: apparently persistent collections are in the "idea graveyard" http://code.google.com/p/guava-libraries/wiki/IdeaGraveyard#Persistent_mutable_collections/mutation_methods_on_immutable_col

15:29 *shrug*

15:29 augustl: I suppose it's pretty common for people that like persistent data structures to just use Clojure

15:29 bbloom: i don't even remember what like was like before persistent data structures

15:29 s/like/life/

15:29 augustl: bbloom: copy all the things, or get ConcurrentModificationException

15:30 bbloom: or just solve smaller problems :-P

15:31 augustl: haha

15:35 Desheng: does Kmett have a site where he gives possible use cases for category-extras or a blog about his arrival at each one, or anything like that?

15:44 TimMc: Desheng: You might have better results asking in #haskell...

15:44 Desheng: oh dang sorry

15:44 TimMc: :-P

15:44 Desheng: the tabs are right next to each other in my client lol

15:45 TimMc: Are you in the Boston area?

15:45 I just happened to hear the name "Kmett" from a coworker who was at the local Haskell meetup last night, otherwise I wouldn't've had a clue.

15:46 Desheng: if you loosely enough define Boston area maybe

15:46 I'm in Maine

15:49 mikerod: Oh no! haskell talk can't be allowed here :P

15:49 Oh, I had no idea that cljs broke out the persistent data structures into a standalone

15:51 bbloom: mikerod: it doesn't really. dnolen_ just packaged up a nice js api called mori by wrapping core

15:54 mikerod: bbloom: oh, tricky

16:09 sritchie: dnolen_: hey david, QQ about om component state organization -

16:10 dnolen_: sritchie: hopefully I can answer it :)

16:10 sritchie: :) dnolen_: I’ve got a component that needs state from two separate locations in my cursor -

16:10 I can paste the state schema in a sec

16:11 so instead of (om/build-all event-row (-> state :static :events))

16:11 that component also needs (-> state :static :pricing)

16:11 dnolen_: sritchie: so just compose those two things into a map

16:12 (om/build event-row {:events ... :pricing})

16:12 sritchie: so (om/build-all event-row (map (fn [event] {:pricing (-> state :static :pricing), :event event}) (-> state :static :events))

16:13 dnolen_: oh, just use “build” and give it a single map

16:13 dnolen_: sritchie: either should work

16:13 I would probably do it w/ a map though

16:13 sritchie: then have that component internally use “build-all” for its event rows, now that it has the “static” pricing alongside

16:13 ?

16:14 dnolen_: oh sorry I didn't see you were doing a build all

16:14 yes that work

16:14 s

16:15 sritchie: okay, trying that out

16:15 thanks!

16:15 well, actually… this is still a little confusing

16:15 let me type up a gist example, one sec

16:16 I’m rendering a row for each event that a race organizer is offering, and each event has its own list of genders, age groups and boat types; so that fits the build-all model well

16:16 but every one of those rows has to have access to a single instance of pricing

16:17 dnolen_: I find myself worrying in advance about mapping across cursors and screwing with Om’s ability to do diffs

16:17 dnolen_: sritchie: you shouldn't run into problems

16:17 Om just used = now

16:17 uses

16:18 sritchie: okay

16:18 dnolen_: sritchie: if you have something that's slow let me know but I doubt it :)

16:18 sritchie: okay, I’ll go for it and see what happens

16:18 yeah, this view in particular is just never going to suffer

16:18 :)

16:18 once I go back and redo that timing app example with its millisecond-level updates, maybe I’ll hit something, but not now

16:42 sandbags: anyone used and recommend any of the twitter streaming libs?

16:43 twitter-streaming-client looks the most maintained but i'm not sure i like its interface very much

16:44 i wish clojars could sort libs by, e.g., last release date

16:49 bbloom: ,let [t (transient [:x :y :z])] (persistent! t) (persistent! t)) ; huh? why? is there any harm in calling persistent on a transient that is already in use persistently?

16:50 clojurebot: #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/let, compiling:(NO_SOURCE_PATH:0:0)>

16:50 bbloom: ,(let [t (transient [:x :y :z])] (persistent! t) (persistent! t)) ; huh? why? is there any harm in calling persistent on a transient that is already in use persistently?

16:50 clojurebot: #<IllegalAccessError java.lang.IllegalAccessError: Transient used after persistent! call>

16:50 amalloy: bbloom: yes

16:50 bbloom: amalloy: what's the problem?

16:51 seems like the arrays are never modified once the edit root is null

16:51 amalloy: well. i guess maybe not? i suppose it might be fine to call persistent! twice; it's other calls that'd be no good

16:51 bbloom: all further modifications to the collections do an array clone first

16:51 well of course actual modifications can't be done after persistent!

16:52 amalloy: bbloom: it might be the case that if there are two different persistent pointers to the same transient collection, you lose the amortized performance guarantees because they repeat the same work

16:53 bbloom: amalloy: i'm not sure i follow

16:53 amalloy: well like, when you take a transient and make it persistent, there's some cleanup work left to be done, right?

16:54 and it's amortized o(1) because it gets done on-demand as you traverse and/or "modify" the persistent collection

16:54 bbloom: amalloy: a tad. persistent vector trims the tail array w/ a copy

16:55 amalloy: so i was imagining that if there are two persistent pointers owning that same underlying transient, you might wind up repeating that cleanup work; persistent! might refuse to let that happen in order to preserve its performanec guarantees

16:57 bbloom: i'm not so sure about the perf issue, but i could see how it would be seen as a bug to call persistent! twice... in my case, i actually have two different transient objects that share an edit root

16:57 (i'm doing something crazy)

16:58 so my problem is that i want to atomically clear the edit root, but still call persistent! on each of the independent transient objects to create the persistent wrappers

16:58 bteuber: (no need for that remark, you're in #clojure so noone would expect anything but :D )

16:59 amalloy: bbloom: you have two transients sharing an edit root? i don't know enough about transients to know what that means, let alone how you make it happen

16:59 bbloom: ensureEditable checks that edit thread == current thread, but i think for persistent, the check really should be edit thread == current thread OR edit thread == null

16:59 amalloy: internally, persistent vector's nodes all have a single atomic reference containing the thread that may edit them

17:00 amalloy: i'm doing a custom structure that has something similar, but it just so happens that the internal nodes are themselves useable as transients standalone

17:04 ok, that's what i'm doing... normal check is (not= owner (Thread/currentThread) but for persistent! i'm checking (and owner (not= owner (Thread/currentThread)))

17:10 gfredericks: so leiningen profiles support using a vector of maps & keywords instead of a simple map

17:10 where the keywords are names of other profiles

17:10 which is cool and useful

17:11 * technomancy waits for the "... but"

17:11 gfredericks: ... but

17:12 :profiles {:a [{...} :b] :b {...}}

17:12 ^ this warns about :b being not found

17:12 while :profiles {:b {...} :a [{...} :b]}

17:12 is okay

17:12 i.e., the map ordering seems to be sensitive

17:12 technomancy: gfredericks: https://github.com/technomancy/leiningen/issues/1424

17:12 gfredericks: hey hey hey

17:13 technomancy: we should add a warning though

17:13 even if we can't drop support yet

17:13 gfredericks: oh I see so I'm Doing It Wrong

17:13 technomancy: yeah, but it's not obvious or documented

17:13 gfredericks: so I should do :profiles {:a' {...} :b {...} :a [:a' :b]}

17:14 technomancy: yeah

17:15 except use a proper unicode prime mark; geez

17:15 ya slacker

17:15 gfredericks: O_O

17:15 Frozenlo`: Are browsers preloading urls? I've got a route in my ring app printing to console when its visited and it prints BEFORE I press enter in my browser. :-/

17:15 amalloy: Frozenlo`: chrome often does

17:16 Frozenlo`: amalloy: So I'm not mad then. Thanks.

17:17 justin_smith: Frozenlo`: what is the path? is it a wildcard? with wildcards I found myself serving favicon.ico requests as if they were dynamically generated pages (until I made a middleware to steal all */favicon.ico)

17:17 Frozenlock: Not, it's a normal path... "/some-path"

17:18 justin_smith: like I would have a article/:id0/comments/:id1 which would get requests with :id1 being favicon.ico

17:18 Oh, OK

17:18 amalloy: justin_smith: that seems weird. isn't favicon.ico only requested at /?

17:19 arrdem: amalloy: you can "suggest" an alternate favicon location. Grimoire and my blog do this.

17:19 but by default yeah it's /favicon.ico

17:21 gfredericks: technomancy: hey hey hey thanks man

17:21 (inc technomancy)

17:21 lazybot: ⇒ 122

17:22 technomancy: no problem

17:25 sdegutis: What's Clojure's biggest strength that sets it apart from other languages?

17:26 mthvedt: parens

17:26 sdegutis: I'm trying to figure out if the only reason I used Clojure to write this web app was because of the honeymoon effect from when I first learned it, coinciding with my realization that Rails causes pain.

17:26 jonathanj: dynamic typing, every compile is a type-lotto

17:26 justin_smith: amalloy: yeah it is weird, but we definitely got it at arbitrary paths

17:27 TEttinger: sdegutis, probably the seq abstraction and how easy concurrency is

17:27 sdegutis: TEttinger: the seq abstraction in what sense?

17:27 TEttinger: being able to deal with complex nested data easily is really handy

17:27 sdegutis: Oh, so the core functions that operate on lazy sequences.

17:27 TEttinger: at least for the stuff I use clojure for

17:27 sorta

17:28 sdegutis: Yeah I wrote briefly about something like that here: http://sdegutis.github.io/2013/10/22/clojure-for-web-apps-p1/

17:28 TEttinger: any coll in clojure can be treated as a seq, so it makes it really nice to convert around

17:28 justin_smith: amalloy: ahh, looks like it was an old chrome bug http://stackoverflow.com/questions/1003350/why-is-chrome-searching-for-my-favicon-ico-when-i-serve-up-a-file-from-asp-net-m

17:31 verma: ,(for [x (range 4) y (range 3)] [x y])

17:31 clojurebot: ([0 0] [0 1] [0 2] [1 0] [1 1] ...)

17:32 sdegutis: I used to like the whole DSL abstraction that macros allow, but I often find myself looking up the source for something like "defroutes" or "defstylesheet" to see what it's actually doing.

17:36 numberten: what does the period mean in https://github.com/jonase/kibit/blob/master/src/kibit/rules/arithmetic.clj ?

17:37 cbp: numberten: that depends on what defrules does

17:37 numberten: ah it's a macro, reading now

17:37 thanks

17:37 amalloy: numberten: it's the old dotted-pair notation for sequences

17:38 jdkealy: if i had an entity which had an attribute of type string with cardinality many, how do i delete one of the items in the list? updating the entity with a new list does not retract the old ones, and there's no ID associated with the string to retract

17:38 amalloy: (a b c . d) is a sequence of at least three args, the first three of which are named a/c/b, and the remaining args are named d

17:38 numberten: amalloy: ah thanks

17:38 can d be '()?

17:38 amalloy: like ##(let [[a b c & d] (range 10)] [a b c d])

17:38 lazybot: ⇒ [0 1 2 (3 4 5 6 7 8 9)]

17:39 amalloy: probably

17:39 bbloom: amalloy: heh, maybe dnolen_ should deprecate that in favor of &

17:39 numberten: alright thanks

17:39 cbp: well TIL

17:39 amalloy: bbloom: this is kibit, not core.match

17:39 bbloom: amalloy: https://github.com/jonase/kibit/blob/master/src/kibit/rules/util.clj

17:39 amalloy: oh, but it's using core.logic

17:39 bbloom: compile.rule delegates entirely to core.logic

17:42 augustl: any libs around to turn an xml file into a persistent data structure, ideally without having to read the whole file into memory first (streaming, om nom)

17:43 ?

17:43 bbloom: augustl: what would it mean for persistent data structure to be streaming?

17:44 augustl: not the data structure, just the actual parsing of the xml file

17:44 under the hood

17:44 bbloom: presumably data.xml does that

17:44 augustl: not super important I guess, all I really want is to have the xml as a persistent data structure in-memory

17:44 bbloom: https://github.com/clojure/data.xml

17:45 augustl: nice, tnx

17:45 arohner: augustl: and yes, you can make data.xml stream lazily

17:46 obviously only useful if you have an array-like structure

17:46 justin_smith: augustl: maybe xml-seq?

17:47 augustl: justin_smith: looking that up, tnx

18:00 sritchie: dnolen_: BOOM, google places autocomplete component working :)

18:03 dnolen_: the beginning of a bootstrap forms component: https://gist.github.com/sritchie/9014c14c15d72c8b6458

18:03 works great over here. next is a table, and then the scrolling component we talked about months ago

18:08 bbloom: what do i do if i have a deftype with an :unsynchronized-mutable and want to create a private helper function that operates on it?

18:08 mutables are private

18:09 so i can't just make a free function w/ a type hint...

18:09 dnolen_: sritchie: nice!

18:10 bbloom: i know that cljs core has a few "private" methods, by just defining them against Object & relying on the lack of validation

18:11 example: https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L5045

18:12 seems like on the JVM my best option is just a private protocol

18:14 dnolen_: bbloom: or a implement a definterface + helper function that calls it, I think.

18:15 bbloom: dnolen_: bummer. i'm doing (defprotocol Private ...) right before the deftype & repeating myself like a god damn C programmer

18:16 dnolen_: bbloom: well you're doing something low level, not supposed to be fun.

18:17 bbloom: dnolen_: yeah, but it's also kinda weird b/c if somebody were to use this class from java, they'd have public methods thanks to the interface

18:17 seems like for interop sake, it would be nice to actually define a private method

18:19 seangrove: "not supposed to be fun" - interesting thought

18:22 bbloom: seems like nothing i do is ever supposed to be fun :-p

18:22 "you're programming, it's supposed to be pain and suffering without explaination"

18:24 amalloy: would an explanation really make it better? "this is no fun because your program is objectively bad"

18:24 i wouldn't want to hear that

18:33 ephemeron: I am writing a wrapper around a rather OOP-ish library which makes extensive use of mutable fields, with much of its API focussed on getting/setting those fields.

18:34 Is it generally considered idiomatic to wrap these methods with functions that return the affected object, e.g. for ease of chaining,

18:35 or is it better to let the wrapper functions return nil, be side-effecting only, and let the wrapper user do the chaining if he needs, e.g. with doto?

18:37 (Wrapper/library are actually cljs/js, but I venture that the question is general enough not to be off-topic.)

18:38 dnolen_: ephemeron: probably would bother wrapping overly side-effecting libs, but guess it just depends on what you are trying to accomplish

18:38 s/would/wouldn't

18:42 ephemeron: dnolen_: Thanks for answering. For now, the wrapper is rather thin, which validates your preference; it is mostly a way to avoid littering namespaces with verbose interop.

18:45 arrdem: ephemeron: one thing you could do is basically create a do monad wrapper, so your "API" really just accumulates instructions, and then you have some force! or execute! instruction which actually interprets the command sequence against mutable objects you never expose to users. You could also achieve the same thing with chained partial applications. Another alternative is to just create object clones and side-effect the clones for global side-effects or what

18:54 ephemeron: arrdem: I suspect that, in my case, object clones would either be contrived or simply unviable, but your first suggestion is interesting; I will likely consider it in the longer run. Danke schön.

19:38 Jaood: ,(every? symbol? ())

19:38 clojurebot: true

19:39 Jaood: ,(symbol? ())

19:39 clojurebot: false

19:39 Glenjamin: ,(every? false? [])

19:39 clojurebot: true

19:39 Glenjamin: ,(every? false? [1])

19:39 clojurebot: false

19:40 Glenjamin: every appears to return true with an empty collection, i guess that makes sense

19:40 arrdem: clearly we need a logical indeterminate value...

19:40 Glenjamin: ,(doc every?)

19:40 clojurebot: "([pred coll]); Returns true if (pred x) is logical true for every x in coll, else false."

19:42 Jaood: Glenjamin: I guess an empty list is still an empty list of symbols

19:48 celwell: I'm having trouble finding sufficient docs for clojure.java.jdbc. I'm trying to create a table with an :id column that is primary key and auto increment. I have this, but how can I extend it to make the id column be AUTO_INCREMENT? [:id "varchar(255)" "primary key"]. (to clarify, I'm using the "create-table" function.)

19:49 amalloy: celwell: c.j.jdbc does not contain a lot of schema modification features. i'd just create the tables in a psql shell or something

19:50 celwell: amalloy: I have to create the tables programatically so I was hoping there was an option for auto increment as there is for primary key. Mayb I should peruse so java jdbc docs. ill see...

19:51 amalloy: just jdbc/execute! for anything more complicated than a SELECT

19:51 the fancy features for trying to work with anything more clojurey than a giant string sql statement are pretty limited

19:53 celwell: amalloy: ok good point, i guess ill have just create the sql string myself, sigh

19:53 elben: I have an infinite lazyseq (it consumes from a kafka queue). I can iterate using (doseq [msg stream] …), but what’s the best way of “breaking out” after some condition is met (e.g. have consumed N messages)?

19:54 however, I don’t want to realized N messages right away using (take n stream)

19:55 hiredman: take is lazy

19:56 but anway, I think seqs for modeling consumtion from queues is tempting, but ultimately not good

19:57 most queues provide some way to ack/nack messages which seqs don't provide, you may want to timeout pulling a message, seqs don't provide a way to do it

19:57 etc

19:58 elben: understandable. i’m using the kafka scala consumer, which is an Iterator interface, hence why I’m using a seq.

19:59 i suppose it throws an exception on timeouts etc

20:32 gfredericks: haha wow okay woohoo so

20:32 two projects on the same machine use the same library; when I `lein repl` in either one the pom.properties for the library shows identical versions

20:33 yet one has a function missing (a function new in this particular version)

20:33 can't wait to find out what on earth

20:34 amalloy: gfredericks: how is lein repl related to pom.propertise? actually i don't even know what pom.properties is

20:34 hiredman: check lein classpath

20:34 also stop aot compiling

20:34 etc

20:34 amalloy: technomancy: getting those same spam PMs from kitimini

20:34 gfredericks: amalloy: it gets packaged with the jar, good for sanity checking what version of a lib you're actually using

20:35 I should mention that results from CI are consistent

20:36 which rules out pretty much every possible explanation I think

20:36 except goblins

20:36 hiredman: check lein classpath

20:36 gfredericks: on it

20:37 hiredman: Ooooh

20:37 gfredericks: yep lein classpath did it

20:37 hiredman: or you could be depending on some other library that transitively aot compiles that was built against an old version, but built after the new version of the library was released

20:37 gfredericks: it's lamer than that

20:37 I had forked it

20:37 hiredman: (true story, I've seen it happen)

20:38 gfredericks: so one of my projects had two versions of it

20:38 due to different group names

20:38 hiredman: and becuase the timestamps on the aot classfiles are newer the "old" code is prefered

20:38 amalloy: hiredman: that sounds like an artists rendition of hell

20:39 hiredman: there was a lot of thrashing around before we figured that out

20:45 technomancy: I've debugged that in a support ticket

20:45 it ain't pretty

20:47 arrdem: so what on earth does Clojure do AOT for a variadic -main..

20:48 gfredericks: arrdem: I think there's a shim method

20:48 since .main needs to take an array anyhow

20:49 arrdem: gfredericks: yeah that's what I'm thinking. you eat an array and then apply the var that's named -main

20:49 gfredericks: public static void main(String[] args){ // as you all have dutifully memorized

20:49 arrdem: I've seen it in the stacktrace

20:49 there's a .main and a ._main

20:49 I guess it's a gen-class feature?

20:50 arrdem: probably.

20:50 gfredericks: the ._main is just a regular var class

20:50 er...function class

20:52 arrdem: okay so the "-main" var has to "exist", because you could potentially recur through it.. so yeah you emit the main var as a "var" (which is a lie for me but whatever) and then you emit the-ns.class with a -main that shims into the "var"... okay doable.

20:53 amalloy: arrdem: because you could recur through it? how is that relevant. it exists because you're allowed to call it

20:53 arrdem: amalloy: that's what I meant, recur as a call rather than clojure's loop jump.

20:54 amalloy: but that doesn't have to be recursive. i can just call (-main) anytime, anywhere

20:55 gfredericks: when pizza's on a bagel you can call (-main) anytime

20:58 hellofunk: I'm trying to find docs about the max size available for a core.async channel buffer. Doesn't appear to be mentioned anywhere.

20:59 gfredericks: why would there be a max size?

20:59 hellofunk: i don't know, just figured there would be; you suggest there isn't?

21:00 gfredericks: I can't think of a reason for one

21:00 hiredman: hellofunk: do you want a max size buffer for some reason?

21:01 hellofunk: hiredman not for a specific reason, I just didn't know if something like 10,000 is a reasonable number or not. I'm having a problem in cljs where my reads aren't happening as fast as my puts, leading to the error about exceeding 1024 pending puts. So I'm thinking a bufferred channel may be necessary to provide some slack.

21:01 hiredman: because I think doing that will mean fighting core.async since it explcitly requires a max size so channels can back pressure

21:02 arrdem: gfredericks: yep. https://www.refheap.com/88314

21:03 can I do this without RT.seq..

21:04 amalloy: why would you want to, arrdem?

21:06 arrdem: amalloy: I'm trying to compile a standalone hello world as a test program. If I can escape RT altogether (and I almost have) I would prefer to, both for complexity's sake and to escape the startup time of loading Clojure "proper".

21:06 amalloy: but you'll just be calling into a var that needs clojure proper anyway, right?

21:07 arrdem: no...

21:07 the whole point of my project is to throw out everything I can, especially vars.

21:08 this test program compiles to zero vars. Note that Oxcart does not claim to be able to interop with Clojure.

21:08 amalloy: okay cool, well i guess i have no idea what you're up to. good luck

21:08 arrdem: :P thanks

21:09 urgh. AFn uses RT. this can't be done.

23:42 hellofunk: Does anyone know if the limit of 1024 pending puts applies to all types of channels, therefore if you have a buffered channel with say 1000 size, then you could put 2400 on that channel before exceeding this limit?

23:42 sorry I meant 2024

Logging service provided by n01se.net