#clojure log - Jul 05 2014

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

0:31 FareWell: thanks! http://dev.clojure.org/jira/browse/TMACRO-6

0:35 seancorfield: FareWell that was an interesting problem to look into :)

0:39 FareWell: seancorfield, thanks for looking into it!

0:39 the lack of read/write invariance is a big pain with clojure

1:54 seancorfield: ,(* 150 350)

1:54 clojurebot: 52500

1:56 rplaca: seancorfield: I'm beginning to dig back into scala again after a long time because of Spark

1:56 seancorfield: rplaca I still think Scala's a good language

1:57 rplaca: seancorfield: too complicated for too little benefit is my feeling

1:57 plus I'm just using too many languages already right now

1:57 seancorfield: I think Scala suffers from the way it is often taught

1:58 I started on Odersky's FP course (Coursera) but the heavily math-based focus bored me

1:58 rplaca: yeah, that could be. Also, all the immutability stuff has gone in since I last used it

1:58 seancorfield: And then you have the "Type Nazis" who are also kind of overwhelming

1:58 rplaca: so that's kind of nice

1:59 :)

1:59 seancorfield: I'm a Math/Comp Sci grad BTW, but Odersky's course was just dry and boring, unless you were so excited about FP itself :)

2:00 rplaca: I can be (like with some of the Haskell stuff), but I also just like things easy :)

2:00 seancorfield: We did 2.7/2.8 and that was a painful upgrade... 2.9 looked better but we'd gone to Clojure by then... and 2.10 has some nice stuff...

2:00 I was very pleased to hear Odersky talk about simplifying the type system at Strange Loop 2013

2:01 rplaca: One of the most amazing things about Clojure is how painless the upgrades are and how interoperable everything is between versions

2:01 seancorfield: Haskell's a GREAT language but many of its advocates are its worst enemies... the zealotry about types...

2:01 ...and the whole dreadful M-word obsession :(

2:01 rplaca: I've been living in the Hadoop world lately and it's just a version nightmare all the time

2:02 seancorfield: I love that Evan is pushing back hard against that academic stuff with Elm

2:02 rplaca: yeah, I definitely treat Haskeel as more theoretical than practical, so that stuff doesn't bother me

2:03 seancorfield: If Haskell ran on the JVM, I'd be a lot more interested :)

2:04 I have a huge amount invested in the JVM, work-wise, which is why Scala was considered for us... and after 18 months, we switched to Clojure...

2:05 ...and we're up over 20K lines of Clojure now and slowly moving our legacy code base over

2:05 rplaca: yeah, I remember that

2:06 Clojure is still my go to in every situation where there's not some particular reason to use something else

2:06 except for stats when I use R

2:08 seancorfield: I have never used R... I here a lot about it...

2:11 TEttinger: Julia seems like an interesting R-like scientific language. the language seems really well-designed, but it's all interpreted, no ability to compile end-user apps, so its applicability remains a bit limited in the general use case

2:11 I was kinda struck by how its standard lib covered data types similarly to clojure

2:12 except it also had nice things like combinatorics in the core

2:13 seancorfield: TEttinger the Seven More Languages book covers Julia - I'm looking forward to that chapter (I'm on Factor right now - language #2)

2:14 TEttinger: oooh factor

2:14 that's a brain-melter

2:14 one of my acquaintances in a gamedev channel tried to make a game in factor

2:14 no one could understand any of his code

2:15 now he uses rust and similarly suffers, just at an architecture level to deal with their mutability primitives

2:15 seancorfield: I did Forth back in the day... and wrote a Forth interpreter / compiler at university in the 80's :)

2:15 So Factor is quite natural - Forth grown up! :)

2:15 TEttinger: yep

2:16 I think there's JVM concatenative languages too

2:16 seancorfield: Haven't looked at Rust yet... that's also on my list...

2:16 TEttinger: this guy was struggling for weeks before just discarding the standard recommendations for safe, high-performance rust code

2:17 $google rsaarelm calx

2:17 lazybot: [rsaarelm (Risto Saarelma) · GitHub] https://github.com/rsaarelm

2:17 TEttinger: https://github.com/rsaarelm/calx I tried so hard to get it to build on windows...

2:19 rplaca: TEttinger: Julia compiles to LLVM backends though as a JIT-only, I think

2:19 TEttinger: yeah, but the libs are not compiled into the app I thought

2:20 I know they are going towards that goal

2:20 rplaca: right but they'll compile whe you load them, I think

2:20 *when

2:21 TEttinger: I'm quite pleased with C# right now, using a JVM game lib with IKVM. all these platforms are slowly merging

2:22 rplaca: TEttinger: that seems complex!

2:22 TEttinger: not at all!

2:22 it was one compilation of libgdx to a dll

2:22 and I just imported it into a C# project

