#clojure logs

2013-02-03

00:31anierohey, i just upgraded my system finally to lein 2.0.0 ... supposedly "lein repl" will write a repl-port file, but i'm not seeing one
00:32anierovia homebrew, specifically
00:34anieronever mind, i shot my own foot here. looks like i had lein installed elsewhere
00:48zodiakaniero, happens to the best of us :)
00:49zodiakI jst spent about 30 minutes trying to debug an org.apache.httpclient problem, only to figure out my project.clj was pulling in an old version of clj-http and that was pulling in an old httpclient version ;)
00:49zodiakbloody java
00:59Rayneszodiak: Dependency mismatches are not Java specific.
00:59michaelr`is there a way to define a GET or POST route with compojure?
00:59zodiakRaynes, maybe not, but java raises pkg mismatch to a whole brutal level in my experience
01:00RaynesYou've never used Haskell + cabal-install then.
01:00Raynes:p
01:00michaelr`I mean, a route which handles both GET and POST requests
01:00zodiakRaynes, nope.. I like my languages practical :P
01:00RaynesLow blow, dude. low blow.
01:01zodiak*tips hat to Raynes*
01:01Raynesmichaelr`: Does it matter if it also matches DELETE, PUT, and POOT?
01:01RaynesIf not, ANY will work.
01:01zodiakmichaelr`, if you have a route that does the same function for a get and post.. urm.. why not have them call the same function ?
01:02RaynesBecause that's not how Clojurians do business.
01:02RaynesWe abstract every damn thing.
01:02zodiakRaynes, repeat code twice ? twice ? repeat code ?
01:02michaelr`yeah, i knew these were my options but just hoped maybe there is also something else :)
01:02zodiakmichaelr`, it sounds (to my stupid ears) that your code is saying 'this should be a function'
01:02zodiakyour call as to wether or not you listen ;)
01:02zodiakwhether. rats.
01:02Raynesmichaelr`: https://github.com/weavejester/compojure/blob/master/src/compojure/core.clj#L86
01:03michaelr`zodiak: what i want is something like that: (GET|POST (do-whatever))
01:03Raynesmichaelr`: This is the lower level function that the GET macros and what not calls.
01:04michaelr`Raynes: thanks.. i guess ;)
01:05RaynesPretty sure that's the best you can do if you want something that can do both. You'd have to write it yourself. In this case though, and unless you have to do this a lot, it's probably best to do what zodiak proposed and just add two routes that both call the same function.
01:05zodiakanyhoo.. I am out for the night. pax.
01:06michaelr`Raynes: yeah
01:08michaelr`Raynes: it doesn't look like that code is built to easily support something like that
01:13jonasendnolen: ping
02:26doc_browndoes lein deps run everything with 'dependencies' in its name in the project.clj file ?
02:55callenbotI have some code I don't understand the behavior of.
02:57callenbotah wait, there it goes.
03:08callenbotis anyone here using drip?
03:14callenbotSigh. No if/else in Clabango.
03:14callenbotgod save me from these goddamn template libraries.
03:34jokarHello Folks
03:35jokarCan I find a person for talk about Clojure?
03:36callenbotjokar: I'll talk about it, but I'm a tumbler of vodka and redbull deep into some code.
03:36jokarcallenbot: Can I send PM?
03:36callenbotwhy?
03:36clojurebotwhy is startup slow is busy compiling the `for` macroexpansion
03:37jokarMy questions are a little odd
03:37headshotask anyway
03:37callenbotyou will share them with the masses.
03:38jokarOK
03:38jokarWhy Clojure is good? Can you tell me some of the features
03:39jokarWhat is good for?
03:39callenbotjokar: writing software
03:39jokar:)
03:39jokarWhich software?
03:39jokarI know it is lisp
03:39callenbotjokar: what do you use to code right now?
03:39callenbotI can compare/contrast accordingly.
03:39jokarI use C\C++, Python, Assembly, Bash
03:41jokarCan I find "Rich Hickey" here?
03:41callenbotjokar: you'll learn and be able to apply functional concepts to your code. Clojure will be faster than Python and higher level than Python or C. It'll give you access to the JVM ecosystem of libraries.
03:41jokarIt is based on java
03:41callenbotjokar: his time is too valuable to justify his programming language to random people when there's nothing special about your questions.
03:41callenbotNo, Clojure is based on Lisp.
03:42callenbotThere are multiple Clojure implementations and the JVM runtime is just the primary one for now.
03:42jokarif it based on Lisp, Why we should choose Clojure and not Lisp?
03:43callenbotbecause most Lisp communities are madmen living in the hills
03:43headshot"lisp" is a family of language implementations
03:43callenbotClojure is for the lisp hacker that has work to do.
03:44jokarCan you compare Clojure and haskell or scala?
03:44headshotjokar: what problem spaces are you developing for?
03:44jokarI have not problem, I'm a nongeek in Lisp
03:44jokarhttp://www.google.com/trends/explore#q=clojure%2C%20Scala%2C%20haskell&cmpt=q
03:44callenbotjokar: Clojure and Haskell/Scala are very different. Haskell and Scala are statically typed whereas Clojure is dynamically typed.
03:45callenbotjokar: interacting with things like arbitrary JSON is going to be a bit nicer in a language like Clojure. It's similar to Python in that respect.
03:45headshotand scala's type system can be quite a headache, especially with readability of code
03:45callenbotjokar: also Clojure is a Lisp, Scala and Haskell are not.
03:45jokarDo you make money with Clo...?
03:45headshot<-- yes
03:46callenbotjokar: some do, many do not.
03:46callenbotjokar: there's a decent community of startups and contractors that use Clojure.
03:46jokarcallenbot: Can you show me a big project that use clo...
03:46callenbotjokar: I don't know that that's a very good selection criteria for learning a programming language. You should seek languages that will teach you something.
03:46callenbotjokar: can do you your own research?
03:46callenbotjokar: you're not asking questions that are difficult to answer with Google.
03:46jokarMaybe
03:47callenbotjokar: don't PM me
03:48jokarcallenbot: Can you tell me some projects that you do them with clo..?
03:49headshotjokar: i do a lot of apache camel stuff, and where i would write java i now use clojure
03:51jokarWhy you switch from java to clo?
03:52headshotbecause java sucks
03:52jokarsucks?
03:52clojurebotwhy oo sucks is oo sucks
03:55SgeoWhen is Java getting lambdas, exactly?
03:55SgeoI heard they're finally getting them
03:56Sgeo,(for [i [1 2 3] j [4 5 6]] (+ i j))
03:56clojurebot(5 6 7 6 7 ...)
03:56Sgeopretty annoying to write the equivalent of that in Java
03:56SgeoNested loops etc
03:56Sgeohm
03:57SgeoI just reminded myself of why I like Tcl
03:58headshot08:48 < callenbot> jokar: don't PM me
03:58headshotkthx
03:58jokarheadshot: No problem, Bye
04:32callenbotSgeo: Tcl is a programming language for nihilists and schizophrenics.
04:33SgeoUh, what?
04:34SgeoI like how even if you define a command to do what in other languages you would use a macro for, you can still force the command to see the result of a computation rather than the literals that a Clojure macro might be expecting
04:43callenbotdoes anybody here use sandbar or riend?
04:43callenbotfriend*
05:28ljosHi, is there somewhere where I can read about how to properly do clojurescript development with emacs. Right now I am just writing stuff and then compiling and testing it in the browser, but that is quite slow. I would like to get back the workflow I have in Clojure with Emacs+nrepl and being able to quickly tests things in the repl.
05:31callenbotljos: you can do a terminal repl or: https://github.com/clojure/clojurescript/wiki/Emacs-&amp;-inferior-lisp-mode
05:31callenbotljos: if you're not already doing so, you might want: https://github.com/ibdknox/cljs-watch or lein-cljsbuild
05:36ljosI am using lein-cljsbuild to build things. An `auto` does make things better, but what I want is the same workflow as I have in clojure. There I have the source and a repl open in emacs and then I C-c C-k to compile. I'm not sure if I like the autocompile function yet as I have a very erratic way of coding..
05:38ljosThough maybe I have to get used to it because the cljsbuild is very slow.
05:52etherealGhi everyone. i'm just getting started learning clojure as my first lisp. been doing the problems on 4clojure as practice, but at about problem 30 upwards i'm really struggling with each one. is there a good guide to get into the functional/recursive style of thinking for someone used to the imperative?
05:55ljosetherealG: one thing I did was to go back to some of the simple imperative code (I started with Java) and converted every loop to a recursive function call. That is not always the best thing to do (especially in Java) but you get a real feel for when to use loops and when recursion is more succint. Then, after working a bit with recursion you can convert every recursive function to using `map` and/or `reduce` instead.
05:56etherealGthanks for the idea
05:58broquaintetherealG: It can also be useful to follow other users and see how they solved problems.
06:00rodney_w
06:03etherealGbroquaint: feels like cheating, although I have for a few of my more difficult ones
06:04callenbothttp://pragprog.com/magazines/2011-03/punk-rock-languages
06:04etherealGi checked the source code for the builtin clojure functions for reverse and a few others, and worked back from there
06:05etherealGbut the knowledge of doing it myself hasn't sunk in
06:14broquaintReading code for a problem you've already solved is hardly cheating and a great way to learn how the more fluent approach problems :)
06:21etherealGah, I see, you meant for the problems I've already done
06:54callenbothttps://www.refheap.com/paste/9226 alright, what am I fucking up?
06:54callenbotit works if I remove (user-middleware)
06:56arcatanwhat does put-context do?
06:57callenbot(defn put-context [key val] (swap! g assoc key val))
06:58arcatanis g defined there? from the error message i'm guessing it's somehow related to g
06:58callenbotarcatan: yes...
06:58callenbot(def ^:dynamic g (atom {})) is right above put-context
06:58arcatanright.
06:58callenbotin the same namespace
06:58callenbotso what am I doing wrong?
06:59arcatanshould the middlewares return something useful?
07:00callenbotoh fuck I'm an idiot
07:00callenbotarcatan: good catch.
07:00arcatanheh, i'm just asking stupid questions :)
07:01callenbotarcatan: no dice, same error but at runtime instead of compile time: java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.IDeref
07:01callenbotshuffling around middleware order to see if moving my food around on my plate does something
07:01callenbotnope
07:03callenbothrm, that's not a good sign.
07:03callenbotarcatan: error is in noir.cookies
07:03callenbotnot my code
07:04callenbotI mean I might be doing something wrong, but it's lib-noir's deref for cookies.
07:06arcatanweird
07:06callenbotarcatan: futzing around to fix it.
07:06tomojperhaps the problem is that you didn't wrap noir-cookies?
07:06tomojer, wrap-noir-cookies
07:07callenbottomoj: I figured the magic yog put in place would, but that might be the case. Testing that hypothesis now.
07:07callenbotsigh, motherfucker.
07:08callenbotI'm 404'ing on the goddamn / now.
07:08tomojyog?
07:08callenbottomoj: https://github.com/noir-clojure/lib-noir/blob/master/src/noir/util/middleware.clj#L75
07:09callenbottomoj: it's already part of it.
07:09callenbotI think it's an ordering problem.
07:09tomojoh
07:09callenbotI need to add my own middleware that depends on noir cookies
07:09callenbotbut it won't happen before the app handler.
07:09callenbotthis is not good magic.
07:10tomojhmm
07:11tomojso the only way to use app-handler with your middleware that does put! is to put your middleware in your routes?
07:15tomojcallenbot: your user-middleware doesn't seem to return a function?
07:16callenbottomoj: I already fixed that
07:17callenbotfun new error: Exception in thread "main" java.lang.IllegalArgumentException: Don't know how to create ISeq from: compojure.core$routes$fn__1194, compiling:(handler.clj:35)
07:18callenbotwait, think I got this one
07:18callenbotstill 404.
07:22callenbotyeah, think I fixed it.
07:26tomojI feel like I'd use (let [x y :when z w v] ..) a whole lot
07:27tomoj(let [x y :when-let [z w] v u] ..) ? :/
07:30AfroCassowarriestomoj,
07:30AfroCassowarriesI worship his shadow.
07:43pepijndevosIs there a stemmer in clojure, or should I just use a Java lib?
07:52babilenpepijndevos: Stemmer for which language?
07:52pepijndevosbabilen, english.
07:54pepijndevosActually, for now I think I jest need to.... singularise? remove trailing S wit added magic.
07:54babilenpepijndevos: https://github.com/dakrone/clojure-opennlp might have one - I am currently using the stemmer that comes with lucene, but you might want to take a look at http://nlp.stanford.edu/software/tokenizer.shtml
07:54pepijndevosbabilen, afaict opennlp has no stemmer.
07:55pepijndevoslucene will definitaly work, but way overkill
07:55pepijndevosmaybe this: http://tartarus.org/~martin/PorterStemmer/java.txt
07:58babilenpepijndevos: Do you need a tokenizer too? As I said, I am currently using http://lucene.apache.org/core/4_0_0/core/org/apache/lucene/analysis/Analyzer.html like https://www.refheap.com/paste/9227 -- It comes with a parterstemmer implementation
07:58pepijndevosbabilen, I have a kick-ass regex tokenizer now. Maybe I should in fact use lucene....
07:58babilenpepijndevos: See http://lucene.apache.org/core/4_0_0/core/org/apache/lucene/analysis/package-summary.html for further examples
07:59babilenregex tokenizer? haha
07:59pepijndevos(re-seq #"\w+(?:[.,]\w+)*|\S+" (s/lower-case l))
07:59babilenpepijndevos: Stanford's tokenizer is quite nice. I would use that if it weren't for the fact that this particular project uses lucene anyway
07:59pepijndevosI'll have a look at both.
07:59babilenpepijndevos: That is a /very/ crude tokenizer
08:01pepijndevoslucene does search... I don't need that
08:01pepijndevosbabilen, I'm building a very crude tool.
08:02babilenSure, that does not prevent you from using its StandardTokenizer though
08:02pepijndevosright
08:02pepijndevosbut I don't like to download the internet
08:02pepijndevosmaybe I should use the stanford one
08:02babilenpepijndevos: You only need [org.apache.lucene/lucene-analyzers-common "4.0.0"] -- but have a look yourself.
08:03pepijndevosoh :)
08:04babilenwait, that implementation I pasted above is a buggy one ... (sorry, old checkout)
08:05pepijndevosbabilen, I was about to mindlessly copy that :)
08:05pepijndevoswhy is it first creating a lazy seq and then doall'ing it?
08:06pepijndevosand, are tokens already stemmed, or is that a separate step?
08:06babilenpepijndevos: https://www.refheap.com/paste/9228 is the right one (you'll have to trim the imports, that includes /much/ more than you need.
08:07pepijndevosthanks :)
08:12pepijndevosbabilen, am I supposed to bind *analyzer* to the StandardAnalyzer, or some other thing?
08:14babilenpepijndevos: https://www.refheap.com/paste/9229 has all the bits (sorry) -- You can use different analyzers and http://lucene.apache.org/core/4_0_0/analyzers-common/overview-summary.html has the overview. You want to play with TokenFilter's -- Take it to #lucene if you need help with that.
08:14babilens/'//
08:14pepijndevoscool
08:21babilenpepijndevos: Looks as if http://lucene.apache.org/core/4_0_0/analyzers-common/org/apache/lucene/analysis/en/package-summary.html is what you are looking for. You might want to play with that -- Otherwise combine your own analyzer as detailed in the Analyzer package description.
08:39pepijndevosbabilen, this is definitely not what I want: (token-seq "what is the age of the king of france?") ("what" "ag" "king" "franc")
08:42pepijndevosmaybe I want org.apache.lucene.analysis.core.SimpleAnalyzer but that is not much better than my regex it seems
08:42augustlpepijndevos: just fyi, the query will also run with the same analyzer
08:43augustlso "age" will match "ag" if the same analyzers are used on both ends
08:44augustland "is" and "the" will also be "analyzed away", etc
08:45pepijndevosaugustl, at the other end is a database and a core.logic program. Both of these would be rather ugly if I mangle all words like that
08:46pepijndevosactually, the standard analyzer sortof makes sense
08:46augustlare you analyzing with lucene and querying with core.logic?
08:49augustliirc the lucene analyzers are made to work with IndexReader and IndexWriter, not for stand-alone use. But I'm not 100% sure about that ;)
09:00abpcemerick, I can even reproduce the "write end dead"-exception thrown by nrepl from lein repl. Just (read-line), wait for around four minutes and try evaluating some other form.
09:05babilenpepijndevos: You want to override the stopwordlist ...
09:05pepijndevosbabilen, why?
09:06babilenBecause the analyzer filters stopwords otherwhise ... It works like "(... *analyzer* (StandardAnalyzer. *version* (StringReader. ""))) for the StandardAnalyzer
09:07babilenpepijndevos: Or what is your problem with the output exactly?
09:07pepijndevosbabilen, with the standard analyzer not much. With the english one that in mangles all words
09:10babilenpepijndevos: You mean that it uses the Porter stemmer algorithm and actually stems the words?
09:10pepijndevosbabilen, I don't know, but it gives me "franc" for "frances"
09:11babilenaugustl: You can use them independently just fine. It is more common to use something like http://nlp.stanford.edu/software/tokenizer.shtml though
09:12babilenpepijndevos: yeah, that is the stemmed form. (cf. http://en.wikipedia.org/wiki/Stemming) -- You don't have to use the porterstemmer and you could just use something like the EnglishMinimalStemmer (which sounds like something you want)
09:13pepijndevosbabilen, I'm using standardAnalyzer now, which doesn't do all the stemming
09:13babilenok
09:14babilenThere are /many/ ways in which you can tailor the Lucene analyzers to do /exactly/ what you want .. Some of this might mean more work in creating the analyzer though
09:17babilenI would also recommend to take a look at the stanford one. I've used it for other NLP projects in the past (along with their Chinese and Arabic one) and it should be quite easy to implement token-seq with that.
09:25sveduboisDoes anybody know any Clojure machine learning framework?
09:26daimrodsvedubois: you can use weka which is in java.
09:32babilensvedubois: weka is certainly a good choice, but what do you need exactly? "machine learning" is a pretty large field :)
09:33sveduboisbabilen: Model-based detection, segmentation and classification for medical image analysis
09:39babilenhmm, not my field :-/
09:43pepijndevos&(keyword "foo bar")
09:43lazybot⇒ :foo bar
09:43pepijndevosWill that ever do something sensible?
09:46hyPiRion,((keyword "woop woop") {(keyword "woop woop") 102})
09:46clojurebot102
09:46hyPiRionPerfectly fine, I assure you.
09:47hyPiRionnot serializable though
09:47hyPiRionhm
09:50pepijndevoshyPiRion, yea, there is a difference between readable and valid keywords. hmmm
09:51pepijndevosMost of the time I'm saying (keyword "some string") I'd like it to return :some-string, which might be an unreasonable expectation. Maybe a helper is appropriate
09:53hyPiRion,(.replace "some string" \ \-)
09:53clojurebot"some-string"
09:53hyPiRion,(.replace "a longer string" \ \-)
09:53clojurebot"a-longer-string"
09:54cemerickabp: ok; could you file an issue on jira describing how to reproduce?
09:58abpcemerick, will do.
10:24pepijndevosI'm ocasionally getting "ERROR: Unhandled REPL handler exception processing message" followed by some trivial piece of code and a long ID.
10:24pepijndevosAfter that, the repl is completely dead
10:28pepijndevosactually: ERROR: Unhandled REPL handler exception processing message {:code (use 'asky.core :reload), :id e2c7d4b1-8d7c-497e-aabc-77173d438cc5, :op eval, :session 143f6060-0c52-46d6-bd59-7be51996cd97}
10:28pepijndevosjava.io.IOException: Write end dead
10:28pepijndevospretty anoying
10:29pepijndevosMaybe less so if I set up drip. I'm hoping somene makes a lein plugin of it
10:36doc_brownwhy would java complain about compjure classes not being in the classpath in one project and not the other ? they have identical project.clj's
10:52doc_brownwhen i do lein classpath i see all the required directories i need to access my classes yet lein complains it cant find them when i try to execute them
11:18Raltwhat's the state of clojure-clr right now?
11:33sveduboisIs this java to clojure conversion correct?
11:33sveduboisImg< T > output = duplicate.factory().create( duplicate, duplicate.firstElement() );
11:33svedubois(def output (-> (duplicate) (.factory (.create duplicate (.firstElement duplicate)))))
11:38a|iis there an xml selector like enlive which supports xml namespaces?
11:39sveduboisIt seems .create is malformed. Any advice?
11:50sveduboisHow I can translate this java line to clojure? Img< T > output = duplicate.factory().create( duplicate, duplicate.firstElement() );
12:06yediis defn- a thing?
12:06yediand if so what does it do?
12:07FrozenlockIIRC, it's for making private functions.
12:07Frozenlock(functions only available in this namespace)
12:08oskarth,(source defn-)
12:08clojurebotSource not found\n
12:08zodiakyedi (doc defn-)
12:11sveduboisIs this java to clojure conversion correct?
12:11sveduboisImg< T > output = input.factory().create( input, input.firstElement() );
12:11svedubois(def output (.create (input (.firstElement input)) (.factory input)))
12:15hyPiRionsvedubois: maybe this reads better? (.. input (factory) (create input (.firstElement input)))
12:15sveduboishyPiRion: Yes, it works
12:15sveduboisThanks
12:20hyPiRionAnytime
12:23weavejesterAnyone know much about Friend?
12:40TimMcyedi: It's just defn + ^:private, which keeps the var from being exported by the namepace.
12:46yedii see, thanks guys
13:11rodnaphdoes anyone know a tool/service for quickly querying the latest version of a library? (that'll check maven central/clojars/etc...)
13:12Raynes$latest compojure
13:12lazybot[compojure "1.2.0-SNAPSHOT"] -- https://clojars.org/compojure
13:12RaynesThat checks clojars.
13:15gfredericksis `lein search` still claimed to work?
13:16sshack$latest clojuratica
13:16lazybotNo project by this name exists on clojars.
13:17gfredericks$.50
13:29LauJensenEvening. Im trying out nrepl, specifically nrepl-jack-in which spawns a server and connect and also allows me to evaluate sexps from my .clj files, but the *nrepl* buffer is empty and I cannot use it as a repl. Am I missing something?
13:30FrozenlockLauJensen: Any interesting info in the *nrepl-server* buffer?
13:30LauJensenFrozenlock: Just that the server is started and in this specific case that its opened a jetty
13:31LauJensennREPL server started on port 61718
13:31LauJensen2013-02-03 18:54:05.117:INFO:oejs.Server:jetty-7.6.1.v20120215
13:31LauJensen2013-02-03 18:54:05.161:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:8080
13:40jamiiThis doesn't seem right... https://www.refheap.com/paste/9231
13:43cgagif i ran (ring.server/serve app {:port 3000 :join? false}), but didn't bind the result to a symbol, is there any way for me to get hold of it so I can stop the server?
13:44Frozenlock*1, if it was your last command :P
13:44FrozenlockI think it goes up to 3 last commands.... *3
13:45cgagi thought of that a few commands too late, it's not an issue to just kill my repl, i'm just curious now
14:05angermanI'm having some trouble converting some java code to clojure. Is this correct: https://gist.github.com/10acef8fddd6588468c4 ?
14:06gfredericksangerman: looks plausible; does it work? I'm surprised you need the type hints
14:07angermangfredericks: I've added type hints while trying to see why it does not work.
14:07gfrederickshow does it fail?
14:07angermanI'm not completely certain that's the issue though.
14:08angermanjavax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
14:08gfredericksoh so it compiles fine?
14:08angermanyep. The clojure code just doesn't behave identical to the javacode.
14:09angermanI'll try another more line-to-line rewrite.
14:09gfredericksdefinitely looks fine to me
14:16jonasendnolen: ping
14:18a|idoes clojure-contrib come with clojure distribution?
14:18a|iif not, how to add it to dependencies?
14:19cldwalkerhi all, anyone know how I could open an editor within clojure i.e. (clojure.java.shell/sh "emacs" file)?
14:24rodnaphRaynes: thanks i didn't know there was a bot for that.
14:30rodnaphcore.logic question: i'm trying to write a flatteno relation - https://gist.github.com/4703280 - but am wondering if there's a much easier way i can do this, something like... https://gist.github.com/4703286 (which obv doesn't work)
14:33dnolenjonasen: pong
14:34dnolenrodnaph: isn't flatteno covered in The Reasoned Schemer? Are you trying to write it from scratch?
14:35rodnaphdnolen: it might be, i don't have a copy to hand though. but yes, i'm learning more than trying to get something done.
14:38angermangfredericks: so I rewrote it. Still compiles, still same issue. But I switched on warn on reflection. And got a invokeStaticMethod error.
14:38angermanbut NO_SOURCE_PATH:1 is not that helpful :)
14:39dnolenrodnaph: yeah, you can't write things that way
14:40rodnaphdnolen: i didn't imagine i could, but i'm trying to work out how using clojure with core.logic behaves. any suggestions for where and when it makes sense to do this?
14:41dnolena|i: clojure-contrib is deprecated - don't use it
14:41a|idnolen: what's the alternative? I want to use zip-filter.
14:42dnolenrodnaph: not that I can sum up easily. There's a tutorial on the wiki which might help. Also I recommend The Reasoned Schemer
14:42dnolena|i: I don't know of any alternatives, but other people might
14:42rodnaphdnolen: ok thanks i'll check it out (am half way through the reasoned schemer as well, book at work though, so will pick it up again). cheers
14:45dnolenrodnaph: it's possible to use clojure functions if you project vars, but it means your program will be non-relational and behave strangely unless you are extremely careful.
14:47bruceadamsa|i: looks like zip-filter has moved to data.zip http://clojure.github.com/data.zip/
14:47powrtocdnolen: I'm flicking through the Byrd thesis, and toying with core.logic to test my understanding
14:49powrtocdnolen, I'm trying to grok walk and unify... but I don't really understand how they work, outside of the run macro... what arguments do they take etc?
14:49jonasendnolen: What's your take on http://dev.clojure.org/jira/browse/CLJS-455?focusedCommentId=30533&amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-30533
14:50jonasendnolen: see my latest comment
14:50a|ibruceadams: thanks.
14:59dnolenjonasen: noted, will get back to you.
14:59jonasendnolen: ok, thanks
15:00dnolenpowrtoc: unify takes the substitution map and two terms to unify. walk takes a substitution map and a value to lookup in the substitution map.
15:00dnolenpowrtoc: they can both be used outside of run, run is just sugar.
15:00ivaraasenhm, nrepl.el is giving me a blank buffer when connecting with nrepl-jack-in/nrepl
15:00ivaraasenREPLy is working fine though
15:05powrtocdnolen: I clearly don't understand the purpose of walk then... because (walk (-> empty-s (ext 'a 1)) 'a) returns => a ... I would have expected it to lookup 'a and return 1
15:11angermangreat. I found it. don't understand it though.
15:13hyPiRionCould anyone explain the following:
15:13hyPiRion,(fn [^long a ^long b ^long c ^long d ^long e] (+ a b c d e))
15:13clojurebot#<CompilerException java.lang.IllegalArgumentException: fns taking primitives support only 4 or fewer args, compiling:(NO_SOURCE_PATH:0)>
15:13hyPiRionAs why there's only 4 or fewer?
15:16sveduboisHow I can write this java conditional in clojure? https://www.refheap.com/paste/9253
15:16FrozenlockhyPiRion: Because otherwise you'll rip the space-time continuum appart and doom us all!
15:16dnolenpowrtoc: you cannot put random things on the left hand side - only logic vars
15:17powrtocahh
15:17hyPiRionFrozenlock: Well darn it.
15:18powrtoccool... so (walk (-> empty-s (ext (lvar 'a false) 5) (ext (lvar 'b false) 10)) (lvar 'a false)) returns 5 as expected
15:19skelternetsvedubois: if you do min or max separately you might be able to use reduce?
15:19skelternet,(doc min)
15:19clojurebot"([x] [x y] [x y & more]); Returns the least of the nums."
15:20powrtocas does: (walk (-> empty-s (ext (lvar 'a false) 5) (ext (lvar 'b false) (lvar 'a false))) (lvar 'b false))
15:20powrtocsweet
15:20hyPiRionsvedubois: (let [iseq (iterator-seq iterator)] (.set min-val (reduce min iseq)) (.set max-val (reduce max iseq)))
15:23ivaraasenhyPiRion: got any idea why nrepl.el is giving me an empty buffer? never experienced this before.
15:25seangroveChrist, my advanced-compiled cljs file is 588kb
15:25seangroveThat's rough
15:25seangroveAh, looks like whitespace optimization isn't turned on. That'll shave a bit off
15:26haspakerI propose that we should replace all parenthesis with the words "start-raccoon" and "end-raccoon"
15:26hyPiRionivaraasen: no idea, never experienced it
15:27ivaraasenhyPiRion: turns out I forgot to install rainbow delimiters. god damnit
15:27hyPiRionheh
15:27Frozenlockhaspaker: Would that bring those who are afraid of parentheses?
15:27skelternetAnyone using reader literals to do something useful?
15:28ivaraasenhyPiRion: thanks for the code review BTW
15:29bosieFrozenlock: i don't understeand the parentheses thing. it was really the last thing that bothered me when i started with clojure
15:29haspakerFrozenlock: Indeed. And those that love raccoons.
15:30seangroveMy sister is learning python, and when she saw python, she said, "Wow, so many parentheses!"
15:30seangroveNatural reaction, I suppose
15:30seangroveerr, sorry, "when she saw clojure"
15:35skelternetthe whitespace vs parens as structure seem like two different sides of a coin…or a d20.
15:35bosiethe task 'itneractive' isn't valid anymore in leiningen 2.0?
15:36Frozenlockparens love http://www.thejach.com/imgs/lisp_parens.png
15:38hyPiRionivaraasen: Anytime sir
15:38sveduboishyPiRion: java.lang.IllegalArgumentException: No matching method found: .set for class clojure.core$min
15:39sshackskelternet: Does it even seem like an argument? Take something you can easily see over something you can't every time.
15:40sveduboishyPiRion: The java source is https://github.com/imagej/imglib/blob/master/imglib2/examples/src/main/java/Example3a1.java
15:41skelternetsshack: Actually yes, I can see the argument. However, having experienced tooling failures and getting bit by whitespace distortion, I too would rather not risk it again.
15:41sveduboishyPiRion: And I have write in clojure this: https://www.refheap.com/paste/9265
15:41sshackThat was exactly what I was getting at.
15:42pepijndevosdnolen, what is the difference between the actual code in logic.datomic and the wiki page? Just optimizations, or structural stuff?
15:42dnolenpepijndevos: I need to update, the unification protocols changed, no more double dispatching
15:42sshackskelternet: There's actually some academic work into the subject from the military field on why you absolutely, under no circumstances ever want that sort of friction.
15:43skelternetsshack: a while back I went through a thought exercise looking at what more I could remove from the expression of Clojure code. Using whitespace and spatial orientation of the glyphs was an idea. I haven't pursued it.
15:43pepijndevosdnolen, Ok, so I'll just have to study the code. Can I update the wiki?
15:43skelternetsshack: to help explain…the context was kind of an art project as well
15:43dnolenpepijndevos: please do
15:43dnolenpepijndevos: the changes are very minor
15:44skelternetsshack: You don't have to sell me the practicalities.
15:44pepijndevosdnolen, ok. Also. I'm not sure it's easy to integrate with a mutable dataase.
15:44FrozenlockWait, you mean there's languages using whitespace as a structure?
15:44sshackskelternet: Awesome. You'd be using tooling to move the information around?
15:45dnolenpepijndevos: what challenges do you forsee?
15:46pepijndevosdnolen, not sure yet, but it seems it's hard to reason aout something that chnges under your feet.
15:46skelternetskelternet: that was the idea to make it practical and elegant. You must have instant and interactive feedback on a touch or gesture device.
15:46skelternetwhy did I say that to myself?
15:46pepijndevosunless you download the internet
15:47sshackskelternet: Trying to make yourself believe?
15:48skelternetsshack: finger macro?
15:48sveduboisAny advice to correct this clojure code (https://www.refheap.com/paste/9265) from this java code (https://github.com/imagej/imglib/blob/master/imglib2/examples/src/main/java/Example3a1.java)
15:48Bronsadnolen: do you know who i should ping for a hudson account?
15:49dnolenBronsa: Stuart Sierra I think
15:49Bronsaok, thanks
15:51dnolenBronsa: nice to see that things are moving forward!
15:52Bronsayeah, yesterday stuarthalloway was on irc so I took the occasion and asked him to setup all the things
15:58ivaraasenhyPiRion: https://github.com/emilhf/array-utils :)
16:05sveduboisHow I can convert this to clojure: if ( type.compareTo( min ) < 0 ) min.set( type );
16:07dnolenjonasen: ping
16:13ljosIs there somewhere I can read about how people work with clojurescript, because the workflow just feels horrendous to me. First of all, how can I get a proper repl (not the standard one where I can't even go back in history) that allows me to import new namespaces? I seem to be having this problem right now: WARNING: Use of undeclared Var cljs.user/use at line 1
16:14jonasendnolen: pong
16:14dnolenjonasen: I read over your comments - yeah I'm OK w/ backing out that commit.
16:15jonasendnolen: Yeah, it seems like js/... is meant to provide that level of magic
16:16dnolenjonasen: yes
16:16jonasena bit surprising
16:17dnolenjonasen: or, we could allow new to be dynamic
16:17dnolenjonasen: we don't have the limitations of the JVM here
16:17sveduboisAny advice?
16:18jonasenI agree. I mentioned that in my comment.
16:19jonasenMaybe you could ask Rich at Clojure/West what the intent for js/.. is.
16:21cgag(when (< (.compareTo type min) 0) (.set min type)) to translate it literally i think
16:22callenbotdnolen: Carthago delenda est: source maps?
16:22jonasendnolen: But it might be a good idea to revert the change for now. Otherwise people will get lots of (potentially false) warnings
16:29dnolenljos: yes let's revert and keep the ticket open until we get more information
16:29dnolenoops that was for jonasen
16:29ljosI got very confused there.
16:30dnolenjonasen: if you add a patch to revert I'll apply
16:30dnolenljos: workflow for CLJS could definitely use improvement
16:31dnolenljos: but somebody needs to work on that
16:31dnolencallenbot: waiting on 1.5.0 to merge in the current work, then probably switch over to tools.reader
16:32ljosdnolen: maybe I will have to look into that. I have been trying to improve some of the cljs-libs I am using, but I get so frustrated by the tools and workflow that I just stop. Maybe it is better if I fix that firs.t
16:32sveduboiscgag: Thanks, it works
16:33Frozenlockljos: I would absolutely welcome a REPL that can survive a page change :)
16:35ljosFrozenlock: I would like a REPL that can handle a `use` or `require` properly.
16:36sveduboisI would like to print the numbers of an UnsignedByteType, but when I println I obtain this #<UnsignedByteType 42>. How I can get the number? I have tried count without success.
16:38ljossvedubois: (.toString val) ?
16:39sveduboisljos:
16:39sveduboisljos: It works
16:40cgagi thought println called toString?
16:40ljosIt calls Object.toString, right?
16:41ljosOr am I way off here?
16:42skelternetmight that depend on the argument? I thought printing was one of those favorite protocol examples?
16:42skelternetor multimethod...
16:43ljosThe question here though is what happens when println is called on a java class.
16:45skelternetprint and println might use .toString but it may not be all they print.
16:45skelternet(println myfile)
16:45skelternet#<File .>
16:46skelternetWe're asking in the context of UnsignedByteType?
16:46sveduboisIs there any more concise way? https://www.refheap.com/paste/9290
16:47dnolensvedubois: I think you can add a print-method case for UnsignedByteType
16:48skelternetis UnsignedByteType from img lib? where is that from?
16:49ljossvedubios: I can't really understand what you are trying to do in that paste. There is too little information.
16:49dnolensvedubois: any reason to not user iterator-seq ?
16:50mpenethttps://www.refheap.com/paste/9293
16:50sveduboisdnolen: I have tried, but I doesn't work. I am doing something wrong... https://www.refheap.com/paste/9265
16:50mpenetwhat am I missing?
16:51mpenetis this a bug?
16:52mpenet,(type (dec (short 1)))
16:52clojurebotjava.lang.Long
16:52mpenet,(doc dec)
16:52clojurebot"([x]); Returns a number one less than num. Does not auto-promote longs, will throw on overflow. See also: dec'"
16:53skelternetmpenet: that surprises me.
16:53dnolenmpenet: dec only takes long
16:53dnolenlook at Numbers.java
16:53sveduboisHow I can use iterator-seq in https://www.refheap.com/paste/9290 ?
16:54mpenetdnolen: thanks I will have a look
16:54dnolenmpenet: actually it does take Number, but it gets the longValue
16:54mpenetdnolen: but still, this deserves a mention in the docstring
16:54mpenet:/
16:54skelternet,(doc compare)
16:54clojurebot"([x y]); Comparator. Returns a negative number, zero, or a positive number when x is logically 'less than', 'equal to', or 'greater than' y. Same as Java x.compareTo(y) except it also works for nil, and compares numbers and collections in a type-independent manner. x must implement Comparable"
16:55augustlsvedubois: I'd use doseq, that's a common way to iterate with side effects
16:56mpenetdnolen: is there an alternative that preserves the original type in core or should I just use (- x (short 1))?
16:56augustlsvedubois: (doseq [item (iterator-seq my-iterator] (when ...) (when ...))
16:56dnolenmpenet: not sure's if that true, Clojure as of 1.3.0 only really deals with 64bit arithmetic as far as I know.
16:56augustlmissing a ) there
16:56dnolenmpenet: if you look at Numbers.java you'll see what I mean.
16:56mpenetdnolen: ok
16:57lynaghkdnolen: hey dude, you have some time to chat about the latest core.logic bits?
16:58dnolenlynaghk: heya what's up?
16:58bordatouehi, when working with emacs and repl i have noticed that once a function is defined it remains loaded in the namespace even after the function is removed from the source . Any ideas on this issue
16:59lynaghkdnolen: sorry for being out of touch, I've been traveling for the past two months. Finally got a chance to check out core.logic 0.8.0 and start trying to use this new unification stuff
17:01lynaghkdnolen: I've been having a hard time figuring out how to actually put constraints on the lvars during unification---couldn't find any docs or tests and couldn't get the syntaxes we'd discussed (https://gist.github.com/4116442) workin
17:01ljosbordatoue: it is by design. If you want to remove a symbol from a namespace you can use (ns-unmap ns symbol).
17:01dnolenlynaghk: yeah sorry I haven't quite finished up that bit yet, but it's not much work
17:02ljosbordatoue: *ns* is the current namespace.
17:02lynaghkdnolen: oh, no worries. I wasn't sure where you were at and couldn't tell from the code---after a few hours of prodding around I thought I should find you on IRC and ask = )
17:03bordatoueljos: the problem is once a function is defined with wrong no of arguments then latter you change it to correct no of arguments the namespace in the repl seems to have reference to the wrong no of arguments
17:03lynaghkdnolen: is there anything I can help with? One thing I was trying to figure out is what exactly the relationship is between predicate functions and constraints. I.e., do I have to use `defc` to make toplevel vars, or can I somehow use anon functions in my constraints?
17:04dnolenlynaghk: yeah so I'm still planning on moving forward with what we discussed.
17:04dnolenlynaghk: you cannot use regular fns for constraints, since regulars fns don't do enough
17:04ljosbordatoue: I don't think so. Can you give an example?
17:05ljosbordatoue: if you do (defn f [a b] (- a b)) then (defn f [a] (- a)), (f 1) => -1.
17:07ljosbordatoue: the repl does not have a notion of a source file. It only know the input it recieves. If you remove something from a file that happens to be the input that the repl takes that should not affect the repl.
17:07lynaghkdnolen: shouldn't there be a way to macro-around that, since you can (defc A [x] (A? x))
17:07bordatoueljos i did it using mutimethods , please try writing a something similar to this (defmulti fun1 [x] (print x) x)
17:08bordatoue(defmulti fun1 [x y] (print x y) x)
17:08lynaghkdnolen: I was looking at the implementation to see what exactly was going on, but I couldn't make heads or tails...
17:08bordatouethis is causing problem in the repl on emacs
17:09bordatoueplease note i have relaced the first version of fun1 with the second version using two arguments
17:11ljosbordatoue: that there is not correct multimethod syntax. Did you mean (defmulti f (fn [x] (print x) x))?
17:11chico_chicotewhat is the standard way to do nlp in clojure?
17:12bordatouesorry, yes , basically define two functions one that replace other with different arguments
17:12ljosbordatoue: a multimethod and a function is not exactly the same, just so you know.
17:13bordatoue(defmulti fun (fn [x] (print x) x) ) this version is latter replace by (defmulti fun (fn [x y] (print x y) x))
17:14bordatoueljos: i know that , i am fininding that the repl is holding on the reference of previously definined multimethods
17:14dnolenlynaghk: a fnc macro would be useful - for creating anonymous constraints
17:15lynaghkdnolen: I can submit a patch today if you want it
17:16lynaghkdnolen: though I dunno if your dev plans involve modifying all of the existing constraint stuff
17:17lynaghkdnolen: I could also write up a bunch of usage tests against the API we discussed if that'd be helpful to run against while you're developing the implementation
17:18lynaghkbut yeah, I'm in San Francisco at the moment and several folks have been very excited about the grammar of graphics stuff, so I want to get the core implementation (including the core.logic pattern rewrites) nailed down sooner rather than later = )
17:18dnolenlynaghk: modifying what existing constraint stuff?
17:19lynaghkdnolen: a patch to split the defc implementation into two pieces, one piece of which is anonomyous constraints
17:19dnolenlynaghk: oh yeah, that would be awesome
17:20lynaghkdnolen: okay, I'll crank that out today.
17:20ljosbordatoue: what to do mean by holding on to? As in when you define new methods for the multimethod or that old methods still work?
17:23sveduboisHow I can write this java line in clojure?
17:23svedubois for ( int i = 0; i <= 10; ++i ) list.add( new FloatType( i ) );
17:23ljosbordatoue: could you post a complete example on https://www.refheap.com/paste with exlenation of what happens and what you expect to happen. I think I am a bit too engrained with this to know exactly what you are having problems with.
17:26mpenetchico_chicote: I dont think there is a standard way, if you are looking for a wrapper to one of the big java frameworks: there is clojure-opennlp. I used it, it's fine for some uses. If you need performance it will require some work though (lots of reflection warnings among other things)
17:27chico_chicotempenet: no native libs?
17:27mpenetchico_chicote: not that I am aware of, but I haven't looked into that for a while
17:28dnolenlynaghk: I'll definitely apply as soon as I get it - I'll try to find some time in the next couple days to wrap up the constraint interface on the unifier should be pretty simple. I'm also considering supporting :let, so you can name subexpressions
17:29mpenetprismatic made one I think, not open source (yet, or ever maybe, I can't remember)
17:30dnolen(unifier '(?x ?y) '(?z 1) :let '{?x (...)}) or something like that
17:30lynaghkdnolen: I'm getting back to PDX on Tuesday afternoon. Would love to do some pairing with you on this when you find the time---I can make room in my schedule
17:30dnolenlynaghk: sounds good
17:30lynaghkdnolen: I think we may be able to hash out a lot of stuff if we can just sit down and chat+code for a bit
17:31dnolenlynaghk: definitely. not sure if you know, but I'll be at Clojure/West, will be fun to hang in Portland
17:31dnolenlynaghk: oh and I think you know my friend Tims Gardner and some other people as well
17:31lynaghkdnolen: rad! Yeah, I met Tims at strangeloop
17:31dnolenlynaghk: do you know his friend David who recently moved to NYC?
17:32lynaghkdnolen: David Landsdown? yeah, I knew him at university
17:33sveduboisHow I can use (map inc (range 10)) to convert this java line? for ( int i = 0; i <= 10; ++i ) list.add( new FloatType( i ) );
17:34lynaghkdnolen: are core.logic master tests supposed to be passing? "mvn test" is throwing a lot of "no implementation of method runnable?..."
17:35lynaghkdnolen: also, datomic and the goog closure compiler are depending on different versions of the guava library, so anyone running lein-pedantic is going to have a hell of a time getting this core.logic lib workin'
17:35chico_chicotempenet: prismatic makes some great libs, i'll check it out, thanks
17:36dnolenlynaghk: yeah he built that crazy wooden toy thing for KickStarter right?
17:37dnolenlynaghk: tests passing for me, I'd make sure your environment is clean
17:37dnolenlynaghk: using 'lein test' anyway
17:37lynaghkdnolen: yep, I know all of those guys.
17:38dnolenlynaghk: core.logic deps are resolved through the pom not project.clj - datomic is not a part of the pom
17:39lynaghkdnolen: ah, got it. yeah, "lein test" works but "mvn test" throws errors.
17:39sveduboisIs this correct? (for [i (range 10)] (.add list (FloatType. i)))
17:41dnolenlynaghk: mvn test works for me too
17:42dnolensvedubois: do you really need an ArrayList? What about (for [i (range 11)] (FloatType. i))
17:46dnolensvedubois: you don't want to do it the way you had written it - for is a list comprehension not a for loop
17:46lynaghkdnolen: hmm, I'll keep poking around. strange that lein test works but mvn doesn't. Anyway, back later and/or I'll push a patch up my github core.logic fork.
18:16mjewkesHey all - I'm trying to connect to nrepl from emacs on win 8. I have a new project made from lein, and have it open in emacs. I run nrepl-jack-in, but I get: Could not start nrepl server: 'eval' is not recognized as an internal or external command
18:16mjewkesAnyone seen this before? google is unhelpful.
18:19amalloymjewkes: https://github.com/kingtim/nrepl.el/blob/master/nrepl.el#L1407 suggests nobody tried to make it work on windows
18:19amalloybut you can customize that var to something more useful
18:21mjewkescool :)
18:24bordatoueljos: please check this https://www.refheap.com/paste/9327
18:25bordatoueCould anyone check if there is any bug with the multimethod support in clojure on the repl
18:29Frozenlockbordatoue: careful with multi, defining it more than once in a REPL might bring trouble...
18:30bordatouei knew there would be something , where are these information provided Frozenlock
18:31FrozenlockI just learned it the hard way and asked wiser individuals here :P
18:31FrozenlockAs everyone know, documentation is Clojure's biggest problem.
18:32Frozenlockhttp://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/
18:32bordatoueFrozenlock: how did you know about the problem with multimethod, how did you resolve it , please don't tell me you don't define multimethod twice. What happens if you make an error
18:34FrozenlockWell... I don't define multimethod twice. Or I switch namespace. Perhaps (ns-unmap ns symbol) could work..
18:36bordatoueFrozenlock: consider while you are working on prototype and made some error while defining this multimethod are you saying everytime you do that you use ns-unmap
18:40bordatoueFrozenlock: such fun, with multimethod
18:43headshot"Only 5 respondents indicated that they target Java 1.5. I honestly expected that number to be much, much higher."
18:43headshoti find that an odd expectation
19:30a|iis http://clojure.github.com/ official?
19:31headshotClojure Source
19:31headshotClojure source code is hosted at github.com/clojure/clojure.
19:31headshotfrom: http://clojure.org/downloads
19:31a|iwhat is http://clojure.github.com/ ?
19:31a|iclojure libraries are indeed confusing.
19:32a|iwhy is that there is a data.xml and a clojure.xml?
19:32a|ia data.zip and a clojure.zip?
19:34headshoti'm puretty sure those are both the same
19:34headshotone's the project github front end, the other is the repo view
19:34a|iare they.
19:37a|iheadshot: they seem different.
19:38a|ihttps://github.com/clojure/data.zip/ says to use [org.clojure/data.zip "0.1.1"] dependency.
19:38a|iit has an xml-> function, while clojure.zip doesn't have that function.
20:04sgarrett|afkSo I upgraded to Lein 2.0 and I'm having trouble getting "leon midje" to work again. I added [midje "1.4.0"] and [lein-midje "2.0.4"] to my profiles.clj and now I'm getting this error: http://pastebin.com/DFtY8HBA
20:04sgarretts/leon/lein
20:07sgarrettAnyone experienced this issue before?
20:36skelternetI might just have to read http://clojure.github.com/clojure/clojure.core-api.html more often.
20:36durka42bathroom reading material perhaps? :p
20:37skelterneti just forget some of these gems are in here
20:47SegFaultAXDoes anyone know if delimitmate is compatible with vim-clojure-static?
20:48SegFaultAXBecause when I use vim-clojure-static, it stops automatically closing matched pairs (eg () "" {} etc)
20:55warzanybody know of a good example of using gen-class' constructors functionality? im using gen-class to subclass a java class, but i want to specify a custom class constructor function
20:55warzive been trying to comprehend this blog post: http://kotka.de/blog/2010/02/gen-class_how_it_works_and_how_to_use_it.html
20:55warzas well as the docs
20:56warzbut i guess im just not getting it
21:00a|iis clojure.xml/parse built on top of SAX?
21:00a|idamn.
21:01a|iisn't SAX one of the slowest java parsers?
21:01S11001001warz: 1. Just a sanity check: what is the subclass for?
21:01S11001001a|i: SAX is an API, not sure what "slow" means for it
21:01S11001001a|i: that is to say, it's an abstract interface
21:02sgarrettAnyone seen this error: http://pastebin.com/DFtY8HBA after installing Lein 2.0?
21:02a|iS11001001: so it's no the same SAX library that comes with java?
21:03S11001001a|i: it's whatever SAX library you have; SAX is seriously just an interface, you supply an implementation via configuration
21:03warzS11001001, it's a Minecraft server plugin, and actually to be honest I don't know if subclassing is what I'm doing. In Java, this would be an Annotation, which I'm not familiar with.
21:03warzI did figure out how to do it in Clojure, though.
21:03warzso really, I just need to create my own constructor.
21:03S11001001warz: so minecraft plugins are reflectively looked up by java class name?
21:04a|iS11001001: does the actual xml parsing happen in clojure, or does it call some external java library?
21:04S11001001a|i: if you supply an external java library, it uses an external java library; if you supply a clojure library, it uses clojure. I imagine it usually ends up using a java library, because no one wants to rewrite all that crap.
21:05a|iS11001001: I'm just using clojure.xml, what's the default implementation for it?
21:06warzS11001001, actually I'm sorry, I mispoke. These plugins have classes that in Java, implement an "Listener" class, which says hey this class is an event listener. They're categorized into various event groups. So, I've got a few of these using gen-class, for various event types in-game.
21:06warzIn instanciate them and register them elsewhere.
21:06warzBut when I instanciate them, I need to give them a reference to the main plugin instance.
21:07warzWhich is why I'm just trying to create a constructor.
21:07S11001001warz: if you are responsible for instantiating them
21:07warzyea, i am
21:07S11001001warz: you don't need gen-class, and should avoid it
21:07S11001001warz: what's Listener? interface, class?
21:08warzeven if they need to be called from Java-land? the Minecraft server is in Java.
21:08S11001001warz: yes, even then
21:08warzhrm ok, im new to clojure so this is all helpful to me
21:08warzListener is an interface
21:08S11001001warz: in that case, try using reify instead
21:09warzhere's my code here: https://github.com/ryancole/com.rycole.bukkit.mixpanel/blob/master/src/com/rycole/bukkit/mixpanel/listeners/block.clj
21:09warzyou can see sort of how i'm tryijng to get the construcotr going
21:09warzreify, hrm ok
21:10S11001001warz: when you need to subclass a class that is not an interface, proxy is available
21:10warzok, i need to do that as well
21:10warzfor another class
21:10S11001001well there you have it
21:10S11001001using these is much easier and much more convenient
21:10warzi was wondering why i thought i needed AOT, when i was providing clojure on the class path
21:11warzwhich seemed like i could just use clojure
21:11S11001001with reify and proxy, you won't :)
21:11warzok, i wont worry about this constructor issue then. ill just try rewriting this using those methods, and deal with it when i get there.
21:12warzlearn a lot on the way :P
21:15warzso when would you need gen-class, i guess?
21:16S11001001When Java or Scala code needs to be able to instantiate the class by name *and* it needs to subclass something that is not an interface.
21:16S11001001note that's *and*, not *or*
21:17S11001001so pretty much never
21:17warzhm ok
21:18S11001001you get classes by name with deftype/defrecord, and you get subclassing with proxy
21:18a|iwhat's a good way of adding a java jar dependency with lein?
21:19S11001001a|i: 1. find in maven 2. if not in maven, put it in 3. refer to it
21:28S11001001a|i: the system is explained here: https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#dependencies
21:29a|iS11001001: I hate maven.
21:29S11001001a|i: Leiningen isn't maven.
21:29a|iI want to use vtd-xml, which is not in maven repo.
21:30S11001001a|i: then read this: https://github.com/technomancy/leiningen/wiki/Repeatability
21:31FrozenlockIs there an implementation of the clojure's map {:a 1 :b 2} in emacs?
21:32S11001001Frozenlock: there are mutable hash tables in the stdlib, not sure if anyone's done treeish things
21:33FrozenlockYes, but I mean with the same functionality: map is a function of its key and vice versa
21:33SegFaultAXFrozenlock: There is no vice versa.
21:33S11001001Ah. No. Pretty sure you can't do that at all.
21:34SegFaultAXFrozenlock: Keywords look themselves up in maps, but that's a special case.
21:34S11001001well, I can think of how to do it for alists and plists
21:34S11001001you won't like it though
21:36cjfriszCan you do rest argument destructuring in ClojureScript?
21:37cljnewbLooking for a way to access previous element when using the map function.
21:38cljnewbFor example, if this element meets condition x, look at previous element to complete calculation.
21:38S11001001cljnewb: (map (fn [prev here] ...) (cons nil lst) lst)
21:40cljnewbS11001001: thanks - I'll try to understand what you've put here
21:41FrozenlockCould anyone link me to an explanation of sets? Seems all I'm using are lists, vectors and maps.
21:41cljnewbSo you're passing two seqs to map? The original, and the original offset by one?
21:41S11001001cljnewb: you got it
21:41cljnewbFrozenlock: sets may not contain duplicate values - think mathematical sets
21:41ChongLiFrozenlock: a set is essentially a map from keys to themselves
21:41ChongLievery key into a set returns itself
21:42ChongLithe primary job of a set is to test for membership
21:43FrozenlockOh I see. So an idiomatic example would be instead of writing a `add-to-list-if-not-present' function?
21:43ChongLisure, and many other things
21:44technomancyFrozenlock: there are no good associative data structures in emacs lisp
21:44ChongLibecause can effectively treat the result of calling a set on some key as true/false
21:44ChongLiyou can treat a set as a predicate
21:44technomancyelisp hash tables are a joke =\
21:44Frozenlocktechnomancy: but plist!
21:44a|ifor uploading a java jar to clojars, do I have to create project.clj?
21:44cjfriszTry this once again...Can you do rest argument destructuring in ClojureScript?
21:45dnolencjfrisz: yes
21:45technomancyFrozenlock: the fact that plists are actually the best choice in many cases tells you how sad things are
21:45dnolencjfrisz: all destructuring is supported
21:45FrozenlockChongLi: Oh right, I remember seeing this with as an example with `filter'
21:45cjfriszdnolen: damn...then it must somehow be *my* fault ;-)
21:45cjfriszdnolen: thanks
21:46technomancyFrozenlock: most elisp functions only work on lists too, so even something that should be as simple as using vectors means rewriting half your codebase
21:46Frozenlocktechnomancy: True... In my case it wasn't so bad, I only had 10s or 100s of elements, but that would never scale...
21:46technomancydon't get me started on the nightmare of lisp-2
21:46S11001001technomancy: just use the cl sequence functions :)
21:47hiredmantechnomancy: surely switching from lists to vectors just means switching from the elisp list module to the vector module
21:47hiredmancause of elisp's great module system
21:48technomancyhiredman: you could have a shining career ahead of you in comedy
21:48technomancyso the changes in clojure 1.5 to speed up multimethods only make a difference for concurrent calls to the same method, right?
21:49hiredmantechnomancy: hard to say, in theory uncontended locks are cheap, but that may just be theory
21:49dnolencjfrisz: doesn't work for protocol fns of course, but that's the case for Clojure too
21:50hiredmanhttp://mechanical-sympathy.blogspot.com/2011/11/java-lock-implementations.html
21:50hiredmanthe guy who did the thing
21:50cjfriszdnolen: right
21:50hiredmanthe lmax disruptor?
21:51cjfriszSpeaking of changes in 1.5, there was a "performance enhancement" that when-first only evaluates its argument once now
21:51technomancyhttps://www.refheap.com/paste/9363 <- sloppy benchmarking of clucy on a complete indexing run of the clojars corpus
21:51cjfrisz...I'm not crazy and that's a *correctness* issue, right?
21:52technomancy1.5.0 brings a 1-3s improvement on a 6 minute indexing run
21:53technomancyoddly enough the multimethod implementation is slightly slower but more consistent
21:54hiredmantechnomancy: have you tried with citerium?
21:54technomancyhiredman: nah; don't need anything beyond ballpark numbers
21:56loliveirahi, did I find a bug? (->> (range 10) (partition-all 3 0))
21:56hiredmaninteresting findings prefering ReentrantLock to synchronized there
21:56S11001001,(->> (range 10) (partition-all 3 0))
21:56clojurebot((0 1 2) (0 1 2) (0 1 2) (0 1 2) (0 1 2) ...)
21:56S11001001,(doc partition-all)
21:56clojurebot"([n coll] [n step coll]); Returns a lazy sequence of lists like partition, but may include partitions with fewer than n items at the end."
21:57hiredmanloliveira: step by 0? what behavor do you expect?
21:57S11001001loliveira: looks right
21:57loliveirahiredman: imo 0 is an invalid value to setp
21:57S11001001how come?
21:58hiredmanloliveira: ok, but what should it do?
21:58loliveirathow an exception?
21:59loliveiraS11001001: it freezes my repl. exiting only with kill
21:59dpickanyone know why sorting is so much slower in clojure vs. ruby? - https://gist.github.com/4704719
22:00technomancyshuffling an array is much cheaper than shuffling a list
22:00technomancyyou're measuring very different operations
22:00dpickI've tried without shuffling as well
22:00dpickthat was just a concise example
22:01cjfriszdnolen: Had an extraneous "apply"
22:01S11001001loliveira: you'll get that with any infinite seq where the repl doesn't apply a print-length, though
22:01cjfriszdnolen: Problem solved and cljs works as expected
22:01technomancydpick: simple microbenchmarks on a JIT VM typically aren't testing the JIt
22:02technomancybecause for it to start caring enough to optimize it needs to be convinced it's a hotspot worth optimizing; typically needs 10k+ iterations
22:02technomancysee criterium for an example of how to do it right
22:03dpicktechnomancy: that makes sense, but the use in my app is always ~10k elements
22:03dpickand I need a response time under 100 ms
22:03loliveiraS11001001: but why should anybody want step = 0? Am I missing something?
22:03dpickwould there be a better way to find top n elements?
22:04dnolendpick: by removing shuffling, and using a vector instead - shuffling takes about 6ms on my machine.
22:04S11001001dpick: heap, implemented as prioqueue in java.util
22:04dpickimplementing a heap seemed like overkill
22:04technomancydpick: you can certainly sort at least an order of magnitude faster in clojure than ruby; if your measurements suggest otherwise they probably aren't realistic
22:04S11001001loliveira: totality is strongly preferred in clojure fns, as well as equivalences
22:04dnolendpick: range take about 12-13ms
22:04dnolentakes
22:04dnolendpick: er I mean by moving shuffling out, and timing just sorting of course
22:05S11001001loliveira: asking for an exception there in the 0 case is kind of like looking for ##(doc iterate) to throw in the identity case, as partition-all is just a fancy iterate
22:05lazybot⇒ ------------------------- clojure.core/iterate ([f x]) Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects nil
22:05S11001001loliveira: welcome to clojureland btw :)
22:05hiredmandnolen: I imagine that also moves the lazy seq allocation out
22:06dpickalright, thanks for the advice
22:06dnolenhiredman: right, I never use shuffle, didn't think about the fact that it's lazy
22:06hiredmanshuffle isn't, but range is
22:07hiredmanan shuffle actually pours through and ArrayList I think
22:08loliveiraS11001001: thank you. =) i'm enjoying this new place.
22:19a|iI have src/foo.clj with ns foo and src/bar.clj with ns bar, when I import bar in foo, the repl cannot find ns bar.
22:32a|iis clojure-contrib completely deprecated?
22:33arkxa|i: most of it lives on as independent projects
22:34arkxSee http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go for more information.
22:34clojurebotdakrone maintains clj-http
22:34S11001001~contrib
22:34clojurebotMonolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
22:35S11001001:D
22:35arkxThis will be a recurring question as long as clojuredocs.org features Clojure Contrib prominently on the front page.
22:39a|ia lot older projects use contrib.
22:39a|iand it is not obvious what happened to each project.
22:39a|ieg, I'm not sure what happened to http://richhickey.github.com/clojure-contrib/duck-streams-api.html
22:39lazybotNooooo, that's so out of date! Please see instead http://clojure.github.com/clojure-contrib/duck-streams-api.html and try to stop linking to rich's repo.
22:40arkx"clojure.contrib.duck-streams mostly migrated to clojure.java.io"
22:42a|imostly?
22:43S11001001stuff that didn't belong was excluded
22:47cemericka|i: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
22:48cemerickoh, it's already been linked :-P
22:48a|ithanks anyway :)
22:48dnolena|i: completely deprecated
22:52Frozenlockhrmph.. is there a function to read a number ("1") without using the clojure reader and having to think about security?
22:53arkxInteger.parseInt? :P
22:53Frozenlocko_O
22:53Frozenlockdat java interop...
22:54Frozenlockarkx: thanks by the way :)
22:54arkxHehe, np
22:55arkxThe host platform is there to be embraced.
22:56Frozenlockarkx: Yes and no... tried the cljsbuild crossover option recently and was really pleased to reuse my code in both the jvm and js :)
22:56qzFrozenlock: have you managed to reduce its compiled size? hello-world taking 700k is a bit too much..
22:57warzS11001001, what if i need to instantiate a class by name and have that class inherit from another class, but my other classes do not, because im in charge of instanciating them?
22:57warzdo you need to use aot for all of the classes, or jsut that one?
22:58Frozenlockqz: 700k? That must be without advanced compilation... my whole cljs code fit into a 270kb js file.
22:58S11001001warz: just the one
22:58FrozenlockAnd it's really not a simple hello-world example...
22:59qzFrozenlock: yeah, without advanced compilation..
22:59FrozenlockOh in that case.. at simple compilation it fits in 2mb :)
23:00dnolenFrozenlock: wow, sounds like a sizeable CLJS app
23:00Frozenlockdnolen: not so big... I'm probably just bad at writting it.
23:02Frozenlockhttps://bacnethelp.com if you want to take a look. Every JS there is cljs (except for an external library).
23:03dnolenqz: the smallest footprint you will see w/ advanced compilation on hello world is ~100k, ~20k gzipped.
23:03dnolenFrozenlock: cool
23:07qzanyone uses lein repl? i'm unable to make arrow keys work there (last/next command choosing) - it thinks i'm pressing Ctrl+R instead of arrow..
23:09S11001001qz: try C-p/C-n instead of arrows
23:11qzS11001001: it worked. now i wonder why arrows do not work..
23:17kaoD,(range 10)
23:17clojurebot(0 1 2 3 4 ...)
23:26jonasendnolen: I added a patch that reverts CLJS-455
23:27dnolenjonasen: great thanks
23:34dnolenjonasen: btw, I think I finally have an idea how to do the structure matching on sequences you've been asking
23:45cjfriszWell, I drew a blinky light in a web browser
23:45cjfriszI'm gonna call that an achievement and go to bed
23:51TimMcCongratulations, you made a black triangle!
23:53durka42do we have any incanter pros in the house?