#clojure log - Sep 22 2013

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

0:00 carlosgaldino: lordQuas: oh, that's cool

0:00 lordQuas: If you download emacs, I'd be happy to walk you through it.

0:00 Though I dont know if I could set up evil-mode, I've never done it before, I hear its easy

0:00 carlosgaldino: lordQuas: yeah, I was thinking about learning emacs when doing clojure

0:01 I have no idea how it works, if it's modal, or whatever. just know that it is better suited for clojure dev

0:01 and lisps in general

0:02 lordQuas: Its not modal by default, but the idea is that it is infinitely customizable. Given that you know clojure, customizing it would be trivial for you.

0:02 CuaThoXay: can I use emacs slime with clojure?

0:02 lordQuas: CuaThoXay: You can, but even better than slime is nrepl

0:02 IMO

0:02 CuaThoXay: thank, googling

0:02 carlosgaldino: lordQuas: haha, two problems then. I don't know clojure, I'm just starting

0:03 * CuaThoXay used emacs slime mode with clisp, works wonder

0:03 lordQuas: I think most people consider nrepl to be the successor to slime

0:03 Setting it up is cake too

0:04 M-x package-install <ret> clojure-mode <ret>

0:04 M-x package-install <ret> nrepl <ret>

0:04 And youre done

0:04 Eval code with C-x C-e (eval-last-s-expression)

0:05 * CuaThoXay uses Emacs 23 so needs a bit of downloading first

0:05 lordQuas: Huh why havent you updated?

0:05 CuaThoXay: stock emacs version of ubuntu 12.04

0:07 lordQuas: ah i see

0:07 CuaThoXay: I prefer to use software straight from the distro's repo, if possible

0:07 less maintenance work

0:08 lordQuas: Understandable. I would say 24 is stable and it's new package manager is worth the upgrade

0:10 Cua: I agree, installation from one's distro repo doesn't work so well with software with fast development pace such as clojure and its friends

0:11 the version of leiningen in ubuntu 12.04 repo is still 1.7.1

0:11 yuck

0:11 lordQuas: yikes

0:12 When did OS X Homebrew surpass apt-get. Its a sad day.

0:12 Cua: well, 12.04 was released one and a half year ago

0:27 technomancy: when you don't have any quality guidelines, you can move faster

0:28 Brand0: you don't need homebrew to install clojure/lein

0:28 or apt-get in linux

0:30 robink: Fastest way to turn a seq of characters into a String in Clojure?

0:32 coventry`: ,(str \a \b \c)

0:32 clojurebot: "abc"

0:33 coventry`: ,(apply str (\a \b \c)) for a seq, I guess.

0:33 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Character cannot be cast to clojure.lang.IFn>

0:33 coventry`: ,(apply str '(\a \b \c))

0:33 clojurebot: "abc"

0:36 allenj12: hey is there a replacement library for clojure.contrib.seq im paticularly interested in positions function

0:42 very quiet here

0:42 robink: coventry`: I guess that works. I was hoping for something a little less stack-hungry.

0:46 coventry`: robink: Oh. (String. (char-array '(\a \b \c))) maybe?

0:46 robink: coventry`: "IllegalArgumentException No matching ctor found for class java.lang.String clojure.lang.Reflector.invokeConstructor (Reflector.java:183)"

0:47 coventry`: Huh, it works in my repl.

0:47 chord: allenj12: lets stop the quietness and wark on starcraft clone in clojure

0:47 robink: Ah, forgot to cast to char-array

0:48 allenj12: chord: xD

0:48 chord: what?

0:48 clojurebot: what is cells

0:48 allenj12: chord: or even better a A* search on a eight puzzle :P (my intro to ai HW)

0:52 chord: allenj12: whatever you want just make the gaem

0:55 dirkdiggler: i'm new to emacs and just installed emacs-live and wondering how I can tell if emacs-live has been loaded

0:57 or i guess the more general question is how do i query emacs on what packages have been loaded

1:14 callen: dirkdiggler: https://www.google.com/search?q=emacs+query+packages&oq=emacs+query+packages&aqs=chrome..69i57j0l2j69i64l2.2635j0&sourceid=chrome&ie=UTF-8

1:20 coventry`: callen: Doesn't emacs-live operate outside the standard package manager?

1:21 https://github.com/overtone/emacs-live#live-packs

1:25 Frozenlock: Is there a way to get a project version for when running from leiningen and/or when running from a uberjar? I've seen different solutions for each of them, but I'm wondering if there's one for both.