2:22 rplaca: cool. and it's performant?

2:23 TEttinger: it appears so, I'm not doing anything too hardcore yet

2:24 rplaca: Does it compile the Java to the DLR intermediate language? Or run the JVM inside the DLR?

2:24 I can't tell from their page

2:33 TEttinger: it uses openjdk and compiles it to a dll somehow

2:34 it doesn't depend on DLR, just CLR

2:36 rplaca: ahh, interesting

3:21 rurumate: using multiple catch clauses inside a go block apparently causes a kind of deadlock: see https://www.refheap.com/87878

3:35 http://dev.clojure.org/jira/browse/ASYNC-78

4:35 ludwig`: does anybody else experience the piggieback/cljs-repl being broken again since the later nrepl middleware updates?

4:42 sometimes it works but it usually it stops after a few browser refreshes or starting lein cljsbuild

4:56 amalloy: rurumate: aren't you reading from ch more often than you're writing to it there?

4:56 so the thread is just blocking forever on <!!

5:00 boxed: I have a list foo = ‘(1 2 3), how do I call a function bar such that it ends up like (bar 1 2 3) instead of (bar ‘(1 2 3)) ?

5:00 amalloy: &(doc apply)

5:00 lazybot: ⇒ "([f args] [f x args] [f x y args] [f x y z args] [f a b c d & args]); Applies fn f to the argument list formed by prepending intervening arguments to args."

5:01 hellofunk: re

5:01 boxed: ah crap, I thought I tried that.. thanks :P

7:03 CaveJohnson: hm, how would I directly insert javascript using clojurescript?

7:04 b highm

7:04 oops.

7:04 damn slash key

8:16 gah, looks like I found a bug in clojure.browser.repl

8:16 [13:15:14.998] TypeError: invalid 'in' operand a @

8:17 if (d in a && !/^https?:\/\//.test(a[d])) {

8:17 :(

8:26 nathan7: CaveJohnson: I'm guessing `a` is undefined or null there then

8:29 CaveJohnson: nathan7: but I haven't modified that all, it's a standard library...

8:29 would you like to take a look at the source? :P

8:36 nathan7: CaveJohnson: sure

8:36 CaveJohnson: nathan7: https://github.com/zackp30/crateincinerator

8:39 nathan7: oh gah I'd have to get my cljs shit going

8:39 CaveJohnson: hehe :P

8:46 nathan7: CaveJohnson: actual JS I can wrangle, but I'm too lazy for build envs

8:52 CaveJohnson: nathan7: :(

8:53 ok, thanks anyway :)

8:53 nathan7: CaveJohnson: if you have compiled JS for me to look at that's cool

8:59 gfredericks: I still don't understand this `lein test` reloading issue and I'm going to try

9:06 CaveJohnson: nathan7: if (d in a && !/^https?:\/\//.test(a[d])) {

9:06 is the line in question

9:06 and if you're interested: http://dev.clojure.org/jira/browse/CLJS-822 is the bug report

9:18 unsafeCoerce: CaveJohnson, when life gives you lemons?

9:29 magopian: what does "(set! *print-length* 5)" do?

9:29 (i'm watching the "introduction to clojure" video from Stuart Halloway (http://vimeo.com/68375202)

9:30 joegallo: http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/*print-length*

9:30 it sets the print-length to 5

9:31 ,(binding [*print-length* 5] (println [1 2 3 4 5 6 7 8 9 10]))

9:31 clojurebot: [1 2 3 4 5 ...]\n

9:32 joegallo: i'm using binding there so it's just modifying the setting locally rather than globally.

9:32 nathan7: CaveJohnson: yes, that leaves 'a' as a free variable

9:32 CaveJohnson: and I know nothing about it beyond it being a primitive

9:35 magopian: i see, thanks a lot joegallo

9:36 joegallo: you're welcome!

9:36 magopian: :)

9:50 martinklepsch: how can I get information about the number of cpu cores on my machine within clojure?

9:51 nathan7: martinklepsch: somewhere under system, gimme a moment

9:51 martinklepsch: (.. Runtime getRuntime availableProcessors)

9:55 martinklepsch: nathan7, thanks!

9:56 nathan7: martinklepsch: fyi, I got that from the second search result on 'available cores java'

9:56 martinklepsch: and some transliteration to Clojure

9:56 martinklepsch: pretty much always if you're looking for this kind of thing, just check how it's done in Java

9:56 martinklepsch: because you'll just have to talk to the JVM's Runtime or System objects

10:22 mbac: what's the easiest way to convert an array of bytes into an array of shorts?

10:23 where short_array[i] = (byte_array[i/2] << 8) | byte_array[i/2+1]

10:24 clgv: mbac: if I remember correctly java.nio.bytebuffer and co

10:26 mbac: hmm, interesting

10:26 cohimame: Hi? So am i allowed to ask bout clojure right here?

10:27 first time in irc since 2004)

10:27 TimMc: Yep.

10:32 cohimame: oh, i've just googled al answers:)

10:33 Despite that, I'm willing to make a simple game in clojure from scratch

10:36 and here's uberjar and wrappers to .exe

10:38 ...so end users have a chance to play it without jvm on board

10:38 thats all)

10:43 m_m_: Hi. How I can change my lazy-seq full of strings to an array of ints ?

10:46 gfredericks: how do you change a string to an int?

10:48 m_m_: read-string?

10:48 gfredericks: if your strings are just digits, sure

10:48 wasn't clear from your question

10:49 also there is ##(Long/parseLong "42")

10:49 lazybot: ⇒ 42

10:49 gfredericks: also did you mean "array" in the JVM sense?

10:49 like you want an array of primitive ints?

10:50 m_m_: I have lazy-seq wiht integer in string format. Now I would like to change them all to int and print them.

10:50 gfredericks: ,(def my-strs ["41" "42" "43"])

10:50 clojurebot: #'sandbox/my-strs

10:51 gfredericks: ,(doseq [s my-strs] (println (Integer/parseInteger s)))

10:51 clojurebot: #<CompilerException java.lang.IllegalArgumentException: No matching method: parseInteger, compiling:(NO_SOURCE_PATH:0:0)>

10:51 gfredericks: ,(doseq [s my-strs] (println (Integer/parseInt s)))

10:51 clojurebot: 41\n42\n43\n

10:51 gfredericks: m_m_: of course if all you're doing is printing them then there's no need to convert them first

10:53 mbac: thanks clgv that totally worked

10:58 i have a lazy sequence where each element is a sequence of x, is there a pattern for turning that into a lazy sequence of x?

10:58 i know i can, say, (reduce concat lazy-sequence) to get a sequence of x, but i can't fit it all into memory

10:58 clgv: mbac great

10:59 mbac: oh maybe it's lazy-cat

10:59 clgv: reduce+concat will cause you pain

11:00 mbac: yeah, i've noticed :)

11:00 also it's not lazy-cat

11:00 hmm

11:03 maybe i want to do (flatten (take-while (fun [samples] (> (count samples) 0)) sequence-of-x-sequences))

11:05 gfredericks: have I forgotten how logic works?

11:05 is it possible for [a b (and a b)] to ever be [true false true]?

11:06 this is what I am witnessing and heck if I

11:06 hm. I think my and is borked.

11:07 somehow it got unmacro'd o_O

11:12 clgv: gfredericks: mutual state or some singularity is happing at your place ;)

11:12 gfredericks: I knows...

11:12 dbasch: mbac: (for [subs s x subs] x)

11:14 clgv: (apply concat ...) should do as well

11:14 dbasch: clgv: except that's eager

11:14 clgv: dbasch: no.

11:14 m_m_: How I can create list from string?. I need each char seperatly.

11:15 clgv: dbasch: consult the source. concat is inherently lazy

11:15 dbasch: clgv: apply is not

11:15 gfredericks: m_m_: seq

11:15 clgv: dbasch: well you got something wring there ;)

11:15 dbasch: clgv: what do you mean?

11:16 m_m_: gfredericks: Thank you. How I can change each of my sequence chars into number ? Integer/parseInt wont work.

11:16 clgv: ok let me reformulate: apply+concat is not different from reduce+concat concerning lazy or not

11:17 dbasch: clgv: I agree

11:17 clgv: except that reduce+concat tends to stack overflow ;)

11:17 which apply+concat does not

11:18 dbasch: clgv: but apply concat will realize the entire long sequence

11:18 clgv: dbasch: humm but the interesting question here is whether apply forces more than just the specified non &rest args

11:19 dbasch: I'd guess it realizes at most 3 elements - the two mandatory paramaters and maybe the first of the &rest parameter

11:19 dbasch: because the long sequence of sequences will be converted into an argument list

11:19 TimMc: m_m_: It sounds like you're doing something the roundabout way.

11:19 clgv: dbasch: see above

11:19 gfredericks: m_m_: that depends on what you want

11:19 e.g.

11:19 ,(def my-char \3)

11:19 clojurebot: #'sandbox/my-char

11:19 gfredericks: ,(int my-char)

11:19 clojurebot: 51

11:20 gfredericks: ,(read-string (str my-char))

11:20 clojurebot: 3

11:23 clgv: dbasch: yes 3 it is ;)

11:23 dbasch: clgv: where do you see that?

11:24 clgv: dbasch: source and a small demo example I post in a minute

11:25 ,(letfn [(myrange [n] (take n (iterate (fn [x] (print x " ") (inc x)) 0))), (mytest [a b & others])] (apply mytest (myrange 10)))

11:25 clojurebot: 0 1 2

11:25 clgv: dbasch: mytest has the same signature as the arbitrary parameter implementation of concat

11:26 dbasch: yeah, this is perhaps a more clear proof

11:26 ,(take 10 (apply concat (map range (range))))

11:26 clojurebot: (0 0 1 0 1 ...)

11:27 clgv: dbasch: what is that supposed to proof?

11:27 ah right

11:27 infinite range ;)

11:27 yeah but I wanted to know how much is forced

11:28 and it seems the "& others" is at least checked whether it contains an element ...

11:30 ,(letfn [(donothing [x])] (donothing 1))

11:30 clojurebot: nil

11:30 clgv: ,(letfn [(donothing [x] (println "nothing done")] (donothing 1))

11:30 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>

11:30 clgv: ,(letfn [(donothing [x] (println "nothing done"))] (donothing 1))

11:30 clojurebot: nothing done\n

11:30 clgv: haha the bot swallows nil returns when something was printed ;)

11:47 nathan7: clgv: checked to see whether it contains an element in the sense that (seq []) is nil, yes

11:48 clgv: nathan7: yes^^

12:06 weavejester: Hm, that’s annoying… “lein deploy clojars” isn’t atomic…

12:14 m_m_: How to remove first char from string (and still get string. I know how to get sequence by 'rest')

12:14 weavejester: m_m_: (subs s 1)

12:14 subs = substring

12:14 ~(subs “hello” 1)

12:14 clojurebot: Huh?

12:15 m_m_: weavejester: Thank you!

12:22 Shayanjm: ugh

12:22 Alright guys, I have a string like: "The Colombian defender&nbsp;Juan Camilo Z&uacute;&ntilde;iga challenged the Brazilian forward Neymar."

12:22 which is absolutely riddled with HTML entity escapes

12:23 I need to decode it and I'm not a huge fan of creating a huge map of character/ID and string replacing

12:23 any suggestions?

12:24 m_m_: Can i create local vars in let like: (let [a 1] [b (+ a 1)]). Or i need to create nested let for "b" ?

12:24 weavejester: Shayanjm: A HTML parser might work

12:25 Shayanjm: weavejester: I'm already using enlive in my project, so if theres something built into that it would be great

12:25 unfortunately when I prodded around, it didn't seem to have anything of the sort

12:25 The data I actually scrape through enlive is fine - text is converted properly etc.

12:26 But the NYT has a weird API, and are sending escaped data in JSON formatted responses

12:26 weavejester: m_m_: You don’t seem to define b anywhere

12:27 Shayanjm: Crouton seems to work. Enlive might have something similar I guess.

12:27 m_m_: weavejester: That was only an example. I have 2 vars but one of them is build by another.

12:27 weavejester: Shayanjm: https://github.com/weavejester/crouton

12:28 m_m_: You can do something like: (let [x 1, y (+ x 1)] [x y])

12:28 Each clause in a let can access bindings defined above it.

12:41 m_m_: weavejester: I have something like that: https://www.refheap.com/36cdac11b88bc1882d1c7e297. Is my let is ok ? I think that str-13 ist visible for seq-of-int.

12:57 gfredericks: m_m_: it's visible, but (str-13) will try to call the string as a function, which will fail at runtime

12:57 ,("my string")

12:57 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn>

12:58 gfredericks: m_m_: line 9 doesn't make any sense either; you can't set variables in clojure

12:58 you probably want to remove that and put (getstrings (subs s 1) reduced-seq) for line 10

12:58 m_m_: gfredericks: So how I can change value ? like i = i + 1 ?

12:59 gfredericks: recursion, sometimes; often the algorithm can be restructured as data transformation such that you don't need to do anything like that

12:59 I'm not sure what your function is trying to do so I can't be more specific

13:10 FareWell: hi. Which is your favorite pattern matcher for clojure?

13:10 for e.g. writing macros

13:10 and source code transformations.

13:11 mdeboard: https://github.com/clojure/core.match ?

13:11 idk specifically about your two example use cases but core.match is nice

13:12 gfredericks: FareWell: what do you mean by pattern matching for macro writing?

13:13 FareWell: something like (match expr `(define-class ~name ~@foo) `(set! ~name (make-class ~@foo)) ...)

13:14 mdeboard: wow

13:14 FareWell: or whatever... something that can recognize the shape of data (like in destructuring) but also constants

13:16 mdeboard: isn't that sort of thing -- if i'm understanding your pseudo-code example -- what protocols and multimethods are for

13:17 gfredericks: multimethods more than protocols probably

13:19 FareWell: pattern matching is what I want right now

13:20 especially since the (1) it's not always done based on a symbol (2) the same symbol may mean different things in different contexts

13:20 especially if a compiler gets written in many passes

13:21 mdeboard: yeah I mean there's core.match but clojure also has arity dispatch for functions

13:21 so it depends what you mean by pattern matching, that is what thing you're matching against

13:21 gfredericks: FareWell: I think core.match should work for this

13:22 * gfredericks hasn't used it in years

13:24 * mdeboard mutters something about erlang

13:24 FareWell: gfredericks, thanks

13:25 reading the docs for core.match, it seems to be knowing what are the locally bound symbols, so it can distinguish between (let [a ...] (match ... a ...) and (match ... a ...)

13:25 where the first would match the value of a, and the second would create a new binding.

13:34 ahem.

13:35 I started cider from a .clj file, and I thought it would load all the dependencies in a project.clj in the directory above, but it didn't... how does that work?

13:35 gfredericks: mdeboard: yes those erlang macros are the best aren't they :P

13:36 FareWell: you might try quoting things for symbol literals? not sure what the approach is

13:37 FareWell: gfredericks, I more like need `',a or something

