#clojure logs

2011-09-29

00:11ibdknoxdnolen: awesome. I should dig through that sometime soon to understand how it all works :)
00:12ibdknoxout of curiosity, has anyone read Land of Lisp?
00:12amalloyibdknox: yeah
00:13ibdknoxwhat'd you think of it? I've been considering purchasing it
00:13amalloyi gave a brief review of it earlier today in #clojure, if i can find it
00:13dnolenibdknox: the upside is that core.match now generates a reasonable amount of code - so even fairly complex pattern like red-black-tree balancing won't a) cause AOT errors b) will be inlined like mad by the JVM. and all the other good stuff unchanged.
00:14dnolensome pluses for ClojureScript here as well.
00:14amalloybut basically: it's interesting, and i definitely picked up a few useful ideas. but a big chunk of it is focused on mutable state, and another big chunk is proselytizing about common lisp
00:14ibdknoxdnolen: sweet, I remember you had a gist a while back showing some of the code it would spit out and it was unbelievably nested haha :)
00:15dnolenibdknox: yeah so maybe 10X less code than that is now generated.
00:15amalloyeg, he advances an iterative series of macros that eventually allow you to create closures with a special hook for getting and setting their closed-over variables
00:15dnolenfor that case anyhow.
00:15amalloyneat, and powerful, but ultimately not that useful in clojure
00:16ibdknoxamalloy: yeah. Part of my motivation for reading it is, I like the concept of teaching lisp through a series of games. I was thinking that it might be a fun project to do something similar for Clojure :)
00:17ibdknoxdnolen: that's an impressive improvement
00:17amalloyibdknox: oh haha wait, i was revieing the wrong book
00:17amalloythat was a description of Let Over Lambda; i always confused the two because of their initials
00:17ibdknoxhahaha
00:17ibdknoxI've not heard of that one
00:17brehautamalloy: LOL
00:17amalloyLand of Lisp is fine, and short enough to get through in an hour or two so it doesn't much matter if it's good
00:18ibdknoxhaha
00:18dnolenibdknox: I was dreading it … but I think I only had to change 10 lines of code or something.
00:19ibdknoxdnolen: wow. Gotta love easy wins
00:19amalloyibdknox: i don't think small implies easy :P
00:19ibdknoxfiiine
00:20ibdknoxGotta love wins?
00:20ibdknoxlol
00:20amalloyi am in favor of...benefits!
00:20ibdknoxscrew anyone who isn't ;)
00:21dnolenwell props mostly to Maranget - his algorithm is simple - so changes not so painful.
00:21dnolenit's actually the main thrust of his paper - the simplicity of the algorithm compared to others
00:22ibdknoxmhm
00:23tomoj"Compiling Pattern Matching in Join-Patterns", or..?
00:23dnolentomoj: Compiling Pattern Matching to Good Decision Trees
00:23tomoj".. to good decision trees" perhaps?
00:23tomojah
00:25dnolentomoj: tho Maranget doesn't get into backtracking there - I had to pick Sam Tobin-Hochstadt's (Typed Racket, Racket match) brain to see the benefits of backtracking
00:27dnolenand by backtracking I mean pre allocating a JVM exception to use it a GOTO
00:46Jpeerindexhello
00:46Jpeerindexlooking for a 2D array solution in clojure.
00:47JpeerindexFor 2D arrays, they say list of lists is the way to go. or a map.. I wonder why ?
00:48amalloyhuh? java uses an array of arrays; why is the switch to a list of lists (or vector of vectors) so surprising?
00:49Jpeerindexgood pt.
00:49Jpeerindexarrays are an abstraction
00:49JpeerindexBUT some data is naturally a uniform grid with fixed size
00:49Jpeerindexfor example, a chess board. or a table
00:52Jpeerindexcan you use array "like" syntax in clojure ?
00:53Jpeerindexor how would you access array operations in clojure. like if i have an Object[] and want the third element. I assume standard . syntax won't work... since java arrays have their own sytnax for access with []s
00:53Jpeerindexanyways, just some thoughts but have to go :(
00:53Jpeerindex!
00:54amalloy...
01:05ibdknoxlol he must've been trolling
01:05ibdknoxI hope he was trolling..
01:08alandipertdnolen: how might one express a 'not' predicate in core.logic? (or is it built in?)
01:09dnolenalandipert: negation as failure, like prolog.
01:10dnolenalandipert: negation is a pretty wild topic in LP, and I'm on the fence about whether such a thing should be introduced.
01:11dnolenalandipert: the idea is that if a subgoal succeeds you cut and fail
01:12dnolenalandipert: you do have a limited version of it in core.logic which is disequality over trees. You can express that two trees should never unify.
01:13alandipertdnolen: i see. i'm a prolog noob, but what i'm trying to express is something like :- foo(x,y), not bar(z,y).
01:14alandipertare you saying that if i express the args as trees, then i can use disequality?
01:14dnolenalandipert: (=/= x y) means you just don't want two things to ever unify.
01:16dnolenalandipert: other option, (defn not-baro […] (conda ((baro …) fail) (…)))
01:16dnolenalandipert: what happens ^, is that if baro succeed all other possibilities are cut off, and we fail.
01:18alandipertdnolen: ahh ok i think that will do the trick for me. because i can try to unify my failure case, and fail when it does
01:18dnolenalandipert: out of curiosity .. what are you doing? :)
01:19alandipertdnolen: the greatest and best meal/menu engine ever conceived by humankind (in clojure)
01:19dnolenalandipert: haha! awesome.
01:21alandipertdnolen: as always, thanks for the awesome shit and help to go with. sleepy time, see you later!
01:22dnolenalandipert: np
01:25alandipertdnolen: oh, one more quick question. math preds on lvars, is there a pattern to follow?
01:26dnolenalandipert: arithmetic preds on lvars are the pits. I will probably start on integrating clpKanren into core.logic soon.
01:27dnolenalandipert: I'm assuming you're working with finite domains, no infinite chicken salads or nuthin
01:27alandipertdnolen: i was hoping to support infinite nutella
01:28dnolenhaha
01:28alandipertbut yes, it's all finite, and the regular clj stuff is working fine for me
01:28alandipertjust curious
01:28dnolenalandipert: yes, what's coming will be way better than what's there now, and it won't break anything.
01:28amalloyalandipert: a restaurant near here puts that on your french toast. more nutella than anyone could reasonably want
01:29alandipertdnolen: i don't believe you, math-related thingies tend to be breaky ;-)
01:29dnolenyou'll be able to say things like: (domfd (range 0 100) x y z) (plusfd x 2 z), etc
01:29alandipertamalloy: that is fantastic
01:30amalloy$google the griddle restaurant la
01:30amalloyerrr, except lazybot is down. pretend i intended you to google that yourself
01:30dnolenalandipert: I think Dan Friedman is a fairly trustworthy brain ;)
01:31alandipertamalloy: np, i am lazybot command feature-complete. just higher latency.
01:32brehautalandipert: but do you compensate for lacking parens?
01:34alandipertbrehaut: yes, i own sports car
01:34brehautalandipert: aha :)
03:13zhouchello, Lisp hackers
03:19pcavshello hello
03:35zhouc:-)
03:35zhoucI need coding some dirty c++ code for food
03:36zhoucLoL
04:57tomojsorenmacbeth: hey
04:59darqhello. I try to figure out the thread macro.. (-> 5 inc inc) this work prefecty .. but what if i have a list of function something like this (-> 5 (inc inc))... is there a way to give to the macro in this form?
04:59carknot with ->
05:00carkthat's the trouble with macros
05:00carkyou need a functtion so that you can apply
05:00carki think this is relevant http://blog.fogus.me/2010/09/28/thrush-in-clojure-redux/
05:01carknow you can do (apply trush 5 [inc inc])
05:02amalloymeh. ##((apply comp [inc inc]) 5), what is the point of thrush there
05:02lazybot⇒ 7
05:03carkwell that's just like the -> macro, but you can apply it
05:03carkthough there was an apply-macro in old contrib
05:03amalloycark: no, it's not really just like ->
05:03carkit's better !
05:03amalloyit's *different*
05:03carkhehe ye
05:03amalloy&(-> 1 (list 4))
05:03lazybot⇒ (1 4)
05:04cark(trush 1 #(list % 4))
05:04carkyou get to choose where your param goes with trush
05:04amalloy&(-> (1 4) quote)
05:04lazybot⇒ (1 4)
05:05amalloythe set of things you can do with -> and the set of things you can do with comp/thrush intersect; neither one subsumes the other
05:05carkah that's something you cannot do with trush
05:05carkyes that's the nature of macros =P
05:06amalloycark: btw it's thrush with an H. trush keeps stopping me in my tracks
05:06carkahh sorry, not a native speaker
05:06seancorfielduh-oh, looks like the "variable position thrush macro" suggestion that rolls around every three or four months :)
05:07amalloymeh, nobody really talks about thrushes anyway. they're a kind of bird
05:08carkseancorfield: not really we're talking about getting (some) of -> functionalities in a functional context instead of a syntactic one
05:08kzarIs there a way to use moustache with Noir?
05:08seancorfieldit always looks like a good idea when it comes up on the list... but i understand the resistance to adding it (after having seen it explained several times)...
05:09amalloycark: if you want variable position, you're just rewriting comp
05:09carki'm not rewriting anything, i just have this in my toolbox when needed
05:09carkand comp is backward looking
05:09darqThx to all. This discussion really helped :)
05:10carkbtw : i'm not fogus
05:11amalloyhaha we know
05:12cark=)
05:16seancorfieldi remember reading fogus' blog post now and wondering what scenario you needed thrush... yeah, i see the benefit of function over macro but i guess it depends on how often you have an opaque list of functions that you can't arrange to be in reverse order (where you could use comp)?
05:17carkthe order is only about making it easy on the eye
05:18seancorfieldso it reads outside-in rather than inside-out?
05:19carkso that the function are applied from left to right
05:19carkfunctions
05:21seancorfieldi guess i find ((apply comp [f g]) 5) more intuitive than (apply thrush 5 [g f]) - or ((comp f g) 5) more intuitive than (thrush 5 g f) ...
05:22carkwell if you have a long list of operations to perform, one per line, it suddenly makes sense
05:22seancorfield... but i do use the -> and ->> macros when i have a sequence of forms that i want applied as function calls with an argument added ...
05:22thorwilkzar: sure, by either bypassing noir's routing, or by forking noir to replace the routing entirely, i guess
05:25seancorfield... but i use -> a lot more than ->> so i guess i haven't run into a need (in my code) for thrush as a function (fogus' post talks about -> but really thrush is closer to ->> isn't it?)
05:25kzarthorwil: How would I go about bypassing noir's routing?
05:25carkamalloy would say they're different =)
05:26seancorfieldcark: lol... yeah...
05:28seancorfieldlooks like he's gone away... and so should i since it's 2:30 in the morning... i work up and had to check the log files... been doing a bunch of jvm tuning so i'm neurotic about memory usage :(
05:28seancorfields/work/woke/
05:28lazybot<seancorfield> looks like he's gone away... and so should i since it's 2:30 in the morning... i woke up and had to check the log files... been doing a bunch of jvm tuning so i'm neurotic about memory usage :(
05:28carkgood night =)
05:29kzars/\)/D/
05:29thorwilkzar: study noir's source to learn about it's expectations regarding routing, to see where you can step in
05:30seancorfieldcark: you're in central europe?
05:30carkyes, belgium
05:30carkthat's near france
05:31seancorfieldi'm originally from england so my european geography is better than most americans :)
05:31seancorfieldglad to see clojure in use in europe :)
05:31carkhehe such a tiny country, i can understand they don't know about it =)
05:31seancorfieldmakes great beer! :)
05:31carkohhh but i'm not the only european clojure user
05:32pyrseancorfield: it definitely is
05:32kzarthorwil: Fair enough, I've been reading the documentation but I can't get their defpage macros to work as they described. I'll have a look at the source
05:32luciani barely use it at all
05:32pyrseancorfield: both in france and switzerland
05:32clgvgermany has better beer than belgium ;)
05:32pyrseancorfield: at least :)
05:32seancorfieldi see various european clojure groups announcing meetings on twitter...
05:32carkclgv : that's a casus belli
05:33clgvlol
05:33seancorfieldheh, didn't mean to start a european beer war...
05:33thorwilkzar: bypassing that problem by using different routing and thus stepping wide out of the framework does not sound like a good idea ;)
05:33carkclgv: very different kind of beers actually, the world is big enough for both our country beers
05:34clgvcark: maybe, or maybe not? ;) :P
05:34cark!
05:34lucianclgv: sure it is. instead of choosing between two bottles of beer, just drink both
05:34carktoo early for that anyways, going for a coffee instead
05:35clgvhehe. coffee will have to wait after lunch ;)
05:36chridohere another european clojure user, austria vienna :)
05:39carkyou guys are using it professionaly ?
05:40chridocark: since 3 weeks
05:41carkwhat kind of projects ?
05:42chridodatafeeds, statistics and so on, trying to calculate everything in realtime
05:43carkahyes a good fit
05:43chridobut f# is also very nice
05:43carki gave it a test run recently, it's not bad at all yes
05:43carki just hate the lack of parenthesis tho =P
05:43chridobut there isn't incanter and the whole apache ecosystem
05:43Blafaselchrido: Coming from F# as well.
05:44carkthe real trouble with f#, it that whole miscrosoft echosystem
05:44chridocompletly agree
05:45carkbut i love their async stuff
05:45carkand there really is something to say about those strongly typed languages like f# or haskell
05:45chridoi was looking for something what could compete with hadoop and could be used with f#/.net, but didn't found something
05:45carkvery different from clojure of course, but good in their own way
05:46chridoso i gave clojure a try
05:46luciannot THAT different from clojure
05:47carkwell typing directed programming is a whole other world, and it has many advantages
05:47carktho i still prefer clojure
05:47lucianalthough the term "protocol" has been overloaded too much
05:48lucian"implicit interface" is probably less overloaded
05:48carkchrido: you'll find that there is a library for everything in the java world, and mosthave friendly licensing
05:51chridocark: completely agree the java/apache ecosystem is just great. after 5 years .net it's hard to get used to that :) the only commercial library i use currently is aspose for generating word documents
05:52carkyep that's really fantastic
05:52chridocark: on which kinds of projects are you working on?
05:53carki'm in telephony stuff
05:53chridoin europe?
05:53carkinterfacing with switch software, presenting the data to the admins and end-users
05:53carkyes
05:54chridointeresting
05:54carkhehe nope that's boring =P
05:54seancorfieldi thought microsoft had turned F# over to the community and were no longer maintaining it themselves? or did i just imagine that?
05:55carkseancorfield: oh no, it's first class language now
05:55carkit's included with visual studio
05:55chridoseancorfield: no, they even announced f# 3.0 with some interesting type extension mechanism
05:56seancorfieldgood... not that i'm a fan of MS but i'm glad they're still fully supporting it
05:57seancorfieldi haven't tried F# - i don't use any MS tech so i've not had the opportunity - but i used to do some ML back in the day
05:58chridoseancorfield: f# is also available for mac, they even founded some extensions for monodevelop
05:58seancorfieldbtw, on clojure in production... we took 1.3.0 to production earlier this week... we've had prerelease 1.3.0 versions in production since april!
05:59seancorfieldchrido: oh, i'll have to take another look at mono... i was involved with the mac port several years ago (mostly testing and bug reporting around xsp but i think i actually did submit a patch or two)
05:59carkmy production stuff is still on 1.2
05:59seancorfieldcark: we decided to jump to 1.3.0 early on and avoid the 1.2 -> 1.3 migration
06:00carkthe trouble is with libraries
06:00seancorfieldyeah, hence my crusade with contrib :)
06:00seancorfieldi just cut maven releases of data.priority-map and math.combinatorics (both 0.0.1)
06:01carkcontrib is one thing
06:01carki'm still using an old version of compojure for clojure 1.0
06:01seancorfieldi need to tie up a few loose ends in java.jdbc and push that to 0.1.0
06:01carkwhich i'm patching from the outside to make it work
06:01seancorfieldyeah, there's a lot of 3rd party libraries that haven't become 1.3-compatible yet
06:02taliosseancorfield: using the clojure-maven-plugin? any issues with 1.3?
06:03kzarI'm trying to accept JSON posted to me through Noir. I can't see how to set the Accept type to JSON and I can't get anything parameters coming through the params destructuring feature of defpage. I'm just returning (str params) and unless I add a route params like "/user/:id" in which case it seems to work
06:03seancorfieldi don't touch maven myself, except for the contrib libraries and that's all set up by Clojure/core
06:03kzarJeez I can't string a sentence together today, sorry about that mess
06:03taliosah :)
06:04seancorfieldi assume that maven setup uses the clojure plugin but i don't know... i'm a leiningen fan :)
06:04taliosI believe contrib is using my plugin still, I know stuart was looking at his own rewrite ( I kinda got overly sidetracked with $work )
06:05taliosI just found a heap of stackoverflow questions about it as well - I should go answer some of them :)
06:05talioslooks like most have decent answers already tho
06:05seancorfieldi'm lucky that $work involves clojure and since we rely on a bunch of libraries, my $work includes helping maintain those too...
06:07taliosnice. We have 3 folk at work who are keen on introducing clojure to the stack, but we're still holding off - too much else to get done first. need to get a proof-of-concept of clojure running in our osgi setup before we can really sneak something in
06:07taliosthankfully - all 3 of us comprise the back-end team :)
06:08seancorfield:)
06:09seancorfieldi get to make that decision and, so far, it's worked out well... we're sending another team member to clojure training at the conj so that'll help too
06:09taliosnice
06:10seancorfieldhe goes out sunday for training and i go out wednesday to join him for the conj itself... looking forward to that... just came back from strange loop and there was quite a bit of clojure content there too...
06:11seancorfieldi'm just happy to see a lisp on the jvm so that i can use it at work :) i never thought i'd get to use lisp in production when i first started learning it about 30 years ago!
06:12taliosWould loved to have gone to strangeloop.
06:12taliosI see some posts that some of Rich's comments kinda.... annoyed/insulted a few people. regarding tools/toolchains
06:12seancorfieldi wanted to go last year but couldn't swing it... i won't miss it again!
06:13chridowill there be recordings of conj
06:13seancorfieldheh, rich has strong opinions and likes to make people think
06:13taliosway too expensive here. ( new zealand )
06:13seancorfieldyes chrido everything will be up on InfoQ eventually
06:13seancorfieldi think ppl were most upset by his dig at TDD / unit testing
06:14seancorfieldbut on the language panel, everyone said they wish they'd invented lisp :)
06:16seancorfieldmeh, i really must go back to bed now i've satisfied myself the latest round of jvm tuning has been reasonably successful... 3:15am... ugh! and i have to be up again in 4 hours for a conf. call with europe!
06:17clgvseancorfield: jvm tuning? - what did you tune?
06:42robermannI've just found that a "lein repl" process started from inside a lein project directory does not inherit the same classpath of a "lein repl" process started from a non-project directory. I was assuming that in the former case we would obtained the default lein classpath + project specifics libraries.
07:05robermannby "default lein classpath" I mean that set in the lein.bat startup file
07:20mcstarhi, how can i make cake use swank-clojure 1.3.3, when i invoke cake swank ?
07:26winkis there any hidden benefit for using a defrecord when a map satisfies all my needs? (I'm grabbing JSON, so the structure already contains everything with the correct name)
07:27carka record is faster when doing (:name my-record)
07:28winkok, that's a point.
07:28carkbut there's more ceremony so is it worth it ?
07:28carkthen you have all the protocol stuff
07:29carka record can be part of a protocol
07:30carki personally almost always go for simple maps
07:30winkjust by telling me that :name record works you've basically blown away my doubts, thanks (yep, just starting and poking around)
07:32carkalso i think you cannot dissoc from a recor
07:32carkd
07:32carknot one of the declared fields anyways
07:32carkwhich makes sense
07:33winkwell, I'n having real datastructures, more like container objects for a handful of properties
07:33winkso I think it really makes sense to have them defined and not just a map that matches by chance
07:34carkahwell then you might want to check on reify which doesn't carry all the baggage of defrecord
07:34clgvI have implemented a lazy way to read a file and apply a function on each data entry. Now my heap blows and yourkit profiler says that inputstream has allocated 1,5GB of memory. can I convince inputstream to not do that? what is my error here?
07:35clgvI dont keep the data after I read it
07:36carkclgv: i woudl guess that you're holding onto the head of your lazy sequence somewhere
07:36carkthough it seems strange that yourkit says the inputstream is holding the data
07:36clgvcark: no I do not. I explicitely made sure of that ;)
07:36clgvits an ObjectInputStream though
07:37carkhum doesn't it maybe need to hold a reference to all data in order to resolve cross-references ?
07:39clgvcark: that might be the cause. but I dont have cross references between the objects since they were appended independently to the file
07:39thorwilhow is name-with-attributes to be used? the name it returns appears as #<core$name clojure.core$name@5f6b0b29> in macro-expansion, but triggers "First argument to def must be a Symbol"
07:39cark" It automatically traverses references between objects, saving and restoring entire graphs."
07:40clgvcark: yes. so I have to hack it to persuade it that it does not have to.... :/
07:41carkin my experience binary serialization is always hairy for large datasets
07:41clgvit was the easiest way to get my result-data stored in compressed form
07:42carkstill not as good as a gzip stream
07:43carkthen you can serialize to text with print
07:43carkmakes for easy debugging =P
07:43clgvcark: lol. I do a result -> ObjectOuputStream -> gzip -> ZippedObject -> ObjectOutputStream (append)
07:43carkwow
07:44clgvso I have a file of ZippedObjects that are entirely independent
07:44carkso you encapsulate your results in separate gzip "packets" ?
07:44clgvyes since I need the append behaviour
07:45carki guess it might be usefull if you cannot wait for buffers to overflow
07:45clgvmy last algorithm runtime was one month consuming 10months cpu time ;)
07:46carkso you're processing a given set of data in one go ?
07:47clgvnow I want to process the resultdata in one run, yes
07:47carki'm pretty sure you'd use less bandwidth with one single gzip stream
07:48clgvcark: not much. I tried
07:48carkthough you might want to test that
07:48clgvand I cannot hold more than 100GB in memory at once ;)
07:48carkwell then you can't use the objectstream =P
07:48clgvwhich would be needed for the gzipstream...
07:48carki disagree there
07:49carkit only holds enough to fill its buffer
07:49clgvgzipstream holds everything in memory and compresses it on closing
07:49clgvI tried that
07:49carkhuh
07:49clgvit has to, for the gzip algorithm to work
07:52clgvhmm maybe I can clear the handle table with reflection myself
07:54carkindeed it's not flushable =/
07:56clgvcark: yeah under normal constraints thats reasonable
07:59carkthere is a bug report about that
07:59carkmaybe you could try apache commons
08:00clgvwhat do you mean?
08:00carkorg.apache.commons.compress.compressors.gzip
08:00carkit has a flush method, doesn't know if it works tho =P
08:00clgvgzipoutpustream has one as well ;)
08:00carkbut it doesn't work
08:01clgvbut it doesnt do anything. the problem is not the gzipping, thats pretty fine.
08:01clgvthe problem is the objectinputstream caching those independent objects ;)
08:02michael_campbellYou know it's going to be a good day when you misspell your own name first thing...
08:03carkhow about you do it this way : serialize each object to binary -> zip it -> put it in a binary packet -> stream it
08:04carkthe packet would have a data size as first bytes
08:04clgvcark: you dont understand. I already have 600GB data that I want to process now ;)
08:04carkoh already serialized ?
08:08winkhm, I seem to have run into some build problem. first it said "unknown ctor" and now after reverting and doing a clean I can't compile because of ClassNotFoundException, any ideas?
08:10clgvyes
08:11winkjust found some _init.class that are still used. wtf
08:11clgvwink: build of what?
08:11winkmy lein project
08:12clgvlein clean does not help?
08:12winknope, it doesn't kill some class files.
08:12winkI got an unkillabla javaw.exe
08:12winkthat seems to be it
08:13winksystem problem. doh
08:16robermannon Windows I find Unlocker an unvaluable tool for that problems: http://www.filehippo.com/download_unlocker/
08:17robermannthis the source: http://www.emptyloop.com/unlocker/
08:21winkgah, now I checked out the last revision and I still get a classNotFoundException.
08:23clgvwink: and without providing details you even wont get an answer or hint here
08:24winkyeah sorry, I'm really trying to scrap some info at all together.
08:25winkbut basically it is: I did a lein clean and now I can't get it to compile again, sounds like java bein stupid
08:30clgvwink: or you actually renamed or deleted something previously
08:31winkand some class was still available under an old name somewhere and not cleaned by a previous clean? yeah
08:34winkseems that was the culprit, sorry for the noise.
08:36clgvhappens easily when moving or renaming defrecord/deftypes
08:42clgvhmm I have a little hobby project where I want to generate graphs dynamically via a webinterface. it needs just a combobox and maybe some editboxes to specify parameters and shall display a graph image. how and with what tools can I do that easily?
08:43winkmy first guess would be raphaeljs + jquery
08:44winkor some other canvas lib
08:44clgvI would want to try one of the clojure webframeworks - since it's a hobby project.
08:45clgvand the image to be displayed should be generated on the server as jpg or something
08:46winkoh ok, sounded more like a quick live manipulation thingy
08:47clgvno. I have some data behind it that is update on a regular basis
08:49clgvand the backend generating the data is already implemented in clojure, so it would be great to implement the frontend in clojure as well
08:50clgvcark: seems my reflection hack works
08:53carkhaha nice
08:59mcoffbyoneclgv: maybe it is worth to have a look at https://github.com/pallix/lacij and vijual
09:00clgvmcoffbyone: oh nice.
09:01mcoffbyoneclgv: also if you can afford to place the nodes by hand you could try using d3.js and the clojurescript wrapper
09:02mcoffbyoneclgv: but the world of displaying graphs is hard, even for a small number of nodes
09:02clgvhmm and webnoir might work for the interface I guess - dont know how much for interaction it offers
09:43duck1123`Does anyone know why, if I have Clojure 1.3 in lib/dev/ I get a NoSuchMethodError. If I delete that jar, then it works
09:53cemerickduck1123`: you probably have some dependency that contains class files AOT-compiled against clojure 1.2.
09:55duck1123`yeah. I think it may be the ordered-set lib that's doing it
10:00clgvduck1123`: did you try a lein clean?
10:04duck1123`lein clean fails. I can't do anything until I remove that jar
10:11Blafasellein deps wants to download org.clojure:clojure:jar:1.+ (literally, it seems?) and fails as soon as I add vimclojure/server 2.3.0-Snapshot to the dev-dependencies.
10:12BlafaselIs that a bug in that package? My ignorance/own fault?
10:21mindbender1
10:22joegalloBlafasel: ITYM 2.3.0-SNAPSHOT
10:23joegallois that a typo here in irc, or do you have it wrong in project.clj? (maybe it's not case sensitive though, but i'd be surprised)
10:24Blafaseljoegallo: That was a typo here - I didn't c/p
10:24joegalloi just created a new project locally, and it works for me with:
10:24BlafaselTrying to fix the last minor hiccups with my environment here. I want better integration between lein and vimclojure..
10:24joegallo[vimclojure/server "2.3.0-SNAPSHOT"]
10:25Blafaseljoegallo: :dependencies or :dev-dependencies?
10:25joegalloThe 1+, it seems, translated into 1.2.1
10:25joegallojust dependencies
10:25BlafaselFor me it was dev-*. Let me try changing that.
10:25joegallohuh, neato
10:25joegalloit blows up on me, too, as a dev dependency
10:26BlafaselAh.
10:26BlafaselAnd that's not expected, right? I mean - it's not a totally stupid idea on my side to try to add it like that?
10:26joegalloadd clojure (whichever version) as a dev dependency, though, and then it works fine.
10:26joegalloas to whether that is representative of a bug, or some known and expected behavior, i have no idea
10:26robermannFYI: recently I was trying to install Emacs on Windows; here I "documented" my steps - maybe this could be useful for someone else - purist Emacs people forgive me :) - https://sourceforge.net/apps/wordpress/codesounding/
10:28Blafaseljoegallo: Added org.clojure/clojure "1.3.0" as a dev-dependency, same trouble with vimclojure/server. What did you put in?
10:29joegallo1.2.1
10:29joegallobut 1.3.0 works for me, too
10:30Blafasel*sigh* Yeah, _this time_ it was a typo. Sorry and thanks for the help.
10:31joegalloheh, no worries
10:31BlafaselNow.. let's see where I can get/build a recent lein-vimclojure
10:45dpritchettI'm jealous of GitHub's Hubot. It's a node-built CampFire bot that does all kinds of hooks like building and deploying stuff, googling things for people, etc.
10:45dpritchettIf you were building somethign similar for your company but didn't want to introduce a Campfire dependency (monthly fees!) where would you start?
10:46dpritchettI could do a jabber bot but that's 1:1 communication and I much prefer public micromessaging type stuff. The only OSS twitter clone i've tried is status.net and it requires a bit more LAMP than I'd like to deal with today.
10:47clgvhow do I flush printlns?
10:47raekclgv: 'flush'
10:47clgv,(doc flush)
10:47clojurebot"([]); Flushes the output stream that is the current value of *out*"
10:48clgvdoh! :P
10:48clgvthx raek
11:02kzardpritchett: Could you use one of the IRC bots?
11:03dpritchettkzar: I guess I could use an IRC bot but I'd really like something that's got a web frontend with permalinks. Something like Twitter.
11:04dpritchettPlus our non-tech users aren't on IRC anyway.
11:04dpritchettMaybe I should just build a little in-house twitter clone myself.
11:04kzardpritchett: Hmm well it could be a starting point I guess, anyhoo I don't know to be honest. We tried campfire and ended up using jaconda.im where I work
11:09kzardpritchett: If you make a great Clojure powered alternative let me know, I'll give it a try
11:11robermannvista
11:11robermannops
11:34simonjdpritchett: What about http://yammer.com? It's a private company but the service is free. Not sure what the API is like though...
11:53dpritchettsimonj: I'm just sticking with xmpp right now, i'll teach it to use the public network later. http://i.imgur.com/TnnwW.png
11:53dpritchetterr i probably meant to send that to kzar sorry.
11:59technomancydpritchett: we have a clojurebot instance running against subrosa that works great
11:59technomancyyou can set up persistent chat history, so it's not like other IRC servers where stuff just disappears
12:00dpritchettpersistent chat (see http://clojure-log.n01se.net/) is almost good enough, i think I might still want per-message permalinks though
12:00dpritchettthere's plenty of low hanging fruit before i get to that point anyway
12:00dpritchettthanks
12:10glob157tryin to set up a clojure dojo east coast
12:23jweisshow do i go from [{:a :b} {:c :d} {:e :f}] -> {:a :b :n {:c :d :n {:e
12:23jweiss :f}}} ? (list of maps to nested maps)? thought there may be a simpler way than loop, accumulator and ever-deeper assoc-in
12:25raek,(reduce #(assoc %2 :n %1) (reverse [{:a :b} {:c :d} {:e :f}]))
12:25clojurebot{:n {:n {:e :f}, :c :d}, :a :b}
12:26raekit's easier to build inside out
12:40jweissraek: excellent, thanks!
13:05bsod1what's the purporse of int-array? is it faster for int arrays?
13:06dnolenbsod1: mostly a convenience
13:08bsod1dnolen: I'll use a data structure, I'll only hold integers, and I need fast lookups, should I use this one or set?
13:08arohnerbsod1: you should probably be using set or vector, unless you know the unboxing is a bottleneck
13:10bsod1arohner: no I didn't know, can you give some resources about unboxing thing for further information?
13:11arohnerbsod1: http://my.safaribooksonline.com/book/programming/clojure/9781935182641/performance/288#X2ludGVybmFsX0ZsYXNoUmVhZGVyP3htbGlkPTk3ODE5MzUxODI2NDEvMjkx
13:12arohnerbsod1: definitely start with set or vector. Switch to java arrays only after you've demonstrated it's necessary
13:14kzarAny ideas why some symbols are getting messed up in my templates? I'm using Noir but my templates are being defined with Enlive's deftemplate. For example &nbsp; in the template is replaced with �.
13:38srid`M-x clojure-jack-in` is broken since yesterday. nothing happens beyond the "Starting swank server..."
13:39sridslime-connect is also broken :(
13:41sridi'm going to reboot to see if that fixes the problem
13:41sridopen-network-stream: make client process failed: Connection refused, :name, SLIME Lisp, :buffer, nil, :host, 127.0.0.1, :service, 4005, :nowait, nil
13:50technomancycheck the *swank* buffer?
14:01srid`cake swank` threw an exception: NoSuchMethodError: clojure.lang.RestFn.<init>(I)V (macroexpand.clj:1) - from cake.log https://gist.github.com/1251430
14:01sridtechnomancy: there is no *swank* buffer.
14:02sridtechnomancy: though clojure-jack-in creates one with "Process swank exited abnormally with code 1. That's not a task. Use "lein help" to list all tasks."
14:04technomancyok, well the first thing you need to do is install swank
14:04technomancyor better yet, start with the readme
14:06sridi had removed lein m2 cache yesterday to fix some problem. so that removed swank itself.
14:16aaelonyI've been cheating a bit by copying a needed jar file that I have in a local directory into my lib directory. I am looking at https://github.com/technomancy/leiningen/blob/1.x/sample.project.clj for the lein option to simply point lein to where this needed jar sits. Can anyone recall the correct project.clj option to copy a local jar to the lib directory without clobbering it?
14:16sridtechnomancy: didn't help unfortunately, I still get "NoSuchMethodError: clojure.lang.RestFn.<init>(I)V (macroexpand.clj:1" https://gist.github.com/1251478 (from swank buffer)
14:17sridi've been getting since yesterday even for 'lein run' and sometimes as a single-line warning in 'lein repl'
14:18technomancysrid: that's a 1.2/1.3 mismatch; nothing to do with swank
14:18duck1123`Is there anything like clj-record yet that uses Protocols, or is that still the best thing w.r.t. ORM's in Clojure
14:18sridtechnomancy: hmm, my project uses 1.2 (it used 1.3 until yesterday afternoon)
14:18ibdknoxduck1123`: that uses protocols?
14:18ibdknoxsrid: lein clean
14:18sridthe traceback contains swank.clj
14:19duck1123`Well, that returns the records as defrecords, and allows them to be extended
14:20duck1123`A while back, I had a patched copy that added metadata to the returned records, but it's very out of date
14:20pmooserIn clojure 1.3, RT.classForName() catches a ClassNotFoundException and wraps it in a runtime exception before re-throwing. Anyone know what the rationale for this is ?
14:20sridibdknox: did `lein clean`. but it didn't fix the exception.
14:20duck1123`Rich hares checked exceptions
14:20ibdknoxduck1123`: hm, what in your case requires a protocol over generic functions over a map?
14:20duck1123`*hates
14:21duck1123`Well, I would like to be able to detect the type of record I'm dealing with and dispatch on that type
14:21llasramA checked exception killed Rich Hickey's mother. True story.
14:22llasramDoes anyone (technomancy?) know of an off-the-shelf way to make flymake do something sane with leiningen projects?
14:23llasrams,flymake,Emacs flymake, (if there was any confusion)
14:23ibdknoxduck1123`: I've been getting fed up with clj-record, and I've written ORMs before. There's a good chance I'll be writing one soon
14:24ibdknoxduck1123`: but for now, jdbc, clojureql and clj-record are the only things I know of
14:24duck1123`Yeah, I've kinda felt the same way. I had to write this elaborate system to reload the connection info, because my username and password aren't available at compile time
14:26pmooserI know from reading the list that there was an effort to remove checked exceptions, but wrapping them all in Runtime ones seems like it obscures things a bit.
14:27TimMcAnybody know of a document rationalizing that change (and also addressing the downsides?)
14:27duck1123`At one point does that wrapping occur? In my experience, catching specific exceptions always seems to do what I want it to.
14:29gtrak`you can still catch specific exceptions
14:34pmoosergtrak, you can't, as far as I know.
14:34pmooserIf you have a runtime exception which is wrapping a ClassNotFoundException, a catch for ClassNotFoundException will not catch it
14:38TimMcException-destructuring catches would be great in Java.
14:38TimMcdechaining, really
14:38technomancydestructuring is cooler
14:38duck1123`does slingshot do that?
14:39duck1123`I haven't gotten around to trying that one yet
14:40technomancyduck1123`: it does
14:43semperosparsing a bunch of XML, consistently structured, for simplicity let's say <parent> item with <title> and <content> children
14:43semperosI want to lazily parse the XML, and as I go create a datastructure for each <parent> (writing that into MongoDB along the way)
14:44semperos(using 1.2.1)
14:44semperosI've gotten as far as (1) contrib.lazy-xml for lazy parsing and (2) contrib.zip-filter.xml for creating a zipper from the parsed XML
14:44sridcrazy. (use 'clojureql.core) makes `table` available in current namespace. but (require '[clojureql.core :as cql]) does not make cql/table available. looking at core.clj doesn't give any hint as to why.
14:44semperoswhat's a/the best way of going about the processing I'm attempting in Clojure?
14:45sridtechnomancy: FTR, i was using homebrew's lein; removing that and installing lein manually fixed the issues for me.
14:48tsdhWhy doesn't if-let allow accessing the test result in the else case? I mean, in Clojure we have 2 different false values, so one might be able to distinguish them...
14:48bsod1I have 2 functions which are making same things, how can I measure their performance in clojure?
14:49tsdhbsod1: (time (dotimes 999999999 (my-fn)))
14:50tsdhbsod1: If they produce lazy seqs, then put a doall arround your function call.
14:50zippy314Hey folks. What's the right way to use try/catch in clojurescript? I'm getting things I don't understand about "instanceof" when I say (catch Exception e ...)
14:50bsod1tsdh: thanks
14:50tsdhbsod1: yw
14:53bhenryin lein, does :jvm-opts in the project.clj file apply to everything done within a clojure.main repl too? i.e. java -cp my-uber-standalone.jar clojure.main
14:54zippy314The actual error message I get is: TypeError: Result of expression 't' [true] is not a valid argument for 'instanceof'.
14:56dnolenzippy314: under which evaluation environment? browser? Rhino?
14:56zippy314dnolen: browser
14:58zippy314I'd just like to be able to capture all errors. If I try: (catch Exception e (js/alert "here"))
14:58zippy314I get: Uncaught TypeError: Expecting a function in instanceof check, but got Error: NOT_FOUND_ERR: DOM Exception 8
14:58zippy314in the browser
14:59zippy314that's in chrome.
14:59zippy314In Safari I get: TypeError: Result of expression 't' [undefined] is not a valid argument for 'instanceof'.
15:00dnolenzippy314: you don't write Exception, you throw js/Error and catch js/Error
15:00devth_how would one go about embedding rhino to interpret js inside of a clojure app? is it even possible?
15:01dnolendevth_: seems very possible
15:02devth_dnolen: i read that ClojureScript does it but don't know how
15:02dnolendevth_: Clojure can call into Java so for many things, integrating Java stuff is straightforward.
15:03devth_dnolen: ah, right. i will look into that route. thanks.
15:04mattmitchellI've used a function before that allowed me to temporarily go into a namespace, run code in that namespace and then jump back out. What function is that?
15:04arohnermattmitchell: with-ns
15:05arohnerin contrib.with-ns
15:05mattmitchellahh that's it. thanks, arohner!
15:05amalloyprobably not a function
15:06mattmitchelltrue
15:08tsdhWhat's the special var that holds the last value in the repl?
15:08cemerick*1
15:08tsdhcemerick: Ah, thanks.
15:11zippy314dnolen: thanks! That solves the newbie problem! However, js/Error isn't what closure dom stuff is throwing because js/Error isn't catching that. And idea what it is throwing?
15:12naeuI'd like to modify a dynamic var within a fn which may or not be called within an explicit binding - what's the standard way of doing this?
15:12naeuI can't seem to call set! without being in a call to binding
15:13naeuyet I'd like to fall back on the default value of the dynamic var if an explicit binding isn't specified
15:13zippy314naeu: can you use refs and call (dosync (alter the-ref...
15:13zippy314That's what I do.
15:14naeuzippy314: but that ref will be shared by all threads and I want this to be thread-local
15:14neroothI have a function which adds something to a database with a generated id. After it has been added I'd like to use that generated id for something else. In python I would return the id with the function and use that. What's the idiomatic way to do it in clojure?
15:14amalloynaeu: you can't set! without a binding, yes
15:14zippy314naeu: I see. Is there a way to check if a binding has been made?
15:16naeuamalloy: ok, thanks
15:16dnolenzippy314: maybe a goog.Error?
15:16naeuamalloy: so what's the point of a dynamic var having a default value?
15:16naeuif the only way you can modify it within a thread if you re-bind it to a different value usign binding
15:17amalloynaeu: you can use a ThreadLocal object perhaps?
15:17amalloyhttps://github.com/flatland/useful/blob/develop/src/useful/utils.clj#L151-174
15:17amalloylike a thread-local atom, for example
15:18amalloyi don't understand the question
15:19naeusorry, I clearly don't fully understand what I'm doign and therefore am unable to clearly communicate my question
15:19zippy314dnolen: Ah, I see, to catch anything I can just: (catch js/Object... That works.
15:19amalloydynamic vars have default values because usually you don't want/need to rebind them anyway?
15:20naeuamalloy: ah ok, so dynamic vars are only really meant to be 'modified' by calls to binding?
15:21amalloymostly. they're set!-able so that you can use them to communicate up the stack as well as down, but mostly it's just for bindings
15:21naeubut you're only able to call set! if you konw it's already been explicitly rebound by a call to binding
15:22amalloyotherwise the scope of your set! is global and unknowable
15:22amalloyif there's a binding in place, you know that someone is going to set it back to what it was before you started messing with it
15:22amalloythereby avoiding full-out global mutable state
15:24naeuamalloy: ah, that makes a lot of sense
15:24amalloy&(do (binding [*clojure-version* *clojure-version*] (set! *clojure-version* 20) (println *clojure-version*)) (println *clojure-version*))
15:24lazybotjava.lang.SecurityException: You tripped the alarm! set! is bad!
15:24tsdhamalloy: While we are at dynamic vars: What's the purpose of `with-bindings' and `with-local-vars'?
15:25amalloylazybot: y u no run my code?
15:28tsdhamalloy: I mean, `with-local-vars' creates dynamic vars that you can access only in its lexical scope. So why dynamic vars here?
15:31tsdhamalloy: And `with-bindings' seems to be equal to `bindings' except that it wants a map of Vars to vals instead a vector of var symbols to vals...
15:38amalloytsdh: you don't always have symbols
15:41amalloyand i don't understand the use of with-local-vars either, but my understanding is that rich needed it for some kind of deep magic
15:42drewrone of them was supposed to be cross-thread was it not?
15:42drewrlike, say, for tests
15:44tsdhdrewr: Oh, indeed. with-local-vars says it creates per-thread bindings...
15:46michaelr525heey
16:05BlafaselIs the vimclojure guy present here, sometimes?
16:07gfredericksI'm trying to expose some methods to JRuby.
16:07dnolensrid: http://stackoverflow.com/questions/2706044/how-do-i-stop-jetty-server-in-clojure
16:07gfredericksour first pass at this is rather hairy, with our (:gen-class :methods [...]) full of class names and method signatures and things
16:08gfredericksand some (def -foo_bar foo-bar)'s at the bottom of the NS
16:08gfrederickswhich of course have to be kept in sync
16:08sriddnolen: that question doesn't address the "edit" part in the workfklow though. AFAIK, for that I need to (.stop server) C-c C-k and then (.start server)?
16:08sridcan the above 3-steps be automated?
16:08gfredericksare there built in tactics we're overlooking? should I just whip up some macros?
16:09dnolensrid: I don't follow - do you understand defonce?
16:12gfredericks$findfn (fn [a b] 4) 2
16:12sridjust read about defonce. I replaced def with defonce, and did C-c C-k ... then magically my server is reloaded (eg: I changed hiccup <title> that is reflected in the browser without myself having to .stop and .start the server)
16:12sriddnolen: so I wonder if defonce is doing more than what it is supposed to do (as per doc)
16:14sridhmm, perhaps the ring handler (defined with `def`) get overwritten during C-c C-k and so the old sever (defined with defonce) uses that automatically.
16:14dnolensrid: it doensn't do anything more. yup.
16:15sridi still don't understand how this "magic" works in repl. the first time I compile the module, my repl gets myproject.web namespace
16:15sridthe second time, this namespace gets overwritten by totally new code, no?
16:15sridexcept for defonce'ed exprs?
16:16jkkramersrid: yes
16:17jkkramersrid: this means you can redefine things on the fly for a running server
16:18sridthe only explanation that makes sense to me is that defonce will tear down the (already assigned) expr's closure environment and bind it to the newly compiled code. and so, the new ring handler comes to effect automatically
16:23jkkramersrid: is the code on SO the same as the code you're working with now?
16:24sridjkkramer: yup (private company project). and I solved it by using dnolen's defonce suggestion. it just works.
16:47zerokarmalefthttps://gist.github.com/1251899 <= hmm, why doesn't SLIME display the println?
16:48technomancyzerokarmaleft: the root value of *out* is the swank process's stdout
16:48technomancyunless you upgrade to swank-clojure 1.3.3-SNAPSHOT
16:48technomancyguess I should man up and cut a release
16:48srid,(inc technomancy)
16:48clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: technomancy in this context, compiling:(NO_SOURCE_PATH:0)>
16:48sridhmm
16:49pjstadigclojurebot: but he's right here
16:49clojurebotHuh?
16:49srid,inc technomancy
16:49clojurebot#<core$inc clojure.core$inc@189ff97>
16:49pjstadig$inc technomancy
16:49technomancysrid: it's lazybot that handles karma
16:49technomancywho appears to be absent
16:49amalloytechnomancy: linode is having troubles today
16:50technomancyI blame node.js
16:50technomancycan't spell linode without node!
16:50sridcan't lazybot be run on heroku? (without workers)
16:50amalloysrid: yeah, if we wanted to pay for heroku and figure out how to do it. i'd rather just use the vps we're already paying for, which gives us an actual shell, thanks
16:51gtrak`,(inc 'technomancy)
16:51clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.Number>
16:51gtrak`,(inc "technomancy")
16:51clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number>
16:51srid,(def karma-yogis {})
16:51clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
16:52technomancyI'm flattered you guys, but clojurebot is not your man.
16:52gfredericks(inc technomancy)
16:52lazybot⟹ 15
16:52amalloy$login
16:52lazybotYou've been logged in.
16:53amalloy$say #clojure I'm here to save the day!
16:53lazybotI'm here to save the day!
16:53sridhow to get the top list?
16:53amalloyanyway. back to your regularly-scheduled programming
16:54srid$say #emacs you are all lazy!
16:54lazybotsrid: It is not the case that you don't not unhave insufficient privileges to do this.
16:54gfredericksthose last four words had way too few negatives
16:54gfrederickslazybot: who gots the mostest karma?
16:55gfredericks(apply max #clojure)
17:00zerokarmalefttechnomancy: ah ok, not a huge deal
17:07dbushenkohi all!
17:07dbushenkohow to join two vectors?
17:07Raynes&(concat [1 2 3 4])
17:07lazybot⇒ (1 2 3 4)
17:07Raynes&(concat [1 2 3 4] [5 6])
17:07lazybot⇒ (1 2 3 4 5 6)
17:07dbushenkothanks!
17:07amalloyRaynes: :(
17:08RaynesAnd if you want them to stay vectors: ##(into [1 2 3 4] [5 6])
17:08lazybot⇒ [1 2 3 4 5 6]
17:08amalloyyay!
17:08Raynesamalloy: I was getting there. ;)
17:08lazybot⇒ [(1 2 3 4 5 6) [1 2 3 4 5 6]]
17:09Rayneso/
17:09gfredericksamalloy: and if you want just one of those, you'll comp with first or last, right?
17:09kjeldahlSo what's the idiomatic way to check if a function returned anything at all, "empty?"?
17:09amalloyi don't always use higher-order functions...but when i do, i prefer juxt
17:10gfrederickskjeldahl: depends on what your definition of "not returning anything" is
17:11gfrederickskjeldahl: probably one of nil? or empty? will be what you want
17:11kjeldahlLet's say from a when-let in a function that did not succeed...
17:11Raynes$google vimclojure git mirror
17:11lazybot[clones/vimclojure - GitHub] https://github.com/clones/vimclojure
17:11gfredericks,(prn (when-let [x false] :poo))
17:11clojurebotnil
17:11RaynesDoh, It's old.
17:11gfrederickskjeldahl: that's nil, so you can check the return value with nil?
17:11dbushenkowhere is duck-streams now?
17:12dbushenkoI mean it was in contrib
17:12TimMcclojurebot: what happened to contrib?
17:12RaynesWhere all bad libraries go to die.
17:12clojurebotExcuse me?
17:12gfrederickskjeldahl: but the question sounds fishy to me, as I don't think most people would want to check such a thing
17:12kjeldahl,(nil? false)
17:12clojurebotfalse
17:12TimMcclojurebot: where did contrib go?
17:12clojurebotwell... it's a long story: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
17:12TimMcdbushenko: ^
17:12Raynesdbushenko: clojure.java.io is essentially the evolution of it.
17:12dbushenkoRaynes, thanks!
17:12Raynesdbushenko: But yes, do read the above link.
17:14dbushenkocan't find anything about clojure.java.io in the above link...
17:14RaynesYeah, I just noticed that.
17:14Rayneshttp://clojure.github.com/clojure/#clojure.java.io
17:15dbushenkoRaynes, is this the core functionality?
17:15RaynesYes.
17:15dbushenkothank!
17:15RaynesWelcome!
17:16dbushenkothough I miss the duckstreams, I can find a solution with clojure.java.io...
17:23gtrak`gfredericks, deletes the byte at the value of the byte
17:24gfredericksgtrak`: best virus ever?
17:24gtrak`yes
17:24gfredericksat least on an 8-bit machine
17:25gfredericksso does nobody have any opinions/advice about populating a :gen-class with a bunch of methods?
17:25gtrak`do it in style, or don't do it at all
17:26gtrak`code like nobody's watching, etc..
17:27gtrak`macroexpand like you've never been hurt,
17:34gfredericks(defn macrocontract [form] ...)
17:35gfredericksfigures out why your code isn't dry, writes a macro to make it better, and applies the macro
17:35jorgebAfternoon. I am trying to find a Clojure library for logging to Scribe (https://github.com/facebook/scribe), but haven't had much luck. Let me know if anyone here can point me in the right direction. Thanks.
17:38brehautjorgeb: have you looked for a Java library?
17:38jorgebbrehaut: yeah, but keep hoping for a Clojure one
17:38jorgebor at least a wrapper
17:39brehautusing java in clojure is first class
17:39jorgebyeah, I know, but I am lazy
17:39brehautand idiomatic
17:39bsod1what is (subs) equivalent for vector and lists?
17:40brehautbsod1: subvec for vectors
17:40dbushenkohow to cast a vector of chars to a string?
17:41brehaut,(apply str [\a \b \c])
17:41clojurebot"abc"
17:41dbushenkothanks!
17:41brehautbsod1: for lists i suspect you would use drop and take?
17:42gfrederickssubs?? how have I used clojure for two years and not heard of this?
17:42brehautgfredericks: that was my reaction too
17:42gfrederickssometimes I wonder if clojure.core is infinite
17:43bsod1brehaut: yes, thank you. I think lists are implemented like linked lists, right? operations like get is O(n) instead of O(1)
17:43brehautgfredericks: .substring is so easy though, theres little motivation to go looking
17:43brehautbsod1: correct
17:45brehautbsod1: i say correct, but ive never looked at the imp so i could be extremely wrong
17:46dbushenkohow to define a function name prior its implementation? I want a function name in the beginning of file, and then, 10 lower -- define the function
17:46dbushenkoI need that for recursive definition
17:47gfredericksdeclare
17:47dbushenkothanks
17:47gfredericksshouldn't need it for a vanilla recursive function though...
17:48TimMcMutual recursion?
17:48gfredericksyeah maybe
17:48dbushenkoyep
17:48gfredericksdbushenko: be careful about the stack depth. If you need tail-optimization, use trampoline
17:49dbushenkothanks, I have to check it out
17:51bsod1brehaut: http://stackoverflow.com/questions/1147975/in-clojure-when-should-i-use-a-vector-over-a-list-and-the-other-way-around about the question I asked about lists
17:51gfredericksso what's up with the :tag metadata and clojure 1.3?
17:52gfredericksI should try it in 1.2 before I ask...
17:53brehautbsod1: theres nothing that definitively stats that lists are cons pair/singly linked lists in their implementation
17:54gfredericksokay, so old behavior for ^:foo is {:tag :foo}, and new behavior is {:foo true}, right?
17:59amalloybrehaut: in whose implementation?
17:59brehautamalloy: in clojure lists. (in the thread that bsod1 linked)
18:00brehautim fairly sure they _are_ but it doesnt have to be the case
18:00brehautamalloy: basicly im backpedaling from an absolute claim i made via assumption
18:00amalloyseeing as there is basically no javadoc or comments of any kind in PersistentList.java i guess that's true
18:02amalloybut certainly the actual impl is a singly-linked chain of Lists
18:02brehautthat was my assumption
18:04amalloyhah. reading through the impl caused me to discover something amusing
18:04amalloy&(with-meta inc {:name 1}) ;; works
18:04lazybot⇒ #<core$inc clojure.core$inc@d1e727>
18:04amalloy&(with-meta inc {:name 1}) ;; no good
18:04lazybot⇒ #<core$inc clojure.core$inc@168c70e>
18:04amalloyer
18:04amalloy&(with-meta list {:name 1}) ;; no good
18:04lazybotjava.lang.UnsupportedOperationException
18:05brehautlists dont support metadata?
18:05brehautor you cant name them 1 ?
18:05amalloybrehaut: the function clojure.core/list doesn't support metadata on itself
18:05brehautoh right
18:06brehauti think i can conclusively say that i have read more of clojure's source than any other language ive used
18:06brehaut(despite having hardly scratched the surface of clojure's source)
18:06gtrak`clojure's source makes me happy
18:06amalloybrehaut: brings up the question of what it would mean to read english's source
18:07brehautamalloy: i dont use english, i misuse it
18:07brehautanyhow, i imagine it looks similar to the perl internals
18:08brehautor perhaps bash, if bash was english and C was german
19:25brehautsuccess. necessary-evil now runs on 1.3
20:33devngtrak`: :)
20:33devngtrak`: It's like reading a good book.
20:34devnThe beginning is a little slow, confusing -- but once the main characters are introduced things get rolling along nicely.
21:13mindbender1how do one choose between let and binding?
21:15brehautmindbender1: bindings is for rebinding dynamic vars, let is for defining local variables
21:15brehautmindbender1: 99.9% of the time you'll probably want a let
21:17mindbender1brehaut:in which cases then do binding suffice as it seems to be confusing to me when to use which
21:17brehautmindbender1: what language have you come from?
21:18mindbender1Java but not much an expert
21:18brehautdo you know what a local variable is in java?
21:18mindbender1yes vars within a function
21:18brehautok
21:18brehautthats what let does
21:19mindbender1ok
21:19brehautin contrast, the def family of forms creates Vars
21:19brehaut(big v)
21:20mindbender1and so you rebind them within a function with binding?
21:20brehautmindbender1: yes, but they have different scope rules
21:20mindbender1yes I understand their diffs
21:21mindbender1binding's scope is broader than let?
21:21brehautlet is for lexical scoped variables and bindings are dynamic scoped variables
21:21brehautits not exactly a case of broader
21:22mindbender1lok
21:22brehautsay for have a Var deffed called *foo* and then you define a function (defn do-baz [x] (frobitz *foo* x))
21:23mindbender1cos I read that binding's continues outside their forms
21:23brehautyou can later wrap a binding around a call to do-baz (which is btw a terrible name for a function) like (binding [*foo* 2] (baz 3))
21:23mindbender1ok
21:24brehautmindbender1: but you very rarely use a binding
21:24mindbender1so nothing to worry about?
21:24brehautif in doubt, use a let
21:24mindbender1ok thanks a lot
21:25brehautmindbender1: http://en.wikipedia.org/wiki/Dynamic_scope has sections on Lexical Scoping and Dynamic Scoping
21:26mindbender1ok.. checking it out.. thanks
22:00amalloymindbender1: neither one is "broader": consider (defn foo [x] (fn [y] (+ x y))), where x can "live on" forever, bound in the functions returned by foo
22:02amalloycompared to (defn bar [x] (binding [*data* x] (some-other-fn))) - now *data* doesn't "live on" in that sense (if some-other-fn returns a function, then it won't know about the temporary binding), but it does reach "farther" by being visible from within some-other-fn even though they're not lexically related
22:03SegFaultyHi, as a person new to clojure would I be better off using 1.2.1 so that I can use the monolithic version of clojure-contrib or should I start with 1.3?
22:06mindbender1amalloy: does your (foo x) imply an implicit let
22:06mindbender1as you did not use a let in foo
22:07brehautmindbender1: function arguments are lexically scoped variables in the samew as let defined locals are
22:08brehautSegFaulty: depends what you are writing, and what you are going to depend on
22:08brehautSegFaulty: a lot of the monolithic contrib is dead code these days, so you dont really want to waste time learning it
22:13jkkramerthere's been talk of creating a monolithic 1.3 "contrib", but it hasn't materialized yet
22:13SegFaultyok, thanks!
22:14brehautjkkramer: do you have a link for that?
22:14brehautjkkramer: btw, clojuresphere is cool
22:14brehautSeqFaulty what are you planning on starting with?
22:15SegFaultybrehaut: not really sure, I'm just really curious about functional programming
22:18hamzaacan anyone explain me this behavior? http://stackoverflow.com/questions/7605241/clojure-priority-map
22:20jkkramerbrehaut: i'm going off a vague recollection of messages on clojure-dev to the effect of someone (stuart sierra?) saying they might create a bundled version of all the new contrib libs, for convenience, but it hasn't been a priority
22:20brehautjkkramer: ok thanks. i'll go have a dig
22:21zerokarmaleftSegFaulty: i'd recommend 1.3 if you're just testing the waters
22:22zerokarmaleftwhen you get to the point where you need to pull in deps outside of core, you can just cross that bridge when you get there
22:22SegFaultyzerokarmaleft: I figured that's where I should start but I wasn't sure if I'd be missing anything important without contrib
22:23brehautSegFaulty: you arent without contrib entirely
22:23brehaut~contrib
22:23clojurebotcontrib is http://github.com/richhickey/clojure-contrib/tree/master
22:23mindbender1brehaut: I want to extend a java apllication with clojure. Do you think that's a good idea?
22:24brehautrats
22:24brehautmindbender1: i have zero idea
22:24jcromartiemindbender1: what do you mean by extend?
22:24jcromartiemindbender1: I think it would be perfect for some cases
22:24brehautclojurebot: tell me about contrib
22:24clojurebotwell... it's a long story: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
22:24mindbender1as in customize the application
22:24jcromartiemindbender1: someone else's application?
22:25mindbender1the customization will be in a seperate jar
22:25jcromartiemindbender1: or adding things like config/plugins?
22:25mindbender1yes an open source app
22:25jcromartiemindbender1: sounds like http://www.gnu.org/s/guile/
22:25jcromartiebut for Java
22:25jcromartieI'd encourage that
22:26jkkramerbrehaut: https://groups.google.com/d/msg/clojure-dev/k6Oc9gxJxI8/C-M4nzUN-XgJ
22:26brehautjkkramer: thanks!
22:26brehautSegFaulty: that second link clojurebot spat out ("well… its a long story") is relevant
22:27brehautwhoa when did completely different groups happen?
22:28SegFaultybrehaut: ok, thanks
22:29jkkramerbrehaut: clojure-dev's been around a long time
22:29brehautjkkramer: sorry, i mean the google groups interface
22:30jkkrameroh, yeah. i'm not sure i like the new one. the interface is cleaner, but it's slow
22:30jkkramerof course, the old one was slow & buggy, too
22:33jayunit100hi guys. anyone use nailgun ? I just got vim / clojure working . but get a weird error about nailgun.
22:35brehautjkkramer: heaps of the new google stuff has been a total PITA with apps for your domain accounts.
22:39symboleCan anyone recommend a commonly used clojure-hadoop fork? Seems like Stuart Sierra's version is not being maintained.
22:42amalloyjkkramer: arohner, i think, did it
22:43amalloythe "1.3 contrib", that is
22:45jkkrameramalloy: o, i didn't know someone actually put that together yet. using the new contrib libs?
22:47jayunit100does "load-file" run the commands in a file ?
22:48jayunit100i have a simple user=> )print "aaa")
22:48jayunit100im sorry, i mean a simple load-file with a print statement, but nothing happens.
22:50amalloyjkkramer: i dunno. i don't recall who it is, but someone has published a version of old-contrib with the 1.3-incompatible bits pulled out
22:50amalloyi think he posted it on the mailing list a week or so ago
22:51jkkrameramalloy: ah ok. i meant a bundled-up version of all the new contrib libs -- core.incubator, data.zip, etc
22:51amalloyno, definitely not, and i do't think anyone *should* do that
22:51amalloy(whether anyone should do the other thing is also questionable)
22:52jkkrameri think it would be handy for experimental or short-lived projects
22:53jkkrameri'd like to have a generic, batteries-included project i can "lein swank" anytime to play with
22:56jkkramerand be able to keep it up-to-date without changing 20 dependencies
22:56jayunit100(load-file "a.clj") runs a file.... load-file "a.clj" doesnt :) i keep forgetting about the parenthesis
22:57brehautjayunit100: already lisping at an advanced level ;)
22:57amalloyhah
22:58jkkramerjayunit100: after using clojure for a while, i regularly write (foo bar...) in non-lisp languages, and leave out commas/semicolons
22:59brehautjkkramer: i find i do that a lot more in python than other languages
23:00jayunit100yeah im kikin butt ovr hereee ((((( )
23:00jayunit100))))))
23:00jkkramerI never realized how useless most commas are until Clojure
23:00zerokarmaleftjkkramer: i've started doing that too ><
23:00brehautjkkramer: i never realised how useless most parens are until Haskell ;)
23:01jayunit100what happens if you dont have parens around something ?
23:01jkkramertrue... i sometimes envy a well-placed $ or .
23:01brehauttype system magic
23:01brehautlikewise
23:02jayunit100& load-file "a"
23:02lazybot⇒ #< clojure.lang.RT$3@12db656>
23:02brehautor more precisely i miss >> and |> from F#
23:02jayunit100what does that mean ? Is that an object or something ?
23:02amalloyjayunit100: that's the function "load-file" being displayed, not called
23:03amalloy&inc
23:03lazybot⇒ #<core$inc clojure.core$inc@1019bf1>
23:03amalloy&(let [x inc] (x 1))
23:03lazybot⇒ 2
23:03jayunit100oh ok. so what is the # sign ?
23:03brehautjayunit100: classname on the left of @ and memory address on the right
23:03amalloy#<...> means "whoa some kind of crazy object, i'll try to print it, but no guarantees"
23:03jayunit100&(inc 1)
23:03lazybot⇒ 2
23:03jayunit100oh ok...
23:03jayunit100really?
23:04amalloybrehaut: s/memory address/toString
23:04amalloy&(.toString inc)
23:04lazybot⇒ "clojure.core$inc@1019bf1"
23:04amalloy&inc
23:04lazybot⇒ #<core$inc clojure.core$inc@1019bf1>
23:04brehautamalloy: its not just the memory addr that is the tostring
23:04jayunit100i guess under the hood , that means everything in clojure is ultimately an object. and there are some artifacts of that in the repl that are meaningless :( thats kinda scary.
23:04brehaut(java.util.Date.)
23:04brehaut,(java.util.Date.)
23:05clojurebot#<Date Thu Sep 29 20:04:35 PDT 2011>
23:05amalloybrehaut: huh? it prints the toString on the right; you only see memory addresses because the default impl of toString involves the memory address
23:06brehautamalloy: i think we are talking past each other again
23:06mindbender1please I need more light on when to use which of clojures collections object like vectors, maps, sets, and seq
23:06brehautamalloy: the default object tostring is "class@memaddr" right?
23:06amalloymore or less
23:07amalloyit's actually "class@identityHashCode", and the identityHashCode is a truncated memory address
23:07mindbender1please I hope I'm not asking for too much
23:07amalloy&(.toString (Date. 1 1 1))
23:07lazybotjava.lang.IllegalArgumentException: Unable to resolve classname: Date
23:08amalloy&(.toString (java.util.Date. 1 1 1))
23:08lazybot⇒ "Fri Feb 01 00:00:00 PST 1901"
23:08amalloy&(System/identityHashCode (java.util.Date. 1 1 1))
23:08lazybot⇒ 12900739
23:11brehautmindbender1: maps are for when you have some associative relationship between the data
23:11brehautmindbender1: vectors are for contiguous groups of things, with O(1ish)lookup by index
23:11brehautvectors also double as tuples
23:12brehautmindbender1: sets are mathematical sets
23:12brehauta collection of things where each item in the set occurs exactly once
23:13brehautand you have a range of set wise operations like union, interesection etc
23:13brehautmindbender1: seqs are an abstraction, rather than a collection
23:13brehautfor when you want to process things sequentally
23:15mindbender1brehaut:thanks a lot
23:15mindbender1much clearer to me now
23:17hamzaacan anyone explain me this behavior? http://stackoverflow.com/questions/7605241/clojure-priority-map
23:29jkkramer,(sorted-map-by (fn [[a] [b]] (< a b)) [1 2] :foo [1 3] :bar)
23:29clojurebot{[1 2] :bar}
23:29jkkramerhamzaa: ^ priority-map-by is based on sorted-map-by, which says that items which compare the same are the same
23:45carkdoes anyone know of a way to prevent warnings from *warn-on-reflection* for a small part of a file ?
23:47carkby that i mean not on top level
23:47carklike from inside a proxy declaration
23:48brehautcark: im guessing where, but (binding [*warn-on-reflection* false] (code you dont want to warn))
23:48brehauts/where/here/
23:48lazybot<brehaut> cark: im guessing here, but (binding [*warn-on-reflection* false] (code you dont want to warn))
23:48carkbrehaut: ahwell that doesn't work, because (not= compile-time run-time)
23:49carki'm guessing *warn-on-reflection* isn't even bound at run time
23:50carkbutbut maybe with some macro trickery ...