1:26 callen: coventry`: it was a subtle way of making him feel pain for not just using emacs

2:26 chenjf: gi1

3:06 chord: lets talk about something

3:14 dirkdiggler: what's up chord?

3:15 i like talking about development tools

3:15 new things beyond emacs

4:02 m00nlight: Can someone tell me how to get a field in a nested map?

4:03 scottj: ,(get-in {:a {:b 1}} [:a :b]) ; m00nlight

4:03 clojurebot: 1

4:04 m00nlight: scottj: Thanks

4:41 klokbaske: ,(+ 1 1)

4:41 clojurebot: 2

4:48 chord: you are all dumb

5:00 rlp10_: I have a vector of maps, each with an ID key. How do I filter the vector so that any maps with an ID the same as one earlier in the list are filtered out (leaving only the first map in the vector that had that ID value)?

5:11 TEttinger: rlp10_, sounds like a use for distinct in some way

5:13 rlp10_: TEttinger: Thanks, I'll check that out

5:13 TEttinger: http://clojuredocs.org/clojure_core/clojure.core/distinct

5:14 I'm thinking you could get the distinct IDs by mapping like (map :id [{:id 1234 :data "blah"}])

5:14 ##(distinct (map :id [{:id 1234 :data "blah"} {:id 1234 :data "boo"} {:id 1235 :data "whee"}]))

5:14 lazybot: ⇒ (1234 1235)

5:15 TEttinger: but then you need to figure out which data to use

5:15 distinct is not sorted

5:15 oh!

5:16 you can get the distinct IDs that way, then use them as part of the filter or map-indexed

5:16 there's also reduce, which might be a good fit

5:17 rlp10_: OK, TEttinger thanks for your help

5:17 I think I've got enough to work on now - I appreciate your help

5:17 TEttinger: np

6:03 Jarda: (first (:content (first (filter #(= (:tag %) :ResponseCode) (xml-seq app-resp)))))

6:03 is this really the best way to get a value of a xml element?

6:03 app-resp is the result of xml/parse-str where xml is clojure.data.xml

6:08 TEttinger: Jarda, it looks to me like clojure.data.xml is not meant for reading xml so much as writing

6:08 I've never used it though

7:16 chord: YOU ARE ALL STUPID



7:19 s4muel: ,(reduce into (sorted-map) (for [e (reverse [{:id 1, :rec "one-rec"}, {:id 1, :rec "two-rec"}])] e))

7:19 clojurebot: {:id 1, :rec "one-rec"}

7:23 s4muel: rlp10_ you could try the above, although, rseq might be faster than reverse

7:24 TEttinger: ,(reduce into (sorted-map) (rseq [{:id 1, :rec "one-rec"}, {:id 1, :rec "two-rec"}])])

7:24 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>

7:24 s4muel: hive mindin'

7:24 TEttinger: ,(reduce into (sorted-map) (rseq [{:id 1, :rec "one-rec"}, {:id 1, :rec "two-rec"}])) ; the point is the for is unneeded I think

7:24 clojurebot: {:id 1, :rec "one-rec"}

7:25 s4muel: ah! it always gets simpler :)

7:26 TEttinger: no, it doesn't quite work ##(reduce into (sorted-map) (rseq [{:id 1, :rec "one-rec"}, {:id 1, :rec "two-rec"}, {:id 2, :rec "eh-rec"}]))

7:26 lazybot: ⇒ {:id 1, :rec "one-rec"}

7:27 TEttinger: I think rlp10_ needs a vector of maps, rather than one sorted-map

7:29 * s4muel was thinking along the lines of {:id 1, :rec {}} where :rec was the original 'seen first' map

7:39 s4muel: ,(reduce (fn [m {:keys [id rec]}] (if (contains? m id) m (assoc m id rec))) (sorted-map) [{:id 1, :rec "one-rec"}, {:id 1, :rec "two-rec"}, {:id 2, :rec "eh-rec"}])

7:39 clojurebot: {1 "one-rec", 2 "eh-rec"}

7:44 mercwithamouth: question...do you all generally read from left to write when writing clojure or inwards and work your way out?

7:44 as if expanding on an idea?

7:45 TEttinger: s4muel, looks good

7:45 s4muel: iteratively, for sure. even just solving that little problem

7:45 hyPiRion: Well, it depends.

7:45 s4muel: (which is why this channel is awesome, its like learn by immersion in random real-world issues)

7:46 TEttinger: mercwithamouth, I generally iterate too.

7:46 jkj_: mercwithamouth: if often go to threading macros -> ->> quite fast when there are many nested calls

7:46 mercwithamouth: so say you wanted to add 5+5 and then 18 to that value you would first think (+ 5 5) and then GO BACK and add another set of parenthesis around that and add the 18?

7:47 jkj_: mercwithamouth: often yes.

7:47 mercwithamouth: or would you automatically think to start off with (+ 18 () ) ?

7:47 TEttinger: mercwithamouth, I think I would prefer (+ 5 5 18), but hey...

7:47 jkj_: but then (->> (+ 5 5) (+ 18) ...)

7:47 mercwithamouth: TEttinger: well yes...that's a bad example =P

7:47 TEttinger: heh

7:47 mercwithamouth: jkj_: hrm!!!

7:48 TEttinger: yeah, I do wind up going back a lot

7:48 iterative is a good way to put it. writing one piece, scanning for what needs to change, adding it

7:48 and it's part of why clojurians prefer small single-use functions

7:49 mercwithamouth: i see

7:49 TEttinger: my clojure code is pretty terrible and tends toward massive one-liners

7:50 https://www.refheap.com/16011

7:50 jkj_: there should be ide support for automatically converting to threading macro style or so

7:50 mklappstuhl: I use korma for querying and jdbc for creation of tables

7:51 both of them need a connection but both have different ways to specify them

8:00 ambrosebs: Bronsa: what's post-GSoC look like for you? More CinC?

8:00 Bronsa: ambrosebs: definitely

8:00 ambrosebs: Bronsa: sweet!

8:00 Bronsa: ambrosebs: I have a few things in mind to extend CinC

8:02 ambrosebs: Bronsa: oh?

8:02 Bronsa: ambrosebs: I would like to have 2 eval targets: 1 normal compilation (like clojure does) and 1 more static, optimizing compilation that uses aggressive infer-tag and method specialization

8:03 like clojurescript's :optimizations :simple vs :advanced

8:03 ambrosebs: Bronsa: are you looking at the same unit of compilation, a form?

8:04 Bronsa: ambrosebs: yes, but I'm storing the result of tag inferring in the fn's metadata

8:05 ambrosebs: Bronsa: does that help resolve reflection calls at runtime?

8:07 Bronsa: or, what does that do? :P

8:07 Bronsa: ambrosebs: yes, take for example (defn x [] "foo") (.hashCode (x))

8:08 clojure compiles the latter to a call to Reflector/invokeNoArgInstanceMethod or how it's called because the defn is not manually tagged

8:08 ambrosebs: Bronsa: oh nice.

8:09 Bronsa: if you tag it ^String it will resolve to String#hashCode but you know that if you redefine x to e.g (defn x [] 1) the compiled (.hashCode (x)) will no longer work

8:09 I plan on keeping this behaviour in the normal eval

8:09 and aggressively inferring the return-tag of (x) to String in the optimizing call

8:10 eval*

8:10 ambrosebs: also I have a partially written pass that transforms forms like (.hashCode (if true 1 "")) in (if true (.hashCode 1) (.hashCode ""))

8:11 removing the need for reflection

8:11 ambrosebs: Bronsa: is it worth following instance? calls to infer accurate types for reflection?

8:12 Bronsa: ambrosebs: didn't think about it, certainly possible to do

8:14 ambrosebs: Bronsa: well core.typed uses branches to infer better types via occurrence typing.

8:14 Bronsa: you could probably implement something similar.

8:17 Bronsa: ambrosebs: that would be sweet -- anyway I'm not going to do any of that until I get primitive support in there and make sure CinC can compile itself

8:17 ambrosebs: Bronsa: good plan

8:22 Bronsa: is the analyzer getting close?

8:23 TEttinger: what's the goal of Clojure in C? better integration with C as opposed to Java?

8:24 or performance?

8:24 gleag: Clojure the language or Clojure the implementation?

8:25 Oh, "Clojure in C" is probably something I haven't been aware of.

8:25 Bronsa: ambrosebs: yes, it's actually already complete but I need to simplify the :tag/:cast/:box handling

8:25 ambrosebs: Bronsa: awesome

8:25 gleag: Why would such a thing be more desirable than Clojure in Clojure?

8:26 Bronsa: TEttinger, gleag CinC is a port of the clojure compiler/analyzer to clojure, not in C

8:26 TEttinger: oh. that makes more sense

8:26 ambrosebs: :)

8:27 TEttinger: isn't there a clojure in C project?

8:27 or am I thinking of something else

8:27 Bronsa: there should be one

8:27 TEttinger: well clojure in clojure sounds great

8:27 Bronsa: https://github.com/schani/clojurec

8:38 borkdude: I find this amazing… I wrote an fsharp script in 2008, compiled it then in Windows XP, 2008. I'm now installing mono and executing the .exe just works: http://twitter.com/borkdude/status/381751228017160192

8:38 on Mountain Lion

8:41 francis_wolke: Killing the JVM associated with nrepl locks my emacs for ~2 minutes. Offhand does anyone know of a way to prevent/bypass this?

8:51 TEttinger: borkdude, neat

8:51 now do it with lisp from the 60s

8:53 borkdude: TEttinger I doubt there are any scripts from the 60s that recursively delete .svn folders ;)

8:54 TEttinger: perhaps.

10:57 jave: I wish to build some clojure code within a larger java build.

10:57 there seems to be a number of options. any hints which one to prefer?

10:58 for instance, i could call lein from maven, or use the zi mvn plugin, or the clojure-maven-plugin

11:16 Bracki: How do I fix "No matching method found:" with polymorphic methods in the Java class I'm calling?

11:22 borkdude: Bracki that should just work I think

11:22 Bracki: reflect only prints two of the three methods.

11:25 borkdude: what fundamental difference does it make in having a concatenative style language or applicative - isn't it just the way you write it down?

11:29 TEttinger: jave, probably a sane option would be separating the clojure into a library

11:30 if that's not possible, uh...

11:30 * TEttinger is not a fan of maven

11:37 technomancy: francis_wolke: kill all the *nrepl- buffers

11:48 munderwo: Hi all, I'm following a tutorial for getting started doing REST api with clojure, here is my code.. https://www.refheap.com/d4d4e459cdcd49ee0e2999b0a

11:49 when I try to do leon ring server I get https://www.refheap.com/42fbcf3e33d7ebd78e9b0ca6e … any help?

11:52 technomancy: or maybe M-x nrepl-disconnect

11:53 munderwo: my bad. found it. Wrong name for the pool

12:08 vurma: Regarding the Ritz debugger: I cant seem to get the nrepl-dbg buffer to pop up when i hit breakpoint. Any ideas?

12:09 Kind of a pain to have to switch buffer and open the dbg buffer every time i need to sort out an exception.

12:44 jkj_: I have an endless sequence coming from I/O. How do I munch the entries so that memory is also freed

12:44 i need to send each of the entries to another mq

12:46 i quess doseq

13:12 rurumate: Is transient recursive, on nested data structure?

13:16 ,(type (:a (transient {:a {}})))

13:16 clojurebot: clojure.lang.PersistentArrayMap

13:29 jowag: Is it valid to say that Clojure Function is a data type?

13:32 mtp: i would say yes

13:32 functions-as-data is an extremely powerful technique

13:39 indigo: Hm... travis-ci still uses lein1 as default :(

13:42 seangrov`: jowag: I don't think so no

