#clojure logs

2013-09-22

00:00carlosgaldinolordQuas: oh, that's cool
00:00lordQuasIf you download emacs, I'd be happy to walk you through it.
00:00lordQuasThough I dont know if I could set up evil-mode, I've never done it before, I hear its easy
00:00carlosgaldinolordQuas: yeah, I was thinking about learning emacs when doing clojure
00:01carlosgaldinoI have no idea how it works, if it's modal, or whatever. just know that it is better suited for clojure dev
00:01carlosgaldinoand lisps in general
00:02lordQuasIts 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.
00:02CuaThoXaycan I use emacs slime with clojure?
00:02lordQuasCuaThoXay: You can, but even better than slime is nrepl
00:02lordQuasIMO
00:02CuaThoXaythank, googling
00:02carlosgaldinolordQuas: haha, two problems then. I don't know clojure, I'm just starting
00:03lordQuasI think most people consider nrepl to be the successor to slime
00:03lordQuasSetting it up is cake too
00:04lordQuasM-x package-install <ret> clojure-mode <ret>
00:04lordQuasM-x package-install <ret> nrepl <ret>
00:04lordQuasAnd youre done
00:04lordQuasEval code with C-x C-e (eval-last-s-expression)
00:05lordQuasHuh why havent you updated?
00:05CuaThoXaystock emacs version of ubuntu 12.04
00:07lordQuasah i see
00:07CuaThoXayI prefer to use software straight from the distro's repo, if possible
00:07CuaThoXayless maintenance work
00:08lordQuasUnderstandable. I would say 24 is stable and it's new package manager is worth the upgrade
00:10CuaI agree, installation from one's distro repo doesn't work so well with software with fast development pace such as clojure and its friends
00:11Cuathe version of leiningen in ubuntu 12.04 repo is still 1.7.1
00:11Cuayuck
00:11lordQuasyikes
00:12lordQuasWhen did OS X Homebrew surpass apt-get. Its a sad day.
00:12Cuawell, 12.04 was released one and a half year ago
00:27technomancywhen you don't have any quality guidelines, you can move faster
00:28Brand0you don't need homebrew to install clojure/lein
00:28Brand0or apt-get in linux
00:30robinkFastest way to turn a seq of characters into a String in Clojure?
00:32coventry`,(str \a \b \c)
00:32clojurebot"abc"
00:33coventry`,(apply str (\a \b \c)) for a seq, I guess.
00:33clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Character cannot be cast to clojure.lang.IFn>
00:33coventry`,(apply str '(\a \b \c))
00:33clojurebot"abc"
00:36allenj12hey is there a replacement library for clojure.contrib.seq im paticularly interested in positions function
00:42allenj12very quiet here
00:42robinkcoventry`: I guess that works. I was hoping for something a little less stack-hungry.
00:46coventry`robink: Oh. (String. (char-array '(\a \b \c))) maybe?
00:46robinkcoventry`: "IllegalArgumentException No matching ctor found for class java.lang.String clojure.lang.Reflector.invokeConstructor (Reflector.java:183)"
00:47coventry`Huh, it works in my repl.
00:47chordallenj12: lets stop the quietness and wark on starcraft clone in clojure
00:47robinkAh, forgot to cast to char-array
00:48allenj12chord: xD
00:48chordwhat?
00:48clojurebotwhat is cells
00:48allenj12chord: or even better a A* search on a eight puzzle :P (my intro to ai HW)
00:52chordallenj12: whatever you want just make the gaem
00:55dirkdiggleri'm new to emacs and just installed emacs-live and wondering how I can tell if emacs-live has been loaded
00:57dirkdiggleror i guess the more general question is how do i query emacs on what packages have been loaded
01:14callendirkdiggler: https://www.google.com/search?q=emacs+query+packages&amp;oq=emacs+query+packages&amp;aqs=chrome..69i57j0l2j69i64l2.2635j0&amp;sourceid=chrome&amp;ie=UTF-8
01:20coventry`callen: Doesn't emacs-live operate outside the standard package manager?
01:21coventry`https://github.com/overtone/emacs-live#live-packs
01:25FrozenlockIs 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.
01:26callencoventry`: it was a subtle way of making him feel pain for not just using emacs
02:26chenjfgi1
03:06chordlets talk about something
03:14dirkdigglerwhat's up chord?
03:15dirkdiggleri like talking about development tools
03:15dirkdigglernew things beyond emacs
04:02m00nlightCan someone tell me how to get a field in a nested map?
04:03scottj,(get-in {:a {:b 1}} [:a :b]) ; m00nlight
04:03clojurebot1
04:04m00nlightscottj: Thanks
04:41klokbaske,(+ 1 1)
04:41clojurebot2
04:48chordyou are all dumb
05:00rlp10_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)?
05:11TEttingerrlp10_, sounds like a use for distinct in some way
05:13rlp10_TEttinger: Thanks, I'll check that out
05:13TEttingerhttp://clojuredocs.org/clojure_core/clojure.core/distinct
05:14TEttingerI'm thinking you could get the distinct IDs by mapping like (map :id [{:id 1234 :data "blah"}])
05:14TEttinger##(distinct (map :id [{:id 1234 :data "blah"} {:id 1234 :data "boo"} {:id 1235 :data "whee"}]))
05:14lazybot⇒ (1234 1235)
05:15TEttingerbut then you need to figure out which data to use
05:15TEttingerdistinct is not sorted
05:15TEttingeroh!
05:16TEttingeryou can get the distinct IDs that way, then use them as part of the filter or map-indexed
05:16TEttingerthere's also reduce, which might be a good fit
05:17rlp10_OK, TEttinger thanks for your help
05:17rlp10_I think I've got enough to work on now - I appreciate your help
05:17TEttingernp
06:03Jarda(first (:content (first (filter #(= (:tag %) :ResponseCode) (xml-seq app-resp)))))
06:03Jardais this really the best way to get a value of a xml element?
06:03Jardaapp-resp is the result of xml/parse-str where xml is clojure.data.xml
06:08TEttingerJarda, it looks to me like clojure.data.xml is not meant for reading xml so much as writing
06:08TEttingerI've never used it though
07:16chordYOU ARE ALL STUPID
07:16chordI AM TALKING
07:16chordI HAVE MENTAL PROBLEMS
07:19s4muel,(reduce into (sorted-map) (for [e (reverse [{:id 1, :rec "one-rec"}, {:id 1, :rec "two-rec"}])] e))
07:19clojurebot{:id 1, :rec "one-rec"}
07:23s4muelrlp10_ you could try the above, although, rseq might be faster than reverse
07:24TEttinger,(reduce into (sorted-map) (rseq [{:id 1, :rec "one-rec"}, {:id 1, :rec "two-rec"}])])
07:24clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>
07:24s4muelhive mindin'
07:24TEttinger,(reduce into (sorted-map) (rseq [{:id 1, :rec "one-rec"}, {:id 1, :rec "two-rec"}])) ; the point is the for is unneeded I think
07:24clojurebot{:id 1, :rec "one-rec"}
07:25s4muelah! it always gets simpler :)
07:26TEttingerno, 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"}]))
07:26lazybot⇒ {:id 1, :rec "one-rec"}
07:27TEttingerI think rlp10_ needs a vector of maps, rather than one sorted-map
07:39s4muel,(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"}])
07:39clojurebot{1 "one-rec", 2 "eh-rec"}
07:44mercwithamouthquestion...do you all generally read from left to write when writing clojure or inwards and work your way out?
07:44mercwithamouthas if expanding on an idea?
07:45TEttingers4muel, looks good
07:45s4mueliteratively, for sure. even just solving that little problem
07:45hyPiRionWell, it depends.
07:45s4muel(which is why this channel is awesome, its like learn by immersion in random real-world issues)
07:46TEttingermercwithamouth, I generally iterate too.
07:46jkj_mercwithamouth: if often go to threading macros -> ->> quite fast when there are many nested calls
07:46mercwithamouthso 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?
07:47jkj_mercwithamouth: often yes.
07:47mercwithamouthor would you automatically think to start off with (+ 18 () ) ?
07:47TEttingermercwithamouth, I think I would prefer (+ 5 5 18), but hey...
07:47jkj_but then (->> (+ 5 5) (+ 18) ...)
07:47mercwithamouthTEttinger: well yes...that's a bad example =P
07:47TEttingerheh
07:47mercwithamouthjkj_: hrm!!!
07:48TEttingeryeah, I do wind up going back a lot
07:48TEttingeriterative is a good way to put it. writing one piece, scanning for what needs to change, adding it
07:48TEttingerand it's part of why clojurians prefer small single-use functions
07:49mercwithamouthi see
07:49TEttingermy clojure code is pretty terrible and tends toward massive one-liners
07:50TEttingerhttps://www.refheap.com/16011
07:50jkj_there should be ide support for automatically converting to threading macro style or so
07:50mklappstuhlI use korma for querying and jdbc for creation of tables
07:51mklappstuhlboth of them need a connection but both have different ways to specify them
08:00ambrosebsBronsa: what's post-GSoC look like for you? More CinC?
08:00Bronsaambrosebs: definitely
08:00ambrosebsBronsa: sweet!
08:00Bronsaambrosebs: I have a few things in mind to extend CinC
08:02ambrosebsBronsa: oh?
08:02Bronsaambrosebs: 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
08:03Bronsalike clojurescript's :optimizations :simple vs :advanced
08:03ambrosebsBronsa: are you looking at the same unit of compilation, a form?
08:04Bronsaambrosebs: yes, but I'm storing the result of tag inferring in the fn's metadata
08:05ambrosebsBronsa: does that help resolve reflection calls at runtime?
08:07ambrosebsBronsa: or, what does that do? :P
08:07Bronsaambrosebs: yes, take for example (defn x [] "foo") (.hashCode (x))
08:08Bronsaclojure compiles the latter to a call to Reflector/invokeNoArgInstanceMethod or how it's called because the defn is not manually tagged
08:08ambrosebsBronsa: oh nice.
08:09Bronsaif 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
08:09BronsaI plan on keeping this behaviour in the normal eval
08:09Bronsaand aggressively inferring the return-tag of (x) to String in the optimizing call
08:10Bronsaeval*
08:10Bronsaambrosebs: also I have a partially written pass that transforms forms like (.hashCode (if true 1 "")) in (if true (.hashCode 1) (.hashCode ""))
08:11Bronsaremoving the need for reflection
08:11ambrosebsBronsa: is it worth following instance? calls to infer accurate types for reflection?
08:12Bronsaambrosebs: didn't think about it, certainly possible to do
08:14ambrosebsBronsa: well core.typed uses branches to infer better types via occurrence typing.
08:14ambrosebsBronsa: you could probably implement something similar.
08:17Bronsaambrosebs: 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
08:17ambrosebsBronsa: good plan
08:22ambrosebsBronsa: is the analyzer getting close?
08:23TEttingerwhat's the goal of Clojure in C? better integration with C as opposed to Java?
08:24TEttingeror performance?
08:24gleagClojure the language or Clojure the implementation?
08:25gleagOh, "Clojure in C" is probably something I haven't been aware of.
08:25Bronsaambrosebs: yes, it's actually already complete but I need to simplify the :tag/:cast/:box handling
08:25ambrosebsBronsa: awesome
08:25gleagWhy would such a thing be more desirable than Clojure in Clojure?
08:26BronsaTEttinger, gleag CinC is a port of the clojure compiler/analyzer to clojure, not in C
08:26TEttingeroh. that makes more sense
08:26ambrosebs:)
08:27TEttingerisn't there a clojure in C project?
08:27TEttingeror am I thinking of something else
08:27Bronsathere should be one
08:27TEttingerwell clojure in clojure sounds great
08:27Bronsahttps://github.com/schani/clojurec
08:38borkdudeI 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
08:38borkdudeon Mountain Lion
08:41francis_wolkeKilling the JVM associated with nrepl locks my emacs for ~2 minutes. Offhand does anyone know of a way to prevent/bypass this?
08:51TEttingerborkdude, neat
08:51TEttingernow do it with lisp from the 60s
08:53borkdudeTEttinger I doubt there are any scripts from the 60s that recursively delete .svn folders ;)
08:54TEttingerperhaps.
10:57javeI wish to build some clojure code within a larger java build.
10:57javethere seems to be a number of options. any hints which one to prefer?
10:58javefor instance, i could call lein from maven, or use the zi mvn plugin, or the clojure-maven-plugin
11:16BrackiHow do I fix "No matching method found:" with polymorphic methods in the Java class I'm calling?
11:22borkdudeBracki that should just work I think
11:22Brackireflect only prints two of the three methods.
11:25borkdudewhat fundamental difference does it make in having a concatenative style language or applicative - isn't it just the way you write it down?
11:29TEttingerjave, probably a sane option would be separating the clojure into a library
11:30TEttingerif that's not possible, uh...
11:37technomancyfrancis_wolke: kill all the *nrepl- buffers
11:48munderwoHi all, I'm following a tutorial for getting started doing REST api with clojure, here is my code.. https://www.refheap.com/d4d4e459cdcd49ee0e2999b0a
11:49munderwo when I try to do leon ring server I get https://www.refheap.com/42fbcf3e33d7ebd78e9b0ca6e … any help?
11:52technomancyor maybe M-x nrepl-disconnect
11:53munderwomy bad. found it. Wrong name for the pool
12:08vurmaRegarding the Ritz debugger: I cant seem to get the nrepl-dbg buffer to pop up when i hit breakpoint. Any ideas?
12:09vurmaKind of a pain to have to switch buffer and open the dbg buffer every time i need to sort out an exception.
12:44jkj_I have an endless sequence coming from I/O. How do I munch the entries so that memory is also freed
12:44jkj_i need to send each of the entries to another mq
12:46jkj_i quess doseq
13:12rurumateIs transient recursive, on nested data structure?
13:16rurumate,(type (:a (transient {:a {}})))
13:16clojurebotclojure.lang.PersistentArrayMap
13:29jowagIs it valid to say that Clojure Function is a data type?
13:32mtpi would say yes
13:32mtpfunctions-as-data is an extremely powerful technique
13:39indigoHm... travis-ci still uses lein1 as default :(
13:42seangrov`jowag: I don't think so no
13:44seangrov`Some things that should work for data types don't work for functions
13:50jowagI'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:50jowagSo I wonder if calling them a data types will be OK. More so that in Clojure, code is data
13:50AimHereData types?
13:51seangrov`AimHere: Do funtions qualify as data types though?
13:51AimHereIsn't that the point of a functional language?
13:52AimHereFunctions are 'first class citizens' in that you can do pretty much all of the things you do to other data
13:52seangrov`Yeah, I suppose they're data types then, but not values
13:52seangrov`You can't serialize them, identity fails on then, etc.
13:52AimHere,(identity identity)
13:52clojurebot#<core$identity clojure.core$identity@c3a340>
13:53seangrov`,(= "this" "this)
13:53clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
13:53seangrov`,(= "this" "this")
13:53clojurebottrue
13:53seangrov`,(= (fn [x] x) (fn [x] x))
13:53clojurebotfalse
13:53seangrov`The concept of value/identity is different for functions that more "fundamental" data types
13:54seangrov`than*
13:54seangrov`That said, I'm sure it's fine for an introduction to call them data types
13:54jowagwell that is an interesting issue, whether a concrete function can be called a "value" of a Function type
13:55seangrov`It's just a question that floats across #clojure every now and then
13:55AimHereWell the clojure equality function covers a multitude of sins.
13:55AimHere(= [1 2] '(1 2))
13:55AimHere,(= [1 2] '(1 2))
13:55clojurebottrue
13:55AimHere,(= (type [1 2]) (type '(1 2)))
13:55clojurebotfalse
13:56hyPiRion"sins"
13:58AimHereAsk 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:00hyPiRionOr flip it around: x = y being false, even when x(a) = y(a) for any a
14:01hyPiRionthat's how functional equivalence works in every language with HOF
14:01hyPiRion*function equivalence
14:01jowagok, I suppose I can call Macro a data type too, but what about nil? :)
14:01AimHereIt has a declared type of it's own
14:01hyPiRionnil is nil
14:02mtpa data type is a shape for data, and operations upon that data which may or may not change its shape
14:02mtpthat's all
14:02ChousukeI would say a function is equivalent to another function if their definitions are equivalent, in the mathematical sense :P
14:03AimHereVery good. Is there 'data' in a function shape then?
14:03Chousukewell, in the context of a programming language, it's usually not possible to prove that one definition is equivalent to another
14:04mtpAimHere: data and code are the same thing
14:05mtpChousuke: it's possible if you solve the halting problem! 8)
14:05AimHereThere is a difference though; data isn't always considered 'executable' somehow
14:06AimHereNobody thinks of a .csv file containing the grain exports of Namibia for 2006/2007 as 'code'
14:06jowagIn Clojure, we do not execute, we evaluate :)
14:07Chousukethe 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:07hyPiRioncode is data, not vice versa.
14:07gfredericksoh man guys elisp is nutso
14:08gfredericks(eq 42 42) but not (eq 4.2 4.2)
14:08hyPiRiongfredericks: heh, welcome to fixnums
14:08Chousukecomparing floats for equality is broken anyway
14:08Chousukeso it's actually sane behaviour to just return false
14:09AimHere.(= 1.0 (+ 2/3 1/3))
14:09gfrederickso_O
14:09AimHere,(= 1.0 (+ 2/3 1/3))
14:09clojurebotfalse
14:10gfredericksthe weird thing to me is that integers and floats have different object-uniqueness semantics
14:10hyPiRiongfredericks: eq is identical?, not equivalence (=)
14:10gfrederickshyPiRion: yeah, I get that part
14:10hyPiRionAimHere: ##(== 1.0 (+ 2/3 1/3))
14:10lazybot⇒ true
14:10gfredericksit's the fact that ints and floats behave differently
14:10Chousukegfredericks: that's probably because integers have a unique bit pattern for each value
14:10Chousukefloats don't
14:11gfredericksfor general numbers, or just infinity/nan/zero edge cases?
14:11ChousukeI'm not sure on the details
14:11gfredericksis there not a machine instruction for this?
14:12Chousukehow would such an instruction be implemented?
14:12hyPiRiongfredericks: ints below a certain size are "pointers"
14:12clojurebotExcuse me?
14:12hyPiRionafaik
14:12gfrederickshyPiRion: I'm getting eq true for arbitrary large integers
14:13hyPiRiongfredericks: (eq 1000000000000000000000 1000000000000000000000) ?
14:13gfredericksChousuke: I think normally as subtraction and zero-check
14:13gfrederickshyPiRion: that's out of range
14:13gfrederickshyPiRion: I get (eq 500000000 500000000), which is close to the top of the int range
14:15gfredericksthere seems to be a test for zero command, so presumably a subtract-and-test mechanism would work?
14:19Chousukegfredericks: how do you implement subtraction?
14:19Chousukegfredericks: it's easy for integers, but floats are complicated
14:20gfredericksChousuke: chips implement subtraction
14:20Chousukegfredericks: yes. how?
14:20gfrederickscompare the exponents, do some shifting, subtract integers, compute new exponent...
14:21gfrederickslots of edge cases for nan/inf
14:21munderwoHi 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:22gfredericksmunderwo: you can slurp it
14:22gfredericksit's an InputStream
14:22Chousukegfredericks: the precision problems with floats are what make equality problematic
14:22munderwogfredericks: 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:23Chousukegfredericks: so just subtracting and checking for 0 won't work since the result of subtracting two equal numbers might not be zero
14:23gfredericksChousuke: under what circumstances is subtracting two "equal" numbers not zero? assuming we're aware that rounding happens during other operations
14:24gfredericksmunderwo: 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:25munderwogfredericks: so I should be able to do (println {request :body}) to get the input stream?
14:25gfredericksmunderwo: you want to print the body of the request?
14:25Chousukegfredericks: eg. if you get to a number from addition of two numbers, and then compare it with another
14:25munderwogfredericks: yup.
14:25gfredericksChousuke: so (+ 2.0 2.0) might not equal 4.0?
14:25Chousukeyes.
14:25gfredericksmunderwo: (println (slurp (:body request)))
14:26gfredericksChousuke: I am skeptical
14:26Chousukegfredericks: or rather, 4.0 - (2.0 + 2.0) might not equal exactly 0
14:26munderwogfredericks: thanks! Im still figuring out syntax. Im doing the dive in head first and hopefully learn my osmosis.. cheers!~
14:26gfredericks,(- 4.0 (+ 2.0 2.0))
14:27clojurebot0.0
14:27gfredericks,(= (- 4.0 (+ 2.0 2.0)) 0.0)
14:27clojurebottrue
14:27ChousukeI'm not talking about those exact numbers mind you
14:28gfredericksI'm aware of the way that floating point numbers round under arithmetic operations
14:28gfrederickswhat is your concept of "equality" that is distinct from "zero after subtraction"?
14:28gfredericksare you simply pointing out the difference between mathematical reals and IEEE doubles?
14:29Chousukemathematical equality is what I'm concerned with
14:30Glenjamini usually do "near zero" after subtraction
14:30Glenjaminthen you'll want some symbolic math stuff i guess
14:30gfredericksit 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:31gfredericksin what sense might those numbers, ignoring how I obtained them, still be equal?
14:33Glenjamin,(= 1.2 (+ 1.0 1.2))
14:33clojurebotfalse
14:33Glenjaminerm
14:33Glenjaminwhoops!
14:33Glenjaminignore me please.
14:33Chousuke:P
14:33Glenjamin,(= 1.2 (+ 1.1 0.1))
14:33clojurebotfalse
14:33gfredericksI wouldn't expect those two to be equal necessarily
14:34gfredericksI assume that they have been rounded slightly different and so are in fact distinct numbers
14:34Chousukegfredericks: the equality check can return false even if two things are actually equal. that's the problem.
14:34Glenjaminthats what i meant.
14:34Glenjaminfrom a maths point of view, thats a weird statement, floating point is an implementation detail
14:34gfredericksChousuke: I'm trying to get at what you mean by "actually equal"
14:34Chousukegfredericks: like the above
14:35gfredericksChousuke: but I don't expect those to be equal
14:35Chousuke1.1 + 0.1 is equal to 1.2
14:35gfredericksnot for floating point numbers
14:35Chousukebut in the implementation, that equality is broken, so the implementation of equality is broken.
14:35gfredericks,(- 1.2 (+ 1.1 0.1))
14:35clojurebot-2.220446049250313E-16
14:35Chousuketherefore it should not be trusted.
14:35gfredericksChousuke: why is this not an issue with rounding rather than equality?
14:36hyPiRionwhat is "it"?
14:36Chousukegfredericks: because the rounding appears in the implementation rather than explicitly.
14:36gfredericksChousuke: IEEE does not specify how to round the result of an addition?
14:37gfrederickshyPiRion: I think he's arguing that (= x y) is never useful for floats
14:37hyPiRionoh
14:37gfredericksor rather
14:37gfredericksthat it can return incorrect results
14:37gfredericksor is "broken" in some sense
14:38gfredericksI 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:38Glenjamini think it boils down to: is 1.2 a decimal, or a float?
14:38gfredericksin clojure it's a float
14:39hyPiRiongfredericks: nah, = handles that
14:39hyPiRion,(= 0.0 (- 0.0))
14:39clojurebottrue
14:39gfrederickshyPiRion: and now that I think about it I don't think there can be distinct representations like that anyways
14:39hyPiRiongfredericks: except for zero, no.
14:40Chousukegfredericks: 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:40hyPiRiona number is always represented as [+-] 0.mantissa * 2^exponent
14:40gfredericksChousuke: 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:41hyPiRionexponent minus base
14:41gfrederickshyPiRion: I remember there being an implicit first 1 digit but I can't remember where/why
14:41Chousukegfredericks: well, it does it with some warped sense of equality
14:41gfredericksChousuke: maybe we're just arguing semantics at this point but that seems like a misleading way to phrase it
14:41Chousukebut I guess this goes back to the implementation thing
14:42hyPiRiongfredericks: yeah, that may well be the case. I just remember that all but plus minus zero can only be represented in one way
14:42gleaggfredericks: Isn't any Lisp that converts 1.1 into FP sort of broken?
14:42gfredericksgleag: why broken?
14:43gleaggfredericks: 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:44gfredericksgleag: "not being what you want" is different from "broken"
14:45gfredericksthe word "broken" implies to me that it was meant to be something else
14:45metellusbut at the same time "correct for a very specific thing nobody wants" is poor design
14:45gfrederickssure
14:46gleaggfredericks: 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:46hyPiRionIt sounds like you guys have been discussing definitions for some time now
14:46gfredericksI bet you could easily make the case that floating point should be no more accessible in clojure than java arrays
14:46hyPiRiongleag: (floatp 1.1) in CL is T, (rationalp 1.1) is NIL
14:47gfredericksgleag: hyPiRion is right, this is just definitions
14:53gleaghyPiRion: 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:53gleag(and the Scheme model certainly builds upon the CL model)
14:53gfredericksafaict 4.2 is not exact in scheme either
14:54gfredericksso I can't tell what difference you're trying to point out
14:54gleagThat is weird.
14:55gfredericksI don't know that I've ever heard of a language that uses not-floats for that syntax
15:01ScorchinI'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:01Scorchincreator almost does it, but closes the channel after the time provided.
15:02gfredericksScorchin: some combination of loop and sleep?
15:03gfredericksI guess that uses a thread
15:03gfredericksyou could create a new timeout channel each time
15:03ScorchinIs that all?
15:03Scorchingfredericks: I intend to split this channel for different output formats
15:06Scorchinerm, not split
15:11gleaggfredericks: I must have been spoiled by the HtDP languages!
15:11gleaggfredericks: (exact? 12.3) ==> true ; (exact? #i12.3) ==> false
15:12gleagIt just seems such a reasonable idea (you can always coerce implicitly if needed) that I apparently assumed that it was more widespread.
15:18allenj12hey im new to clojure and was wondering if i could make a priority map with two lists?
15:18TimMcallenj12: Remind me what a priority map does, again?
15:19allenj12TimMc: 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:20allenj12so if i want one list to be the key
15:20allenj12TimMc: and i wanted the other list to be the values
15:21yazirian,(doc zipmap)
15:21clojurebot"([keys vals]); Returns a map with the keys mapped to the corresponding vals."
15:21yazirianlike that?
15:21metellusyou could also use sorted-map-by
15:22metellusinstead of two lists
15:23TimMcsorted-map-by doesn't give you access to the values
15:23TimMcs/you/the comparator/
15:27yazirianallenj12: https://github.com/clojure/data.priority-map
15:28yazirianso maybe pass a zipmap to that -- this depends on your needs re: duplicate values somewhat
15:28allenj12yazirian: hmm kk ill try that
15:41BrackiWhat's the prefered way for default args? Multi arity fns or maps with defaults?
15:42coventry`I've seen multiarity more often than maps with defaults.
15:43Brackicoventry`: Also for stuff like: hostname, port, password, username etc?
15:44coventry`Haven't read much of that kind of code.
15:48technomancydepends on whether you care about getting errors when given too many args
16:05BrackiWhen wrapping Java libs, do I need to alias everything with my own names or can I expose the underlying API?
16:05Brackis/need/should
16:06gfredericksI think clojure style is not to introduce unnecessary abstraction
16:06coventry`"It's complicated." http://www.infoq.com/presentations/Distilling-Java-Libraries
16:06gfredericksso if you're just wrapping it for the sake of using kebab-case, then don't
16:06hhenkelHi 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:07hhenkelI got a working code, but it "feels not right" as a I use nesed "doseq"...
16:07callenI broke the Clojure Cup layout :) http://clojurecup.com/apps.html
16:08technomancygfredericks: but completion
16:08gfrederickstechnomancy: you talkin bout stuff not appearing in your source?
16:08technomancyjust messing with you
16:08gfredericksPHEW
16:08technomancygfredericks: were you at strange loop?
16:09gfrederickstechnomancy: no I just had a babby
16:09technomancyoh that's right; congrats
16:09gfredericksthx
16:10gfredericksdid hofstadter reveal the essence of conciousness?
16:11technomancythat man has some ideas.
16:11gfrederickswhen I make a list that contains itself does the list become conscious?
16:12technomancyyou're thinking of thermostats
16:13callen(inc gfredericks)
16:13lazybot⇒ 30
16:15BrackiCan anybody point me to a leiningen setup that requires a vagrant box to be spun up for integration testing?
16:16callenThat sounds like a lot of work. Not it.
16:16BrackiNot it what?
16:17callenNot it. Can't draw my straw.
16:17sandbagsif 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:17callensandbags: embedding an nrepl instance came up not too long ago.
16:17callencommon request.
16:18sandbagscallen: ah so requested, but not doable?
16:18sandbagsi'm googling embedded nrepl now
16:18callenperfectly doable.
16:18callenas your google will show you.
16:18Brackicallen: Can your paraphrase "Not it. Can't draw my straw." for a non native speaker please.
16:18coventry`sandbags: http://clojure-log.n01se.net/date/2013-09-21.html#22:35
16:19sandbagscallen: got you, misread you as meaning common request for clojure, not here. thanks.
16:19sandbagscoventry`: oh, thank you
16:19callenBracki: 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:19coventry`Oh, if you want access to the local variables, that's not going to give it to you, I think.
16:19callenthen you're in Ritz territory.
16:19coventry`callen: not necessarily. https://coderwall.com/p/xayyvq
16:20Brackicallen: Ah as in "not me".
16:20callenBracki: yep
16:20callencoventry`: eh. that's like jahad's thingy and limit-break.
16:20callencoventry`: the locals clearing fucks you anyway.
16:20coventry`Yeah.
16:21sandbagscoventry`: 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:23BrackiSince 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:25callenBracki: ideally there'd be an actual API separating the Java objects from the Clojure.
16:27coventry`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:29Brackicallen: What kind of separation?
16:32sandbagscoventry`: that's odd, i can't find that macro in my copy of joy of clojure
16:33coventry`sandbags: Its in one of the later chapters. There's a subheading in the TOC which mentions debugging, I think.
16:33sandbagsi think it's the Preview search that's at fault
16:34sandbagspossibly this MEAP copy isn't well indexed
16:34sandbagsah found it in my copy of 1st which does have an index :)
16:35coventry`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:35sandbagsokay so is it likely to be a problem combining that break macro with running via lein uberjar/java?
16:36sandbagsthe 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:38coventry`Is there an easy way to figure out which multimethod a given argument is dispatched to?
16:41AimHereYou could just call the dispatch function and inspect the answer!
16:42coventry`Dispatch function is (class). (ancestors clojure.lang.APersistentVector) returns 22 possibilities.
16:45AimHereBut the dispatch function only has one value and I think defmethod only takes one dispatch value
16:46AimHereThe only source for confusion is if you don't know what class the object you're passing in is
16:46coventry`AimHere: The dispatch can be ambiguous. That is the reason for multimethods. See 3rd paragraph of http://clojure.org/multimethods
16:46coventry`"reason for prefer-method"
16:49coventry`How the hell is it getting APersistentVector anyway? That's an abstract class.
16:51callensandbags: that's because it's not a real debugger :)
16:52callensandbags: Ritz is possibly closer to what you want
16:52sandbagscallen: ah, thanks ... i'll have a look at Ritz
16:53sandbagsor maybe i'll just go back to repetitive pprint
16:54sandbagsif only clojure.inspector/inspect worked properly
16:54sandbagsit's pretty much all i need
16:55callensandbags: I've been having a nice time with clojure.tools.trace lately.
16:55callenI found clojure.tools.trace more efficient in terms of debugging time than a stepping debugger
16:56callenless manual, you just read what happened.
16:57sandbagsi'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:57coventry`sandbags: ritz has an inspector. I don't remember how good it is for exploring large hierarchical datastructures, though.
16:57sandbagsi'll have a look at trace also
16:57coventry`trace is great if the data structures are simple.
16:58sandbagsthe 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:58napperhey all, python convert here. I want to do this: self._item = container OR "this instead" - how do I accomplish this in clojure?
16:58sandbagsis a good thing
16:59coventry`napper: if-let for the RHS. You may not need a LHS.
16:59sandbagsi guess lein-ritz is what i'm after
17:01coventry`napper: Sorry, that's wrong. (or container "this instead.")
17:01sandbagsbut - googling - it looks like it may be something of a labour to get it all setup for a relative newcomer like myself
17:01coventry`sandbags: Yes, ritz was pretty hard to get going when I looked at it about 6 weeks ago.
17:01nappercoventry: perfect
17:02nappercoventry, thanks
17:02sandbagshrmm.. it looks above my paygrade right now and i fear i am losing sight of solving my actual problem :)
17:05sandbagshrmmm inspect-table actually seems to work reasonably well
17:35callennapper: (let [item (or container "this instead")] )
17:36callencoventry: that's not a very idiomatic recommendation if you look at how Python uses what he's asking about.
17:36callenif-let is for fallback behavior after the binding, not falling back the binding itself.
17:36callenfalling back the binding itself is what the Python code is doing.
17:38indigoRace conditions ftw
17:46coventrycallen: Yes, it was a mistake to recommend if-let. Thanks for re-iterating that.
17:47callen,(let [items (or [] "[] isn't falsy") item (or nil "but nil is")] [items item])
17:47clojurebot[[] "but nil is"]
17:48callennapper: ^^
17:48callennapper: do the Clojure Koans, they hammer this stuff in.
17:59mklappstuhl(csv/read-csv file :seperator \t))
18:00mklappstuhlhow do I get clojure.csv to use a tab character as seperator?
18:01mklappstuhlok, first mistake was mistyping sepArator
18:01allenj12is there any place where i can paste code and share a link of that code so i can ask a question?
18:01s4muelallenj12: refheap.com
18:01mklappstuhlallenj12: gist.github,com
18:07allenj12https://www.refheap.com/18898 can anyone help me with this i asked the question in the a-star defn
18:11metellusallenj12: (filter #(possible-move % board) *moves*) I think
18:13allenj12metellus: yes! ty really should get use to thos anonymous functions
18:13gaYakYuck "not=".
18:13allenj12lol? is that bad?
18:14allenj12im new to clojure so critques on everything would be great :)
18:14gaYakI'm not an expert on Clojure, but looking with Scheme eyes.. it looks horrible ;)
18:15gaYakTo me (not (= .. )) just looks more readable.
18:16allenj12ahh k thanks for the tip i kinda like that to
18:20mklappstuhlhow do I get a tab character as java.lang.Character?
18:20Bronsa\tab
18:25TEttingergaYak, 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:25TEttingerI think there may be some tiny speed difference, but I don't think it's obvious
18:26TEttinger(not (= ... is two function lookups is all
18:26gaYakThat's the compiler's job to fix
18:26gaYakWell, JITs in this case.
18:26TEttingerwell yes, JIT will kick in after 20,000 calls
18:27gaYakThat 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:27TEttingerthat's a good question
18:28s4muelforgive me if this sounds crazy but is there a notion of 'warming' the JIT for optimizing certain code paths?
18:28TEttingerAOT I think does a good job, s4muel, but I don't know if JIT works after AOT has been done
18:29TEttingers4muel, I think it is done, but in the apps where it really matters those code paths get called 20,000 times anyway
18:29s4muelTrue
18:52TEttingerlooks like AOT does not prevent JIT from occuring later, it just prevents the startup compilation to .class files
18:52TEttingerso s4muel, warming would still be useful if you can predict the path the code will take
19:30rhgi have a small question how can you write a fn to use in the ns macro, i was hoping for a :require-nodejs
19:32brehautrhg: i dont know if ive ever seen that documented anyway; might be time to hit the source for core
19:32brehauthttps://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L5214-L5268
19:34rhgthx
19:35brehautrhg i would guess you are looking at references and process-reference but im not 100% on that
19:35brehaut,`(~(symbol "clojure.core" (clojure.core/name kname))
19:35brehaut ~@(map #(list 'quote %) args))
19:35clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
19:36ToBeReplacedgenerally, should i try to keep my go blocks close to my puts, or does it not matter?
19:36rhgah
19:37ToBeReplacedex (go (with-open (doseq (>! ... )))) or (with-open (go (doseq (>! ...))))
19:37rhgwell id now if it was a ns but nodes modules are js "objects"
19:37rhgknow*
19:38brehautrhg: oh, i might have sent you to clojure.core rather than cljs.core btw
19:38rhgbasically how can i declare a var in a fn
19:40brehautrhg: 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:41brehautalso
19:41brehaut,,(ns foo.bar (:print [1]))
19:41clojurebot[1]
19:41brehautlol
20:01rhgso it's a dead-end
20:01rhgoh well back to the refer-node macro
20:09SegFaultAXbbloom: 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:16rhgugh i can't even compile js now i get java.io.FileNotFoundException: out/constants_table.js running ./bin/cljsc
20:17rhgim begginning to think cljsc hates me
20:19rhghmm, advanced optimizations are broken
20:22srrubyHow 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:23llasramsrruby: Is this for a programming exercise, or just something you're trying to do?
20:23srrubySorry, 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:24brehautsrruby: keep
20:24brehaut,(keep :name [ {:name "john"} {:name "jane" } {:type "foo"} ] )
20:24clojurebot("john" "jane")
20:24srrubyI'm trying to do it as I hack away at clojure. Thanks!!
20:25brehaut,(keep identity [true false nil ""])
20:25clojurebot(true false "")
20:26srrubyllasram: Not sure what you mean by programming excercise... I'm not in a clojure class.
20:26brehautsrruby: sure, but some people are and they just want their exercises done for them
20:26brehautwhich is a waste of everyones time
20:27llasramsrruby, 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:28rhghow do you require macros in cljs?
20:28rhgrequire-macros?
20:31ToBeReplacedrhg: yes
20:31rhghow excatly
20:31rhgdo you pass the ns
20:44rhg,(doc split-at)
20:44clojurebot"([n coll]); Returns a vector of [(take n coll) (drop n coll)]"
20:44rhgoops
20:45rhgwrong chan
21:20callenI'm pondering a wrapper DSL for datalog.
21:20brehautcodatalog
21:21callenWell 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:21callendatalog is abstractable, so that's not too big of a problem, but I'd also like to enable some custom post-processing.
21:21callenbrehaut: cute.
21:21coventryIs there a way to add metadata to a var?
21:21coventry,(with-meta #'clojure.core/map {:foo true})
21:21xeqicoventry: looks like your analyzer is further then I got, thanks for the reference
21:21clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Var cannot be cast to clojure.lang.IObj>
21:21callenI'm also concerned datalog might intimidate people.
21:22coventryxeqi: No worries.
21:22coventryThe research was actually useful in extending riddley to deal with the dot special form. :-)
21:22xeqii had played some with jvm.analyze, and was leary to pull it in here cause I don't want to eval the forms
21:23callenxeqi: leery*
21:23callenyou're not taking LSD, you're just mistrustful.
21:26ToBeReplacedwith core-async, if you want to drain a channel into a seq, is the "right" way (take-while (complement nil?) (repeatedly #(<!! channel)))
21:29callenToBeReplaced: seems like a standard naive channel drain. Maybe toss in an alt and a timeout?
21:29callenI don't mean naive pejoratively, to be clear.
21:29ToBeReplacedcallen: thanks, just sanity checking -- not using it for prod code, just testing
21:30ToBeReplacedi've got readers that need to be parsed... previously was dumping the elements onto LBQ, trying it out with channels
21:30callenToBeReplaced: seems reasonable for poking around. In production you have to be a bit more paranoid/Erlang-esque about it.
21:31ToBeReplacedcallen: does it seem reasonable for a function to accept an input stream and return a channel? i can't really follow the implications
21:33callenToBeReplaced: do whatever works if you're learning/experimenting. Don't tread lightly when experimenting, just ruins opportunities for learning (breakage)
21:33callenif something broke that you didn't expect to - you're about to learn something. Do not fear that.
21:34ToBeReplacedcallen: word
21:35munderwohey has anyone use debug-repl? is there something better to use? if you want to break into an inline debugger?
21:35callenmunderwo: there's limit-break as well. You're going to need to turn off locals clearing as well.
21:35callen(alter-var-root #'*compiler-options* assoc :disable-locals-clearing true)
21:35callenotherwise shit won't be there that should be :)
21:36munderwocallen: is that line put in the module that I'm breaking into? or like the project.clj ?
21:36callenjust somewhere top-level that gets loaded in your actual code, not project.clj
21:36munderwocallen: also is it a 50/50 between them?
21:36callenthe project.clj is closer to a (but not precisely) data structure than code.
21:36callenmunderwo: 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:37munderwocallen: cool. I thought that might be the case. just starting out, so getting a handle on the tooling etc.
21:37callenmunderwo: 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:37callenmunderwo: 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:38callenparticularly 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:38munderwocallen: ahh ok. I might be a little spoiled from python. :)
21:38callenmunderwo: 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:38callenI don't find I miss debuggers when dealing with my own code anymore.
21:39callenmunderwo: I used to think as you do. I wouldn't sweat it.
21:39callenI might start using debug-repl/limit-break again just to see if things can be improved.
21:39callenI want a real injectable REPL someday.
21:40munderwocallen: 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:40munderwocallen: 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:42munderwocallen: 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:44munderwohmm… anybody any idea about whats wrong with this? https://www.refheap.com/abec9999a49cf668cca3bc4f1
21:46callenmunderwo: if you're learning, just live in the REPL.
21:46callenmunderwo: this is why you need to be in the REPL, so you can inspect foodtruck
21:47munderwocallen: yeah at the moment i'm firing http queries at my app through the repl.
21:47callenmunderwo: if you did, you'd see that your keyword against the foodtruck var is producing nil, causing your slurp to fail.
21:47callenit doesn't know how to do IO against a nil.
21:47callenthat's what the protocol error means.
21:47munderwobut how do I get the repl to be in the midst of a request?
21:48callenmunderwo: if you were using clojure.tools.trace, you would've seen log output for your request handler, thereby dumping foodtruck to the terminal.
21:48callenthen you'd see exactly what is going on
21:48callenjust change the defn to deftrace for your create-new-foodtruck handler.
21:49callenafter loading deftrace from c.t.t
21:49callenmunderwo: also there's nothing special about web apps, you can load them from your REPL and interact with them like any other code.
21:49munderworight. do I need to do a (:use clojure.tools.trace) ? up the top of the module?
21:49callenthere's no magic here.
21:49callenmunderwo: try to avoid use. Use require instead.
21:50munderwowhy avoid use?
21:50callenit's very bad form.
21:50callenthe same thing in Python is very bad.
21:50callenyou shouldn't from module import * in Python either.
21:50muhoo~use
21:50clojurebotI am putting myself to the fullest possible use, which is all I think that any conscious entity can ever hope to do.
21:50callenit makes it impossible to know what the fuck is going on.
21:50callenmunderwo: (:require [clojure.tools.trace :refer [deftrace]])
21:51munderwoahhh I see. cool. understand now.
21:51callenWhen my coworkers use 'use, I let them pick which limb they're giving up.
21:51callenThere's a wall of limbs, but not many. They learn fast that way.
21:52munderwonice :)
21:53callenmuhoo: pretty terrible response from the bot. It needs retaught.
21:53callenbatty bastard bot.
21:53munderwois 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:53callenmunderwo: the latter is bad style.
21:53callenmunderwo: one :require form per ns decl plz.
21:53callenmunderwo: do you have a book?
21:54callenmunderwo: http://clojurebook.com/
21:54munderwogood to know. not yet. just going through tutorials.
21:56sinistersnarehello, 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:56munderwocallen: is clojure.tools.trace in the standard lib? or needs to be dep for lein to download?
21:57sinistersnareactually i think i fixed that
21:57sinistersnarehttps://www.refheap.com/18904
21:57sinistersnareok, so my actual problem is of scoping
21:58sinistersnarewhere can i put spawn-raindrop so that it has access to all of the variables of screen?
22:01callenmunderwo: google it
22:02munderwoI think i found it on clojars
22:02sinistersnareim 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:02munderwowhich to me would indicate that its a third party
22:03callenmunderwo: get in the habit of googling for your libraries and lining up github with what's in clojars.
22:03callendon't expect other people to do it for you. waste of time.
22:04callenAsk other people for help when you've exhausted all sensible means in front of you (google, stack overflow, reading the damn code)
22:04callenasking trivial questions just makes people not want to help you.
22:05munderwoyeah, just found the github page. the namespace for it 'clojure.tools.trace' seemed to indicate it was in the stdlib
22:05munderwo(or equivalent)
22:05nooniansinistersnare: too many arguments to def usually means you used a def where you wanted a defn
22:05sinistersnareI JUST FIGURED THAT OUT!
22:05sinistersnare:p now im getting a runtime error i guess
22:05sinistersnareException in thread "LWJGL Application" java.lang.IllegalStateException: Function is not supported
22:05sinistersnareLibGL error though
22:12sinistersnareok so i guess i cant use libgdx because im using openGL 1.4, even though it works in java!
22:12sinistersnareweird
22:13ToBeReplacedi'm seeing reflection in clojure core.async go blocks -- others see this?
22:17sinistersnarehow can i use a sontype repo for my leiningen setup?
22:22bbloom$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:22lazybotMessage saved.
22:26timvisherany way to increase the heap size for the compiler run by cljsbuild?
22:28gfredericksis there any reason why attaching metadata to a lazyseq should force the first element?
22:28bbloomtimvisher: use the jvm opts for lein
22:29gfredericks,(let [s1 (map println '(1 2 3))] (with-meta s1 {}) nil)
22:29clojurebot1\n
22:29brehautgfredericks: because a lazy seq can be empty?
22:29gfredericks,(with-meta () {:this :is :empty :too})
22:29clojurebot()
22:29brehaut,(seq nil)
22:29clojurebotnil
22:30gfredericksmaybe rich thinks it's weird to be able to pull metadata off an unrealized object
22:30timvisherbbloom: thanks!
22:31sinistersnarehttps://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:31sinistersnarespecifically the gdx one
22:31sinistersnareand gdx-backends-lwjgl
22:33sinistersnareoh god, i just cant spell badlogic -> badlogicgames
22:40sinistersnareis there any way that i can use a lib/ folder and just add that to my build path?
22:40sinistersnarewith lein
22:41sinistersnaretechnomancy: 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:41bbloomanybody know if there is anyway to get a view-count from infoq? my vanity requires i know how many people watched my talk :-)
22:42sinistersnarebbloom: which talk?
22:42bbloomaw, dammit. i didn't mean to self promote
22:42sinistersnareoh but im curious now!
22:42bbloomhttp://www.infoq.com/presentations/concatenative-clojure
22:43sinistersnareahh i saw this on /r/clojure
22:43bbloomah cool
22:43sinistersnarei think there was some comment about the video and slides not syncing?
22:43bbloomreally? dammit.
22:43sinistersnareor was that some other video....idk
22:44sinistersnareill make sure to watch it later, my speakers are super quiet on linux and i dont feel like headphones
22:44havenwoodjust ordered an AR.Drone 2.0 quadracopter, pretty excited about playing with clj-drone library
22:47tufflaxSometimes my prints just don't print anything. What could be wrong?
22:48sinistersnarei guess local maven repo is only answer :p
22:48gfrederickstufflax: clojure.core/print doesn't flush
22:49tufflaxgfredericks: yeah but even the ones that does flush. Sometimes I get no output from my logging. After I restart the repl, I do.
22:51gfrederickstufflax: maybe something wrt nrepl server/client?
22:52tufflaxgfredericks: maybe. It's like it working depends on something like which thread is running the code or something like that
22:52gfredericksbbloom: there may have been a comment about your talk actually being on agglutinative clojure
22:53bbloomgfredericks: ?
22:53gfrederickstufflax: with nrepl the *out* is specially bound. are you doing anything with threading that would lose its thread-local value?
22:53gfredericksbbloom: making lame language jokes
22:53bbloomheh ok
22:55tufflaxgfredericks: 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:55tufflax*out*
22:56tufflaxI do (println ... (with-out-str (pprint something)))
22:57gfrederickstufflax: yeah that should be fine
22:58gfrederickstufflax: but e.g. if you start up a new thread manually, use a thread pool, that sort of thing
22:58gfredericksnot necessarily having anything to do with *out* directly
22:59tufflaxYeah I start a few new threads.
22:59tufflaxBut I don't get how that could matter
23:16s4muelnew threads don't have their out bound to the same stringwriter that the repl does
23:20ToBeReplacedhow do you avoid reflection when you have a doseq in a go block? i'm getting call to nth can't be resolved
23:21callenyou're doing something for side effects in a go block?
23:21ToBeReplacedcallen: >!
23:21callenoh, pumping a seq into a channel?
23:21ToBeReplacedyeah
23:22callenToBeReplaced: refheap plz
23:25s4mueltufflax: (alter-var-root #'*out* (constantly *out*))
23:25ToBeReplacedcallen: https://www.refheap.com/18905
23:26callenToBeReplaced: the doseq and doall are making me cry tears of blood.
23:26tufflaxs4muel: ok. I'll try. But it works sometimes (and it's always new threads).
23:26ToBeReplacedcallen: just trying to create simple case obv
23:27ToBeReplaceddoseq 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:28callenToBeReplaced: type-hint whack-a-mole. Have fun.
23:30s4muel,(class *out*)
23:30clojurebotjava.io.StringWriter
23:31s4muel,(class (System/out))
23:31clojurebotjava.io.PrintStream
23:31s4mueltufflax: new threads use the latter by default
23:33tufflaxs4muel: Sorry if I'm slow but I still don't get how it comes that it works sometimes :p
23:33ToBeReplacedcallen: doseq reflects, loop/recur doesn't
23:33ToBeReplacedcallen: clojure.core.async.lab/spool demonstrates
23:34s4mueltufflax: Well sans code I don't see how either, but that's the general idea. :)
23:34tufflaxs4muel: Ok thanks. I'll try it next time it disappears
23:35allenj12https://www.refheap.com/18906 can someone help me with this i asked the question in the comments by where i need help
23:37srrubyI saw here a command that tries all clojure functions, something like (which-function [1 2] 1) ==> first . Can anyone help?
23:38tufflaxallenj12: I have not read everything, but it looks like you are calling man-dist with the wrong args order
23:39sinistersnareim having some problems using a local maven repository with clojure (leiningen).
23:39sinistersnarehttps://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:39sinistersnareim not sure what im doing wrong...
23:43amalloy$findfn [1 2] 1
23:43lazybot[clojure.core/first clojure.core/rand-nth]
23:45marcopoloHey 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:45amalloysrruby: ^
23:46srruby(^ [1] 1)
23:47srruby^([1] 1)
23:47allenj12tufflax: 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:47srrubyhelp
23:47srruby\help
23:47allenj12eduarj:'
23:48allenj12the error is at the bottom and i posted it
23:49tufflaxallenj12: #(...) creates a function, and you have not called it to get a number back
23:49tufflaxallenj12: you are trying to add up the function
23:51tufflaxallenj12: maybe you wanted to use (map #(...) board) or something?
23:54allenj12tufflax: yea i think the apply is the problem ill play with map and see what i get
23:55tufflaxallenj12: The apply is fine I think
23:55tufflaxallenj12: but maybe you wanted (apply + (map #(...) board))
23:55allenj12tufflax: oo ill try it
23:57tufflaxallenj12: I don't really understand the comment though, about "as well as the board itself"
23:58allenj12tufflax: 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