14:33 * FareWell digs into the implementation of core.match and discovers *locals*

14:34 arrdem: FareWell: beware of nasal daemons

14:34 FareWell: where is this *locals* thing documented?

14:35 oh, it's defined in same file, and initialized with (dissoc &env '_

14:36 OK, so searching for &env

14:37 Bronsa: FareWell: &env is a variable you can use from inside defmacros and is a map from locals symbol to locals expr

14:38 FareWell: I see

14:38 Bronsa: FareWell: I don't think it's actually documented anywhere

14:38 FareWell: is it a lexical or dynamic variable? I assume lexical

14:38 Bronsa: yes, lexical

14:39 FareWell: of course, if some macro starts by expanding its body then wrapping new bindings around... oops

14:43 bbloom: Bronsa: does anything in core actually depend on &env?

14:43 Bronsa: &form is useful and probably sensible to spec, since it's inherently very well defined

14:44 FareWell: what is the recipe for cider to load my dependencies, already?

14:44 bbloom, is core.match part of core?

14:45 Bronsa: bbloom: nothing uses &env in core

14:45 bbloom: FareWell: i was mainly talking about the stdlib

14:45 Bronsa: bbloom: there might be some macro that uses &form to get the original meta though

15:10 seriously_random: join #gnome

15:12 TimMc: Gno.