13:44 Some things that should work for data types don't work for functions

13:50 jowag: I'm preparing some kind of a presentation and I want to find a common name for Numbers, Functions, Strings, Vectors. The best I could think of is "Abstractions", but this is too abstract :)

13:50 So I wonder if calling them a data types will be OK. More so that in Clojure, code is data

13:50 AimHere: Data types?

13:51 seangrov`: AimHere: Do funtions qualify as data types though?

13:51 AimHere: Isn't that the point of a functional language?

13:52 Functions are 'first class citizens' in that you can do pretty much all of the things you do to other data

13:52 seangrov`: Yeah, I suppose they're data types then, but not values

13:52 You can't serialize them, identity fails on then, etc.

13:52 AimHere: ,(identity identity)

13:52 clojurebot: #<core$identity clojure.core$identity@c3a340>

13:53 seangrov`: ,(= "this" "this)

13:53 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading string>

13:53 seangrov`: ,(= "this" "this")

13:53 clojurebot: true

13:53 seangrov`: ,(= (fn [x] x) (fn [x] x))

13:53 clojurebot: false

13:53 seangrov`: The concept of value/identity is different for functions that more "fundamental" data types

13:54 than*

13:54 That said, I'm sure it's fine for an introduction to call them data types

13:54 jowag: well that is an interesting issue, whether a concrete function can be called a "value" of a Function type

