#clojure logs

2009-12-04

00:03technomancyso how many are at the bay-area clojure meetup tonight?
00:06alexykbtw, perl also got a repl, it's called re.pl
00:07alexykDevel::REPL, if anybody needs a real repl in perl
00:07alexyknow back to clj :)
00:09alexyktechnomancy: are you not near Boston, per blog?
00:18technomancyalexyk: nope; seattle
00:19alexyktechnomancy: ah nice, I used to be there, and hope to be back. :)
00:20technomancyif I ever start a Seattle Clojure group, I'm going to be very tempted to name in Seajure
00:20technomancyjust to emphasize how tired I am of *jure names. =)
00:21alexyktechnomancy: there's a seafunc already
00:22alexyksoup du jure :)
00:25piccolinoCan someone help me understand exactly what the "test" is in the docs of if-let?
00:26somnium ,(if-let [x (* 2 42)] x)
00:27somnium ^^ test
00:28piccolinoThe test is (* 2 42)?
00:29somniumits a shortcut for (if (... expr ...) (let [x (... expr ...)] ...
00:30piccolinoHm, OK, I think I see.
00:30piccolinoThanks.
00:37piccolinoSo if there's more than one binding?
00:39somniumnot supported by if-let, though an and-let macro isnt too hard (I have one somewhere)
00:39piccolinoAh, OK.
00:39piccolinoThe doc uses the word "bindings," so I wasn't sure.
00:43somniumyou can destructure in one binding I guess
00:43somnium,(if-let [[x & ys] (range 5)] ys)
00:43clojurebot(1 2 3 4)
00:44technomancyseafunc hasn't happened since like july =(
00:50alexyktechnomancy: leiningen sounds very similar to Lenin. That'll be my Russian alias for it. :) Building the New World.
00:50alexykthe working monads
00:51alexykha! incanter has a project.clj. Time for lein?
00:53alexyktechnomancy: so the very first lime I have to build lein with ant, correct?
00:53alexyktwbray: I've asked Maurice Herlihy about WF, and he promised to read about it!
00:53liebkealexyk: that project.clj is a work in progress, we're in the process of adding a javac task to Leiningen, so it can compile Incanter's single Java class. I do use Leiningen for building applications with Incanter, just not for building Incanter itself (yet)
00:54alexyk& about Clojure, too.
00:54alexykliebke: ah ok, so ant then, right? or how will it get all the deps?
00:54liebkeant deps
00:54alexykliebke: kinda silly when I have a maven handy, but ok then
00:55twbrayalexyk: WF isn't really at Herlihy's level, it's an engineering not a CS thing. But anyhow, cool.
00:56liebkeI just don't want maven to be a requirement for building Incanter
00:56alexyktwbray: I think WF is really the best thing in years which happened to concurrency. Working-class concurrency is the future, not theory or HPC. So theoretician should serve the working people of concurrency and analyze it! :)
00:57alexyktwbray: all the solutions exercise the cutting edge. In fact, you ought to write an O'Reilly *book* on WF. :)
00:57alexyk...with all code, analysis, and essays from the original blogs, before they disappear.
00:58alexykliebke: so is ML code from FlightCaster already in, or just promised?
00:59alexykhuh, leiningen has no build.xml, just a project.clj...
00:59liebkeIt's in, but more will be coming. Here's a very brief description of what's there now: http://incanter-blog.org/2009/12/03/flightcaster/#comment-132
01:01alexykliebke: brilliant
01:03alexykliebke: http://cloud.github.com/downloads/liebke/incanter/deps-1.0.zip to /s/w/clojure/incanter/deps-1.0.zip error 403, forbidden.
01:03alexykant deps failed
01:03liebkecrap, thanks
01:08alexykliebke: so which stats degree did you get to understand the ESL book? :) I'd like to do the same, but am in academia and ML courses may be enough...
01:09liebkeI picked up a master's in statistics, but that might be excessive if you just want to understand EoSL :)
01:10liebkeokay, ant deps should work now, I uploaded the deps file with the wrong name
01:11alexykliebke: I actually have a pause on classical statistics in the form of "who cares," despite many books and a few courses, seem to prefer ML/data-mining which requires software engineering and data engineering. Still remains to be seen what a good balance is. Bishop's book is the best so far.
01:12alexykok ant deps is cooking
01:12liebkeclassical statistics is very useful, although I prefer bayesian methods, simulation, and ml approaches
01:12liebkebishop's book is good
01:13alexykliebke: I'd say EDA is enough, then ML. Need to see classical statistics cast in massive data scenarios to appreciate...
01:15liebkehaha, well I guess it depends what you're trying to do. Day to day work in science depends on classical statistics
01:19alexykliebke: my science is massive web/twitter data mining... brute-force classifiers will do :)
01:21alexykok got myself an incanter! :) now need to launch it somehow...
01:21technomancyliebke: did you have to use flash to upload to the files section of github, or is there another way?
01:21alexykliebke: can I use my own clojure driver instead of bin/clj? I set various java flags
01:24liebketechnomancy: I didn't realize that the downloads page on github uses flash. I don't know of another way to do uploads though
01:24technomancybummer
01:24technomancyI wanted to upload some files, but I'm not about to install flash just to do that
01:24technomancyoh well... I have my own server. =)
01:24liebkealexyk: sure, you can use any driver you like. bin/clj just sets the classpath to include the dependencies
01:25alexykliebke: how should I try the examples/<something>.clj from the running repl?
01:27alexykah ok, it just runs all plots! a wait for <enter> would help :)
01:28alexykha, apparently you can drag the plots to scroll!
01:29alexyktechnomancy: are you in the RMS school of thought? :)
01:30alexykno flash evar? :)
01:33technomancymy browser hasn't crashed in years, I'm not about to start for a lousy file upload
01:34technomancyflash is such a disaster
01:35alexyktechnomancy: you can get a second browser just for that :) I use safari for idle pursuits, firefox for delicious-able ones
01:35technomancyyeah, but that would involve using the mouse
01:36alexyktechnomancy: ah! :) are you running the xmonad for window manager?
01:38technomancyno, but I should
01:38technomancyI'm using devilspie+metacity. it gets the job done but is not exciting.
02:08alexyksomnium: insomnium? :)
02:11somniumalexyk: heh
02:12alexyksomnium: I wonder why I can only store java.util.Date but not joda-time
02:12alexykis it due to mongo-java-driver?
02:12somniumalexyk: almost got a java-script repl working on app-engine, curious to poke around in the cloud
02:12somniumhmm
02:13somniumquite possibly
02:13alexykapparently BSON stores some time of its own: http://www.mongodb.org/display/DOCS/Mongo+Extended+JSON
02:13somniumtake a look at Bytes.java in the driver
02:13alexyksomnium: what's that JS scripting?
02:13somnium*maintenance-nightmare*
02:14somniumclojure generated js-client that posts clojure to the server which evals it
02:14alexyksomnium: I'm new to JS and was curious to see to what extend mongo shell supports it, and how it can be used instead of SQL
02:15somniumjs is its native scripting lang
02:15somniumyou can send js to eval with the java driver
02:16somniumI didnt put it in congo cuz its too easy to crash a mongod with it ;)
02:17alexykinteresting
02:17alexykso I guess you can get some standard JS setup for these things?
02:17somniumbut you can do (fetch :foos {:$where "some js expression"})
02:18somniumnot sure what you mean
02:18carkalexyk : hello, did you fix your permgen issues yet ?
02:19alexykcark: long time ago. -XX:MaxPermSpace=1g
02:20carkhehe ok
02:20carki was thinking you're not using the right tool
02:20carkwoke up to that actually
02:20carkwhy not put everything in a postgres/mysql database then do your stats on that ?
02:23somniumalekyk: you can also store map-reduce js fns in mongo, with the amount of data youre crunching ti might be a good idea
02:23somniumany kind of aggregation fn
02:23alexykcark: it's already loading mongo... people said js is too slow for map/reduce. clojure is faster :)
02:24alexykbut, I'll see.
02:24carkbut keeping everything in memory, java is already memory intensive, clojure is even worse in that respect
02:24carkthere is a point where it must break down
02:24alexykcark: I got RAM to burn
02:24somniumthe js is calling C code though, with no tcp/ip
02:25somniumwell, it *might* be faster
02:25alexykand am using mongo for large data
02:25alexyksomnium: indeed, worth testing... but would have to learn JS :(
02:25carktsss js is easy !
02:25alexyktoo many languages
02:25alexykI already use Scala and Clojure, two crazy ones :)
02:25alexykin the same project. Plus perl preprocessing
02:26somniumjs is easy!
02:26carkthat's our curse as programmers ...there is always some more to learn
02:26carkand blessing too =)
02:26somniumits easy to generate js with clojure too
02:27alexyksomnium: too many dynamic ones, I begrudgingly allowed for Clojure out of curiosity for Lisp and out of respect to the elders :)
02:27somniumI rather dislike types except when my code is too slow :p
02:29somniumI love being able to write ruby-like throwaway scripts and primitive juggling encoders in the same language
02:31alexyksomnium: that's why I use Clojure for data mining. Scala has its fun though. Both are better than one. :)
02:32somniumclojurebot: tell me about scala
02:32clojurebotUnfortunately the standard idiom of consuming an infinite/unbounded resource as a stream can be problematic unless you're really careful -- seen in #scala
02:32alexyksomnium: streams and all are vastly improved in scala 2.8. very active development.
02:33somniumclojurebot: tell me about scala
02:33clojurebotscala is also<reply>"we are completely screwed on ==." -- seen in #scala
02:33somniumclojurebot: tell me about scala
02:33clojurebot{((x: Any, y: Any) => (f: Function2[Any, Any, Any]) => f(x, y))(1, 2)((x: Any, y: Any) => x)}
02:33somniumthats the one :p
02:34alexykclojurebot: hold hands and sing kumbaya
02:34clojurebotPardon?
02:34somniumheh
02:34alexyklooks like it's French, too
02:35somniumclojurebot: scala |is| hold hands and sing kumbaya
02:37somniumI took a few stabs at scala, but it didnt grab me like clojure
02:37somniummaybe its a parens thing
02:38alexyksomnium: both have their use
02:39somniumwhat is scala better suited for?
02:39carkmaybe is it faster due to static typing ?
02:40somniumis type-hinted clojure not equivalent?
02:40carkall function parameters are boxed in clojure, don't know how it is on the scala side
02:41alexykit should be faster, and the experience of typed development is similar to OCaml or Haskell. Basically it all compiles and then runs right away.
02:41alexyksomnium: type-hinting would still work at runtime, AFAICS
02:41alexykbut I'm not a language guru...
02:41carknope type hints when done properly are a compile time thing
02:42alexykcark: good
02:42alexykyet in clojure type hints look ass-ugly
02:42alexyk:)
02:42carkyou can get very good perfs out of clojure inside a function
02:42alexykyeah, my clojure speed is on par with scala's
02:43alexykit's all bottlenecked by mongo anyways :)
02:43carkbut you're bounded by io are you not ?
02:43carkright
02:43alexykbut when they parallelize mongo, it'll be another story
02:43alexykClojure agents vs Scala actors shootout will occur
02:44alexykthe fittest will survive
02:44carkmongo is not multithreaded ?
02:45somniumtalk of changing type hints from #^Foo bar to Foo^bar
02:45somniumless perl-ugly
02:46twbrayAm currently struggling to make Clojure WF performance competitive with Scala. Don't see any reason in principle that they shouldn't be more or less competitive.
02:47alexyktwbray: Scala has to be slower due to actors copying stuff, but it's faster! :)
02:47alexykcark: mongo will be multithreaded very soon, 1.3/4, now at 1.2
02:48alexyktwbray: Scala is static and Martin Odersky wrote javac.
02:48somniumalexyk: just pray you never have cause to examine the c++ source
02:48twbrayWhat's Mongo? link plese
02:48twbrayplease
02:48carkhttp://www.mongodb.org/display/DOCS/Home
02:48alexyktwbray: it's a cute JSON database: mongodb.org
02:49twbrayOh, MongoDB.
02:49alexykafter you use it, BDB is old, postgres is stale, etc.
02:49alexykOracle is booring :)
02:49carkhuh
02:49carkyou're one of those noSQL people !
02:49alexykcark: Twitter teaches you to be one.
02:49somniumIm trying to like to learn to like couch too, its just so easy to get stuff done with mongo
02:50alexykall this kind of data, hbase, voldemort -- JVM is made for it
02:50timothypratleysomnium: Foo^bar sounds great to me! Is that something that's been discussed before or did you just come up with it?
02:50twbrayCassandra Couch Voldemort Riak Redis Tokyo etc etc etc
02:50defndid someone say xmonad?
02:50defnI miss it on OSX so much...
02:50carkalexyk : i guess once you go beyond 10GB databases it makes sense, but i never hit that =)
02:50alexykdefn: apparently you can get it on X on OSX too, no?
02:50somniumtimothypratley: I saw Rich talking about it on the logs
02:51alexyktho'
02:51defnalexyk: yeah but it doesnt play nice the way xmonad plays nice with say, gnome
02:51defnso it's sort of useless IMO
02:51timothypratleysomnium: oh... cool! that's a much nicer syntax
02:51alexykcark: any size. Have a hashmap, map of lists of map, -- dump into mongo, et voila!
02:51somniumwhat does OSX offor over gnome/kde?
02:51defnerr that's not the point
02:52carkalexyk : age old argument, how do you do joins =)
02:52alexyksomnium: apples!:)
02:52defnthe point is that xmonad doesn't support OSX the way it supports gnome
02:52alexykcark: dunno yet. JS queries
02:52twbraysomnium: Spell-checker, so it tells you "offor" is wrong
02:52carkalexyk : you'll be in denormalisation hell
02:52timothypratleydefn: isn't it gnome that supports xmonad? ;)
02:52carkanyways, it sure is great for very big data
02:52alexykcark: real world is not normal either
02:52somniumtwbray: Ill just blame emacs erc mode
02:53defntimothypratley: sort of i suppose :)
02:53somniumcark: you can do relational queries wit mongo
02:53somniumjust no transactions
02:54carkthere is always something missing, ahwell that's the price to pay for scalability
02:54somniumits great for read heavy data crunching
02:54somniumand storing blg comments :p
02:55somniums/blg/blog
02:55carki guess that's the grumpy old man in me talking, but i like my relational databases !
02:55carkthey're _fast_
02:56defnas fast as a set
02:57somniumcark: you can index on anything in nosql land too
02:58somniumnever learned advanced sql though, maybe Im missing something
02:58carkthe one thing i don't like is the sql language itself
02:58carkwell it's powerfull
02:59carkbut not very easy to generate
02:59carkno a very regular language
03:05defnthe higher level stuff is fun, but i feel like most of the people i meet who are DB people, don't know anything about anything else
03:05defnit's an annoying niché that way
04:14j3ff86is there a function to remove the last element of a seq? or should i just stick with (reverse (rest (reverse
04:15_ato,(doc butlast)
04:16j3ff86nice, thanks
04:16clojurebot"([coll]); Return a seq of all but the last item in coll, in linear time"
04:17_atothere's also
04:17_ato,(doc drop-last)
04:17clojurebot"([s] [n s]); Return a lazy sequence of all but the last n (default 1) items in coll"
04:17_atowhich is lazy
04:21j3ff86aye
04:22j3ff86even better
04:56arj_is there a way to see all watches on a ref?
04:57_ato,(.getWatches (ref 0))
04:57clojurebot{}
04:58arj_thanks
04:59arj_seems to be missing from clojure.org/api?
04:59_atoit may be undocumented on purpose, there's no Clojure wrapper function for .getWatches
05:00_ato(ie it might disappear in future versions of Clojure)
05:00clojurebotclojure is like life: you make trade-offs
05:00arj_:)
05:00arj_watches are really useful, but yeah I saw the experimental warning :)
05:00j3ff86I have a question about agents.. say i have a function that i send an agent, like (send agent1 function1 [1 2]). Is it possible to map the sending onto a collection like [[1 2][3 4][5 6]]?
05:02_atoyou mean like this? (doseq [pair [[1 2][3 4][5 6]]] (send agent1 function1 pair))
05:03_atoor am I misunderstanding what you mean by "map the sending" ?
05:04j3ff86that worked perfectly
05:04j3ff86thanks for the 5th or so time!!
05:09j3ff86they should add that in the clojure book
05:10j3ff86ah nm it is hehe
06:34moah<F8>/part
07:58j3ff86is there anyway to make sure an agent finishes the function it's sent before proceeding to the next block of code, or would that just defeat the purpose of an agent?
07:59interferonsay i have a map of string -> array pairs
08:00interferonis there a function (like map) that will let me apply a transformation to the values of the map, s.t. i get back a map of string -> double pairs where the keys are the same and the double is a function of each array value?
08:00cgrand(doc await)
08:00clojurebot"([& agents]); Blocks the current thread (indefinitely!) until all actions dispatched thus far, from this thread or agent, to the agent(s) have occurred."
08:00cgrandj3ff86: ^^
08:00j3ff86thanks
08:04interferonanyone>?
08:04cgrandinterferon: I thought there was one in contrib but I can't find it
08:05cgrand(#(into {} (map (juxt key (comp %1 val)) %2)) inc {1 2 3 4})
08:05cgrand,(#(into {} (map (juxt key (comp %1 val)) %2)) inc {1 2 3 4})
08:05clojurebot{1 3, 3 5}
08:06cgrand,(#(into {} (for [[k v] %2] [k (%1 v)])) inc {1 2 3 4})
08:06clojurebot{1 3, 3 5}
08:12thehcdreamerhi guys. I'm a bit confused if this is the correct way to call java: (. (java.util.Calendar/getInstance) setTimeInMillis 2519863044747) what I'm trying to do is to call setTimeInMillis with argument 2151... on the Calendar/getInstance. The problem is that it returns nil, which is not what I expected
08:14cgrand,(doto (java.util.Calendar/getInstance) (.setTimeInMillis 2519863044747))
08:14clojurebotjava.lang.ExceptionInInitializerError
08:15thehcdreamercgrand: it works
08:51arj_how exactly does one get a blocking queue with seque?
08:56chouser(def q (seque (iterate #(do (Thread/sleep 1000) (inc %)) 0)))
08:56chouser(doseq [i q] (prn i))
08:58angermantwo macros to get a little more then (time http://gist.github.com/249022
08:58arj_chouser: well I want a queue where if I get an element and there is none it will block until there is one. And a simple way to add items to the queue
08:59arj_it seems like in the example the adding function is predefined?
08:59chouserarj_: thats what I just showed you. :-) the doseq blocks until each next item is available from the queue
08:59arj_chouser: aha
08:59arj_gonna try :)
09:00ohpauleezarj_: also have a look at fill-queue in contrib
09:01chouserthe choice between seque and fill-queue turns mainly on how much control you have over the item-producing code. prefer seque when you can make it work.
09:01ohpauleezah, thanks for the tip chouser
09:02arj_lol
09:02arj_I'm completely lots here :(
09:02arj_how do I add an item to the queue?
09:03chouserthat 'iterate' is producing the items to flow into the queue
09:03chouserarj_: what is your code like that will produce the value?
09:03chouservalues
09:03arj_chouser: I want something exactly like any collection
09:03arj_and acts like any collection
09:04chousercollections are immutable
09:04ohpauleezhttp://clojure.org/api#toc513
09:04chouserthis queue is not
09:04angermanwheee. My RandomAccessReader does work.
09:04ohpauleezyou can also make n-or-q a concurrent BlockingQueue
09:04arj_except that when I try to get an element without any items in, it wil block
09:04ohpauleeznice work angerman, I looked at the code yesterday
09:04angermanHere's the java class that wrappes a buffer around RAF and add's Clojures IObj capabilities to it: http://gist.github.com/249027
09:04chouserohpauleez: that api page is pretty much gone
09:04angermanand http://gist.github.com/249025 is more "clojurey"now
09:05chouserohpauleez: broken links to it still, though. :-/
09:05arj_ohpauleez: yeah, do you have an example?
09:06chouserarj_: collections are usually built up using things like (vec (map ...)). That 'map' would work as an arg to seque.
09:06angermanand it's fast. on avg. 2.3 seconds to run through a 160MB file. http://gist.github.com/249031
09:06angermanohpauleez: thanks. Though hiredman was right, yesterday, the code was quite bad
09:06ohpauleezarj_: not handy
09:06angermanI think I was able to improve it a little.
09:07ohpauleezI'll take a look at it now
09:07arj_chouser: yeah that's what I thought
09:07arj_so
09:07arj_(def a (seque []))
09:08chouserno
09:08arj_but (take 1 a) doesn't block
09:08chouserthat's because it reached the end of the queue
09:08chousertell me something about the code that will be filling the queue
09:09arj_I just want to create a simple producer/consumer
09:09chouser(seque (map inc (range 10))) would work.
09:09chouseror (seque (filter odd? (range 10)))
09:09chouseror (seque (line-seq reader))
09:10arj_but the values of the producer is not known beforehand
09:10chouserbut they can be computed?
09:10arj_not really. Sorry let me try to explain
09:10arj_lets say that we have a as before
09:11arj_then I want to be able to conj into it like e.g. a ref to a []
09:11arj_and I want trying to do a take 1 to block if there a no items
09:12chouserbut vectors are immutable, so it's just not going to be identical in structure.
09:12chouserit's possible to get very close. how is the value you're conj'ing going to be produced? reading from a file? applying a calculation to a previous result?
09:13arj_well it can come from multiple sources
09:14arj_I basically just want to implement a blocking-queue in clojure
09:14chouseryou want a global stateful queue with bits of code here and there adding to it in a side-effecty way.
09:14arj_yes :)
09:15chouseryou're sure I can't talk you out of that?
09:15chouser:-)
09:15ohpauleezwhich is not functional, so what your REALLY want is a lazy seq generated by function calls
09:15arj_yes
09:15ohpauleezthose calls will block the queue until they're done, as shown by sleep example chouser made
09:16chouserhm, see even fill-queue won't work in that case.
09:17ohpauleezright
09:17ohpauleezyou need to reframe the problem
09:17chouserI think cgrand wrote a thing that would work.
09:18arj_where can I have a look at that?
09:18chouserhttp://clj-me.cgrand.net/2009/11/18/are-pipe-dreams-made-of-promises/
09:18arj_thanks :)
09:18ohpauleezarj_: also take a look at chouser's reply here: http://groups.google.com/group/clojure/browse_thread/thread/e8533549c290ce74
09:19arj_it's clojure 1.1 or head stuff?
09:20arj_I was actually reading that thread, but it didn't make much sense to me :)
09:20chouserarj_: yeah, promise/deliver is in the 'master' branch. Will be in 1.1
09:21arj_thanks for the help, I think I need to think about it some more
09:22chouserarj_: you're welcome. Don't be discouraged, this stuff is tricky to think about.
09:24ohpauleezsince someone links the pipe code almost once daily, are we seeing that moved into contrib or core?
09:24ohpauleezs/almost/at least
09:25chouserthread intercommunication is inherently impure, but Clojure tries to avoid side effects. Trying to combine both concepts in a single fn like seque, fill-queue, or pipe definitely stretches the brain.
09:26chouserohpauleez: sounds good to me, if cgrand wants to submit it.
09:30cgrandpipe was a mere thought experiment but since there is demand I'll contribute it
09:31ohpauleezthanks a lot cgrand
09:31chouseryou know...
09:32cgrandI'm not happy with the swap! trick because it retains a reference to a unused item
09:32chouserwell, either way. I just wonder if it would be better to simply use a BlockingQueue
09:32tmountainanybody know if the frest function was removed or renamed at some point?
09:32chousermaybe wrap a lazy seq around the takes
09:33tmountainnm, fnext...
09:35cgrandchouser: I agree
09:36chouseralso helps demonstrate the non-functional nature of what's going on.
09:39octei'm having a bit of troubling understanding unquote/unquote-splicing
09:39octewhat does splicing actually mean?
09:39the-kenny,(macroexpand-1 '(let [foo [1 2 3]] `(do ~@foo)))
09:39clojurebot(let* [foo [1 2 3]] (clojure.core/seq (clojure.core/concat (clojure.core/list (quote do)) foo)))
09:39the-kennyhm.. wrong
09:40lisppaste8Chouser pasted "stateful BlockingQueues in Clojure" at http://paste.lisp.org/display/91574
09:40octehttp://paste.lisp.org/display/91573 in my mind, the macro and function should be the same
09:40octebut they aren't
09:40chouserarj_: this is probably what (you think) you want: http://paste.lisp.org/display/91574
09:41ohpauleezocte: are you coming from Java or Python/Ruby?
09:41fogus_,`[~@[1 2 3]]
09:41octeohpauleez: both i guess
09:41octemostly java
09:41clojurebot[1 2 3]
09:41ohpauleezsimply put, unquoting, unquotes something so it gets eval'd. Splicing will unpack that collection
09:42ohpauleezso it'll appear like args to a function
09:42octeohpauleez: hmm, then i don't understand why my macro doesn't work the same way as my function in my paste
09:42ohpauleezlet me look
09:43ohpauleez~@more will produce 1 2 3 4. more will be in a vector [1 2 3 4]
09:44the-kennyohpauleez: Try a macroexpand on your function
09:44the-kennyYou will see the difference
09:44the-kennyUhm.. I mean octe
09:44ohpauleezocte: ^^
09:44ohpauleezit's all good
09:44octeohpauleez: ohhh
09:44octeso (interpose " " [~@more])
09:45ohpauleezor just (str ~@more)
09:45ohpauleeznvm, you want spaces
09:46octeohpauleez: yeah, thanks :)
09:46octei understand better now
09:47ohpauleezyou're totally welcome
09:47ohpauleezocte: if you want it to remain a list, you can just unquote it
09:47ohpauleezlist/vector
09:48chouser[~@more] or just ~more
09:48the-kennyunquote-splicing is especially useful for with-* macros
09:49octechouser: [~@more] = vector, ~more = list?
09:50the-kennyocte: ~@ of a symbol holding [1 2 3] will return 1 2 3, ~ of the same symbol will give you [1 2 3]
09:50chouserocte: yes
09:50octechouser: if i try to pass ~more as arguments to a function, it seems to interpret it as calling a function, not passing the list
09:51chouserocte: oh! yes of course. sorry
09:52chouserso [~@more] or (list ~@more) or ~(cons `list more)
09:52octechouser: why is that, btw?
09:53chouser,(let [more '(1 2 3)] `(interpose " " ~more))
09:53clojurebot(clojure.core/interpose " " (1 2 3))
09:53octewhy is ~more considered a function call and not a list?
09:53chouserit is a list, at macroexpand time
09:53chouserbut after that, the resulting form (printed above) get's eval'ed
09:53octeoooh
09:53chouserwhen that happens, lists are function calls unless quoted or something.
09:54octeso i could do '~more?
09:54chouser,(let [more '(1 2 3)] `(interpose " " ~(cons `list more)))
09:54clojurebot(clojure.core/interpose " " (clojure.core/list 1 2 3))
09:54chouser,(let [more '(1 2 3)] `(interpose " " '~more))
09:54clojurebot(clojure.core/interpose " " (quote (1 2 3)))
09:54the-kennys/everu/every/
09:54chouserocte: right
09:55chouserocte: though '~more is not the same as ~(cons `list more) ... the latter will allow the args to your macro to be evaluated, the former will not.
09:55octeah, right
09:55octenoticed that
09:56chouserso -- depends on which you want.
09:56djorkso I decided to use keywords for ObjC methods in my c-in-parens... (c (:setFoo x y)) -> "[x setFoo:y]"
09:57dublindanhey, what is the difference between -
09:57dublindanah
09:57dublindanbetween -> and ->>
09:57the-kenny,(doc ->>)
09:57clojurebot"([x form] [x form & more]); Threads the expr through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc."
09:58the-kenny,(doc ->)
09:58clojurebot"([x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."
09:58ohpauleezdublindan: the first one makes it the second arg, the other one puts it in the last position
09:58the-kennysecond item vs. last item :)
09:58dublindanahhh! Thanks!
09:58dublindanah one word difference in the description, no wonder i missed it :-/
09:59dublindanerr two words, actually
10:13cemerickoh, man, the reader does push the content that couldn't be read back onto the provided PushbackReader
10:14cemericks/does/doesn't
10:15angerman~source take
10:17ohpauleez~source dosync
10:19the-kennyIs there a reason why clojurebot sends the url as a notice to the channel?
10:26chousercemerick: really? where does it go?
10:28cemerickchouser: gets dropped on the floor
10:29cemerick,(let [r (-> "{foo" java.io.StringReader. java.io.PushbackReader.)] (try (read r) (catch Exception e)) (.read r))
10:29clojurebotcemerick: I don't understand.
10:29cemerickfeh
10:29cemerickthat *should* return \{ IMO
10:29chouseroh, if there's a failure?
10:30cemerickthe semantics of read in the face of a parsing error is undefined, but nevertheless
10:30cemerickyeah
10:30chouserhm
10:31chouseryou think it should unread a bunch before throwing
10:31cemerickyes, it should push back so the reader is where it was
10:32chouserI doubt it has that text anywhere. It could be a very long stream that has to be unread
10:32cemerickthis may not be germane, given that the next-gen reader will almost certainly operate over seqs
10:32chouserAdd an extra open paren at the top of the file, and when it gets to the end it would have to unread the entire thing.
10:32cemerickach, yeah, pushbackreader requires a pushback buffer size
10:33cemerickcall me an idealist
10:33chouser:-)
10:35rhickeyaargh, now I get a merge conflict when trying to bring master changes into new
10:35rhickeyversion.protperties
10:35chouserrhickey: that's my fault
10:36cemerickversioning files are a constant thorn in that way
10:36chouserrhickey: I was hoping it would be easy for you to just throw out the changes from that one file
10:36rhickeychouser: if I knew git better, I imagine that's pretty easy
10:37rhickeyright now this is my first failed merge and I'm at a bit of a loss
10:37chouserwhat command do you run to merge master into new?
10:38rhickeyI have a pile of modified files (I guess merge usually commits so I don't see this interim state)
10:38rhickeyand this error:
10:38rhickeyAutomatic merge failed; fix conflicts and then commit the result.
10:38rhickeychouser: in new, merge master
10:38rhickeyversion.properties has >>>>>>>>>>> <<<<<<<<<< cruft in it
10:39chouserright
10:39rhickeyjust edit that away?
10:39chouserthere's got to be a way to tell it to overwrite with one version
10:39ohpauleezI don't about git, but in svn and mercurial you can just rm the file and update and you'll grabbed the merged version
10:40ohpauleezif you don't actually care about that file getting merged correctly
10:40rhickeyMacintosh:clojure rich$ git checkout -- src/clj/clojure/version.properties
10:40rhickeyerror: path 'src/clj/clojure/version.properties' is unmerged
10:40the-kennyJust fix the conflicts in the file, add the changes and commit it
10:41rhickeythe-kenny: but is really should be unchanged, editing it back to what it was seems fraught
10:41chouseryeah, you want to find an easy command to fully overwrite
10:42chouserI was hoping checkout would work.
10:42the-kennyrhickey: hm.. maybe just checkout the old version?
10:42rhickeychouser: or unmerge or something
10:42rhickeythe-kenny: ^^
10:42chouserrhickey: sorry, I could have researched this ahead of time. I knew it was coming. :-/
10:42AWizzArdwhat is the goal? To come back into the state your code was in before you did the merge?
10:43chouserno, just overwrite a conflicting file with a version from before the commit
10:44karmazillaFrom memory: when a merge fails, you're put in a state where you have files with conflicts. Those need fixing, then add everything to index and commit. Then the merge is complete.
10:44chouserok, the rm works.
10:45ohpauleez:) good
10:45ohpauleezin the future, if there is a plugin like hg's "shelve" for git, I recommend it
10:46ohpauleezlet's "shelve" changes you've made not to be merged or committed currently
10:46chouserrm src/clj/clojure/version.properties
10:46chousergit checkout src/clj/clojure/version.properties
10:46ohpauleezso you can pull in or push changes without dealing with things that will conflict right away
10:46karmazillaohpauleez: sounds like git stash
10:46rhickeyMacintosh:clojure rich$ rm src/clj/clojure/version.properties
10:46rhickeyMacintosh:clojure rich$ git checkout src/clj/clojure/version.properties
10:46rhickeyerror: path 'src/clj/clojure/version.properties' is unmerged
10:46noidiohpauleez, git stash
10:47chouserrhickey: I just tried that. it worked here. I'll try again.
10:47Chousukerhickey: you need -- I think
10:47rhickeyMacintosh:clojure rich$ git checkout -- src/clj/clojure/version.properties
10:47rhickeyerror: path 'src/clj/clojure/version.properties' is unmerged
10:47Chousukerhickey: otherwise it thinks the filename is a branch
10:47Chousukehm
10:47ohpauleezchouser: if you're already in a dirty merge, git most likely has stored that state
10:47Chousukerhickey: -f? :/
10:48chouserChousuke: no
10:48the-kennyisn't there a command to abort the merge?
10:49Chousukejust git reset
10:49rhickeygit reset --hard ??
10:49chouserno
10:50chousergit checkout new -- src/clj/clojure/version.properties
10:51drewolsonquick question about leiningen: do i need mvn installed to use it? lein new blah blows up and says that leiningen isn't in my classpath. i'm guessing it's a lack of local mvn repo?
10:52chouserrhickey: Did that work? I think you're supposed to do a commit after that, but I'm not 100% sure.
10:52chousertrying again.
10:53rhickeychouser: yes, pushing now, thanks
10:53rhickeyany better recipes for the future?
10:53chouserso no need to rm first.
10:53chousergit checkout new -- src/clj/clojure/version.properties
10:54chousergit commit -a
10:54rhickeyIdeally a way to merge ignoring that file, so it succeeds directly
10:54AWizzArdDoes reify not need a name for 'this' anymore?
10:54chouserafter the merge fail, those two steps will finish it correctly.
10:54rhickeyAWizzArd: read the new docs
10:55rhickeychouser: I'd like to avoid the failure if possible
10:55rhickeyAWizzArd: not trying to be obtuse, but I'd like to know if they are clear :)
10:56rhickeyok, latest new branch has new (final?) format for reify and deftype, also multiple arities in defprotocol no longer in list
10:56AWizzArdI started using reify today for the first time and read about it here: http://www.assembla.com/wiki/show/clojure/Datatypes
10:56rhickeydocs should describe the new formats etc
10:56rhickeyAWizzArd: ah, updating that next...
10:56angerman~time
10:56clojurebotNo entiendo
10:56angerman~source time
10:57AWizzArdok, then I simply read the wrong docs
10:57AWizzArdI got it working already by simply leaving the this-name parameter out. Thanks.
10:58Chousukerhickey: are the API docs for the new branch on the web somewhere? As web pages, I mean
10:59rhickeyChousuke: I know Tom is working on docs for multiple branches, but not yet - use (doc reify) etc
11:00Chousukelooks like there is something in the gh-pages branch. hmm
11:01Chousukeapparently it's not possible to just open those in a browser. github serves them as plain text. :/
11:02angermanhm. maybe i should read about IO Monad or so.
11:04angermananyway, my RAF interface seems to work. It's just not completely functional.
11:08angermanI'd like some advice about the timer and statistics macro http://gist.github.com/249022
11:24chouserrhickey: the version.properties file will not cause future merges of master -> new to fail.
11:25rhickeychouser: neat - how'd you do that?
11:26chouserit's inherent in how git works.
11:26chouserbut there's a catch. a future merge of new->master is likely to set the version string in master to "new"
11:26rhickeychouser: ok, makes sense
11:27rhickeythanks for looking into it
11:27chouserwe shouldn't be storing the branch name in a checked-in file at all.
11:27chouserrhickey: sure. #git is helpful. :-)
11:29cemerickis there a fn somewhere that drains a reader into a string?
11:30chouserlike slurp but on a reader instead of a file?
11:30chouserfilename
11:30cemerickyeah
11:31cemerickseems that should be broken out
11:31rhickeyslurp, the protocol...
11:31chousermmmm
11:32cemerickwell, slurp is doing decoding as well -- a reader already has an encoding set.
11:32cemerickBut yes, I get your point. :-)
11:32stuartsierrachouser: duck-streams/slurp* will do that
11:33KirinDaveGrr. Every library for clojure that I'm excited to use never works without significant troubleshooting.
11:33cemerickstuartsierra: ah, indeed, thanks :-)
11:33stuartsierraKirinDave: It's a young language.
11:33chouserKirinDave: outside of contrib, I hope?
11:33KirinDavechouser: Yes.
11:33KirinDavecontrib works fine.
11:33rhickeystuartsierra: they are younger libraries
11:33ohpauleezKirinDave: playing with stat stuff?
11:34KirinDaveohpauleez: In this case no. I was trying to use enlive.
11:34KirinDaveI simply cannot get it to work, though.
11:34ohpauleezI'm working on a project that will heavily use it, so please email the list or write a blog post
11:39ohpauleezKirinDave: cgrand is in here too if you need help
11:49jonase_Destructuring an argumentlist (to a protocol method) does not work inside deftype. Is this correct?
11:50chouserjonase_: Not yet, I think.
11:50jonase_ok
11:50cp2is it just me or is github's search broken?
11:54AWizzArdIs there a better way to check if a java.lang.Process is still running than calling (.exitValue on-it) and see if it throws IllegalThreadStateException?
11:54cgrandKirinDave: need help with enlive?
11:54the-kennycp2: I noticed this earlier this day. "leiningen" didn't show any search results.
11:54cp2the-kenny: mhm, seems to be happening with every query i try
11:54arohnerthere is no search but google
11:54arohner:-)
11:54stuartsierraWhat's up with th name "leiningen" anyway? Makes me think of Lenin.
11:54cp2arohner: yeah, but still =P
11:55arohnerleiningen site:github.com works just fine :-)
11:55the-kennyGoogle is always an option
11:55AWizzArdWhat was the ^ reader macro doing? And btw, is there a replacement for add-classpath?
11:56arohnerstuartsierra: there's an explanation in the leiningen readme
11:56cgrandAWizzArd: ^foo was (meta foo)
11:56hiredmanhttp://en.wikipedia.org/wiki/Leiningen_Versus_the_Ants
11:58stuartsierraOk, I get it, but it's still hard to pronounce/spell/remember.
11:58AWizzArdhmm, for germans it's very easy to remember I think
11:58hiredmanyes
11:59hiredmanbut its cute pun
11:59arohnerI bet everyone will call it lein, like the executable
11:59stuartsierramaybe
11:59ChousukeI don't find it particularly difficult :/
11:59AWizzArdI would pronounce it pratically identical to the english word "line".
12:00stuartsierraIf we're going for puns on Ant, I would have preferred "picnic"
12:00cemerickyeah, I don't think I'll ever be able to remember anything other than lein
12:00Chousukethen again, as a Finn I'm used to 4+ syllable words
12:00AWizzArd:)
12:01AWizzArdAh, this Carl Stephenson actually was a german, which explains it.
12:01AWizzArdWhy were ^ and add-classpath deprecated? No problem with it, I am just curious.
12:02stuartsierraadd-classpath because it doesn't work in most environments and was a bad idea to begin with.
12:02ChousukeI think ^ was deprecated so that it can replace #^ at some point
12:02stuartsierra^ to clear the way for replacing #^ with ^ eventually
12:03chouserclojurebot has been deprecating add-classpath for a long time
12:04chouserclojurebot: add-classpath?
12:04clojurebotclasspath is (System/getProperty "java.class.path")
12:04chouserclojurebot: add-classpath
12:04clojurebotadd-classpath is bad, avoid it. I mean it!
12:04arohnerhah
12:04AWizzArdah oki
12:06cp2clojurebot: botsnack
12:06clojurebotthanks; that was delicious. (nom nom nom)
12:17lisppaste8cemerick pasted "string interpolation supporting arbitrary forms" at http://paste.lisp.org/display/91588
12:17cemerickthoughts on above?
12:17cemerickdoesn't support nested strings of course *shrug*
12:18chousercemerick: beautiful choice of syntax
12:18cemerickchouser: where's my heredocs?!? ;-)
12:19KirinDavecgrand: I'm having some trouble with enlive. Do you have a moment?
12:19chousercemerick: seriously, ~() is inspired.
12:19chousernot sure about ~{}
12:20cemerickwell, I definitely want a simple value replacement, but ~binding won't cut it
12:20chouserwhy not? too common?
12:20chousernot sufficiently distinct, visually?
12:20cp2leiningen is awesome :)
12:20cp2technomancy: hackersnack
12:21cemerickyeah. Seems like a lone sigil like that will need a lot of escaping.
12:21cemerickI saw this this morning, and knew I had to finish up my interpolation impl (with blog post, of course!): http://speaking-my-language.blogspot.com/2009/12/string-interpolation-in-scala.html
12:22Chousukecemerick: I think ~[foo] would be neater
12:22cemerickChousuke: that's not bad
12:23Chousuke~{foo} looks like a syntax error :P
12:23clojurebotFoo is not Baz.
12:23cemerickactually, ~@ might do alright, but that mixes things up with deref
12:23cemerickeh, no, need that trailing brace
12:24djork~() is awesome
12:24clojurebotRoger.
12:24chouserheh
12:24djorkso why not ~foo
12:25cemerickchouser: that's a much better reason why ~binding won't work -- that's depending on trailing whitespace, when there are plenty of times you don't want whitespace after the val string
12:25chouseroh, sure.
12:25djorkbut then you have ~()
12:25cemericke.g. This is ~username's account
12:26chouser~(do 5)
12:26clojurebotPardon?
12:26cemerickchouser: yuck
12:26chouser:-)
12:26djorkhmm, yeah
12:27djorkI suppose there are a lot of tricky areas thanks to the flexibility of Clojure keywords
12:27djorker symbols
12:28AWizzArdIs there a way to generate a dynamic deftype on the fly? For example when I want to have a var holding a config for a resource, then I don't want to make a deftype and only make one singleton instance holding this config. Currently I simply use {} instead.
12:29AWizzArdSomething like (defvar- *config* (dynamic {:port 10, :name "Some name here", :host "localhost"})) or so.
12:31angermanthere was a fn that was the inverse of (filter ... I fail to remember the name
12:32AWizzArdCould be "singleton" instead of "dynamic". Results in a persistent map which has access speed of deftypes.
12:32the-kennyangerman: remove?
12:32angermanthe-kenny: yes!... thanks!
12:33angermanis there a fn that tells me the position of a certain element in a list?
12:34notallamainverse of filter? how does that work? filter isn't 1-to-1
12:34the-kennyangerman: c.c.seq-utils/position is almost what you want
12:35AWizzArdmaybe instead of (filter f coll) it can be okay to do (filter (complement f) coll)
12:35the-kennyreturns a sequence of positions where pred is true
12:35angermanyep, I guess calling filter on it
12:35angermanerr first
12:35AWizzArdangerman: you can also use find-first which would give you the element itself, not its position
12:35AWizzArdfind-first === (first (filter ...))
12:36angermanAWizzArd: but I need the position :)
12:36AWizzArdk
12:36chouserangerman: it usually works out best to avoid using position numbers in clojure, whenever that's possible.
12:37angermanchouser: ok. I'll try to explain.
12:37angermanI have a list of numbers. (6 2 3 1 4 5)
12:38replacaChosuke: (catching up) I will have doc for multple branches, but not immediately. The github uses the gh-pages branch to generate the API doc (it's the source). Unfortunately, you can have only one gh-pages branch.
12:38angermanassuming I'm interested in the tuple (2,3) I'd need the position of 3 in the list without 2. as well as the position of 2 in the list without 3
12:38hiredman,(.indexOf '(6 2 3 1 4 5) 3)
12:38clojurebot2
12:38hiredmanangerman: :(
12:38hiredmanif you using tuples, why not just have a list of tuples?
12:39angerman,(.indexOf (remove #(= 2 %) '(6 2 3 1 4 5) 3)
12:39clojurebotEOF while reading
12:39hiredmanhorrible
12:39twbrayErjang, a beam interpreter on the JVM: http://wiki.github.com/krestenkrab/erjang
12:39angermanhiredman: I'm starting to love it when you say that ...
12:41angermanhiredman: how would I improve that?
12:41the-kennytwbray: I found this project interesting too :)
12:42rsynnottUgh, that's a terrible name :)
12:42the-kennyrsynnott: twbray or erjang? :D
12:42rsynnotterjang
12:43the-kenny(No offense)
12:43the-kennysorry ;)
12:48arohnerare there any gotchas I should be aware of when redefining deftypes?
12:48arohnersomething weird is going on
12:48arohnerI haven't exactly narrowed it down yet, but it seems that if I redefine a deftype at the repl, the keyword accessors break
13:01technomancycp2: NOM!
13:02cp2:)
13:06angermancan I ask clojure about memory useage of a var?
13:07the-kennyangerman: Maybe though java
13:07the-kenny*through
13:08angermanhmm... well :) I'll have to use the visualjvm thing then
13:08the-kennyangerman: But I ask myself every time someone asks this: "Why would I want to know the size of an object?"
13:09chouserthe-kenny: to know how many I could have before I run out of memory?
13:09angermanthe-kenny: seeing if it grew or not (e.g. if it's retaining something that the gc doesn't take)
13:09chouseror perhap, is representation x better than y based on: speed, memory, etc.
13:09the-kennyhm ok.. that's an argument. I never had to deal with so much data :)
13:10the-kennyInteresting answer on google: http://wiki.answers.com/Q/What_is_the_size_of_a_Java_object_and_how_can_you_find_it
13:10the-kenny"Most Java objects seem to be 32KB and are located under your downloaded programs."
13:10chouserangerman: but no, there's no solid fool-proof way on the JVM. It's a JVM question, and the usual (googlable) JVM answers apply.
13:10chouserthe-kenny: gah!
13:12angermancan I map over a {} and have the fn be applied to the values?
13:12the-kennyangerman: I think there's a function called "values"
13:12the-kenny,(values {:foo 42 :bar 23})
13:12clojurebotjava.lang.Exception: Unable to resolve symbol: values in this context
13:13angermanthe-kenny: that wouldn't help
13:13chouser,(vals {:foo 42 :bar 23})
13:13clojurebot(42 23)
13:13angermanbasically I would want to keep the keys and modify the values
13:13the-kennyMaybe a construct with zipmap if there isn't a predefined function?
13:14chouser,(let [m {:foo 42 :bar 23}] (zipmap (keys m) (map inc (vals m))))
13:14clojurebot{:bar 24, :foo 43}
13:14the-kennychouser: That's what I've meant ;)
13:14angermanzipmap is lazy
13:14angerman?
13:14chouserno
13:15chouserit returns a map, so it can't be
13:15angermanok
13:18angermanthat's the most annoying thing with os x I found. And I haven't figured how to switch it off
13:18the-kennyangerman: Are you using launchbar?
13:18angermanyep
13:18the-kennyI don't think it's a feature of osx, but of launchbar
13:18angermandoes that cause it?
13:18the-kennyYes, it's a feature of launchbar
13:18the-kennyan annoying one ;)
13:19angermanclip-merge.
13:19the-kennyIt's called "ClipMerge"
13:19angermanwtf?!
13:19angermanI like launchbar a lot, but man that feature. It's so pointless. But it's only supposed to happen on double cmd-c
13:20angermanthat though does not really coincide with my experience
13:21the-kennyangerman: I think sometimes osx is a bit overactive with the keystrokes..
13:21the-kenny(I'm not sure if "overactive" is the right word)
13:23angermanthe-kenny: thank's so much for pointing out that LaunchBar *feature*
13:23the-kennyangerman: You're welcome
13:24the-kennyI was searching a long time too... I just started using launchbar with SL and I thought it was a new feature of SL
13:38jonase_I've been trying out the 'new branch' with a (deftype Matrix ...) implementation. I've broken my (blockmatrix ...) method and I can't find what's wrong with it. Anyone care to take a look? http://gist.github.com/234535
13:39cemerickOK, so I wrote up the string interpolation macro I pasted earlier: http://muckandbrass.com/web/display/~cemerick/2009/12/04/String+Interpolation+in+Clojure
13:51AWizzArd,(time (dotimes [i 1000] (reify [Runnable] (.run []))))
13:51clojurebot"Elapsed time: 0.985 msecs"
13:51AWizzArd,(time (dotimes [i 1000000] (reify [Runnable] (.run []))))
13:51clojurebot"Elapsed time: 100.537 msecs"
13:51AWizzArdimpressive :)
13:51AWizzArdhiredman: does clojurebot run in a client or server jvm?
13:52hiredman~clojurebot
13:52clojurebotclojurebot is amazing
13:52hiredmanI forget
13:52hiredmanrlwrap java -server -Djava.security.manager -cp $CLASSPATH:./clojurebot/ clojure.main -i clojurebot/hiredman/clojurebot.clj -r
13:53rsynnottIs there a huge difference these days?
13:53hiredmanthese days people run anything from jdk1.5 to openjdk1.7
13:54hiredman(some people still run jdk1.3 but clojure runs on 1.5 and later)
13:55AWizzArdrsynnott: I can see big differences
14:04the-kennyOh, I think I just found a beautiful way to map a function to every key in a map.. someone asked that here. c.c.generic.functor/fnmap is perfect for this
14:13SergeyDidenkohi. could anyone give advice on this: I use closures to bind some values to a general "handler" to pass it into a function - "(def draw-mark ( #(partial draw %1 %2 %3) mark-size mark-size mark-thickness ) )" . Is there more idiomatic way to do this, instead of 1.anonymous function, 2. partial, 3. call of that function?
14:18chouserSergeyDidenko: not quite sure. Maybe (apply draw mark-size mark-size mark-thickness) ?
14:20SergeyDidenkochouser: I need to pass it into another function later: see "paint-minus" ""
14:20SergeyDidenko(def paint-minus (#(partial minus-painter %) mark-size))
14:20SergeyDidenko(draw-mark color-disabled "images/minus-off.png" paint-minus )
14:21SergeyDidenkoI need to read the doc for apply, I think I misunderstood it.
14:21hamzais it possible to define a method that throws exception using gen-interface?
14:23SergeyDidenkoApply is almost the same as "(", so probably there is no other way
14:23chouserSergeyDidenko: I'm being thrown by #(partial ...) gimme a while to let it sink in.
14:25SergeyDidenkochouser, thanks. Another addition to make it clear, I call the paint-minus inside of draw-mark.
14:25chouserhow is your def-mark different than (def draw-mark (partial draw mark-size mark-size mark-thickness)) ?
14:28SergeyDidenkochouser, thanks! That's it. I did not see that partial itself creates a closure
14:31chouserok. I'm still not sure I quite understand, but I'm glad you feel better. :-)
14:33SergeyDidenko:)
14:35chouserseems like a lot of args to a function. have you considered passing around a map instead?
14:40SergeyDidenkochouser, that is a solution to the problem of passing different handlers into wrapper function (note the different set of parameters in handlers):
14:40SergeyDidenko(defn wrapper[ handler ]
14:40SergeyDidenko (first-stuff)
14:40SergeyDidenko (handler)
14:40SergeyDidenko (end-stuff))
14:40SergeyDidenko
14:40SergeyDidenko(defn handler1 [size color] (...))
14:40SergeyDidenko(defn handler2 [width height fore-color back-color] (...))
14:41SergeyDidenkoIt's not beutiful to pass the different set of parameters into the wrapper function just to pass them back to handlers later
14:42SergeyDidenkoA good reason to use closures to pass that sets of parameters
14:43SergeyDidenko(wrapper (partial handler1 some-size some-color))
14:44SergeyDidenkowell. may be it's more clear to add this:
14:44SergeyDidenko(defn wrapper[ handler ]
14:44SergeyDidenko (let [abinding ...]
14:44SergeyDidenko (first-stuff)
14:44SergeyDidenko (handler abinding)
14:44SergeyDidenko (end-stuff)))
14:44SergeyDidenko
14:44SergeyDidenko(defn handler1 [size color abinding] (...))
14:44SergeyDidenko(defn handler2 [width height fore-color back-color abinding] (...))
14:45chouserSergeyDidenko: please use a pastebin for multi-line code snippets next time
14:45chouserlisppaste8: url
14:45lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
14:46SergeyDidenkook
14:46chouserok, I think I can see your point.
14:48lisppaste8SergeyDidenko pasted "wrapper and handlers" at http://paste.lisp.org/display/91598
14:48Licensergood morning everyone
14:48Licenseror good evening or good what-ever-local-time-you-have
14:49SergeyDidenkoLicenser, good evening
14:52hiredmanchouser: how do you use zip-filter.xml?
14:52hiredmando I need to actually know the nested tag structure to pull out an element?
14:53hiredman(whatever I do zip-filter seems to return infinite results and makes rlwrap explode)
14:57LicenserI was wondering the following. Clojure is great to harnes the power of a multi core CPU due to it's easy ways for working with threads and things alike. Now I wonder is there a equally beatuiful way to work with multiple CPU's or even multiple hosts?
14:57leafw_Licenser: checkout terracota
14:58Licenserleafw_: thank you but I'm not looking for pottery
14:58Licensersorry for the bad joke
14:59Licenserthanks for the hint ;)
14:59clojurebotfor is not a loop
15:00SergeyDidenkoLicenser: map-reduce frameworks?
15:00LicenserSergeyDidenko: just generlly the ability to 'run one clojure program on the combined power of more then one JVM'
15:01rhickeyAWizzArd: dynamic deftype ===> reify
15:02SergeyDidenkoLicenser, Terracotta then. Though I think there can be pretty big delays because of blocking nature of Terracotta.
15:02Licenser*nods*
15:02stuartsierraTerracotta is the only transparent solution, not necessarily the best.
15:03SergeyDidenkoLicenser, CouchDB is similar in some aspects to Clojure STM though it's not very optimal
15:03stuartsierraYou've got dozens of options for spreading work across multiple machines: RabbitMQ, Hadoop, ...
15:03SergeyDidenkoAlso CouchDB has some limitations - I read it can do only one level of map-reduce
15:04LicenserMy current thought is, I've this nice server sadly (or fortunately) the Solaris OS implements a very smart taks sceduler that keeps threads on one CPU if possible. So starting 1 JVM I'd mostly only use 1 of the 4 CPU's for short 'bursts' of computation which means performance loss
15:04AWizzArdrhickey: oh good, thanks
15:05leafw_Licenser: on designing software for a specific through generic hardware, such software goes obsolete fast.
15:06leafw_s/through/though/
15:06Licenserso if I could fire off a few JVM's one per CPU and then share work more or less evenly on them it'd give a performance boost for computations. I did some testing with JRuby (I know it's not clojure bot the JVM&OS will behave pretty much the same I'd expect) and I learned that it makes a huge difference if you share work on 4 instances instead of 4 times the threads
15:07Licenserfor JRuby you can use DRuby with gives a mostly transperent view on the problem of tasking more the one interpreter instance
15:08SergeyDidenkoLicenser, I would try Terracotta then. It's not like you have a few JVMs in different parts of the world, they are very close in your case
15:08LicenserAnd before someone says it this is not going to be a attempt to complain about clojure and say how cool ruby is - it is just that I made this epxerience with ruby
15:08LicenserSergeyDidenko: *nods
15:08Licenser*
15:08Licenser then I'll give that a try
15:09chouserhiredman: you can use 'descendents' if you don't want to be explicit about each level of the hierarchy
15:09SergeyDidenkoLicenser, it's pretty raw yet. See my mail discussion with Paul Stadig "Clojure & Terracotta - TIM"
15:09LicenserThanks for the advice, I'll dig in that too
15:10AWizzArdà propos hardware, cores and speed... here is a talk, about self improving AI from the Stanford University. It's one hour, but you can just go minute 20 and listen a few minutes. http://www.youtube.com/watch?v=omsuTsOmvsc&amp;fmt=18
15:10SergeyDidenkoLicenser, I had no time yet to try to fix it on Windows, but it worked on Linux
15:10Licenserfor me it's purely scientific at the moment I just want to see what toos I've at hand
15:10LicenserSergeyDidenko: I don't care for windows :P I'll run Solaris
15:10SergeyDidenkoLicensor, I mean Solaris is not Linux too
15:11Licenseryes but it's closer to linux then windows, a lot closer
15:25hiredmanhttp://github.com/hiredman/odds-and-ends/blob/master/newegg.clj <3 clojure and tagsoup
15:42akuakuclojurebot: paste
15:42clojurebotlisppaste8, url
15:42lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
15:43chouserugh. glad that's over.
15:44chouserThe API links on clojure.org should all be working again, point to the new api doc pages.
15:44chouserlet me know if you notice any that are broken.
15:47arohnerwow, where did clojure.inspector, clojure.stacktrace, come from? apparently I haven't been paying attention
15:47cemerickbeen there for a *long* time
15:49lisppaste8akuaku pasted "should that be allowed?" at http://paste.lisp.org/display/91611
15:51akuakubeen playing with Protoclos, and ive noticed that you could make a minimal protocol which could be the basis for a larger protocol
15:52akuakuthis only works when extending the protocol interface however, doesnt work on the protocol itself
15:52akuakujust wanted to ask if this is stupid/dangerous
15:53drewrwhat does larger mean?
15:53drewrcould it just be a different protocol?
15:53akuakuyes
15:54akuakubut the idea is to provide base implementations
15:54akuakuand another protocol to make a richer interface
15:54akuakulike traits in scala
15:54chouserrhickey: you are summoned
15:55drewrI'm not familiar with traits, but if you're wanting protocol inheritance, that's not going to happen
15:55akuakuit works, but is a hack
15:55akuakuseems bad to use the java interface
15:55Chousukeakuaku: I think that works just accidentally :/
15:56akuakuthe question is if that should work
15:56akuakuor should be forbidden
15:56Chousukeit would require special logic to forbid though.
15:57somniumperhaps declaring it as *evil* would suffice?
15:57Chousukeyes. :)
16:00ChousukeI guess the problem is not all things implementing protocol P will work with bar
16:01akuakui was just thinking how one would express "everything that satisfies Sequable also satifies Reversable by default"
16:01akuakuin a clojure-in-clojure setting
16:01Chousukeakuaku: I think you would just provide a mixin map of default implementation
16:01Chousukeand pass it to extend
16:01Chousukeimplementations*
16:02chouserakuaku: from my (as yet weak and fragile) understanding, it's considered fragile to say such things
16:02chouseralso, fragile fragile
16:02chouserakuaku: because you're making assumptions about concrete things that may be defined later.
16:03ChousukeI guess could have something like (def reversible-on-seq-mixin {:reverse (fn [o] (seq-stuff o))})
16:03lisppaste8hamza pasted "exception" at http://paste.lisp.org/display/91612
16:03hamzaguys, is it possible to define a interface for this with a signiture that says it throws a exception..
16:06akuakuit feels
16:06akuakuwrong to me, but currently reverse depends on the collection to be an ISeq
16:07akuakuso it is kind of similar
16:07hamza~def gen-interface
16:12duperAny other LISP dialects I don't know about?
16:13the-kennyduper: http://www.lrde.epita.fr/~didier/software/smilisp.php
16:26MikeDevOkay. Question. How does one use request?
16:27chouserwhat's "request"?
16:27MikeDevone moment
16:27the-kennythe function from clojure-http-client?
16:27MikeDevcompojure.http.request
16:28MikeDevbut clojure-http-client might work for me too
16:28MikeDevi just need to be able to req foreign URLs
16:29MikeDevcompojure's request is annoying in that u would have to split up the host and URI
16:29the-kennyMikeDev: If you just want to get the data from an url without special adjustments, you can just use slurp* fro m c.c.duck-streams
16:29MikeDevbut if I could get it to work, i'd be happy
16:29michaeljaaka,( + 2 4 )
16:29clojurebot6
16:29michaeljaaka(doc filter)
16:29clojurebot"([pred coll]); "
16:30michaeljaaka,(doc filter)
16:30clojurebot"([pred coll]); "
16:30alexykso I saw that there's a talk of making type hints more beautiful, like Type^var or var^Type -- I'd *love* that, and so other 5 million people!
16:30michaeljaakahow to get doc of filter?
16:30michaeljaaka(doc filter)
16:30clojurebot"([pred coll]); "
16:30MikeDevc.c.duck-streams?
16:30the-kennymichaeljaaka: There isn't
16:30MikeDevis that an abbrev?
16:30the-kennyMikeDev: clojure.contrib.duck-streams
16:30michaeljaaka(doc +)
16:30clojurebot"([] [x] [x y] [x y & more]); Returns the sum of nums. (+) returns 0."
16:30MikeDevyeah okay
16:31michaeljaaka(doc map)
16:31clojurebot"([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."
16:31the-kennyMikeDev: You're welcome :)
16:31the-kennymichaeljaaka: There isn't any doc for filter in my repl either. I assume there isn't any
16:31chousermichaeljaaka: huh! filter seems to have no docs
16:31michaeljaakaok, thx
16:32MikeDevo is that your library
16:32MikeDevI dont know that I wanna use contrib, but will check it out
16:32the-kennyMikeDev: clojure.contrib is a library made by many people.. but there's no code from me there ;)
16:32the-kennyMikeDev: contrib is very very helpful
16:32michaeljaaka(doc remove)
16:32clojurebot"([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns false. pred must be free of side-effects."
16:33the-kennyIt's like boost for C++ :)
16:39alexykhow do you flush stdout and stderr?
16:39arohnerchouser: I have docs for filter. I'm on (or near) head of new
16:40the-kennyalexyk: http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/flush
16:40the-kenny,(flush)
16:40clojurebotnil
16:41alexykthe-kenny: and what if I want to flush System/err?
16:41alexykwithout making it *out*
16:41the-kennyalexyk: Take a look at the source of flush. Just call the java method .flush on your stream
16:42alexykthe-kenny: ok
16:43MikeDevslurp doesnt seem easier than request
16:43the-kennyMikeDev: Why?
16:43the-kenny(slurp* is the thing you want, as it works with urls)
16:44the-kenny(take 3 (slurp* "http://google.de&quot;))
16:44the-kenny,(take 3 (slurp* "http://google.de&quot;))
16:44clojurebotjava.lang.Exception: Unable to resolve symbol: slurp* in this context
16:44MikeDev:use clojure.contrib.duck-streams
16:44MikeDev(:use clojure.contrib.duck-streams)
16:45the-kennyMikeDev: It's just use in a function call
16:45the-kenny,(use clojure.contrib.duck-streams)
16:45clojurebotjava.lang.ClassNotFoundException: clojure.contrib.duck-streams
16:45MikeDev(use clojure.contrib.duck-streams)
16:45the-kenny,(use 'clojure.contrib.duck-streams)
16:45clojurebotnil
16:45the-kenny,(take 3 (slurp* "http://google.de&quot;))
16:45clojurebotjava.security.AccessControlException: access denied (java.net.SocketPermission google.de:80 connect,resolve)
16:45the-kennyHeh, that was clear
16:45MikeDevo i thought i needed some filereader
16:46the-kennyslurp* chooses internally the right reader for your type of url/file/anything else
16:52MikeDevsweet
16:52MikeDevthat was exhausting
16:52MikeDevI've been trying to figure that out for hours now
16:56angermanfinally I think I got clojure to crunch away on huge files.
16:57angermanstill the api, is not so nice... :(
16:59MikeDevHey, I'm trying to do this:
17:00MikeDevhttp://pastie.org/728219
17:00MikeDevand it gives me
17:00Chousukeyou have an extra '
17:00MikeDevjava.lang.Exception: lib names inside prefix lists must not contain periods (exercises.clj:0)
17:01MikeDevbut it works on the cmd line
17:01the-kennyMikeDev: Just do (:use compojure clojure.contrib.duck-streams)
17:01ChousukeMikeDev: the use function is not the ns :use
17:01the-kenny(In one (:use), I'm not sure if it's valud with two :use)
17:01ChousukeMikeDev: the :use arguments don't need to be quoted
17:01MikeDevk
17:04somniumin the ns macro (ns foo (use c.c.bar) (import j.u.Klass)) executes fine. is there a reason for the keyword convention?
17:05somnium(it just seems to conguse people)
17:05somniums/conguse/confuse
17:05polypusdon't you mean conjuse people
17:05somniumthats it
17:06the-kennyIs there a good emacs-package to refactor clojure code?
17:06somnium(still struggling with a dvorak experiment)
17:07MikeDevhow to do regexps in clojure?
17:08jasapp,(doc re-find)
17:08clojurebot"([m] [re s]); Returns the next regex match, if any, of string to pattern, using java.util.regex.Matcher.find(). Uses re-groups to return the groups."
17:08the-kennyMikeDev: #"yourregex" will return a java.regex.pattern
17:08the-kennys/p/P/
17:10ataggartcan anyone confirm a branch of contrib that compiles using the "new" branch of clojure?
17:11somniumthe contrib new branch?
17:11ataggarttried and failed
17:11ataggart[java] Caused by: java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V
17:11ataggartlots of those
17:11the-kennyataggart: You have to do a "ant clean" before you build contrib
17:12ataggartk
17:12the-kennyclojurebot: RestFn
17:12clojurebotIt's greek to me.
17:12the-kenny~clojure.lang.RestFn
17:12clojurebotant clean and rebuild contrib
17:12the-kenny:)
17:17ataggart [java] Caused by: java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.Symbol
17:17ataggart [java] at clojure.core$ns_resolve__5000.invoke(core.clj:2849)
17:19MikeDev,(doc re)
17:19clojurebotTitim gan éirí ort.
17:19MikeDevi dont need to find
17:19alexykanybody else supports prettier type hints? is there a plan for them?
17:19MikeDevi just need to know yes/no
17:19MikeDevas in $Blah =~
17:20the-kennyMikeDev: re-match or something like this
17:20the-kenny,(doc re-match)
17:20clojurebotHuh?
17:20the-kenny,(doc re-matches)
17:20clojurebot"([re s]); Returns the match, if any, of string to pattern, using java.util.regex.Matcher.matches(). Uses re-groups to return the groups."
17:20the-kennyMikeDev: http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/re-matcher
17:20hiredmanalexyk: deprecating ^ as a reader macro fro (meta ...) is on the list for 1.1, and it needs to be done before ^ can be safely repurposed
17:21alexykah ok, so at least the train is in motion
17:21the-kennyHow can I access "this" in a proxy-method?
17:21MikeDevi wish it would say what it returns if FAIL
17:22MikeDevnil?
17:22j3ff86say i have 2 agents, and im doing (await agent1) (await agent2), why would (map await (list agent1 agent2)) not work correctly?
17:22the-kennyMikeDev: Just try it in a repl :)
17:23the-kennyj3ff86: Generally said: Because map is *lazy*
17:23somniumhttp://java.ociweb.com/mark/clojure/article.html
17:23ataggartmap is lazy
17:23ataggartI win!
17:23somnium^^ is a good free guide to the api
17:23j3ff86ah ok
17:24ataggartnote for anyone that cars, master branch of contrib compiles fine with "new" branch of clojure, once running ant clean.
17:24j3ff86is there a none lazy way to do map?
17:25the-kennyj3ff86: (doall (map ...))
17:25j3ff86thanks
17:26ataggartor dorun
17:26j3ff86which is better?
17:28alexykhow do I import << from http://muckandbrass.com/web/display/~cemerick/2009/12/04/String+Interpolation+in+Clojure into another namespace?
17:28alexykataggart: it did for a while, didn't it?
17:29MikeDev([m] [#"http://.*&quot; "httpS://www.google.com"])
17:29MikeDev,([m] [#"http://.*&quot; "httpS://www.google.com"])
17:29clojurebotjava.lang.Exception: Unable to resolve symbol: m in this context
17:29MikeDev,([re-matches] [#"http://.*&quot; "httpS://www.google.com"])
17:29clojurebotjava.lang.IllegalArgumentException: Key must be integer
17:30MikeDev,([re-find] [#"http://.*&quot; "httpS://www.google.com"])
17:30clojurebotjava.lang.IllegalArgumentException: Key must be integer
17:30MikeDev,(re-find [#"http://.*&quot; "httpS://www.google.com"])
17:30clojurebotjava.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.util.regex.Matcher
17:30the-kenny:(
17:30ataggartwhy do you have brackets around the fn name?
17:30ataggartmike
17:30MikeDevbecause i'm retarded
17:30hiredmanyeah
17:30the-kennyMikeDev: If you going to try much things, you should do it local on your own pc
17:30MikeDevok
17:31MikeDeveaier here because repl doesnt do backarrow or uparrow
17:31alexykcan one launch a clojurebot on a private channel for clojure hacking from internet cafes?
17:31hiredmanclojurebot repsonds to private messages
17:31the-kennyMikeDev: Run it with rlwrap or use emacs or a plugin for another ide :)
17:32hiredmanand clojurebot is on xmpp clojurebot@thelastcitadel.com
17:32hiredmanhuh
17:33alexykhiredman: lovely. now we can say. "get a room with clojurebot, will ya?"
17:33hiredmanclojurebot isn't on xmpp right now
17:33alexykwhat's xmpp?
17:33hiredmanjabber
17:33alexykah...
17:33arohnerisn't there a WeakReference wrapper floating around somewhere, or did I imagine that?
17:34alexykMikeDev: IDEA hs a lovely La Cojure plugin, and is free now:)
17:34angermanhiredman: I did incorporate your suggestions from yesterday. http://gist.github.com/249422 does it look better now?
17:34MikeDevmsging closurebot works well, and yes it gives nil when none found
17:35MikeDevbtw I kinda know ML
17:35alexykso back to import, I want to import cemerick's << which he did as defmacro in his ns. How do I import that? '<< ?
17:36hiredmanangerman: what is with the (in-ns 'clojure.contrib.duck-streams)
17:36MikeDevWhen I have problems, I will swear at closurebot in pm
17:36MikeDevwill be cathartic
17:36angermanhiredman: for me, that's the place where I expect it mentally. Apart from that nothing.
17:37hiredmanso you are monkey patching this function into that namespace?
17:37angermanyes. Because I set out to find that functionality there. But didn't.
17:38angermanThough I know that that should be changed.
17:38somniumalexyk: loading the file and (use 'commons.clojure.strint) doesnt work?
17:39alexyksomnium: nope
17:39the-kennyhm... looks like lein-swank is bugged :(
17:40somniumalexyk: what doesnt work?
17:40angermanhiredman: I added support for the Obj Interface to the BufferedRandomAccessReader too. So it could hold metadata.
17:41alexyksomnium: my IDEA loaded it into repl with: (load-file "/Users/alexyk/twitter/mongol/draft/strint.clj") => #'commons.clojure.strint/<<
17:41alexyknow if I do the use above, I get: java.io.FileNotFoundException: Could not locate commons/clojure/strint__init.class or commons/clojure/strint.clj on classpath: (NO_SOURCE_FILE:0)
17:42somniumyou need to add the file to your classpath
17:42alexykwell I'm in darn repl already! can I rename it within repl? :)
17:43somniumin netbeans you would drop it in a library, something similar in idea?
17:43MikeDevi like fugde repl
17:43technomancythe-kenny: it needs to be updated to use eval-in-project from the latest... I plan on fixing that tonight.
17:43the-kennytechnomancy: Ah, nice :)
17:44the-kennyI'll just stick to lein repl manually invoking (swank.swank/start-repl) now
17:44alexyksomnium: my question is, this works: (commons.clojure.strint/<< "There's ~(seq (range n 90 -1)) bottles of beer on the wall...")
17:44alexykI simply wonder whether I can yank a name into the current namespace in repl, in general
17:44alexykor in other scripts
17:45somniumah, becuz its not on classpath, but try (alias '<< 'commons.../<<)
17:45alexyki.e. rename without reimporting -- I guess I can do defmacro << {something using f.q.d.n./<<} -- oh I see
17:47alexyksomnium: (alias '<< 'commons.clojure.strint/<<)
17:47alexykjava.lang.NullPointerException: Expecting Symbol + Namespace (NO_SOURCE_FILE:0)
17:58somniumalexyk: (defmacro << [& blah] `(commons.../<< ~@blah))
17:59somniumafter this I give up
18:01ataggartis emacs a nonstarter if one is not a touch-typist?
18:01somniumataggart: you can enable the toolbar
18:03angermansomnium: 8-)
18:03angermanataggart: if you *want* a mouse driven env. emacs is probably not for you.
18:04ataggartangerman: it's not so much want as not being a touch-typist.
18:05ataggartI'll try it regardless. Again. I think this will be my 5th attempt at getting emacs.
18:05angermanataggart: in my opinion, you have to want to use the keyboard way more to utilize emacs or vim effectivly.
18:05technomancyataggart: if I didn't know Emacs and didn't know touch-typing, I would prioritize learning touch-typing over learning Emacs
18:06technomancyand I really like Emacs
18:06ataggartfair enough
18:09angermancomputing the average weights of a LibSVM Model file with 45000 features on 250 samples took "Elapsed time: 1063192.462 msecs" hmmm.
18:10angermanif I add agents in the mix and up the mem for the stack, that could go faster I think
18:11angermanat least, that's what I think the graph tells me
18:11angermanhttp://skitch.com/angerman/nk8hb/java-visualvm
18:12Licenserangerman: I'd give out the blind guess that the profiling took a good bit of the performance for tiself
18:12ohpauleezangerman: yeah, user agents, arrays, and ints/floats where you can
18:13angermanLicenser: sure. But I think it's a memory problem too
18:13Licenser50M does not seem too much to me
18:14angermanLicenser: no, I mean the memory that the JVM is allowed to use
18:14Licenserah okay sorry
18:14angermanmaybe I'm reading that graph wong
18:14Licenserwell you could just give it more memory
18:15Licenserno clue it seems to spend a lot of time in the GC, giving it more memroy might really help
18:15angermanbut it looks like the jvm is caped at ~80M Heap space or so. So the GC goes nuts.
18:15Licenserjava 1.5 or 1.6
18:15angerman1.6 os x
18:15angerman(_not yet_ having installed the latest update from yesterday or so)
18:15Licenserhmm hmm odd
18:15kylesmithIs there a function like read-string that reads everything (not just the first item)? Or, is there a function that will return how many characters were consumed from read-string?
18:15Licenserdo you start the jvm with any parameters?
18:16angermanand it's just driving one CPU hot. So at least a second agent should help
18:16angermanLicenser: no. lein swank, and then call from emacs
18:16Licenserhmm it might pass arguments to the JVM
18:16angermanyep, but I know where to look for performance gains now :)
18:17Licenserjava 1.6 is supposed to smartly guess what are the best settings for you so you don't have the effect you see - at least that is what I understood when reading up on it
18:17_atokylesmith: the only way I can think of is to use a StringReader: (java.io.PushbackReader. (java.io.StringReader. "(foo)(bar)"))
18:17angermanand it finally works, I can work with clojure and files of a few hundret megs without running into out of mem exceptions.
18:17MikeDevdoes anyone have an example of if/else in code?
18:17_atoand then keep calling read on it until you run into EOF
18:17_atoor
18:17_atoactually
18:18_atoalternatively, just wrap whatever you're reading in parens
18:18Licensermake a lazy read seq!
18:18_ato,(read-str (str "(" "(read)(things)(reading)" ")"))
18:18clojurebotjava.lang.Exception: Unable to resolve symbol: read-str in this context
18:18_ato,(read-string (str "(" "(read)(things)(reading)" ")"))
18:18clojurebot((read) (things) (reading))
18:18angermanLicenser: well if I only had to read a sequencelly and only apply a simple function to it... yes that could have worked
18:18kylesmithato: that might work. let me see..
18:18angermananyway.
18:18angerman-> bed
18:18Licensernight angerman
18:19_ato,(if (= 1 1) :yes :no)
18:19clojurebot:yes
18:19hiredmanMikeDev: http://github.com/richhickey/clojure/blob/master/src/clj/clojure/core.clj#L61
18:19_ato,(if (= 1 2) :yes :no)
18:19clojurebot:no
18:23MikeDevyep, k
18:23arohnerlisppaste8: url
18:23lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
18:23MikeDevaw sweet
19:42j3ff86is there a version of the split-at function that always splits in the middle of a function?
19:43j3ff86i mean collection
19:44j3ff86i wrote my own but just wondering if theres something simpler
19:44ataggartnope
19:44ataggartthere's also the question of where the middle is in an odd sized coll
19:44j3ff86yeah
19:45j3ff86thats what my function does
19:45j3ff86cases for odd and even sized collections
19:45ataggart(split-at (/ (count coll) 2) coll)
19:47ataggartI've been playing with emacs for all of an hour and my left hand is killing me
19:48ataggartclearly the designers of the macbook keyboard thought ctrl would not be an oft used key
19:48tomojmy mac has cap lock = ctrl
19:49ataggarthmm I'll give that a shot
19:50tomojthere's a setting for it somewhere in system preferences
19:50ataggartyep
19:50ataggarteasy
19:51ChousukeI actually made cmd control for emacs
19:51Chousukeand caps lock is meta
19:51Chousukeit works pretty well
19:51j3ff86i hate laptops with the fn and ctrl keys switched
19:52ataggartcan I just tell emacs to use different keys for C- and M- ?
19:52Chousukeataggart: yes
19:52Chousukeataggart: that's what I do. I have caps lock mapped to control normally.
19:52ataggartwhich control is used more M or C?
19:53hiredman(you could just use vim)
19:53Chousukeataggart: C
19:54ataggartchousuke: thx
19:54the-kennyYes C. M is almost only used for M-x some-command
19:55ataggarthiredman: my main motiviation for even bothering is because so many seem to be using emacs-related stuff.
19:55the-kennyataggart: Emacs is the nonplusultra lisp-editor
19:56ataggartif technomancy et al. can use it for remote pair programming, it seems useful enough to learn
20:26interferonis there an aggregator of clojure blogs, something like Planet Lisp or Planet Gnome?
20:26tbatchellinot exaclty and aggregator, but there is disclojure.org
20:32metvopanyone know how to get Waterfront IDE to find contrib? Using windows and have clojure-contrib jar sitting sitting on the C:\ drive.. I'm playing around with this thing and it's nice and lightweight. If only I can get it to find contrib. I have the same problem with Clojurebox, but not looking to delve into that right now..
20:41interferonis there any way to make clojure's error traces less opaque? will clj-trace do that?
20:47alexykliebke: incanter may be called ClojuR :)
20:48liebkehehe, true but I think there are enough *jure names already :)
20:51alexykliebke: so I see you get R datasets and refer to R analogs. Perhaps a thorough translation table would be useful for those who know R?
20:51alexykis the dataframe in incanter a map with first pair being column names and next the rows?
20:51liebkeI have thought about it
20:51liebkeyes
20:52alexykliebke: did you see plyr in R?
20:52liebkeI've looked at it a bit, cool stuff
20:53alexykliebke: yeah... apparently group-by can be used similarly
20:54alexykthere's also ggodi from R, perhaps we can hook it up as well
20:54alexykbasically we need to steal everything off http://had.co.nz/ :)
20:57alexykone-liners with S-exps really shine here
20:57liebkealexyk: why don't you port plyr to Incanter instead :)
21:08michaeljaakahi
21:08michaeljaakawhy I get output onto screen instead into file
21:08michaeljaakahttp://gist.github.com/249509
21:08michaeljaakaanyone can help?!
21:09carkfirst there are missing parenthesis around your map fomr
21:09carkbut it's completely wrong anyways
21:09michaeljaakawell I just removed it just to try another option
21:09michaeljaakawith paenthiesis won't work too
21:09carkright
21:11carktry binding *out* to your stream
21:11carkthen jèust use println as you would to output to screen
21:12hamzahttp://nakkaya.com/2009/11/01/clojure-persistence-for-java-programmers/ check this out, it explains what you are trying to do..
21:13carksomething like this : (with-open [w (writer "c:\\a.a")] (binding [*out* w]) (println "coucou1"))
21:15alexykliebke: I have to produce some data-mining graphs ASAP to prove I'm doing work, not just playing with Clojure and incanter. So that's the first order of the day! :)
21:15carkor better : (with-out-writer (writer "c:/a.txt") (println "coucou"))
21:15michaeljaakahmmm
21:15michaeljaakathis works ok
21:15liebkealexyk: hehe
21:15michaeljaakabut when repleacing println "xx"
21:15michaeljaakawith
21:15michaeljaaka(map println seq)
21:16michaeljaakathen stops to work
21:16cark,(doc map)
21:16clojurebot"([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."
21:16carkmap returns a lazy sequence
21:17michaeljaakaok
21:17alexykliebke: I guess the weird R row names are lost in translation?
21:17michaeljaakaso how to write sequence?
21:17michaeljaakadoseq ?
21:17michaeljaakaor what?
21:17liebkeyeah, no R row names yet
21:17cark(doseq [i [1 2 3]] (println i))
21:17michaeljaakaok :)
21:18michaeljaakagoing to try
21:19alexykliebke: can be an optional :row-names=>[names] pair in the dataframe map, or go as last element into each row
21:19alexykthus providing compatibility
21:19michaeljaakawowoowowm works, thanks cark
21:19carkmichaeljaaka : map is usefull when you want the result of your operation, there is no result with println
21:20carkactually there is a nil but not very usefull =)
21:20michaeljaakacark: now I'm going to replace dorun map with doseq
21:20liebkealexyk: yeah, I would just add :row-names to the dataset map
21:20michaeljaakain many places
21:21cark=)
21:23carkhum there should be a do-map function
21:23carkor something like it
21:25hiredman(comp vec map)
21:25cark^what if you're not interested in the result ?
21:25carkor maybe do-each would be a better name
21:25hiredmanuh
21:25cark(do-each println [1 2 3 4])
21:25hiredmandoseq
21:26hiredman(doseq [i [1 2 3 4]] (println i))
21:26carkright but there is just that bit more syntax with doseq
21:26alexykliebke: how do you produce doc/api/index.html with all doc strings?
21:26hiredman(comp (constantly nil) vec map)
21:27carkinefficient !
21:27liebkealexyk: look at the bin/generate_docs.clj script
21:27michaeljaakado-map is ok
21:28alexykliebke: perhaps you can git mv src/incanter src/main/clojure/incanter for default maven compatibility, tests, and future src/main/scala? :)
21:28michaeljaakais more idomatic to map
21:28carkmichaeljaaka : if you have many places where you do use doseq, it means you're using lots of side effects
21:28liebkehehe, the future build tool for Incanter will be Leiningen, not Maven :)
21:29carkmichaeljaaka : i usually build lists or vectors then only doseq at the end
21:29michaeljaakacark: yes I do
21:29alexykthen a pom.xml is easily added and it's mavenized => 1-click import into IDEA. Well, not to worry, pom.xml will drop in there, src is configurable... :)
21:29michaeljaakahmmm, maybe I could, but I'm just beginer
21:30carkmichaeljaaka : so it's a good time to learn good practices ! makes for easier to test programs
21:30alexykI found, after painfully learning maven for Scala, that it really begins to pay for itself with more JVM languages.
21:30liebkeLeiningen can generate a pom.xml using 'lein pom'
21:30alexykIf you're in Scala, you can use SBT, and in Clojure Leiningen, but if you have both and also Java, Maven starts to sit pretty.
21:31liebketrue
21:35slyrusliebke: I read that as lein porn and was waiting for some good screenshots...
21:35liebke:)
21:39slyrusso is anybody working on a persistent datalog for clojure?
22:27polypusi'm trying out clojure mode in emacs and C-c v which is supposed to eval buffer is evaling the buffer as elisp
22:27polypusnot as clojure. but some of the other key bindings are working right
22:27carkc-c c-l
22:28polypusthx that works. any idea why evaling straight from the buffer doesn't?
22:29carksorry i don't know that
22:29carkpeople are using slime which has it
22:29carkclojuremode is good enough for me =)
22:30polypusi'm just trying out slime for the first time now
22:31polypusisn't slime just a repl into another process? can you eval buffers with slime?
22:31_atopolypus: C-c C-k will eval the buffer
22:31carkyes you can, thoi don't remember how
22:32cark-i
22:32_atoor well that compiles it
22:32duperhi, I just discovered clojure.. any other popular LISP dialects with sizable freenode channels I should know about?
22:32_atothere's an M-x slime-eval-buffer
22:32duperor Scheme
22:34_atopolypus: C-h b will give you a list of all the key bindings bindings. You may like to bind some yourself, eg I bind swank-clojure-project to C-c C-o and slime-quit-lisp to C-c C-q
22:35_atoso you could bind C-c v to slime-eval-buffer if you want
22:35notallamai like to idle in #haskell sometimes. it's not a lisp, but it will work if you add parens like it was. :p
22:35polypus_ato: thx, seems like the M-x slime-eval-buffer is the fastest. and thx 4 other tips
22:38carkc-c c-k to compile and load
22:38_atoduper: elisp is probably one of the more popular lisp dialects so #emacs :-P
22:41DeusExPikachuso I checked the IRC logs for why clojure is not on the computer language shootout and found no satisfactory answer. At best I have a link https://alioth.debian.org/forum/message.php?msg_id=181551 of someone thinking clojure is just another lisp. I think the biggest reason to include it is to brag about the conciseness and its use of immutable and persistent datastructures. Thoughts?
22:42JAS415the code you have write to win benchmark games ends up being ugly
22:44_atoDeusExPikachu: well the answer is probably just that nobody has bothered entering it
22:48hamzajava bencmarks are pretty much usesless they are over before hotspot gets a chance to optimize your code.
22:48hamzathen there is the startup time, compared to c and what not
22:49DeusExPikachuhamza, http://shootout.alioth.debian.org/u32q/help.php#dynamic they tried adding a steady state version
22:50alexykis there a way to add a jar to a repl without restarting? it's important for me as repl stores huge datasets I need to visualize with incanter, but it was started before I've become incanter-aware!
22:52alexykhamza: c'mon, run a 1000 times and average startup out
22:52hamzaDeusExPikachu: btw check this out, it is a long discussion about bencmarks in java http://blogs.azulsystems.com/cliff/2009/09/java-vs-c-performance-again.html
22:53_atoalexyk: (add-classpath "file:///some/file.jar") but beware it's not reliable (eg loading JDBC drivers with add-classpath will not work)
22:53alexyk_ato: I hope incanter is safer than jdbc... let's see
22:54DeusExPikachuhamza, that's a good discussion, but regardless of whether the test is "flawed" I feel like we should just post it anyways, I'm reading the stuart book, maybe as an exercise I'll write them and submit them but theirs quite a few and to be convincing it might be best if all of them were submitted in short succession
23:24alexykliebke: incanter fails to build unless X window system is available
23:25liebkealexyk: hmm... can you email the error to liebke@gmail.com?
23:25alexykok, 1 min
23:28alexykdone
23:30alexykcompiling from there with ssh X forwarding enabled works and launches X on my mac. bizarro!
23:31alexykjust defining DISPLAY=:0 was not enough, it had to be real
23:32alexykliebke: can I specify X11 DISPLAY from within REPL somehow?
23:32liebkestrange... I didn't realize the build would be dependent on X. It looks like it's Processing
23:32alexykhow do we setenv from repl?
23:32alexykyep
23:32liebkefrom the repl? Not that I know
23:36alexykliebke: you may want to define the final claspath into a variable in bin/clj, not to copy it in the final if branches
23:36liebkegood idea
23:46alexykhow do you inspect classpath from repl?
23:58_ato,(System/getProperty "java.class.path")
23:58clojurebotjava.security.AccessControlException: access denied (java.util.PropertyPermission java.class.path read)
23:58_atothat probably won't show stuff that's been added with add-classpath though
23:59_ato~def add-classpath