15:15 arrdem: Huh, I'd always heard it as purple monkeys.

15:15 ...although always from the same person, so there's that.

15:19 bbloom: hmm: https://github.com/clojure/core.async/commit/99d2ffbb22f57b29a41220cfb292e4c286037e46

15:19 arrdem: TimMc: the imagery of the compiler being able to choose arbitrarily bizare results just sits well with me :D

15:19 TimMc: *nod*

15:20 amalloy: bbloom: it must be international participle day, with all them -ings

15:22 bbloom: it's an interesting idea putting the transform in to the channel itself

15:29 arrdem: tbaldridge: thanks for reccomending core.cljs, it was an interesting read

15:38 tbaldridge: arrdem: yeah it's pretty cool

15:39 FareWell: is there read-time computation in clojure? what's the equivalent of CL's #. ?

15:40 is there a syntax for escaping characters in a symbol?

15:41 Bronsa: FareWell: there's #=

15:43 FareWell: thanks!

15:43 * FareWell should probably use readable symbols, not #=(symbol "@")

15:43 arrdem: FareWell: yeah... please don't do that

15:43 Bronsa: FareWell: yeah that's a really bad idead

15:45 FareWell: I was "just" interning (symbol foo), where foo was the string of the delimiter or operator in my lexer

15:50 how do I make sure I am *not* importing any symbol in a namespace?

