#clojure logs

2014-07-05

00:31FareWellthanks! http://dev.clojure.org/jira/browse/TMACRO-6
00:35seancorfieldFareWell that was an interesting problem to look into :)
00:39FareWellseancorfield, thanks for looking into it!
00:39FareWellthe lack of read/write invariance is a big pain with clojure
01:54seancorfield,(* 150 350)
01:54clojurebot52500
01:56rplacaseancorfield: I'm beginning to dig back into scala again after a long time because of Spark
01:56seancorfieldrplaca I still think Scala's a good language
01:57rplacaseancorfield: too complicated for too little benefit is my feeling
01:57rplacaplus I'm just using too many languages already right now
01:57seancorfieldI think Scala suffers from the way it is often taught
01:58seancorfieldI started on Odersky's FP course (Coursera) but the heavily math-based focus bored me
01:58rplacayeah, that could be. Also, all the immutability stuff has gone in since I last used it
01:58seancorfieldAnd then you have the "Type Nazis" who are also kind of overwhelming
01:58rplacaso that's kind of nice
01:59rplaca:)
01:59seancorfieldI'm a Math/Comp Sci grad BTW, but Odersky's course was just dry and boring, unless you were so excited about FP itself :)
02:00rplacaI can be (like with some of the Haskell stuff), but I also just like things easy :)
02:00seancorfieldWe 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...
02:00seancorfieldI was very pleased to hear Odersky talk about simplifying the type system at Strange Loop 2013
02:01rplacaOne of the most amazing things about Clojure is how painless the upgrades are and how interoperable everything is between versions
02:01seancorfieldHaskell's a GREAT language but many of its advocates are its worst enemies... the zealotry about types...
02:01seancorfield...and the whole dreadful M-word obsession :(
02:01rplacaI've been living in the Hadoop world lately and it's just a version nightmare all the time
02:02seancorfieldI love that Evan is pushing back hard against that academic stuff with Elm
02:02rplacayeah, I definitely treat Haskeel as more theoretical than practical, so that stuff doesn't bother me
02:03seancorfieldIf Haskell ran on the JVM, I'd be a lot more interested :)
02:04seancorfieldI 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...
02:05seancorfield...and we're up over 20K lines of Clojure now and slowly moving our legacy code base over
02:05rplacayeah, I remember that
02:06rplacaClojure is still my go to in every situation where there's not some particular reason to use something else
02:06rplacaexcept for stats when I use R
02:08seancorfieldI have never used R... I here a lot about it...
02:11TEttingerJulia 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
02:11TEttingerI was kinda struck by how its standard lib covered data types similarly to clojure
02:12TEttingerexcept it also had nice things like combinatorics in the core
02:13seancorfieldTEttinger the Seven More Languages book covers Julia - I'm looking forward to that chapter (I'm on Factor right now - language #2)
02:14TEttingeroooh factor
02:14TEttingerthat's a brain-melter
02:14TEttingerone of my acquaintances in a gamedev channel tried to make a game in factor
02:14TEttingerno one could understand any of his code
02:15TEttingernow he uses rust and similarly suffers, just at an architecture level to deal with their mutability primitives
02:15seancorfieldI did Forth back in the day... and wrote a Forth interpreter / compiler at university in the 80's :)
02:15seancorfieldSo Factor is quite natural - Forth grown up! :)
02:15TEttingeryep
02:16TEttingerI think there's JVM concatenative languages too
02:16seancorfieldHaven't looked at Rust yet... that's also on my list...
02:16TEttingerthis guy was struggling for weeks before just discarding the standard recommendations for safe, high-performance rust code
02:17TEttinger$google rsaarelm calx
02:17lazybot[rsaarelm (Risto Saarelma) · GitHub] https://github.com/rsaarelm
02:17TEttingerhttps://github.com/rsaarelm/calx I tried so hard to get it to build on windows...
02:19rplacaTEttinger: Julia compiles to LLVM backends though as a JIT-only, I think
02:19TEttingeryeah, but the libs are not compiled into the app I thought
02:20TEttingerI know they are going towards that goal
02:20rplacaright but they'll compile whe you load them, I think
02:20rplaca*when
02:21TEttingerI'm quite pleased with C# right now, using a JVM game lib with IKVM. all these platforms are slowly merging
02:22rplacaTEttinger: that seems complex!
02:22TEttingernot at all!
02:22TEttingerit was one compilation of libgdx to a dll
02:22TEttingerand I just imported it into a C# project
02:22rplacacool. and it's performant?
02:23TEttingerit appears so, I'm not doing anything too hardcore yet
02:24rplacaDoes it compile the Java to the DLR intermediate language? Or run the JVM inside the DLR?
02:24rplacaI can't tell from their page
02:33TEttingerit uses openjdk and compiles it to a dll somehow
02:34TEttingerit doesn't depend on DLR, just CLR
02:36rplacaahh, interesting
03:21rurumateusing multiple catch clauses inside a go block apparently causes a kind of deadlock: see https://www.refheap.com/87878
03:35rurumatehttp://dev.clojure.org/jira/browse/ASYNC-78
04:35ludwig`does anybody else experience the piggieback/cljs-repl being broken again since the later nrepl middleware updates?
04:42ludwig`sometimes it works but it usually it stops after a few browser refreshes or starting lein cljsbuild
04:56amalloyrurumate: aren't you reading from ch more often than you're writing to it there?
04:56amalloyso the thread is just blocking forever on <!!
05:00boxedI 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)) ?
05:00amalloy&(doc apply)
05:00lazybot⇒ "([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."
05:01hellofunkre
05:01boxedah crap, I thought I tried that.. thanks :P
07:03CaveJohnsonhm, how would I directly insert javascript using clojurescript?
07:04CaveJohnsonb highm
07:04CaveJohnsonoops.
07:04CaveJohnsondamn slash key
08:16CaveJohnsongah, looks like I found a bug in clojure.browser.repl
08:16CaveJohnson[13:15:14.998] TypeError: invalid 'in' operand a @ http://127.0.0.1:3000/js/site.js:6559
08:17CaveJohnson if (d in a && !/^https?:\/\//.test(a[d])) {
08:17CaveJohnson:(
08:26nathan7CaveJohnson: I'm guessing `a` is undefined or null there then
08:29CaveJohnsonnathan7: but I haven't modified that all, it's a standard library...
08:29CaveJohnsonwould you like to take a look at the source? :P
08:36nathan7CaveJohnson: sure
08:36CaveJohnsonnathan7: https://github.com/zackp30/crateincinerator
08:39nathan7oh gah I'd have to get my cljs shit going
08:39CaveJohnsonhehe :P
08:46nathan7CaveJohnson: actual JS I can wrangle, but I'm too lazy for build envs
08:52CaveJohnsonnathan7: :(
08:53CaveJohnsonok, thanks anyway :)
08:53nathan7CaveJohnson: if you have compiled JS for me to look at that's cool
08:59gfredericksI still don't understand this `lein test` reloading issue and I'm going to try
09:06CaveJohnsonnathan7: if (d in a && !/^https?:\/\//.test(a[d])) {
09:06CaveJohnsonis the line in question
09:06CaveJohnsonand if you're interested: http://dev.clojure.org/jira/browse/CLJS-822 is the bug report
09:18unsafeCoerceCaveJohnson, when life gives you lemons?
09:29magopianwhat does "(set! *print-length* 5)" do?
09:29magopian(i'm watching the "introduction to clojure" video from Stuart Halloway (http://vimeo.com/68375202)
09:30joegallohttp://clojure.github.io/clojure/clojure.core-api.html#clojure.core/*print-length*
09:30joegalloit sets the print-length to 5
09:31joegallo,(binding [*print-length* 5] (println [1 2 3 4 5 6 7 8 9 10]))
09:31clojurebot[1 2 3 4 5 ...]\n
09:32joegalloi'm using binding there so it's just modifying the setting locally rather than globally.
09:32nathan7CaveJohnson: yes, that leaves 'a' as a free variable
09:32nathan7CaveJohnson: and I know nothing about it beyond it being a primitive
09:35magopiani see, thanks a lot joegallo
09:36joegalloyou're welcome!
09:36magopian:)
09:50martinklepschhow can I get information about the number of cpu cores on my machine within clojure?
09:51nathan7martinklepsch: somewhere under system, gimme a moment
09:51nathan7martinklepsch: (.. Runtime getRuntime availableProcessors)
09:55martinklepschnathan7, thanks!
09:56nathan7martinklepsch: fyi, I got that from the second search result on 'available cores java'
09:56nathan7martinklepsch: and some transliteration to Clojure
09:56nathan7martinklepsch: pretty much always if you're looking for this kind of thing, just check how it's done in Java
09:56nathan7martinklepsch: because you'll just have to talk to the JVM's Runtime or System objects
10:22mbacwhat's the easiest way to convert an array of bytes into an array of shorts?
10:23mbacwhere short_array[i] = (byte_array[i/2] << 8) | byte_array[i/2+1]
10:24clgvmbac: if I remember correctly java.nio.bytebuffer and co
10:26mbachmm, interesting
10:26cohimameHi? So am i allowed to ask bout clojure right here?
10:27cohimamefirst time in irc since 2004)
10:27TimMcYep.
10:32cohimameoh, i've just googled al answers:)
10:33cohimameDespite that, I'm willing to make a simple game in clojure from scratch
10:36cohimameand here's uberjar and wrappers to .exe
10:38cohimame...so end users have a chance to play it without jvm on board
10:38cohimamethats all)
10:43m_m_Hi. How I can change my lazy-seq full of strings to an array of ints ?
10:46gfrederickshow do you change a string to an int?
10:48m_m_read-string?
10:48gfredericksif your strings are just digits, sure
10:48gfrederickswasn't clear from your question
10:49gfredericksalso there is ##(Long/parseLong "42")
10:49lazybot⇒ 42
10:49gfredericksalso did you mean "array" in the JVM sense?
10:49gfrederickslike you want an array of primitive ints?
10:50m_m_I have lazy-seq wiht integer in string format. Now I would like to change them all to int and print them.
10:50gfredericks,(def my-strs ["41" "42" "43"])
10:50clojurebot#'sandbox/my-strs
10:51gfredericks,(doseq [s my-strs] (println (Integer/parseInteger s)))
10:51clojurebot#<CompilerException java.lang.IllegalArgumentException: No matching method: parseInteger, compiling:(NO_SOURCE_PATH:0:0)>
10:51gfredericks,(doseq [s my-strs] (println (Integer/parseInt s)))
10:51clojurebot41\n42\n43\n
10:51gfredericksm_m_: of course if all you're doing is printing them then there's no need to convert them first
10:53mbacthanks clgv that totally worked
10:58mbaci 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:58mbaci know i can, say, (reduce concat lazy-sequence) to get a sequence of x, but i can't fit it all into memory
10:58clgvmbac great
10:59mbacoh maybe it's lazy-cat
10:59clgvreduce+concat will cause you pain
11:00mbacyeah, i've noticed :)
11:00mbacalso it's not lazy-cat
11:00mbachmm
11:03mbacmaybe i want to do (flatten (take-while (fun [samples] (> (count samples) 0)) sequence-of-x-sequences))
11:05gfrederickshave I forgotten how logic works?
11:05gfredericksis it possible for [a b (and a b)] to ever be [true false true]?
11:06gfredericksthis is what I am witnessing and heck if I
11:06gfrederickshm. I think my and is borked.
11:07gfrederickssomehow it got unmacro'd o_O
11:12clgvgfredericks: mutual state or some singularity is happing at your place ;)
11:12gfredericksI knows...
11:12dbaschmbac: (for [subs s x subs] x)
11:14clgv(apply concat ...) should do as well
11:14dbaschclgv: except that's eager
11:14clgvdbasch: no.
11:14m_m_How I can create list from string?. I need each char seperatly.
11:15clgvdbasch: consult the source. concat is inherently lazy
11:15dbaschclgv: apply is not
11:15gfredericksm_m_: seq
11:15clgvdbasch: well you got something wring there ;)
11:15dbaschclgv: what do you mean?
11:16m_m_gfredericks: Thank you. How I can change each of my sequence chars into number ? Integer/parseInt wont work.
11:16clgvok let me reformulate: apply+concat is not different from reduce+concat concerning lazy or not
11:17dbaschclgv: I agree
11:17clgvexcept that reduce+concat tends to stack overflow ;)
11:17clgvwhich apply+concat does not
11:18dbaschclgv: but apply concat will realize the entire long sequence
11:18clgvdbasch: humm but the interesting question here is whether apply forces more than just the specified non &rest args
11:19clgvdbasch: I'd guess it realizes at most 3 elements - the two mandatory paramaters and maybe the first of the &rest parameter
11:19dbaschbecause the long sequence of sequences will be converted into an argument list
11:19TimMcm_m_: It sounds like you're doing something the roundabout way.
11:19clgvdbasch: see above
11:19gfredericksm_m_: that depends on what you want
11:19gfrederickse.g.
11:19gfredericks,(def my-char \3)
11:19clojurebot#'sandbox/my-char
11:19gfredericks,(int my-char)
11:19clojurebot51
11:20gfredericks,(read-string (str my-char))
11:20clojurebot3
11:23clgvdbasch: yes 3 it is ;)
11:23dbaschclgv: where do you see that?
11:24clgvdbasch: source and a small demo example I post in a minute
11:25clgv,(letfn [(myrange [n] (take n (iterate (fn [x] (print x " ") (inc x)) 0))), (mytest [a b & others])] (apply mytest (myrange 10)))
11:25clojurebot0 1 2
11:25clgvdbasch: mytest has the same signature as the arbitrary parameter implementation of concat
11:26dbaschyeah, this is perhaps a more clear proof
11:26dbasch,(take 10 (apply concat (map range (range))))
11:26clojurebot(0 0 1 0 1 ...)
11:27clgvdbasch: what is that supposed to proof?
11:27clgvah right
11:27clgvinfinite range ;)
11:27clgvyeah but I wanted to know how much is forced
11:28clgvand it seems the "& others" is at least checked whether it contains an element ...
11:30clgv,(letfn [(donothing [x])] (donothing 1))
11:30clojurebotnil
11:30clgv,(letfn [(donothing [x] (println "nothing done")] (donothing 1))
11:30clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>
11:30clgv,(letfn [(donothing [x] (println "nothing done"))] (donothing 1))
11:30clojurebotnothing done\n
11:30clgvhaha the bot swallows nil returns when something was printed ;)
11:47nathan7clgv: checked to see whether it contains an element in the sense that (seq []) is nil, yes
11:48clgvnathan7: yes^^
12:06weavejesterHm, that’s annoying… “lein deploy clojars” isn’t atomic…
12:14m_m_How to remove first char from string (and still get string. I know how to get sequence by 'rest')
12:14weavejesterm_m_: (subs s 1)
12:14weavejestersubs = substring
12:14weavejester~(subs “hello” 1)
12:14clojurebotHuh?
12:15m_m_weavejester: Thank you!
12:22Shayanjmugh
12:22ShayanjmAlright guys, I have a string like: "The Colombian defender&nbsp;Juan Camilo Z&uacute;&ntilde;iga challenged the Brazilian forward Neymar."
12:22Shayanjmwhich is absolutely riddled with HTML entity escapes
12:23ShayanjmI need to decode it and I'm not a huge fan of creating a huge map of character/ID and string replacing
12:23Shayanjmany suggestions?
12:24m_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:24weavejesterShayanjm: A HTML parser might work
12:25Shayanjmweavejester: I'm already using enlive in my project, so if theres something built into that it would be great
12:25Shayanjmunfortunately when I prodded around, it didn't seem to have anything of the sort
12:25ShayanjmThe data I actually scrape through enlive is fine - text is converted properly etc.
12:26ShayanjmBut the NYT has a weird API, and are sending escaped data in JSON formatted responses
12:26weavejesterm_m_: You don’t seem to define b anywhere
12:27weavejesterShayanjm: Crouton seems to work. Enlive might have something similar I guess.
12:27m_m_weavejester: That was only an example. I have 2 vars but one of them is build by another.
12:27weavejesterShayanjm: https://github.com/weavejester/crouton
12:28weavejesterm_m_: You can do something like: (let [x 1, y (+ x 1)] [x y])
12:28weavejesterEach clause in a let can access bindings defined above it.
12:41m_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:57gfredericksm_m_: it's visible, but (str-13) will try to call the string as a function, which will fail at runtime
12:57gfredericks,("my string")
12:57clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn>
12:58gfredericksm_m_: line 9 doesn't make any sense either; you can't set variables in clojure
12:58gfredericksyou probably want to remove that and put (getstrings (subs s 1) reduced-seq) for line 10
12:58m_m_gfredericks: So how I can change value ? like i = i + 1 ?
12:59gfredericksrecursion, sometimes; often the algorithm can be restructured as data transformation such that you don't need to do anything like that
12:59gfredericksI'm not sure what your function is trying to do so I can't be more specific
13:10FareWellhi. Which is your favorite pattern matcher for clojure?
13:10FareWellfor e.g. writing macros
13:10FareWelland source code transformations.
13:11mdeboardhttps://github.com/clojure/core.match ?
13:11mdeboardidk specifically about your two example use cases but core.match is nice
13:12gfredericksFareWell: what do you mean by pattern matching for macro writing?
13:13FareWellsomething like (match expr `(define-class ~name ~@foo) `(set! ~name (make-class ~@foo)) ...)
13:14mdeboardwow
13:14FareWellor whatever... something that can recognize the shape of data (like in destructuring) but also constants
13:16mdeboardisn't that sort of thing -- if i'm understanding your pseudo-code example -- what protocols and multimethods are for
13:17gfredericksmultimethods more than protocols probably
13:19FareWellpattern matching is what I want right now
13:20FareWellespecially since the (1) it's not always done based on a symbol (2) the same symbol may mean different things in different contexts
13:20FareWellespecially if a compiler gets written in many passes
13:21mdeboardyeah I mean there's core.match but clojure also has arity dispatch for functions
13:21mdeboardso it depends what you mean by pattern matching, that is what thing you're matching against
13:21gfredericksFareWell: I think core.match should work for this
13:24FareWellgfredericks, thanks
13:25FareWellreading 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:25FareWellwhere the first would match the value of a, and the second would create a new binding.
13:34FareWellahem.
13:35FareWellI 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:35gfredericksmdeboard: yes those erlang macros are the best aren't they :P
13:36gfredericksFareWell: you might try quoting things for symbol literals? not sure what the approach is
13:37FareWellgfredericks, I more like need `',a or something
14:34arrdemFareWell: beware of nasal daemons
14:34FareWellwhere is this *locals* thing documented?
14:35FareWelloh, it's defined in same file, and initialized with (dissoc &env '_
14:36FareWellOK, so searching for &env
14:37BronsaFareWell: &env is a variable you can use from inside defmacros and is a map from locals symbol to locals expr
14:38FareWellI see
14:38BronsaFareWell: I don't think it's actually documented anywhere
14:38FareWellis it a lexical or dynamic variable? I assume lexical
14:38Bronsayes, lexical
14:39FareWellof course, if some macro starts by expanding its body then wrapping new bindings around... oops
14:43bbloomBronsa: does anything in core actually depend on &env?
14:43bbloomBronsa: &form is useful and probably sensible to spec, since it's inherently very well defined
14:44FareWellwhat is the recipe for cider to load my dependencies, already?
14:44FareWellbbloom, is core.match part of core?
14:45Bronsabbloom: nothing uses &env in core
14:45bbloomFareWell: i was mainly talking about the stdlib
14:45Bronsabbloom: there might be some macro that uses &form to get the original meta though
15:10seriously_randomjoin #gnome
15:12TimMcGno.
15:15TimMcarrdem: Huh, I'd always heard it as purple monkeys.
15:15TimMc...although always from the same person, so there's that.
15:19bbloomhmm: https://github.com/clojure/core.async/commit/99d2ffbb22f57b29a41220cfb292e4c286037e46
15:19arrdemTimMc: the imagery of the compiler being able to choose arbitrarily bizare results just sits well with me :D
15:19TimMc*nod*
15:20amalloybbloom: it must be international participle day, with all them -ings
15:22bbloomit's an interesting idea putting the transform in to the channel itself
15:29arrdemtbaldridge: thanks for reccomending core.cljs, it was an interesting read
15:38tbaldridgearrdem: yeah it's pretty cool
15:39FareWellis there read-time computation in clojure? what's the equivalent of CL's #. ?
15:40FareWellis there a syntax for escaping characters in a symbol?
15:41BronsaFareWell: there's #=
15:43FareWellthanks!
15:43arrdemFareWell: yeah... please don't do that
15:43BronsaFareWell: yeah that's a really bad idead
15:45FareWellI was "just" interning (symbol foo), where foo was the string of the delimiter or operator in my lexer
15:50FareWellhow do I make sure I am *not* importing any symbol in a namespace?
15:50FareWell(refer-clojure :only "def") ?
15:51nathan7def is a special form I think
15:51nathan7:only []
15:51arrdemit is
15:51nathan7I had a bunch of trouble trying to redefine def because of that
15:52Bronsayou can't redefine def
15:52FareWellcan I shadow def?
15:52Bronsano
15:52nathan7nope :(
15:52FareWell:-(
15:52nathan7I ended up having a def*
15:52FareWellgood to know
15:52Bronsayou can just use a fully ns qualified alternative
15:52Bronsa(foo/def ..)
15:53FareWellmaybe I shouldn't implement python identifiers as symbols, then
15:53nathan7FareWell: nah, that is sane
15:53FareWellor add a prefix _ everywhere :-/
15:53nathan7FareWell: you can define a def, (def …) just won't use it
15:53nathan7FareWell: like, evaluation of a list form won't use `def` from the environment
15:53FareWellI'll cross that bridge later
15:54FareWellhopefully, I can maintain some hygiene in the implementation
15:54amalloyFareWell: 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:56arrdemFareWell: 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:59FareWellamalloy: I'm trying to compile python directly to clojure
15:59nathan7I have a very confusing implementation of my f-expr LISP, Plan
16:00FareWellor rather, a pure subset of python
16:00nathan7the confusion stems from how I'm connecting the lands of Clojure and Plan
16:00nathan7though Python should be really fine in this respect
16:00nathan7I have the problem that a Clojure function is a Plan macro
16:01nathan7oh, I actually have a fix for that, yay
16:01nathan7I just need to start using the ns map as my environment object
16:01nathan7and shuffle some namespaces around
16:02nathan7thanks for being my rubber duck, humans
16:02mbacis there anything like common lisp weblocks, but for clojure?
16:02mbacthat is, uses continuation passing magic to make webapps seems stateful
16:24ShayanjmIf I wanted to utilize a scala Set in some clojure code
16:24Shayanjmhow would I go about doing that?
16:25Shayanjmspecifically: https://github.com/GravityLabs/goose/blob/88567c78a2cd393a8fd1a918cc21312c35c63116/src/main/scala/com/gravity/goose/Article.scala#L79
16:25ShayanjmI'd like to be able to iterate over "tags"
16:25nathan7can't really just extend it with seqable, can you
16:26nathan7err, ISeq
16:27ShayanjmI honestly have no idea
16:27nathan7why can't that be a protocol :(
16:33bordatouewhat is new in clojure 1.6 is it worth upgrading from 1.5 ?
16:39Shayanjmnathan7: I ended up just using Scala's .mkString method from their immutable set class
16:39Shayanjmsplit the string into a clojure vector
16:39Bronsabordatoue: https://github.com/clojure/clojure/blob/master/changes.md
16:40bordatoueBronsa: thanks
16:41nathan7Shayanjm: I'd rather define a set-seq or something
16:42Bronsabordatoue: the most notable change is probably the work done around hashing
16:42Shayanjmnathan7: So from string, go to set?
16:49nathan7Shayanjm: from set, go to seq
16:50nathan7Shayanjm: you have a Scala Set
16:50nathan7Shayanjm: and you make a Clojure Seq out of it
16:50nathan7Shayanjm: doesn't it have a method to give you a Java Iterator though?
16:50Shayanjmnathan7: Clojure doesn't know how to turn a Scala Set into a Clojure seq
16:50nathan7Shayanjm: you do though
16:51ShayanjmYeah, 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:51arrdemtbaldridge: is there a design document somewhere detailing the interface choices?
16:51nathan7Shayanjm: definitely not
16:51nathan7Shayanjm: it has .iterator()
16:52arrdemShayanjm: just get an Object[] out of your Set, clojure can deal with Object[] just fine.
16:52Shayanjmhmmk
16:54nathan7(defn set-seq [s] (let [iter (.iterator s)] (repeatedly #(.next iter))))
16:54nathan7except with checking .hasNext
16:56ShayanjmI see, that makes sense
16:58nathan7Shayanjm: http://sprunge.us/KFaM?clojure
17:00Shayanjmthanks nathan7 :)
17:00Shayanjmout of curiousity, why a lazy-seq?
17:00Shayanjmthe data that's being returned is of a known size + type, and has a finite number of elements
17:00Shayanjmwhy not just throw it into a vector or regular seq?
17:01whilotbaldridge: 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:01nathan7Shayanjm: because lazy sequences are the norm and efficient and stuff
17:01whiloany pointers for further information (besides the talk and upstream llvm docs)?
17:01Shayanjmgotcha nathan7
17:01nathan7Shayanjm: no need to materialize an entire seq
17:02Shayanjmso lazyseqs are more efficient than seqs?
17:02nathan7Shayanjm: because the collection itself is already materialized
17:02nathan7Shayanjm: it spreads the cost of iteration
17:02nathan7Shayanjm: and saves you some memory
17:02Shayanjmgotcha. So when I consume this, I'll obviously have to iterate over the entire lazy-seq
17:02ShayanjmI can't just map it
17:05nathan7Shayanjm: map takes a sequence (including lazy ones), and returns a lazy one
17:05Shayanjmoh sweet, good deal. Thanks nathan7
17:08nathan7Shayanjm: many sequence operations in Clojure are lazy
17:08ShayanjmYeah - I've been realizing that very slowly
18:13akurilinSchema question: has anybody here figured out how to implement a string to integer coercion for schema/
18:13akurilinI believe by default the json coercer doesn't actually attempt to parse the string into a numeric type
18:26FareWellakurilin, I don't know anything about schema, but I coerced my integers by prepending "10r" and calling the edn reader.
18:26FareWellor 16r, 8r, 2r, depending on the base
18:28akurilinFareWell: sounds good!
18:28akurilinyeah 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:28FareWellif you know a better way, tell me
18:30FareWellthe 10r prefix prevents 025 from being parsed as 21.
18:33FareWell(inc Bronsa)
18:33lazybot⇒ 26
18:33FareWell(inc bbloom)
18:33lazybot⇒ 35
18:45FareWellis there a tutorial on how to use lein to manage several private (for now) projects some of which depend on other such projects?
18:57avshalomHi 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:58avshalomafter 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:18arrdemFare: lein/maven support local installations and private deploy targets..
19:18arrdem`lein help install`
19:19amalloyavshalom: 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:21amalloyyou 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:35avshalomamalloy_: 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:39akurilinQuick question: what's the most popular / supported monads library out there?
19:39akurilinthat you guys would recommend
19:48travisrin 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:49nathan7a better question is "why the hell are you using eval"
19:50travisri 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:50travisrnormally, I wouldn't, but without it, the code is "level" away from being eval'd
19:51nathan7You could write a macro that uses the &env
19:51travisrI am writing a dsl... hence the convolution.
19:51travisrhmm...
19:52travisrI will look it up, if you don't want to elucidate...
19:52nathan7&env holds an object describing the local environment
19:52lazybotjava.lang.RuntimeException: Unable to resolve symbol: env in this context
19:52travisrwhat would I do with that...? it is a capture of the macro environment, right
19:52nathan7,(defmacro x [] (println &env)) (x)
19:52clojurebot#'sandbox/x
19:52nathan7:|
19:52nathan7,(do (defmacro x [] (println &env)) (x))
19:52travisrthanks, I will git that a try..
19:52clojurebotnil\n
19:53nathan7er
19:53nathan7,(do (defmacro x [] (println &env)) (let [blah 3] (x)))
19:53clojurebot{blah #<LocalBinding clojure.lang.Compiler$LocalBinding@b7558a>}\n
19:53nathan7travisr: I'd like to hear, in a few weeks, if this is the thing you're sticking with
19:53nathan7travisr: because I dearly hope you'll find a better way of accomplishing your goal
19:55travisryeah... me too...
19:56travisrthe problem is this:
19:56travisrthat the form that comes back is this:
19:56travisr,(eval (apply concat (list 'cond) [[(quote (< (+ a 2) 3)) "Object A"] [(quote (> (+ b 2) 3)) "Object B"]]))
19:56clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0:0)>
19:56travisrer...
19:56travisr,(eval (apply concat (list 'cond) [[(quote (< 2 3)) "Object A"] [(quote (> 2 3)) "Object B"]]))
19:56clojurebot"Object A"
19:57travisrclojurebot 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:58travisrso 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:58travisrso close, yet so far
19:58travisr*add
20:00travisrI 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:00travisrI can give you a bit more code if you would like that encapsulates the issue, if you want...
20:00travisrit illustrates it a little better
20:01travisractually, let me write the actual return form...
20:04travisrthis is what that form, apart from the variables eval's to:
20:04travisr(clojure.core/cond (< 2 3) "Object A" (> 2 3) "Object B")
20:04travisrthis is seen as a list by the enclosing macro, and not an s-expression in the evaluation
20:05travisrhence 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:06travisras illustrated by the (let [a, b]) not being available in the eval...
20:07travisrso, 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:07travisrthanks
20:11travisrnathan7: any other thoughts?
20:13nathan7travisr: are you sure you don't need to just unquote that
20:13nathan7travisr: like, more of the surrounding code would be very helpful
20:13nathan7travisr: because I think I can help you fix this entirely
20:14travisrshould I gist exemplar code, or can I just add it here?
20:14nathan7gist would rock, yeah
20:14travisrokay, I will send you a link...
20:15jimdueyakurilin: I'm partial to https://github.com/jduey/protocol-monads myself. :)
20:15travisrthe 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:18travisrokay, here it is: https://gist.github.com/anonymous/9c839217c56642250639
20:18travisrthanks
20:19travisrnathan7: did you catch that?
20:20nathan7travisr: yeah
20:20nathan7travisr: I don't appear to have a macroexpand-all, just macroexpand
20:21travisrnathan7: so what is holding me from applying... macroexpand-all from clojure.tools.macro
20:22travisrsorry
20:22nathan7travisr: how does that relate to macroexpand?
20:22nathan7travisr: as far as I knew macroexpand itself already expands completely
20:22travisrit does, macroexpand will do one level of expansion, macroexpand-all will fully expand all statements
20:22nathan7really? interesting
20:24travisryes, 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:24travisrargh... man I have to run...
20:24nathan7oh!
20:24nathan7I'm blind
20:24nathan7travisr: when will you return?
20:24nathan7I'm in a bit of a mad state and I've been given a problem to solve q=
20:25travisr6-6:30-ish PST
20:25nathan7what time is it now?
20:25travisr5:23
20:25nathan7ah
20:25travisrprobasbly more like 7:00
20:25travisrsorry...
20:25nathan7it's 2:23AM here
20:25nathan7(which is why the mad state)
20:25travisrbummer
20:25travisrhaha
20:26nathan7and I should try to be alive tomorrow because I have to go be a psychologist
20:26travisrokay... well, I will look for you again then... thanks for taking a look...
20:26nathan7travisr: do you leave your IRC client connected?
20:26nathan7travisr: if so, I'll just send you a link if my brain does its thing
20:26travisrI do... thanks!
20:28travisrI will review the history when I get back...
20:28travisrthanks again!
20:28nathan7[=
20:39vermahey 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:41nathan7travisr: http://sprunge.us/SbYZ?clojure
21:04ShayanjmIf I have a macro that takes an arg, how do I resolve the symbol of that arg?
21:04Shayanjmi.e: (macroname argname) => argname
21:12Shayanjmah it's name
22:29Fareif I have a personal repo on my machine, need I add it to the project.clj ???
22:29lazybotFare: Yes, 100% for sure.
22:30Farelazybot: ???
22:30lazybotFare: Yes, 100% for sure.
22:30Fare???
22:30lazybotFare: Yes, 100% for sure.
22:30Fareok
23:31JaniczekWhat does cljsbuild not like about this line? (:use-macros [purnam.test :only [fact]]))
23:31Janiczekclojure.lang.ExceptionInfo: Only [lib.ns :only (names)] specs supported in :use / :use-macros; offending spec: [purnam.test]