13:55 seangrov`: It's just a question that floats across #clojure every now and then

13:55 AimHere: Well the clojure equality function covers a multitude of sins.

13:55 (= [1 2] '(1 2))

13:55 ,(= [1 2] '(1 2))

13:55 clojurebot: true

13:55 AimHere: ,(= (type [1 2]) (type '(1 2)))

13:55 clojurebot: false

13:56 hyPiRion: "sins"

13:58 AimHere: Ask a mathematician how he feels about x=y being true when f(x)=f(y) is false, and you're fairly likely to get some synonym of 'sinful' ;)

14:00 hyPiRion: Or flip it around: x = y being false, even when x(a) = y(a) for any a

14:01 that's how functional equivalence works in every language with HOF

14:01 *function equivalence

14:01 jowag: ok, I suppose I can call Macro a data type too, but what about nil? :)

14:01 AimHere: It has a declared type of it's own

14:01 hyPiRion: nil is nil

14:02 mtp: a data type is a shape for data, and operations upon that data which may or may not change its shape

14:02 that's all

14:02 Chousuke: I would say a function is equivalent to another function if their definitions are equivalent, in the mathematical sense :P

14:03 AimHere: Very good. Is there 'data' in a function shape then?

14:03 Chousuke: well, in the context of a programming language, it's usually not possible to prove that one definition is equivalent to another

14:04 mtp: AimHere: data and code are the same thing

14:05 Chousuke: it's possible if you solve the halting problem! 8)

14:05 AimHere: There is a difference though; data isn't always considered 'executable' somehow

14:06 Nobody thinks of a .csv file containing the grain exports of Namibia for 2006/2007 as 'code'

14:06 jowag: In Clojure, we do not execute, we evaluate :)

14:07 Chousuke: the whole "code is data" thing is supposed to refer to the fact that code can be represented as ordinary data structures which can be transformed just like all other data.

14:07 hyPiRion: code is data, not vice versa.

14:07 gfredericks: oh man guys elisp is nutso

14:08 (eq 42 42) but not (eq 4.2 4.2)

14:08 hyPiRion: gfredericks: heh, welcome to fixnums

14:08 Chousuke: comparing floats for equality is broken anyway

14:08 so it's actually sane behaviour to just return false

14:09 AimHere: .(= 1.0 (+ 2/3 1/3))

14:09 gfredericks: o_O

14:09 AimHere: ,(= 1.0 (+ 2/3 1/3))

14:09 clojurebot: false

14:10 gfredericks: the weird thing to me is that integers and floats have different object-uniqueness semantics

14:10 hyPiRion: gfredericks: eq is identical?, not equivalence (=)

14:10 gfredericks: hyPiRion: yeah, I get that part

14:10 hyPiRion: AimHere: ##(== 1.0 (+ 2/3 1/3))

14:10 lazybot: ⇒ true

14:10 gfredericks: it's the fact that ints and floats behave differently

14:10 Chousuke: gfredericks: that's probably because integers have a unique bit pattern for each value

14:10 floats don't

14:11 gfredericks: for general numbers, or just infinity/nan/zero edge cases?

14:11 Chousuke: I'm not sure on the details

14:11 gfredericks: is there not a machine instruction for this?

14:12 Chousuke: how would such an instruction be implemented?

14:12 hyPiRion: gfredericks: ints below a certain size are "pointers"

14:12 clojurebot: Excuse me?

14:12 hyPiRion: afaik

14:12 gfredericks: hyPiRion: I'm getting eq true for arbitrary large integers

14:13 hyPiRion: gfredericks: (eq 1000000000000000000000 1000000000000000000000) ?

14:13 gfredericks: Chousuke: I think normally as subtraction and zero-check

14:13 hyPiRion: that's out of range

14:13 hyPiRion: I get (eq 500000000 500000000), which is close to the top of the int range

14:15 there seems to be a test for zero command, so presumably a subtract-and-test mechanism would work?

14:19 Chousuke: gfredericks: how do you implement subtraction?

14:19 gfredericks: it's easy for integers, but floats are complicated

14:20 gfredericks: Chousuke: chips implement subtraction

14:20 Chousuke: gfredericks: yes. how?

14:20 gfredericks: compare the exponents, do some shifting, subtract integers, compute new exponent...

14:21 lots of edge cases for nan/inf

14:21 munderwo: Hi all. Im using compojure and want to print out the body of a request in a handler. if the handler is declared as (defn get-data [request] …. how would I print out just the body of request? it looks like request is a org.eclipse.jetty.server.HttpInput ?

14:22 gfredericks: munderwo: you can slurp it

14:22 it's an InputStream

14:22 Chousuke: gfredericks: the precision problems with floats are what make equality problematic

14:22 munderwo: gfredericks: I'm an absolute newbie at clojure. So request is an Stream? so I need to read it rather than it being a java object?

14:23 Chousuke: gfredericks: so just subtracting and checking for 0 won't work since the result of subtracting two equal numbers might not be zero

14:23 gfredericks: Chousuke: under what circumstances is subtracting two "equal" numbers not zero? assuming we're aware that rounding happens during other operations

14:24 munderwo: the arg to your handler should be a map, with :body key. the value under that key should be an input stream that you can pass to slurp to get a string

14:25 munderwo: gfredericks: so I should be able to do (println {request :body}) to get the input stream?

14:25 gfredericks: munderwo: you want to print the body of the request?

14:25 Chousuke: gfredericks: eg. if you get to a number from addition of two numbers, and then compare it with another

14:25 munderwo: gfredericks: yup.

14:25 gfredericks: Chousuke: so (+ 2.0 2.0) might not equal 4.0?

14:25 Chousuke: yes.

14:25 gfredericks: munderwo: (println (slurp (:body request)))

14:26 Chousuke: I am skeptical

14:26 Chousuke: gfredericks: or rather, 4.0 - (2.0 + 2.0) might not equal exactly 0

14:26 munderwo: gfredericks: thanks! Im still figuring out syntax. Im doing the dive in head first and hopefully learn my osmosis.. cheers!~

14:26 gfredericks: ,(- 4.0 (+ 2.0 2.0))

14:27 clojurebot: 0.0

14:27 gfredericks: ,(= (- 4.0 (+ 2.0 2.0)) 0.0)

14:27 clojurebot: true

14:27 Chousuke: I'm not talking about those exact numbers mind you

14:28 gfredericks: I'm aware of the way that floating point numbers round under arithmetic operations

14:28 what is your concept of "equality" that is distinct from "zero after subtraction"?

14:28 are you simply pointing out the difference between mathematical reals and IEEE doubles?

14:29 Chousuke: mathematical equality is what I'm concerned with

14:30 Glenjamin: i usually do "near zero" after subtraction

14:30 then you'll want some symbolic math stuff i guess

14:30 gfredericks: it sounded like you were saying that comparing two floats is not a useful thing to do. So if I do (= x y) and it returns false, what might I be accidentally missing if I assume they are not equal?

14:31 in what sense might those numbers, ignoring how I obtained them, still be equal?

14:33 Glenjamin: ,(= 1.2 (+ 1.0 1.2))

14:33 clojurebot: false

14:33 Glenjamin: erm

14:33 whoops!

14:33 ignore me please.

14:33 Chousuke: :P

14:33 Glenjamin: ,(= 1.2 (+ 1.1 0.1))

14:33 clojurebot: false

14:33 gfredericks: I wouldn't expect those two to be equal necessarily

14:34 I assume that they have been rounded slightly different and so are in fact distinct numbers

14:34 Chousuke: gfredericks: the equality check can return false even if two things are actually equal. that's the problem.

14:34 Glenjamin: thats what i meant.

14:34 from a maths point of view, thats a weird statement, floating point is an implementation detail

14:34 gfredericks: Chousuke: I'm trying to get at what you mean by "actually equal"

14:34 Chousuke: gfredericks: like the above

14:35 gfredericks: Chousuke: but I don't expect those to be equal

14:35 Chousuke: 1.1 + 0.1 is equal to 1.2

14:35 gfredericks: not for floating point numbers

14:35 Chousuke: but in the implementation, that equality is broken, so the implementation of equality is broken.

14:35 gfredericks: ,(- 1.2 (+ 1.1 0.1))

14:35 clojurebot: -2.220446049250313E-16

14:35 Chousuke: therefore it should not be trusted.

14:35 gfredericks: Chousuke: why is this not an issue with rounding rather than equality?

14:36 hyPiRion: what is "it"?

14:36 Chousuke: gfredericks: because the rounding appears in the implementation rather than explicitly.

14:36 gfredericks: Chousuke: IEEE does not specify how to round the result of an addition?

14:37 hyPiRion: I think he's arguing that (= x y) is never useful for floats

14:37 hyPiRion: oh

14:37 gfredericks: or rather

14:37 that it can return incorrect results

14:37 or is "broken" in some sense

14:38 I thought at first that he meant that e.g. you can represent 4 as both 1*(2^2) and 2*(2^1) and that = would consider them different

14:38 Glenjamin: i think it boils down to: is 1.2 a decimal, or a float?

14:38 gfredericks: in clojure it's a float

14:39 hyPiRion: gfredericks: nah, = handles that

14:39 ,(= 0.0 (- 0.0))

14:39 clojurebot: true

14:39 gfredericks: hyPiRion: and now that I think about it I don't think there can be distinct representations like that anyways

14:39 hyPiRion: gfredericks: except for zero, no.

14:40 Chousuke: gfredericks: the rounding behaviour of floats makes equality checks not robust, which makes it not very useful; unless I suppose you do explicit rounding of values.

14:40 hyPiRion: a number is always represented as [+-] 0.mantissa * 2^exponent

14:40 gfredericks: Chousuke: the equality check tells me if two numbers are equal. You can argue that this isn't very useful due to rounding, but I don't think you can argue that it doesn't do that at all.

14:41 hyPiRion: exponent minus base

14:41 gfredericks: hyPiRion: I remember there being an implicit first 1 digit but I can't remember where/why

14:41 Chousuke: gfredericks: well, it does it with some warped sense of equality

14:41 gfredericks: Chousuke: maybe we're just arguing semantics at this point but that seems like a misleading way to phrase it

14:41 Chousuke: but I guess this goes back to the implementation thing

14:42 hyPiRion: gfredericks: yeah, that may well be the case. I just remember that all but plus minus zero can only be represented in one way

14:42 gleag: gfredericks: Isn't any Lisp that converts 1.1 into FP sort of broken?

14:42 gfredericks: gleag: why broken?

14:43 gleag: gfredericks: Given that FP semantics isn't what you want for lispy numerals most of the time, intepreting 1.1 as anything else as 11/10 in the generic context seems like a language design bug to me.

14:44 gfredericks: gleag: "not being what you want" is different from "broken"

14:45 the word "broken" implies to me that it was meant to be something else

14:45 metellus: but at the same time "correct for a very specific thing nobody wants" is poor design

14:45 gfredericks: sure

14:46 gleag: gfredericks: Accoring to this logic, C has a non-broken memory management. Why would Clorure treat 1.1 as FP, when two decades of Common Lisp and Scheme yielded a more meaningful design?

14:46 hyPiRion: It sounds like you guys have been discussing definitions for some time now

14:46 gfredericks: I bet you could easily make the case that floating point should be no more accessible in clojure than java arrays

14:46 hyPiRion: gleag: (floatp 1.1) in CL is T, (rationalp 1.1) is NIL

14:47 gfredericks: gleag: hyPiRion is right, this is just definitions

14:53 gleag: hyPiRion: I'm not saying that CL in general is the pinnacle of the development of lispy arithmetics, but the Scheme way of exact-by-default makes much more sense to me.

14:53 (and the Scheme model certainly builds upon the CL model)

14:53 gfredericks: afaict 4.2 is not exact in scheme either

14:54 so I can't tell what difference you're trying to point out

14:54 gleag: That is weird.

14:55 gfredericks: I don't know that I've ever heard of a language that uses not-floats for that syntax

15:01 Scorchin: I've had a play around and core.async looks like a decent way to do the kind of small processing I need (I expect there to be at least ~500 go blocks at a time), but is there a an easy way to get a function to add itself onto a channel once it's completed with a schedule? e.g. run a go block and post to a channel every X milliseconds? The (timeout) channel

15:01 creator almost does it, but closes the channel after the time provided.

15:02 gfredericks: Scorchin: some combination of loop and sleep?

15:03 I guess that uses a thread

15:03 you could create a new timeout channel each time

15:03 Scorchin: Is that all?

15:03 gfredericks: I intend to split this channel for different output formats

15:06 * gleag is now thoroughty confused.

15:06 Scorchin: erm, not split

15:11 gleag: gfredericks: I must have been spoiled by the HtDP languages!

15:11 gfredericks: (exact? 12.3) ==> true ; (exact? #i12.3) ==> false

15:12 It just seems such a reasonable idea (you can always coerce implicitly if needed) that I apparently assumed that it was more widespread.

15:18 allenj12: hey im new to clojure and was wondering if i could make a priority map with two lists?

15:18 TimMc: allenj12: Remind me what a priority map does, again?

15:19 allenj12: TimMc: it has a key and a value for each slot so like [:a 1 :b 2 :c 3] and sorts it by the value

15:20 so if i want one list to be the key

15:20 TimMc: and i wanted the other list to be the values

15:21 yazirian: ,(doc zipmap)

15:21 clojurebot: "([keys vals]); Returns a map with the keys mapped to the corresponding vals."

15:21 yazirian: like that?

15:21 metellus: you could also use sorted-map-by

15:22 instead of two lists

15:23 TimMc: sorted-map-by doesn't give you access to the values

15:23 s/you/the comparator/

15:27 yazirian: allenj12: https://github.com/clojure/data.priority-map

15:28 so maybe pass a zipmap to that -- this depends on your needs re: duplicate values somewhat

15:28 allenj12: yazirian: hmm kk ill try that

15:41 Bracki: What's the prefered way for default args? Multi arity fns or maps with defaults?

15:42 coventry`: I've seen multiarity more often than maps with defaults.