15:50 (refer-clojure :only "def") ?

15:51 nathan7: def is a special form I think

15:51 :only []

15:51 arrdem: it is

15:51 nathan7: I had a bunch of trouble trying to redefine def because of that

15:52 Bronsa: you can't redefine def

15:52 FareWell: can I shadow def?

15:52 Bronsa: no

15:52 nathan7: nope :(

15:52 FareWell: :-(

15:52 nathan7: I ended up having a def*

15:52 FareWell: good to know

15:52 Bronsa: you can just use a fully ns qualified alternative

15:52 (foo/def ..)

15:53 FareWell: maybe I shouldn't implement python identifiers as symbols, then

15:53 nathan7: FareWell: nah, that is sane

15:53 FareWell: or add a prefix _ everywhere :-/

15:53 nathan7: FareWell: you can define a def, (def …) just won't use it

15:53 FareWell: like, evaluation of a list form won't use `def` from the environment

15:53 FareWell: I'll cross that bridge later

15:54 hopefully, I can maintain some hygiene in the implementation

15:54 amalloy: FareWell: if you're interpreting python, i'd say that python's code should have its own data types, really. ie, a python-symbol, not a symbol

15:56 arrdem: FareWell: I don't know if you really need a full python symbol class, but trying to use Clojure namespaces to store Python symbols (which is what you seem to be doing) isn't a great idea. You'll do better to have your own binding structure but you can probably get away with reusing clojure's Symbols as binding values.

15:59 FareWell: amalloy: I'm trying to compile python directly to clojure

15:59 nathan7: I have a very confusing implementation of my f-expr LISP, Plan

16:00 FareWell: or rather, a pure subset of python

16:00 nathan7: the confusion stems from how I'm connecting the lands of Clojure and Plan

16:00 though Python should be really fine in this respect

16:00 I have the problem that a Clojure function is a Plan macro

16:01 oh, I actually have a fix for that, yay

16:01 I just need to start using the ns map as my environment object

16:01 and shuffle some namespaces around

16:02 thanks for being my rubber duck, humans

16:02 mbac: is there anything like common lisp weblocks, but for clojure?

16:02 that is, uses continuation passing magic to make webapps seems stateful

16:24 Shayanjm: If I wanted to utilize a scala Set in some clojure code

16:24 how would I go about doing that?

16:25 specifically: https://github.com/GravityLabs/goose/blob/88567c78a2cd393a8fd1a918cc21312c35c63116/src/main/scala/com/gravity/goose/Article.scala#L79

16:25 I'd like to be able to iterate over "tags"

16:25 nathan7: can't really just extend it with seqable, can you

16:26 err, ISeq

16:27 Shayanjm: I honestly have no idea

16:27 nathan7: why can't that be a protocol :(

16:33 bordatoue: what is new in clojure 1.6 is it worth upgrading from 1.5 ?

16:39 Shayanjm: nathan7: I ended up just using Scala's .mkString method from their immutable set class

16:39 split the string into a clojure vector

16:39 Bronsa: bordatoue: https://github.com/clojure/clojure/blob/master/changes.md

16:40 bordatoue: Bronsa: thanks

16:41 nathan7: Shayanjm: I'd rather define a set-seq or something

16:42 Bronsa: bordatoue: the most notable change is probably the work done around hashing

16:42 Shayanjm: nathan7: So from string, go to set?

16:49 nathan7: Shayanjm: from set, go to seq

16:50 Shayanjm: you have a Scala Set

16:50 Shayanjm: and you make a Clojure Seq out of it

16:50 Shayanjm: doesn't it have a method to give you a Java Iterator though?

16:50 Shayanjm: nathan7: Clojure doesn't know how to turn a Scala Set into a Clojure seq

16:50 nathan7: Shayanjm: you do though

16:51 Shayanjm: Yeah, so that's what I'm asking - is the "most efficient way" to do this to turn the set into a string, then the string into a seq?

16:51 arrdem: tbaldridge: is there a design document somewhere detailing the interface choices?

16:51 nathan7: Shayanjm: definitely not

16:51 Shayanjm: it has .iterator()

16:52 arrdem: Shayanjm: just get an Object[] out of your Set, clojure can deal with Object[] just fine.

16:52 Shayanjm: hmmk

16:54 nathan7: (defn set-seq [s] (let [iter (.iterator s)] (repeatedly #(.next iter))))

16:54 except with checking .hasNext

16:56 Shayanjm: I see, that makes sense

16:58 nathan7: Shayanjm: http://sprunge.us/KFaM?clojure

17:00 Shayanjm: thanks nathan7 :)

17:00 out of curiousity, why a lazy-seq?

17:00 the data that's being returned is of a known size + type, and has a finite number of elements

17:00 why not just throw it into a vector or regular seq?

17:01 whilo: tbaldridge: mjolnir is still fairly cool. i managed to get the simplest unit test running on ubuntu amd64 with llvm-3.4, but it is a bit tough to figure out the missing peaces. defnf fib with integers behaves unexpected and i couldn't get the ptx backend working so far, which is my main motivation

17:01 nathan7: Shayanjm: because lazy sequences are the norm and efficient and stuff

17:01 whilo: any pointers for further information (besides the talk and upstream llvm docs)?

17:01 Shayanjm: gotcha nathan7

17:01 nathan7: Shayanjm: no need to materialize an entire seq

17:02 Shayanjm: so lazyseqs are more efficient than seqs?

17:02 nathan7: Shayanjm: because the collection itself is already materialized

17:02 Shayanjm: it spreads the cost of iteration

17:02 Shayanjm: and saves you some memory

17:02 Shayanjm: gotcha. So when I consume this, I'll obviously have to iterate over the entire lazy-seq

17:02 I can't just map it

17:05 nathan7: Shayanjm: map takes a sequence (including lazy ones), and returns a lazy one

17:05 Shayanjm: oh sweet, good deal. Thanks nathan7

17:08 nathan7: Shayanjm: many sequence operations in Clojure are lazy

17:08 Shayanjm: Yeah - I've been realizing that very slowly

18:13 akurilin: Schema question: has anybody here figured out how to implement a string to integer coercion for schema/

18:13 I believe by default the json coercer doesn't actually attempt to parse the string into a numeric type

18:26 FareWell: akurilin, I don't know anything about schema, but I coerced my integers by prepending "10r" and calling the edn reader.

18:26 or 16r, 8r, 2r, depending on the base

18:28 akurilin: FareWell: sounds good!

18:28 yeah I'm just going to have to customized the default +json-coercions+ in their library to make this happen. Thank gosh they didn't make that stuff private

18:28 FareWell: if you know a better way, tell me

18:30 the 10r prefix prevents 025 from being parsed as 21.

18:33 (inc Bronsa)

18:33 lazybot: ⇒ 26

18:33 FareWell: (inc bbloom)

18:33 lazybot: ⇒ 35

18:45 FareWell: is there a tutorial on how to use lein to manage several private (for now) projects some of which depend on other such projects?

18:46 * FareWell googles it

18:57 avshalom: Hi All, clojure 1.6.0, jdk8, leiningen, and korma reading a large table from Oracle. -Xms1g, -Xmx220g, -XX:+UseConcMarkSweepGC, -XX:-UseGCOverheadLimit. (machine has 250g ram) about after 30g into the read of a large database table, I get: java.lang.OutOfMemoryError: GC overhead limit exceeded. The first line of the stack trace is java.lang.Object.clone(Native Method)

18:58 after some googling, I found things like, too little gain for too much GC. But it's not responding to my request to -UseGCOverheadlimit. Any ideas?

19:18 arrdem: Fare: lein/maven support local installations and private deploy targets..

19:18 `lein help install`

19:19 amalloy: avshalom: you are using up all available ram on something. the program is giving up because it's spending 90% of its time GCing just to get a little breathing room

19:21 you need to figure out why you're using 220g on something that you think should take only 30g (although, seriously, you can't do this incrementally?); twiddling with gc params is not going to help

19:35 avshalom: amalloy_: not to be a smartass, but the reason I have set it to 220g is that I have 250g of ram. the same could be said about any maximum parameter. Yes, a 100g table could be read peicewise. But for what purpose? I don't understand why it consumes 30g and then crashes, though it has 220g allocated.

19:39 akurilin: Quick question: what's the most popular / supported monads library out there?

19:39 that you guys would recommend

19:48 travisr: in a situation like this how can one capture the variables, despite the eval? (let [a 3 b 7] (eval (apply concat (list 'cond) [[(quote (< (+ a 2) 3)) "Object A"] [(quote (> (+ b 2) 3)) "Object B"]])))

19:49 nathan7: a better question is "why the hell are you using eval"

19:50 travisr: i have a very complex set up macros, that are producing a final output of code that would work if the above question is answered.

19:50 normally, I wouldn't, but without it, the code is "level" away from being eval'd

19:51 nathan7: You could write a macro that uses the &env

19:51 travisr: I am writing a dsl... hence the convolution.

19:51 hmm...

19:52 I will look it up, if you don't want to elucidate...

19:52 nathan7: &env holds an object describing the local environment

19:52 lazybot: java.lang.RuntimeException: Unable to resolve symbol: env in this context

19:52 travisr: what would I do with that...? it is a capture of the macro environment, right

19:52 nathan7: ,(defmacro x [] (println &env)) (x)

19:52 clojurebot: #'sandbox/x

19:52 nathan7: :|

19:52 ,(do (defmacro x [] (println &env)) (x))

19:52 travisr: thanks, I will git that a try..

19:52 clojurebot: nil\n

19:53 nathan7: er

19:53 ,(do (defmacro x [] (println &env)) (let [blah 3] (x)))

19:53 clojurebot: {blah #<LocalBinding clojure.lang.Compiler$LocalBinding@b7558a>}\n

19:53 nathan7: travisr: I'd like to hear, in a few weeks, if this is the thing you're sticking with

19:53 travisr: because I dearly hope you'll find a better way of accomplishing your goal

19:55 travisr: yeah... me too...

19:56 the problem is this:

19:56 that the form that comes back is this:

19:56 ,(eval (apply concat (list 'cond) [[(quote (< (+ a 2) 3)) "Object A"] [(quote (> (+ b 2) 3)) "Object B"]]))

19:56 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0:0)>

19:56 travisr: er...

19:56 ,(eval (apply concat (list 'cond) [[(quote (< 2 3)) "Object A"] [(quote (> 2 3)) "Object B"]]))

19:56 clojurebot: "Object A"

19:57 travisr: clojurebot is returning "Object A" because it is running a REPL, and evaling the returned list, but these forms are subsumed under another macro, that sees them as an ISeq, and is not evaluating it as the cond form

19:58 so I ad the eval, to force the resolution to a cond, but it doesn't pick up the variable that are scoped in the macro

19:58 so close, yet so far

19:58 *add

20:00 I will look into the &env, but what I am seeing initially is that the values that are accessible are experimental and subject to change... not good... but I have not been able to find another option.

20:00 I can give you a bit more code if you would like that encapsulates the issue, if you want...

20:00 it illustrates it a little better

20:01 actually, let me write the actual return form...

20:04 this is what that form, apart from the variables eval's to:

20:04 (clojure.core/cond (< 2 3) "Object A" (> 2 3) "Object B")

20:04 this is seen as a list by the enclosing macro, and not an s-expression in the evaluation

20:05 hence the addition of the eval, which causes it to move up the evaluation ladders, so-to-speak, but it doesn't capture the variables of the enclosing macro

20:06 as illustrated by the (let [a, b]) not being available in the eval...

20:07 so, any thoughts would be greatly appreciated. this is the second time I have run into this type of a scenario, and I would like to find a consistent way to get past it.

20:07 thanks

20:11 nathan7: any other thoughts?

20:13 nathan7: travisr: are you sure you don't need to just unquote that

20:13 travisr: like, more of the surrounding code would be very helpful

20:13 travisr: because I think I can help you fix this entirely

20:14 travisr: should I gist exemplar code, or can I just add it here?

20:14 nathan7: gist would rock, yeah

20:14 travisr: okay, I will send you a link...

20:15 jimduey: akurilin: I'm partial to https://github.com/jduey/protocol-monads myself. :)

20:15 travisr: the code will be example code that exhibits the exact problem... I can't send the actual code, it is not owned by by me... but, it does illustrate the issue... brb

20:18 okay, here it is: https://gist.github.com/anonymous/9c839217c56642250639

20:18 thanks

20:19 nathan7: did you catch that?

20:20 nathan7: travisr: yeah

20:20 travisr: I don't appear to have a macroexpand-all, just macroexpand

20:21 travisr: nathan7: so what is holding me from applying... macroexpand-all from clojure.tools.macro

20:22 sorry

20:22 nathan7: travisr: how does that relate to macroexpand?

20:22 travisr: as far as I knew macroexpand itself already expands completely

20:22 travisr: it does, macroexpand will do one level of expansion, macroexpand-all will fully expand all statements

20:22 nathan7: really? interesting

20:24 travisr: yes, so if you run macroexpand, you will see that the 'unit' macro is not expanded, but if you run macroexpand-all, all the statements are expanded..

20:24 argh... man I have to run...

20:24 nathan7: oh!

20:24 I'm blind

20:24 travisr: when will you return?

20:24 I'm in a bit of a mad state and I've been given a problem to solve q=

20:25 travisr: 6-6:30-ish PST

20:25 nathan7: what time is it now?

20:25 travisr: 5:23

20:25 nathan7: ah

20:25 travisr: probasbly more like 7:00

20:25 sorry...

20:25 nathan7: it's 2:23AM here

20:25 (which is why the mad state)

20:25 travisr: bummer

20:25 haha

20:26 nathan7: and I should try to be alive tomorrow because I have to go be a psychologist

20:26 travisr: okay... well, I will look for you again then... thanks for taking a look...

20:26 nathan7: travisr: do you leave your IRC client connected?

20:26 travisr: if so, I'll just send you a link if my brain does its thing

20:26 travisr: I do... thanks!

20:28 I will review the history when I get back...

20:28 thanks again!

20:28 nathan7: [=

20:39 verma: hey guys, just some general questions about building a library, why do projects like this [1] using cljx only define "dev" profiles? [1] https://github.com/r0man/sablono/blob/master/project.clj

20:41 nathan7: travisr: http://sprunge.us/SbYZ?clojure

21:04 Shayanjm: If I have a macro that takes an arg, how do I resolve the symbol of that arg?

21:04 i.e: (macroname argname) => argname

21:12 ah it's name

22:29 Fare: if I have a personal repo on my machine, need I add it to the project.clj ???

22:29 lazybot: Fare: Yes, 100% for sure.

22:30 Fare: lazybot: ???

22:30 lazybot: Fare: Yes, 100% for sure.

22:30 Fare: ???

22:30 lazybot: Fare: Yes, 100% for sure.

22:30 Fare: ok

22:32 * Fare learns about checkout dependencies

23:31 Janiczek: What does cljsbuild not like about this line? (:use-macros [purnam.test :only [fact]]))

23:31 clojure.lang.ExceptionInfo: Only [lib.ns :only (names)] specs supported in :use / :use-macros; offending spec: [purnam.test]

Logging service provided by n01se.net