#clojure logs

2011-01-23

01:26technomancyso calling .read on a reader that's hooked up to a file or stdin will eventually return -1 for EOF. is there any way to get that effect for a reader hooked up to a socket? closing the socket just causes exceptions.
01:30zztrdo you close the output stream from the socket before closing the socket?
01:32technomancypretty sure; maybe I could double-check the ordering on that
02:33scoderaek: Thanks!
02:33scode(SOrry for the late ack :))
03:01jliyay clojure
03:02Zeiris_What are some really clutch use-cases for Clojure? Erlang has backend servers, Haskell has parsers, Ruby has Rails... What does Clojure excell at?
03:11Zeiris_(I want to use clojure a bit, but have really limited time, so I'd like to pick a project really well suited to the domain.)
03:44SergeyDhi. Does anybody know the url of that article that describes the drawbacks of Lisps, that inspired the creation of Clojure? I want to answer the opponent in the discussion, but can't find it
03:53hoeckZeiris_: clojure excels at a lot of things, for me the ability to hook into existing java apps/frameworks/libs is one of them
03:54hoeckZeiris_: so maybe there is some java lib that you wanted to play with and now can because you don't have to use java
03:54hoeckfor me that was at first jbox2d, processing and swing
04:40robonoboIs there a way to get the agent of the thread that sent the message?
04:44Zeiris_Ugh, I was afraid that was the answer... Java libs don't excite me, sadly :(
04:59hsaliakhas anyone had any luck using proguard to shrink clojure based apps ?
04:59bobo_Zeiris_: for me clojure excels as a multi purpose language. Id use it for most things.
06:29raekrobonobo: no. sends do not have to originate from an agent (any code can perform them). you could just pass the sending agent as an arg to the transition function: (defn do-something [state sender] ...) (send a do-something *agent*)
07:05fliebelmorning
07:09dedeibelmorning
07:19fliebelIdiomatic Clojure is slow :(
07:22fliebel&(let [v (doall (range 1e6))] (time (dorun (map inc v))))
07:22sexpbot⟹ "Elapsed time: 266.448622 msecs" nil
07:22fliebel&(let [a (java.util.concurrent.atomic.AtomicIntegerArray. (int-array (range 1e6)))] (time (dotimes [idx (alength v)] (.incrementAndGet a idx))))
07:22sexpbotjava.lang.Exception: Unable to resolve symbol: v in this context
07:23fliebel&(let [a (java.util.concurrent.atomic.AtomicIntegerArray. (int-array (range 1e6)))] (time (dotimes [idx (.length a)] (.incrementAndGet a idx))))
07:23sexpbotExecution Timed Out!
07:23mduerksen^^
07:24fliebelUhm, right… on my coputer, that is at least twice as fast as the map thing.
07:36fliebel,(let [a (java.util.concurrent.atomic.AtomicIntegerArray. (int-array (range 1e6)))] (time (dotimes [idx (.length a)] (.incrementAndGet a idx))))
07:36clojurebot"Elapsed time: 108.397 msecs"
07:37fliebelbotsnack
07:58dedeibelIf I see the difference between alter and commute correctly, for example a simple transaction that just adds an entry to a set, which does not care about it's order and without any conditions depending on the set itself, should rather use commute for the operation, since it will not cause the transaction to be restarted in case of a concurrent change. Right?
08:05raekcommute should be used when it doesn't matter whether anyone else has changed (altered or commuted) the ref during the transaction. this often implies that this ref is not affected by any conditions, i.e. it should be changed the same way no mattter what
08:10raekdedeibel: so: yes.
08:10dedeibelI guess would like to add that as a comment on the clojuredocs page :)
08:11dedeibelCan I kind of use your formulation for that? Should I cite you?
08:12raekit would be better two quote rich hickey, I think
08:12dedeibelwhat did he say?
08:12raekhe has explained this in some videos
08:13raek,(doc commute)
08:13clojurebot"([ref fun & args]); Must be called in a transaction. Sets the in-transaction-value of ref to: (apply fun in-transaction-value-of-ref args) and returns the in-transaction-value of ref. At the commit ...
08:14dedeibelWell, I think the docs are pretty sharp. They explain what it does. But sometimes a few more, maybe inaccurate, words help for the understanding.
08:14raekhttp://clojure.org/refs
08:15raekI'm looking for a more elegant formulation
08:16raekthe part about conditions in what I said can be slightly misleading if one of the branches causes an exception to be thrown
08:16dedeibelNow that I know what it is for, I think this one on the refs page is pretty good.
08:16raekso in my reasoning there, aborted transaction "didn't count"
08:17dedeibelyes
08:18dedeibelaltered ... "using a successful transaction" ... might be better
08:19edoloughlinAnyone know how to disable the warnings about functions from core being replaced when useing ?
08:19edoloughlin...using clojureQl.
08:20raekedoloughlin: (:refer-clojure :exclude (foo bar))
08:20edoloughlinThanks
08:26raekwhen using commute in transaction A, a concurrent transaction B that change the ref and finishes before A do will not cause A to restart
08:27raekis this is correct, #clojure?
08:27raekthe semantics of the STM operations can be a little tricky
08:31raekah, now I understand how it's implemented. the docstring for commute is pretty clear.
08:31raekthe function is applied twice
08:31raekfirst it changes the in-transaction-value at the place of call
08:32raekat the write point of the transaction, the in-transaction-value is discarded, and the function is applied to the current value of the ref and the result is stored back.
08:35LauJensenraek: You should really start writing manuals
08:37raek:-)
09:11fliebelI have a CQL question, although it might be just a general SQL question as well. Imagine the classic bank account in a tutorial, where someone checks his balance, and does a transfer. Meanwhile someone has retrieved money from the account, and the transfer fails horribly! Refs solve this nicely with transactions and all, but how is this solved in SQL and CQL?
09:33OlegYch|hfliebel: with transactions?
09:41Dranikhi all!
09:42fliebelDranik: Hi
09:42Dranikdo futures use a thread pool or they create as many threads as they are called?
09:43fliebelOlegYch|h: Right. I just read they're not in MySam, but they exist. Is there CQL syntax for them?
09:43fliebelDranik: I think they create threads, but I'll have to check that.
09:44Dranikfliebel, could you please have a look? Bcs I haven't found an answer in google
09:46raekDranik: yes, and yes. They use the same thread pool as send-off, which will create new threads when there are none available. when a task is done, its thread will return to the threadpool and be deallocated if it is not used within 1 minute.
09:47Dranikraek, wow, thanks!
09:47Dranikraek, btw, where did you found the answer?
09:48raekhttp://download.oracle.com/javase/6/docs/api/java/util/concurrent/Executors.html#newCachedThreadPool()
09:48Dranikohkaaaay.......
09:48raekI think I asked here some time ago... :-)
09:48Dranikraek, thanks :-)
09:48raek(the link was not the answer, just the docs for the kind of thread pool clojure uses)
09:50fliebelraek: Does that mean that launching 1000 futures will create 1000 threads, unless the first future has finished before the last one is created?
09:51raekfliebel: yes.
09:52Dranikis is possible to create a limited-size thread pool?
09:52DranikI'm developing a small multithreaded application for file searching (just for learning clojure)
09:52raekDranik: yes: http://download.oracle.com/javase/6/docs/api/java/util/concurrent/Executors.html#newFixedThreadPool(int)
09:53Dranikso what mechanism to choose? I guess -- futures?
09:53raekyou can submit clojure functions to it using the methods in http://download.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutorService.html
09:54raekthe name of 'future' in clojure is a bit confusing
09:54Dranikraek, thats java. is anything in pure clojure?
09:54raeka Future object is a "handle" for an asynchrounus computation
09:54Dranikyep. is any way to limit their thread pool size?
09:55raekDranik: re pure clojure, no: http://raek.se/java.util.concurrent.txt
09:55Dranikthanks
09:56raekthe java stuff is not broken, so you are expected to use it directly
09:56raeksimilarly to the situation of the string operations
09:56raekDranik: a Future object is something that the threadpool creates
09:57raekit's the ticket you get when you submit the job
09:58raekthe 'future' function in clojure does multiple things: creates an anonymous function, submits it to the 'send-off' pool, returns the Future object it got from it
09:58Dranikraek, so how one should use the Executors and futures together?
09:59fliebelAre there other areas in Java where 'good stuff' lives? java.util.concurrent is one of them, but I suppose there is more in Java 'done right'. java.lang.String and java.io come to mind(while there is clojure.java.io…)
09:59raekDranik: note that whenerever it says "Callable" or "Runnable", you can pass a clojure function of zero arguments
10:00Dranikraek, any clojure function or you mean "future"?
10:00raekfliebel: yeah, that's pretty much the "good parts" I have used
10:00raekDranik: regarding which of my utterances?
10:00fliebelDranik: Any function, with 0 arguments.
10:00Dranik... you can pass a clojure function of zero arguments
10:01raek(def pool (Executors/newFixedThreadPool 4))
10:01fliebelDranik: IFn extends from Callable and Runnable, IIRC.
10:02raek(def jobs (for [i (range 10)] #(println "hello " i)))
10:02Dranikfliebel, aha!
10:02fliebelhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/IFn.java#L17
10:02raek(def futures (seq (.ivokeAll pool jobs)))
10:02raek(map #(.get %) futures)
10:03Dranikraek, interesting...
10:03raekif you add a delay to each "job function", you should be able to see that it executes 4 at a time
10:03Dranikraek, thanks, that was helpful!
10:04raek(def jobs (for [i (range 10)] #(do (Thread/sleep 1000) (println "hello " i))))
10:04fliebelI wonder what DOODL, LOL and the like are for?
10:04raektoday is my begin-to-blog day. after I'm done setting up stuff, I will write a short post about this
10:05raekfliebel: I think that's interfaces for enhanced primitive support
10:05raeklike, "long invoke(double, object, object, double)" or something
10:06fliebelraek: Horrifying… But about the blog, what are you using?
10:06raekjust wordpress
10:06fliebel:(
10:06raekfliebel: any suggestions for something else?
10:07raekI just want something that is easy to maintain... .-)
10:08fliebelI guess WP is the dead-simple got-to do-all solution, but that doesn't mean I like it. Be sure to check out OStatus for Wordpress though ;)
10:10raekfliebel: will do
10:10DranikI use futures for fairly simple and fast funtion (just to test). The application works ok, but after the main functions is finished, it hangs
10:11Dranikis guess it's because there are some threads not killed which were started by futures
10:11Dranikhow to kill them?
10:11raekI guess I could roll my own bloggin system using clojure and ring, etc. but then I have one more project that I will never finish... :-)
10:11fliebelDranik: Since it uses the agent thread pool, look at that.. what was it...
10:12fliebelshutdown-agents
10:13Dranikfliebel, thanks, that helped!
10:14fliebelraek: My main problem is that I'm to cheap to buy a server that can do servlets, they tend to be a lot more expensive than shared PHP hosting.
10:18nlogaxraek: but nothing is ever finished, right? can still be fun and useful :D
10:20raekof course... :-) progress is not measured by number of finished projects, but number of started
10:24Dranikwhen I run a single-threaded application clojure creates 4 threads... why?
10:24DranikI don't use any concurrency their
10:24Dranik*there
10:24raekprobably the thread pool used by 'send'
10:24fliebelDranik: How do you measure? Java creates a dozen threads before I have done anything :S
10:24Dranikno way, I never use send there
10:24Dranikfliebel, why?
10:24raekI think it is created anyway
10:25Dranikok...
10:25fliebel16 currently, but I don't knwo why.
10:25fliebeland now 17, without me doing anything…
10:26raekDranik: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Agent.java#L48
10:27Dranikthanks
10:27Dranikbtw, I've just finished single-threaded and multithreaded find-file app. On average, the multighreaded works twice faster!
10:28raekI find it really interesting that the sources for Atom and Agent are not longer than they are
10:28DranikI've used futures for pattern matching will the main thread was searching for the rest of the dirs
10:30Dranikthank you all! bye!
10:32fliebelWhat would be the nicest way to generate XML(with namespaces) in Clojure?
10:34fliebelEnlive does not do namespaces, clojure.xml does no rendering, any other options?
10:35mrBlissfliebel: clojure.contrib.prxml
10:36fliebelmrBliss: No namespaces.
10:48shortlordhow can I "reload" used namespaces when I'm in a REPL?
10:48fliebelshortlord: (use :reload-all 'ns)
10:49shortlordfliebel: ah, thx a lot :)
11:04fliebelhrm, this is still the most sensible thing I found so far… http://ws.apache.org/xmlrpc/xmlrpc2/apidocs/org/apache/xmlrpc/XmlWriter.html There must be a better way.
11:11robonoboIs there a way I can find out why an agent failed?
11:12mefestorobonobo: (agent-error a)
11:13robonobomefesto: thanks
11:19raekrobonobo: since 1.2, you can also handle errors in a more convenient way: https://github.com/clojure/clojure/blob/1.2.x/changes.txt#L168
11:20fliebelHuh? Why is there an XMLHandler in clojure.lang?
11:27LauJensenWhy was the HTTP Agent lib deprecated in contrib?
11:30david`(= nil ())
11:30mrBlissfalse
11:30raek,(= (seq nil) (seq ()))
11:30clojurebottrue
11:31LauJensen,(= nil (seq ()))
11:31clojurebottrue
11:32david`is (= nil ()) one of the differences between common lisp and scheme?
11:33david`in other words, is clojure a scheme branch of lisp?
11:33david`,(= nil ())
11:33clojurebotfalse
11:34david`or wait, it's a common lisp branch
11:34david`in common lisp () == NIL
11:35fliebeldavid`: Clojure is a lisp 1 and an empty seq is not false or nil. I don't htink it's a branch of either scheme or common lisp.
11:39david`fliebel: I see, thanks
11:41david`i guess branch was the wrong word. from wikipedia: It is usually referred to as the Lisp-1 vs. Lisp-2 debate. Lisp-1 refers to Scheme's model and Lisp-2 refers to Common Lisp's model.
11:42fliebelStill no decent SAX parser/serializer pair. xerces looked nice, until I noticed its last release was 10 years ago…
11:43WarrenForeignI'm trying to replace some java code that uses spring constructor injection using annotations with a clojure defrecord
11:43WarrenForeignAnnotating the constructor parameters is working fine
11:44WarrenForeignIs there a way to annotate the constructor itself?
11:44WarrenForeign@Autowired
11:46LauJensenWarrenForeign: https://groups.google.com/group/clojure/browse_thread/thread/d2128e1505c0c117
11:47WarrenForeignThanks!
11:49WarrenForeignRich says there fields, methods and types
11:49WarrenForeignI know constructor and method parameters are working too
11:50WarrenForeignWhat about the constructor itself?
11:59Licenseris there any secret trick to make sessions work in ring?
12:01Licenseryes there is
12:07robonoboraek: nice find
12:10robonoboI didn't know about the git add --patch thing. Very cool.
12:25gfrlog,(-> partial partial partial partial partial)
12:25clojurebotjava.lang.IllegalArgumentException: Wrong number of args (1) passed to: core$partial
12:28peregrine81I have a record. I am trying to modify the record using (update-in record [:key] function)
12:29peregrine81I keep getting the error java.lang.IllegalArgumentException: Key must be integer (NO_SOURCE_FILE:0)
12:29gfrlog,(doc update-in)
12:29clojurebot"([m [k & ks] f & args]); 'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new...
12:31gfrlog,(update-in ["a" "b" "c" "d"] [:not-an-int] identity)
12:31clojurebotjava.lang.IllegalArgumentException: Key must be integer
12:31gfrlogperegrine81: So is it possible part of your record is a vector when you're expecting a map?
12:32peregrine81my record contains only booleans
12:32peregrine81no vectors
12:32gfrlogcan you give an example expression that produces the error?
12:33peregrine81 lemme get a pastie
12:33shortlordwould you rather use (epxr1 (expr2 (expr3 (expr4 coll)))) or (-> coll expr4 expr3 expr2 expr1) or ((comp expr1 expr2 expr3 expr4) coll) in most cases?
12:33gfrlogshortlord: I think the arrow is the cool one
12:34gfrlogthe first one is definitely the worst
12:34gfrlogarrow is also more flexible -- can be used with functions of more than one argument
12:35shortlordgfrlog: ok, thx, I'll use the arrow then
12:35peregrine81gfrlog: http://pastie.org/1490331
12:35peregrine81this code get a different error
12:36peregrine81sigh :)
12:37gfrlogone thing that's usually helpful to me in this kind of situation is to hack away at the sample code until you get to the simplest piece of code that still produces the error
12:37peregrine81yea I'm working on that one
12:39gfrlogperegrine81: on a hopefully unrelated note, can't your "[(get x 0) (get x 1)]" expression be simplified to just "x"?
12:41peregrine81gfrlog: yes, yes it can :)
12:41gfrlogI love it when I find out I can delete half my code and it still does the same thing
12:42peregrine81now the error is comming from my (update-in (make-board) [1 4] [] #( %))
12:42gfrlogwhat's the reason for the empty vector there?
12:42peregrine81well I just want to update the entire record
12:43peregrine81so I don't need to get the propery
12:43peregrine81oops
12:43peregrine81dug
12:43peregrine81duh*
12:44gfrlogthe constantly function would probably work well for you
12:44gfrlogin case you were about to write something like (fn [_] x)
12:45gfrlog(doc assoc-in)
12:45clojurebot"([m [k & ks] v]); Associates a value in a nested associative structure, where ks is a sequence of keys and v is the new value and returns a new nested structure. If any levels do not exist, hash-maps will be created."
12:45gfrlogfor that matter, it looks like assoc-in is simpler than update-in when you're ignoring the old value
12:45peregrine81really?
12:46peregrine81that works on records also?
12:46gfrlogprobably
12:46gfrlogI think records are just optimized maps
12:48peregrine81ok
12:49peregrine81well no more cryptic issues, assoc-in/update-in are both not doing what I expect
12:49gfrlogyou've got a 2D vector and you want to change one of the values, is that a fair summary?
12:50gfrlogoh wait
12:50mefestoperegrine81: is this part of yesterday's thing?
12:50gfrlognot quite a 2D vector
12:50peregrine81nope. I've got a 2d hash map. I want to change the value associated with key, which is a percept. I want to update one of the properties in the record
12:50peregrine81mefesto: Yes :)
12:51gfrlogso there are two basic ways to do a grid, and my next hasty thought is that you're mixing them up
12:51mefestoperegrine81: ok the board is immutable as well so you either need to generate a whole new board on each change or make each "cell" a ref/atom
12:51peregrine81mefesto: doesn't update-in return a new board everytime
12:51peregrine81i mean return a new map/record
12:51mefestoperegrine81: yeah, are you storing the current state of the board as a ref somewhere?
12:52peregrine81mefesto: nope. I'm just passing around new versions of the board
12:52peregrine81mefesto: at least thats the idea
12:52mefestoperegrine81: ok can you pastie an example?
12:53mefestoperegrine81: if i remember correctly it should look something like: (assoc-in board [[1 1] :field-name] value)
12:53peregrine81mefesto: http://pastie.org/1490331
12:53peregrine81that should have everything
12:54gfrlogperegrine81: so the keys of your map are coordinate pairs, right?
12:54peregrine81gfrlog: yep
12:54gfrlogso why not just use assoc?
12:54gfrlogassoc-in and update-in are only for nested structures. I don't think yours is nested. Not the board at least
12:54peregrine81gfrlog: okay
12:55mefestothe board is a map of records
12:55mefestoso maps in a map
12:55mefestothe first key is the coordinate, the next is the field of a record at that coordinate
12:55gfrlogokay
12:55gfrlogso yes, assoc-in should work for that
12:55mefesto(assoc-in board [[1 2] :stench] true)
12:55gfrlogright
12:56gfrlog,(assoc-in {[1 2] {:stench true}} [[1 2] :stench] false)
12:56clojurebot{[1 2] {:stench false}}
12:56peregrine81wow
12:59peregrine81I now understand update-in
12:59peregrine81thank you both so much again
12:59mefestonp
13:00gfrlog,(println "no prob")
13:00clojurebotno prob
13:00peregrine81still getting my mind around the whole functional/immutable thing
13:00peregrine81doing my class assignments in clojure is a good way to force myself :)
13:08__name__hi
13:08__name__is there a builtin infinite seq that just counts?
13:08__name__(0 1 2 3…)
13:09LauJensen__name__: (range)
13:10fliebel__name__: Coming from Python?
13:10__name__yes
13:11Scriptorshould be --name-- :)
13:11__name__huh?
13:11Scriptorjust joking
13:12Bronsain lisp
13:12Bronsathw convention
13:12Bronsa*the
13:13pdk(iterate inc 0)
13:13pdk,(take 10 (iterate inc 0))
13:13clojurebot(0 1 2 3 4 5 6 7 8 9)
13:13Bronsa,(take 10 (range))
13:13clojurebot(0 1 2 3 4 5 6 7 8 9)
13:13pdkOR THAT
13:14raek,(range 10)
13:14clojurebot(0 1 2 3 4 5 6 7 8 9)
13:14Bronsalol
13:15__name__now i just need to make a string from a list of characters
13:15raek,(seq "hello")
13:15clojurebot(\h \e \l \l \o)
13:16raek,(apply str (seq hello))
13:16clojurebotjava.lang.Exception: Unable to resolve symbol: hello in this context
13:16raek,(apply str (seq "hello"))
13:16clojurebot"hello"
13:17jamiltronAre your chars being packed in a list of escaped characters?
13:18LauJensenpdk: No need to promote (interate inc 0) when I had just shown him (range)
13:19jamiltronif you have a list of escaped chars (i.e. '(\h \e \l \l \o)) you can string it together with
13:20jamiltron,(apply str '(\h \e \l \l \o))
13:20Bronsa19:16:14 < raek> ,(apply str (seq "hello"))
13:20clojurebot"hello"
13:25shortlordin the case that I'd like to dispatch a multimethod on the passed value istelf, it is better to just build one big normal method and use 'case' inside that method than to use the identity function as a dispatch function, right?
13:25clojurebotfunctions are maps
13:25__name__can clojure do partial application?
13:27LauJensen,((partial + 1 2) 3)
13:27clojurebot6
13:28LauJensen,(#(+ 1 2 %1) 3)
13:28clojurebot6
13:30devn,(#(+ 1 2 %1 %2 %3) 1 2 3)
13:30clojurebot9
13:30__name__,(#(= %1 %2) 1 2)
13:30clojurebotfalse
13:30__name__,(#(= %1 %2) 1 1)
13:30clojurebottrue
13:31devnwhat is the highest you can go with %1, %2, etc.? Isn't there a limit of like 20 or something?
13:31__name__thanks LauJensen
13:31LauJensendevn: 42? :)
13:31devn:) -- I guess we could give it a try...
13:32__name__,(#(+ %42 1) 1 2 3 4 5 6 7 8 9 10 11 12 13 15 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 15 15 16 17 18 19 20 21)
13:32clojurebotjava.lang.Exception: Can't specify more than 20 params
13:32__name__here we go
13:32devnthere it is :)
13:32LauJensenHow cheap :)
13:33__name__i want my money back :(
13:33devnI was actually typing out %1 through %21
13:33devnYou're smarter than me.
13:33LauJensendevn: You can do it automatically with a keyboard macro
13:33devnHeh, of course you can!
13:33devnnice to cycle buffers with
13:34LauJensenC-tab? painful combo
13:34devnnot for me -- i have my caps lock as control
13:34LauJensenYea me too - Which puts them right next to each other
13:35devni move my hand and use my index + pointer, or middle + ring finger
13:35devni kind of like its placement, personally
13:36LauJensenk
13:37devnactually now that im using it i find it is nice to hold my thumb down on Control and then just tap TAB as necessary
13:37devnYMMV
13:38LauJensenMMDV
13:41devn:D
13:41devnLauJensen: it's not really all that useful anyway
13:42devnit would be nice if I could limit it to files which live under the current project
13:42devni dont care to cycle to my loaddefs or *Messages*, etc.
13:42LauJensendevn: 'psycho' was actually working on a emacs mode for that called scopes. Dunno if he finished it
13:57fliebelHi devn! Just curious if there is any news abut your "secret" Utterson successor. I keep running into Clojure bloggers who are using Wordpress… I am secretly planning a conspiracy against Wordpress now. (I'm stukc at finding a decent SAX parser)
14:07DeranderLauJensen: that's an interesting idea
14:22mefesto(assoc-in {} [:session :history] [1 2 3])
14:22mefestodoh, wrong window :-\
14:24Raynesmefesto: Did you get my mail?
14:24mefestoRaynes: no but was it about tryclojure update?
14:25Raynes/msg sexpbot mail
14:25mefestowhen i got back home i updated my repo and it worked
14:25RaynesYeah, I forgot to remove some references to clj-sandbox when I removed the dep.
14:25mefestoRaynes: i've been playing with the code since and thinking about tackling the interactive tutorial
14:25fliebelRaynes: What happened to clj-sandbox?
14:26Raynesmefesto: You'd be my hero.
14:26Raynesfliebel: Nothing. I'm just using clojail now. Nobody really maintains clj-sandbox anymore.
14:27fliebelRaynes: Ah, I was confused. Clojail is what you made?
14:27RaynesYes.
14:27RaynesIt's I and amalloy's project.
14:30fliebelSad that IRC is not XML based, otherwise you'd undoubtedly be able to point me at a great way to parse and generate namespaced XML. After second thought. I'm happy that IRC is not XML based. I wonder why RSS is XML based… :(
14:31RaynesXMPP is XML based.
14:32fliebeltrue
14:35fliebelI'm thinking it is a good idea to write an XML DSL, like Hiccup, on to of Xercus.
14:37fliebel:namespaced/xml is going to be less of a pain that way :)
14:37wolverianooh, clojail. that will be useful.
14:52chousercounted-sorted-sets (from clojure.data.finger-tree) support inserting items only in sorted order, but you can then pull items off of either end
14:54chouservia first/rest on the left and peek/pop on the right
14:54chouserthat is, ISeq and IPersistentStack
14:55chouserThis is the wrong forum for this, isn't it.
14:56fliebelchouser: It sounds interesting though :)
14:56chouseremail would probably be better
14:57LauJensenchouser: How's performance coming along?
14:57chouserI think ISeq should perhaps not inherit Sequential
14:58Licenser*shakes his fist at enlive*
14:59Licenserit is cool but it has this horrible tendencie to just die in the middle of something without telling you what went wrong
14:59fliebelchouser: What is wrong with sequential?
14:59fliebelLicenser: NullPointerException?
15:00LicenserNo clue it just dies :P
15:00chouserfliebel: counted-sorted-set belongs in the "set" equality partition, not the sequential or map partition
15:00Licenserthe html page shows half filled and then just ends
15:01chouserfliebel: but if it implements ISeq and ISeq inherits Sequential, then if you call equals on a vector, it will be willing to consider itself equal to a counted-sorted-set
15:03fliebelchouser: It sounds pretty natural that a seq(uence) is sequential. *browsing source code*
15:05chouseryeah, it does, doesn't it.
15:06fliebelchouser: So maybe your question should be if first/rest should be on ISeq or if ISeq is the correct protocol for a non-sequential collection.
15:07Licenserhmm can enlive snipents be used recursively?
15:08fliebelLicenser: I think so… I'd try removing transformations until it starts working again.
15:09LicenserI know what transformation breaks it, sadly
15:09LicenserI've a defsnippet X that calls X within a clone-for
15:10Licensercalling X with the input clone for gives it also works
15:11fliebelDid you try stupid things like calling Y instead, (declare X) beforehand, do #'X or...
15:12Licensernot a bad idea
15:13Licenserugly solution: copying the defmacro calling it Y then calling Y from X works fine :P
15:13fliebelWelll.
15:14Licenserbut only for 1 recursion deepth, calling X from Y again does not work
15:14LicenserI think I should make a bug case here ^^
15:15Licenserbut calling Y from Y works o.O
15:15fliebelLicenser: paste?
15:15Licensersure
15:17Licenserhttp://pastebin.com/QbeFQg7d
15:17Licenserit is odd
15:18fliebel(= list1 list2)?
15:18Licenserthe code is exactly the same yes
15:18fliebelLicenser: You realize there is a snippet as wel as an argument called list?
15:18LicenserI just coppied list to list2 then replaced the call to list in L17 to list2 and it started working
15:19Licenserew
15:20Licenserhttp://pastebin.com/up7vbeGD <-fixed
15:20fliebelSo, why not kill list2 altogether?
15:21Licenserbecause it stops working then -.-
15:22Licenserwaaaait
15:22Licenseryou are a genius fliebel
15:22Licenser:)
15:24fliebelLicenser: Lets put it this way: I've dealt with the same problem before, and before… AND before. So I'm not sure if I'm a genius, or a someone who takes a while to learn from his own mistakes.
15:24Licenser^^
15:24SomelauwIs clojure 1.1 outdated?
15:24fliebelSomelauw: Yes
15:25shortlordshould the arguments in a function definition always be put into the next line or is it ok to keep them on the same line of the function name, if no doc string is used?
15:25SomelauwIs there a way to make sure I always have the newest version of clojure installed?
15:25fliebelSomelauw: How did you install it?
15:25Somelauwunder ubuntu
15:25SomelauwI probably used aptitude.
15:26hiredmanthe clojure runtime is a jar, "installing it" system wide is just weird
15:26hiredmanyour build tool will grab the right version for your project
15:26raekSomelauw: it's very common (if not the norm) to use leiningen or cake to fetch the correct clojure version on a per-project basis
15:30SomelauwThen I will install leiningen
15:32raek~lein
15:32clojurebotlein is http://github.com/technomancy/leiningen
15:33fliebelshortlord: I do that all the time. Only with a doc it becomes ugly.
15:33fliebel~cake
15:33clojurebotcake is http://wondermark.com/030/
15:33fliebelhuh?
15:34raekhaha
15:34SomelauwBut what is wrong with installing clojure system wide. I mean python and gcc are installed system wide as well?
15:35raekwhen you need a server running, you often use something like python's virtualenv to freeze the python and package versions anyway
15:35fliebelSomelauw: Python invented virtualenv to solve that problem.
15:35raekSomelauw: if you want a global installation, irclj can do that
15:36fliebelCake also has a global project ;)
15:36raek*ljr
15:36raek*cljr
15:37raek(irclj is the IRC lib that sexpbot uses; I'm too used to type that name)
15:37Raynescake can do pretty much anything that cljr can do now and more.
15:37fliebelHow can I tell Clojurebot that Cake is ninjudd's
15:37RaynesEven the searching clojars stuff.
15:37fliebel?
15:37fliebelcake search?
15:37Raynesfliebel: You can't. Apparently hiredman has it blocked or something for whatever reason.
15:37raek~cake is https://github.com/ninjudd/cake
15:37RaynesNot surprising.
15:37clojurebotIk begrijp
15:37SomelauwAre cake, lein and cljr very similar?
15:38raekI have got the impression that for most basic task, they are 100% interchangeable
15:38Raynesfliebel: I added search functional and stuff based on David Liebke's code not so long ago.
15:38Raynesraek: That doesn't really apply to cljr.
15:38Raynescljr is built on leiningen for entirely different purposes.
15:38raekoh, yeah. that's true.
15:38SomelauwIs lein like make?
15:39raek(my utterance was re. cake and lein)
15:39Raynescake is more like make than lein.
15:39RaynesIn that cake is dependency-based.
15:39fliebelIn name at least...
15:40raekbut yeah, both allow you to do perform build-related tasks, dependency management and launching a repl
15:40raekwhen you start to make your own tasks, that's when they start to be different
15:41raekRaynes wrote an introductionary blog post about these things
15:41Somelauwlink?
15:41clojurebotyour link is dead
15:41raekhttp://blog.raynes.me/?p=48
15:42Raynesraek: And the vast majority of an entire chapter of my book is dedicated to teaching cake, so that'll be useful.
15:42david`Raynes: which book?
15:42Somelauwthanks
15:42raeksome history: http://blog.fogus.me/2010/11/30/take-6-justin-balthrop/
15:42SomelauwThe link is dead (temporarily?)
15:43raekstrange... works for me
15:43RaynesWorks for me as well.
15:43jamiltronRayne's blog? Its working for me.
15:43Raynesdavid`: http://blog.raynes.me/?p=94
15:43SomelauwIt's working again.
16:20edoloughlinAnyone know how to diagnose a 'java.lang.RuntimeException: java.lang.NullPointerException' in a namespace declaration? https://gist.github.com/792443
16:22tonylI don't know about this much, but have you tried it with 1 require instead of 2
16:23peregrine81is there a good way in clojure/java to print a table in the console?
16:24edoloughlintonyl: I don't think the problem is actually on that line as I've only made one change since it last worked. My issue is that there's no stacktrace to diagnose the root cause.
16:27dnolenedoloughlin: the exception is coming from user.clj, are you using that file to do some global config stuff?
16:28pdk(doc spit)
16:28clojurebot"([f content & options]); Opposite of slurp. Opens f with writer, writes content, then closes f. Options passed to clojure.java.io/writer."
16:28pdk(doc slurp)
16:28clojurebot"([f & opts]); Reads the file named by f using the encoding enc into a string and returns it."
16:31edoloughlindnolen: No. It's just db access.
17:02peregrine81I feel like this should be easy, combine list of lists into single list? ((1 2) (1 2)) => (1 2 1 2)
17:04chouser(apply concat stuff)
17:04__name__(apply concat)
17:04__name__*(apply concat …)
17:05peregrine81thanks chouser! love your book btw :)
17:05chouserperegrine81: thanks!
17:52emmaHi everyone. I'm new to the whole IRC, so I'm not sure what the etiquette is.
17:52emmaI have a question I've seen asked about in varying degrees on the Google group
17:52emmaAbout the overhead in lazy-seqs.
17:53arohneremma: just ask. maybe someone will know
17:53arohneremma: we're mostly a friendly bunch :-)
17:53emmathanks! :)
17:54emmaI'm checking out the Project Euler stuff and am trying to write a sieve for prime numbers
17:54emmaand I'd like to just discard each previous computation - maybe make this more like a generator?
17:54emmabut I'm not sure how to do it without mutable state
17:55emmaIt's definitely blowing the stack at large numbers
17:55arohnercan you paste the code? use gist or pastie or one of those
17:56emmaHere is my integer stream: (def integers (letfn [(k [n] (lazy-seq (cons n (k (inc n)))))] (k 1)))
17:57arohnerah, you're holding on to the head
17:58arohnerintegers has a reference to the head of the list. The GC can only collect items in the list that have no references
17:58emmamy primes function looks the same
17:59emmaso would it be better to just pass along the rest of the list?
17:59arohneryes
17:59emmasweet
17:59emmathanks!
18:38jlihurray clojure. I finally wrote the silly little program for automatically trying to renew my library borrows. I never got around to it because Haskell, OCaml, Common Lisp, ... didn't seem to have great HTTP client libraries, but HtmlUnit worked well for me
19:03zakwilsonUsing Ring, I want to get a list of existing sessions from the repl. Is this possible?
19:21shortlorddo you know any SLOC count tool that recognizes clojure code?
19:26tonylwhat about just counting lines
19:26tonylwc -l core.clj
19:27tonylu can use grep to strip comments
20:27phenom_hey folks, for some reason technomancy's starter kit isn't loading up for me
20:28phenom_i removed my .emacs and .emacs.d file and folder, created a new .emacs.d directory and moved the starter-kit in there
20:30dnolenlogos.minikanren gets copy-term, soft cuts, committed choice and project. The full power of Prolog in Clojure? unsure, but next up, pattern matching ...
21:14dnoleninteresting, logos.minikanren now solves zebra nearly as fast as swi-prolog.
22:22mreynoldsCan someone point me to how 'doc' works with multi-methods? I'm using a library where it's rather important to know all the options and I'd like to add proper docs, but am not sure how to best provide the extra info
22:37pdkmreynolds
22:37pdkiirc you can add them to the defmulti form
22:37pdksince you're always writing (defmulti blah (fn [args] ...))
22:37pdkyou can stick the docstring in the fn probably
22:38pdkohh wait
22:38pdkfailing that try putting the docstring after the name in defmulti
22:40mreynoldsI'll give that a shot. I was hoping for a way to put them on the defmethod and have doc intelligently display them, but I haven't gotten that to work yet.
22:40mreynoldsThanks
22:42pdki'd be surprised if it did it per method
22:53brehautcan macros have multiple arities
22:54chouserbrehaut: yes
22:54brehautchouser: cheers :)
23:39mefestoping raynes