15:43 Bracki: coventry`: Also for stuff like: hostname, port, password, username etc?

15:44 coventry`: Haven't read much of that kind of code.

15:48 technomancy: depends on whether you care about getting errors when given too many args

16:05 Bracki: When wrapping Java libs, do I need to alias everything with my own names or can I expose the underlying API?

16:05 s/need/should

16:06 gfredericks: I think clojure style is not to introduce unnecessary abstraction

16:06 coventry`: "It's complicated." http://www.infoq.com/presentations/Distilling-Java-Libraries

16:06 gfredericks: so if you're just wrapping it for the sake of using kebab-case, then don't

16:06 hhenkel: Hi all, I got a a map that represents config data. This config contains a subtree with multiple "domains" and one domain could habe multiple "servers". What is the clojure way of iterating over such thing?

16:07 I got a working code, but it "feels not right" as a I use nesed "doseq"...

16:07 callen: I broke the Clojure Cup layout :) http://clojurecup.com/apps.html

16:08 technomancy: gfredericks: but completion

16:08 gfredericks: technomancy: you talkin bout stuff not appearing in your source?

16:08 technomancy: just messing with you

16:08 gfredericks: PHEW

16:08 technomancy: gfredericks: were you at strange loop?

16:09 gfredericks: technomancy: no I just had a babby

16:09 technomancy: oh that's right; congrats

16:09 gfredericks: thx

16:10 did hofstadter reveal the essence of conciousness?

16:11 technomancy: that man has some ideas.

16:11 gfredericks: when I make a list that contains itself does the list become conscious?

16:12 technomancy: you're thinking of thermostats

16:13 callen: (inc gfredericks)

16:13 lazybot: ⇒ 30

16:15 Bracki: Can anybody point me to a leiningen setup that requires a vagrant box to be spun up for integration testing?

16:16 callen: That sounds like a lot of work. Not it.

16:16 Bracki: Not it what?

16:17 callen: Not it. Can't draw my straw.

16:17 sandbags: if i am running a clojure app via java -jar on the command line is there a way to drop into a repl at a certain point in my program and query the local variables? (similar to using the Pry utility if you're familiar with that from Ruby)?

16:17 callen: sandbags: embedding an nrepl instance came up not too long ago.

16:17 common request.

16:18 sandbags: callen: ah so requested, but not doable?

16:18 i'm googling embedded nrepl now

16:18 callen: perfectly doable.

16:18 as your google will show you.

16:18 Bracki: callen: Can your paraphrase "Not it. Can't draw my straw." for a non native speaker please.

16:18 coventry`: sandbags: http://clojure-log.n01se.net/date/2013-09-21.html#22:35

16:19 sandbags: callen: got you, misread you as meaning common request for clojure, not here. thanks.

16:19 coventry`: oh, thank you

16:19 callen: Bracki: amongst children, if a chore or unpleasant task is mentioned, people will declare, "not it" immediately after its mention so as to disinclude themselves from having to do it.

16:19 coventry`: Oh, if you want access to the local variables, that's not going to give it to you, I think.

16:19 callen: then you're in Ritz territory.

16:19 coventry`: callen: not necessarily. https://coderwall.com/p/xayyvq

16:20 Bracki: callen: Ah as in "not me".

16:20 callen: Bracki: yep

16:20 coventry`: eh. that's like jahad's thingy and limit-break.

16:20 coventry`: the locals clearing fucks you anyway.

16:20 coventry`: Yeah.

16:21 sandbags: coventry`: i want to be able to explore the state of a function at a certain point, yes .. is this related to eval? I've bumped into a related issue in the past i think

16:23 Bracki: Since I didn't do Clojure in a long while, does this look alright? https://github.com/bracki/clj-nsca/blob/master/src/clj_nsca/core.clj

16:25 callen: Bracki: ideally there'd be an actual API separating the Java objects from the Clojure.

16:27 coventry`: It's typical to thread strings of java method calls with (doto) rather than (->), but it doesn't make any difference in this case. http://clojuredocs.org/clojure_core/1.2.0/clojure.core/doto

16:29 Bracki: callen: What kind of separation?

16:32 sandbags: coventry`: that's odd, i can't find that macro in my copy of joy of clojure

16:33 coventry`: sandbags: Its in one of the later chapters. There's a subheading in the TOC which mentions debugging, I think.

16:33 sandbags: i think it's the Preview search that's at fault

16:34 possibly this MEAP copy isn't well indexed

16:34 ah found it in my copy of 1st which does have an index :)

16:35 coventry`: print-dup is outputting "#=(clojure.lang.APersistentVector/create [x])" in a certain context. It should be just outputting "[x]". Anyone know what prefer-method command I want to persuade it to do that?

16:35 sandbags: okay so is it likely to be a problem combining that break macro with running via lein uberjar/java?

16:36 the break part works but anything I try to do from that REPL seems to give me some variation on "Invalid method Code length 105966 in class file clojure/core$eval12, compiling:(NO_SOURCE_PATH:0:0)"

16:38 coventry`: Is there an easy way to figure out which multimethod a given argument is dispatched to?

16:41 AimHere: You could just call the dispatch function and inspect the answer!

16:42 coventry`: Dispatch function is (class). (ancestors clojure.lang.APersistentVector) returns 22 possibilities.

16:45 AimHere: But the dispatch function only has one value and I think defmethod only takes one dispatch value

16:46 The only source for confusion is if you don't know what class the object you're passing in is

16:46 coventry`: AimHere: The dispatch can be ambiguous. That is the reason for multimethods. See 3rd paragraph of http://clojure.org/multimethods

16:46 "reason for prefer-method"

16:49 How the hell is it getting APersistentVector anyway? That's an abstract class.

16:51 callen: sandbags: that's because it's not a real debugger :)

16:52 sandbags: Ritz is possibly closer to what you want

16:52 sandbags: callen: ah, thanks ... i'll have a look at Ritz

16:53 or maybe i'll just go back to repetitive pprint

16:54 if only clojure.inspector/inspect worked properly

16:54 it's pretty much all i need

16:55 callen: sandbags: I've been having a nice time with clojure.tools.trace lately.

16:55 I found clojure.tools.trace more efficient in terms of debugging time than a stepping debugger

16:56 less manual, you just read what happened.

16:57 sandbags: i've gotten used, in Ruby, to being able to just drop into any context using pry and poke around ... not so much single-stepping as being able to x-ray a point from different perspectives

16:57 coventry`: sandbags: ritz has an inspector. I don't remember how good it is for exploring large hierarchical datastructures, though.

16:57 sandbags: i'll have a look at trace also

16:57 coventry`: trace is great if the data structures are simple.

16:58 sandbags: the problem with embedding traces in my experience is that it may take several goes to figure out what you really need to see, so being able to poke about with the tools of your language

16:58 napper: hey all, python convert here. I want to do this: self._item = container OR "this instead" - how do I accomplish this in clojure?

16:58 sandbags: is a good thing

16:59 coventry`: napper: if-let for the RHS. You may not need a LHS.

16:59 sandbags: i guess lein-ritz is what i'm after

17:01 coventry`: napper: Sorry, that's wrong. (or container "this instead.")

17:01 sandbags: but - googling - it looks like it may be something of a labour to get it all setup for a relative newcomer like myself

17:01 coventry`: sandbags: Yes, ritz was pretty hard to get going when I looked at it about 6 weeks ago.

17:01 napper: coventry: perfect

17:02 coventry, thanks

17:02 sandbags: hrmm.. it looks above my paygrade right now and i fear i am losing sight of solving my actual problem :)

17:05 hrmmm inspect-table actually seems to work reasonably well

17:35 callen: napper: (let [item (or container "this instead")] )

17:36 coventry: that's not a very idiomatic recommendation if you look at how Python uses what he's asking about.

17:36 if-let is for fallback behavior after the binding, not falling back the binding itself.

17:36 falling back the binding itself is what the Python code is doing.

17:38 indigo: Race conditions ftw

17:46 coventry: callen: Yes, it was a mistake to recommend if-let. Thanks for re-iterating that.

17:47 callen: ,(let [items (or [] "[] isn't falsy") item (or nil "but nil is")] [items item])

17:47 clojurebot: [[] "but nil is"]

17:48 callen: napper: ^^

17:48 napper: do the Clojure Koans, they hammer this stuff in.

17:59 mklappstuhl: (csv/read-csv file :seperator \t))

18:00 how do I get clojure.csv to use a tab character as seperator?

18:01 ok, first mistake was mistyping sepArator

18:01 allenj12: is there any place where i can paste code and share a link of that code so i can ask a question?

18:01 s4muel: allenj12: refheap.com

18:01 mklappstuhl: allenj12: gist.github,com

18:07 allenj12: https://www.refheap.com/18898 can anyone help me with this i asked the question in the a-star defn

18:11 metellus: allenj12: (filter #(possible-move % board) *moves*) I think

18:13 allenj12: metellus: yes! ty really should get use to thos anonymous functions

18:13 gaYak: Yuck "not=".

18:13 allenj12: lol? is that bad?

18:14 im new to clojure so critques on everything would be great :)

18:14 gaYak: I'm not an expert on Clojure, but looking with Scheme eyes.. it looks horrible ;)

18:15 To me (not (= .. )) just looks more readable.

18:16 allenj12: ahh k thanks for the tip i kinda like that to

18:20 mklappstuhl: how do I get a tab character as java.lang.Character?

18:20 Bronsa: \tab

18:25 TEttinger: gaYak, not= is the same as != in java. I think ! is used primarily for other stuff, like swap! and reset! so they spelled it out

18:25 I think there may be some tiny speed difference, but I don't think it's obvious

18:26 (not (= ... is two function lookups is all

18:26 gaYak: That's the compiler's job to fix

18:26 Well, JITs in this case.

18:26 TEttinger: well yes, JIT will kick in after 20,000 calls

18:27 gaYak: That brings me thinking, are there any blog posts about JIT & Clojure? For Java I've seen many, where it's been discussed how often JIT will inline some methods, based on their length etc

18:27 TEttinger: that's a good question

18:28 s4muel: forgive me if this sounds crazy but is there a notion of 'warming' the JIT for optimizing certain code paths?

18:28 TEttinger: AOT I think does a good job, s4muel, but I don't know if JIT works after AOT has been done

18:29 s4muel, I think it is done, but in the apps where it really matters those code paths get called 20,000 times anyway

18:29 s4muel: True

18:52 TEttinger: looks like AOT does not prevent JIT from occuring later, it just prevents the startup compilation to .class files

18:52 so s4muel, warming would still be useful if you can predict the path the code will take

19:30 rhg: i have a small question how can you write a fn to use in the ns macro, i was hoping for a :require-nodejs

19:32 brehaut: rhg: i dont know if ive ever seen that documented anyway; might be time to hit the source for core

19:32 https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L5214-L5268

19:34 rhg: thx

19:35 brehaut: rhg i would guess you are looking at references and process-reference but im not 100% on that

19:35 ,`(~(symbol "clojure.core" (clojure.core/name kname))

19:35 ~@(map #(list 'quote %) args))

19:35 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

19:36 ToBeReplaced: generally, should i try to keep my go blocks close to my puts, or does it not matter?

19:36 rhg: ah

19:37 ToBeReplaced: ex (go (with-open (doseq (>! ... )))) or (with-open (go (doseq (>! ...))))

19:37 rhg: well id now if it was a ns but nodes modules are js "objects"

19:37 know*

19:38 brehaut: rhg: oh, i might have sent you to clojure.core rather than cljs.core btw

19:38 rhg: basically how can i declare a var in a fn

19:40 brehaut: rhg: it looks like what clojure.core/ns does is get the name of the keyword and then look it up in the clojure.core namespace and pass the rest in as arguments. as you wont be able to jam anythign into clojure.core, i think augmenting ns is out of bounds

19:41 also

19:41 ,,(ns foo.bar (:print [1]))

19:41 clojurebot: [1]

19:41 brehaut: lol

20:01 rhg: so it's a dead-end

20:01 oh well back to the refer-node macro

20:09 SegFaultAX: bbloom: Watched your talk on Factjor last night. Seems like a pretty interesting project. I especially like the direction you took it with domscript. Is that a project you're still actively hacking on?

20:16 rhg: ugh i can't even compile js now i get java.io.FileNotFoundException: out/constants_table.js running ./bin/cljsc

20:17 im begginning to think cljsc hates me

20:19 hmm, advanced optimizations are broken

20:22 srruby: How do I get ["john" "jane"] from [ {:name "john"} {:name "jane" } {:name "fred"} ] I can use filter and map but I'm thinking there must be a more idiomatic way. Thanks.

20:23 llasram: srruby: Is this for a programming exercise, or just something you're trying to do?

20:23 srruby: Sorry, I meant this: How do I get ["john" "jane"] from [ {:name "john"} {:name "jane" } {:type "foo"} ] I can use filter and map but I'm thinking there must be a more idiomatic way. Thanks.

20:24 brehaut: srruby: keep

20:24 ,(keep :name [ {:name "john"} {:name "jane" } {:type "foo"} ] )

20:24 clojurebot: ("john" "jane")

20:24 srruby: I'm trying to do it as I hack away at clojure. Thanks!!

20:25 brehaut: ,(keep identity [true false nil ""])

20:25 clojurebot: (true false "")

20:26 srruby: llasram: Not sure what you mean by programming excercise... I'm not in a clojure class.

20:26 brehaut: srruby: sure, but some people are and they just want their exercises done for them

20:26 which is a waste of everyones time

20:27 llasram: srruby, brehaut: Well, I was more assuming that if it was for like a 4clojure problem, srruby wouldn't want me just giving away the full answer :-)

20:28 rhg: how do you require macros in cljs?

20:28 require-macros?

20:31 ToBeReplaced: rhg: yes

20:31 rhg: how excatly

20:31 do you pass the ns

20:44 ,(doc split-at)

20:44 clojurebot: "([n coll]); Returns a vector of [(take n coll) (drop n coll)]"

20:44 rhg: oops

20:45 wrong chan

21:20 callen: I'm pondering a wrapper DSL for datalog.

21:20 brehaut: codatalog

21:21 callen: Well there are a few design parameters I have in mind. One is that I'd rather not directly link the query patterns to datomic if possible.

21:21 datalog is abstractable, so that's not too big of a problem, but I'd also like to enable some custom post-processing.

21:21 brehaut: cute.

21:21 coventry: Is there a way to add metadata to a var?

21:21 ,(with-meta #'clojure.core/map {:foo true})

21:21 xeqi: coventry: looks like your analyzer is further then I got, thanks for the reference

21:21 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Var cannot be cast to clojure.lang.IObj>

21:21 callen: I'm also concerned datalog might intimidate people.

21:22 coventry: xeqi: No worries.

21:22 The research was actually useful in extending riddley to deal with the dot special form. :-)

21:22 xeqi: i had played some with jvm.analyze, and was leary to pull it in here cause I don't want to eval the forms

21:23 callen: xeqi: leery*

21:23 you're not taking LSD, you're just mistrustful.

21:26 ToBeReplaced: with core-async, if you want to drain a channel into a seq, is the "right" way (take-while (complement nil?) (repeatedly #(<!! channel)))

21:29 callen: ToBeReplaced: seems like a standard naive channel drain. Maybe toss in an alt and a timeout?

21:29 I don't mean naive pejoratively, to be clear.

21:29 ToBeReplaced: callen: thanks, just sanity checking -- not using it for prod code, just testing

21:30 i've got readers that need to be parsed... previously was dumping the elements onto LBQ, trying it out with channels

21:30 callen: ToBeReplaced: seems reasonable for poking around. In production you have to be a bit more paranoid/Erlang-esque about it.

21:31 ToBeReplaced: callen: does it seem reasonable for a function to accept an input stream and return a channel? i can't really follow the implications

21:33 callen: ToBeReplaced: do whatever works if you're learning/experimenting. Don't tread lightly when experimenting, just ruins opportunities for learning (breakage)

21:33 if something broke that you didn't expect to - you're about to learn something. Do not fear that.

21:34 ToBeReplaced: callen: word

21:35 munderwo: hey has anyone use debug-repl? is there something better to use? if you want to break into an inline debugger?

21:35 callen: munderwo: there's limit-break as well. You're going to need to turn off locals clearing as well.

21:35 (alter-var-root #'*compiler-options* assoc :disable-locals-clearing true)

21:35 otherwise shit won't be there that should be :)

21:36 munderwo: callen: is that line put in the module that I'm breaking into? or like the project.clj ?

21:36 callen: just somewhere top-level that gets loaded in your actual code, not project.clj

21:36 munderwo: callen: also is it a 50/50 between them?

21:36 callen: the project.clj is closer to a (but not precisely) data structure than code.

21:36 munderwo: debug-repl and limit-break are both done'ish to the extent they are designed to handle. They're based on the same code.

21:37 munderwo: callen: cool. I thought that might be the case. just starting out, so getting a handle on the tooling etc.

21:37 callen: munderwo: limit-break was kind of a post-debug-repl wrap-up by technomancy. jahad pokes at debug-repl occasionally if I irritate the shit out of him about it.

21:37 munderwo: Clojure's interactive debugging story isn't great right now. I've had more successful using clojure.tools.trace, michael drogalis' night-vision and plain old thinking.

21:38 particularly given that most of my code is pure anyway, debugging is of limited use. if I understand the code, there's not much else to think about, hypothetically.

21:38 munderwo: callen: ahh ok. I might be a little spoiled from python. :)

21:38 callen: munderwo: I came here from Python too. you think it was being spoiled, but eventually you learn referential transparency and the like was more valuable anyway.

21:38 I don't find I miss debuggers when dealing with my own code anymore.

21:39 munderwo: I used to think as you do. I wouldn't sweat it.

21:39 I might start using debug-repl/limit-break again just to see if things can be improved.

21:39 I want a real injectable REPL someday.

21:40 munderwo: callen: good to know. I thought that perhaps a debugger might help me learn the syntax, like step through some stuff. I've basically just dived into porting a simple rest api over to clojure.

21:40 callen: yeah I think its helpful sometimes to be able to do that. especially if you have a chain of execution that your not sure of whats happening. That might be less of an issue in clojure.

21:42 callen: oh also, is there a way around the slow startup time of the JVM? I had a look at drip and installed it, but it hasn't made a dramatic improvement.

21:44 hmm… anybody any idea about whats wrong with this? https://www.refheap.com/abec9999a49cf668cca3bc4f1

21:46 callen: munderwo: if you're learning, just live in the REPL.

21:46 munderwo: this is why you need to be in the REPL, so you can inspect foodtruck

21:47 munderwo: callen: yeah at the moment i'm firing http queries at my app through the repl.

21:47 callen: munderwo: if you did, you'd see that your keyword against the foodtruck var is producing nil, causing your slurp to fail.

21:47 it doesn't know how to do IO against a nil.

21:47 that's what the protocol error means.

21:47 munderwo: but how do I get the repl to be in the midst of a request?

21:48 callen: munderwo: if you were using clojure.tools.trace, you would've seen log output for your request handler, thereby dumping foodtruck to the terminal.

21:48 then you'd see exactly what is going on

21:48 just change the defn to deftrace for your create-new-foodtruck handler.

21:49 after loading deftrace from c.t.t

21:49 munderwo: also there's nothing special about web apps, you can load them from your REPL and interact with them like any other code.

21:49 munderwo: right. do I need to do a (:use clojure.tools.trace) ? up the top of the module?

21:49 callen: there's no magic here.

21:49 munderwo: try to avoid use. Use require instead.

21:50 munderwo: why avoid use?

21:50 callen: it's very bad form.

21:50 the same thing in Python is very bad.

21:50 you shouldn't from module import * in Python either.

21:50 muhoo: ~use

21:50 clojurebot: I am putting myself to the fullest possible use, which is all I think that any conscious entity can ever hope to do.

21:50 callen: it makes it impossible to know what the fuck is going on.

21:50 munderwo: (:require [clojure.tools.trace :refer [deftrace]])

21:51 munderwo: ahhh I see. cool. understand now.

21:51 callen: When my coworkers use 'use, I let them pick which limb they're giving up.

21:51 There's a wall of limbs, but not many. They learn fast that way.

21:52 munderwo: nice :)

21:53 callen: muhoo: pretty terrible response from the bot. It needs retaught.

21:53 batty bastard bot.

21:53 munderwo: is there a difference between (:require [compojure.handler :as handler][ring.middleware.json :as middleware]) and (:require [compojure.handler :as handler])(:require [ring.middleware.json :as middleware])

21:53 callen: munderwo: the latter is bad style.

21:53 munderwo: one :require form per ns decl plz.

21:53 munderwo: do you have a book?

21:54 munderwo: http://clojurebook.com/

21:54 munderwo: good to know. not yet. just going through tutorials.

21:56 sinistersnare: hello, im trying to get libgdx setup with clojure. im running into an error which ill post in a second. from what ive read it has to do with some mistaken syntax somewhere, and i was wondering if anyones open to helping. https://gist.github.com/sinistersnare/6665526 heres the code so far

21:56 munderwo: callen: is clojure.tools.trace in the standard lib? or needs to be dep for lein to download?

21:57 sinistersnare: actually i think i fixed that

21:57 https://www.refheap.com/18904

21:57 ok, so my actual problem is of scoping

21:58 where can i put spawn-raindrop so that it has access to all of the variables of screen?

22:01 callen: munderwo: google it

22:02 munderwo: I think i found it on clojars

22:02 sinistersnare: im not the best at clojure, so im not good at idiomatic stuff, so if you want to criticize my imperative style too, please help me :p

22:02 munderwo: which to me would indicate that its a third party

22:03 callen: munderwo: get in the habit of googling for your libraries and lining up github with what's in clojars.

22:03 don't expect other people to do it for you. waste of time.

22:04 Ask other people for help when you've exhausted all sensible means in front of you (google, stack overflow, reading the damn code)

22:04 asking trivial questions just makes people not want to help you.

22:05 munderwo: yeah, just found the github page. the namespace for it 'clojure.tools.trace' seemed to indicate it was in the stdlib

22:05 (or equivalent)

22:05 noonian: sinistersnare: too many arguments to def usually means you used a def where you wanted a defn

22:05 sinistersnare: I JUST FIGURED THAT OUT!

22:05 :p now im getting a runtime error i guess

22:05 Exception in thread "LWJGL Application" java.lang.IllegalStateException: Function is not supported

22:05 LibGL error though

22:12 ok so i guess i cant use libgdx because im using openGL 1.4, even though it works in java!

22:12 weird

22:13 ToBeReplaced: i'm seeing reflection in clojure core.async go blocks -- others see this?

22:17 sinistersnare: how can i use a sontype repo for my leiningen setup?

22:22 bbloom: $mail segfaultax I'm not hacking on factor & domscript directly, but some of the core ideas & learnings live on in other projects I'm working on

22:22 lazybot: Message saved.

22:26 timvisher: any way to increase the heap size for the compiler run by cljsbuild?

22:28 gfredericks: is there any reason why attaching metadata to a lazyseq should force the first element?

22:28 bbloom: timvisher: use the jvm opts for lein

22:29 gfredericks: ,(let [s1 (map println '(1 2 3))] (with-meta s1 {}) nil)

22:29 clojurebot: 1\n

22:29 brehaut: gfredericks: because a lazy seq can be empty?

22:29 gfredericks: ,(with-meta () {:this :is :empty :too})

22:29 clojurebot: ()

22:29 brehaut: ,(seq nil)

22:29 clojurebot: nil

22:30 gfredericks: maybe rich thinks it's weird to be able to pull metadata off an unrealized object

22:30 timvisher: bbloom: thanks!

22:31 sinistersnare: https://gist.github.com/sinistersnare/6665526 ok sorry again, but can anyone check to see if this project.clj is correct? it says it cannot find the jars, https://oss.sonatype.org/index.html#nexus-search;quick~badlogic here is the repo im looking for

22:31 specifically the gdx one

22:31 and gdx-backends-lwjgl

22:33 oh god, i just cant spell badlogic -> badlogicgames

22:40 is there any way that i can use a lib/ folder and just add that to my build path?

22:40 with lein

22:41 technomancy: libgdx provides a lot of its jars through maven, but the natives are built from a build server, and need to be downloaded manually and placed manually. how can i deal with this?

22:41 bbloom: anybody know if there is anyway to get a view-count from infoq? my vanity requires i know how many people watched my talk :-)

22:42 sinistersnare: bbloom: which talk?

22:42 bbloom: aw, dammit. i didn't mean to self promote

22:42 sinistersnare: oh but im curious now!

22:42 bbloom: http://www.infoq.com/presentations/concatenative-clojure

22:43 sinistersnare: ahh i saw this on /r/clojure

22:43 bbloom: ah cool

22:43 sinistersnare: i think there was some comment about the video and slides not syncing?

22:43 bbloom: really? dammit.

22:43 sinistersnare: or was that some other video....idk

22:44 ill make sure to watch it later, my speakers are super quiet on linux and i dont feel like headphones

22:44 havenwood: just ordered an AR.Drone 2.0 quadracopter, pretty excited about playing with clj-drone library

22:47 tufflax: Sometimes my prints just don't print anything. What could be wrong?

22:48 sinistersnare: i guess local maven repo is only answer :p

22:48 gfredericks: tufflax: clojure.core/print doesn't flush

22:49 tufflax: gfredericks: yeah but even the ones that does flush. Sometimes I get no output from my logging. After I restart the repl, I do.

22:51 gfredericks: tufflax: maybe something wrt nrepl server/client?

22:52 tufflax: gfredericks: maybe. It's like it working depends on something like which thread is running the code or something like that

22:52 gfredericks: bbloom: there may have been a comment about your talk actually being on agglutinative clojure

22:53 bbloom: gfredericks: ?

22:53 gfredericks: tufflax: with nrepl the *out* is specially bound. are you doing anything with threading that would lose its thread-local value?

22:53 bbloom: making lame language jokes

22:53 bbloom: heh ok

22:55 tufflax: gfredericks: Hm don't think so. I use with-out-str in one place just for one call, but that shouldn't matter, right? Other than that I don't touch out

22:55 *out*

22:56 I do (println ... (with-out-str (pprint something)))

22:57 gfredericks: tufflax: yeah that should be fine

22:58 tufflax: but e.g. if you start up a new thread manually, use a thread pool, that sort of thing

22:58 not necessarily having anything to do with *out* directly

22:59 tufflax: Yeah I start a few new threads.

22:59 But I don't get how that could matter

23:16 s4muel: new threads don't have their out bound to the same stringwriter that the repl does

23:20 ToBeReplaced: how do you avoid reflection when you have a doseq in a go block? i'm getting call to nth can't be resolved

23:21 callen: you're doing something for side effects in a go block?

23:21 ToBeReplaced: callen: >!

23:21 callen: oh, pumping a seq into a channel?

23:21 ToBeReplaced: yeah

23:22 callen: ToBeReplaced: refheap plz

23:25 s4muel: tufflax: (alter-var-root #'*out* (constantly *out*))

23:25 ToBeReplaced: callen: https://www.refheap.com/18905

23:26 callen: ToBeReplaced: the doseq and doall are making me cry tears of blood.

23:26 tufflax: s4muel: ok. I'll try. But it works sometimes (and it's always new threads).

23:26 ToBeReplaced: callen: just trying to create simple case obv

23:27 doseq is what i was interested in... same issue as from before -- i've got an input stream that's being parsed on the fly... don't see any reasonable alternative

23:28 callen: ToBeReplaced: type-hint whack-a-mole. Have fun.

23:30 s4muel: ,(class *out*)

23:30 clojurebot: java.io.StringWriter

23:31 s4muel: ,(class (System/out))

23:31 clojurebot: java.io.PrintStream

23:31 s4muel: tufflax: new threads use the latter by default

23:33 tufflax: s4muel: Sorry if I'm slow but I still don't get how it comes that it works sometimes :p

23:33 ToBeReplaced: callen: doseq reflects, loop/recur doesn't

23:33 callen: clojure.core.async.lab/spool demonstrates

23:34 s4muel: tufflax: Well sans code I don't see how either, but that's the general idea. :)

23:34 tufflax: s4muel: Ok thanks. I'll try it next time it disappears

23:35 allenj12: https://www.refheap.com/18906 can someone help me with this i asked the question in the comments by where i need help

23:37 srruby: I saw here a command that tries all clojure functions, something like (which-function [1 2] 1) ==> first . Can anyone help?

23:38 tufflax: allenj12: I have not read everything, but it looks like you are calling man-dist with the wrong args order

23:39 sinistersnare: im having some problems using a local maven repository with clojure (leiningen).

23:39 https://www.refheap.com/18907 is my maven directory tree, and my project.clj is here https://gist.github.com/sinistersnare/6665526#file-project-clj

23:39 im not sure what im doing wrong...

23:43 amalloy: $findfn [1 2] 1

23:43 lazybot: [clojure.core/first clojure.core/rand-nth]

23:45 marcopolo: Hey I'm using core.async in clojurescript, but order seems to matter? here is some demo code http://sprunge.us/VaBV ,should that work?

23:45 amalloy: srruby: ^

23:46 srruby: (^ [1] 1)

23:47 ^([1] 1)

23:47 allenj12: tufflax: woops cant believe i missed that... when i try to run it still using light table live im getting an error https://www.refheap.com/18906

23:47 srruby: help

23:47 \help

23:47 allenj12: eduarj:'

23:48 the error is at the bottom and i posted it

23:49 tufflax: allenj12: #(...) creates a function, and you have not called it to get a number back

23:49 allenj12: you are trying to add up the function

23:51 allenj12: maybe you wanted to use (map #(...) board) or something?

23:54 allenj12: tufflax: yea i think the apply is the problem ill play with map and see what i get

23:55 tufflax: allenj12: The apply is fine I think

23:55 allenj12: but maybe you wanted (apply + (map #(...) board))

23:55 allenj12: tufflax: oo ill try it

23:57 tufflax: allenj12: I don't really understand the comment though, about "as well as the board itself"

23:58 allenj12: tufflax: o so the board itself would be (1 2 3 4 5 6 7 8 0) as each number is the tile and the % argument that i had mixed up

Logging service provided by n01se.net