#clojure logs

2012-11-20

00:10alexykwhat's the mainstream way to do RESTful APIs nowadays?
00:11wingyi have an array of arrays and want to use queries like in datomic to get the missing values eg https://www.refheap.com/paste/6859
00:11wingyhow do i do this? with the datalog in datomic or clojure.logic?
00:12wingyalexyk: i wonder that too
00:12wingyapigee? :)
00:15SgeoIs there a find-in similar to get-in?
00:15Sgeo(doc find-in)
00:15clojurebotExcuse me?
00:15SgeoOr should I just use get-in with a sentinal value?
00:21amalloyi think you want get-in, Sgeo, though of course you can fake it like (-> m (get-in [a b c]) (find d))
00:26sw2wolfAre there window-manager developed using clojure ?
00:29amalloysw2wolf: technomancy has written some gnome extensions in cljs, but that's all i know of
00:35sw2wolfI am clojure newbie and i am using stumpwm every day. thx
00:37ivansomeone barely started one at https://github.com/abrooks/prion
00:47ambrosebsRE: adding new CLJS specials. hiredman: thanks for the suggestion. From my perspective as a consumer of analysis, it seems like natural thing to do. But this will do for now.
00:57bjorkintosh why does (*) return 1, and (+) return 0?
00:57bjorkintoshwhat are they using as arguments?
00:57ivanno arguments, it's a useful identity for folds
00:58sw2wolfit is relative to mathematic
00:58ivanthat is, reduce
01:01ivan&(reduce * [10])
01:01lazybot⇒ 10
01:24muhoolein is complaining:
01:24muhoo[com.cemerick/pomegranate "0.0.13"] -> [org.apache.maven.wagon/wagon-http "2.2"] -> [org.apache.httpcomponents/httpclient "4.1.2"]
01:25muhoowhere is pomegranate 0.0.13 coming from?
01:26ambrosebstried lein deps :tree ?
01:26muhoogood call, i'd forgotten about that.
01:27muhoothe bigger problem seems to be that pomegranate wants httpclient 4.1.2, and i'm using clj-http 0.5.8 which wants httpclient 4.2.2
01:28muhoohaha, lein deps :tree fails, because of that conflict
01:28Apage43muhoo: exclude httpclient from whatever is bringing in pomegranate
01:29Apage43I had to do a similar thing; https://github.com/apage43/cbdrawer/blob/master/project.clj
01:29muhoothat's what it says to do, but still... i'd rather have everything agree than have to have exclusions all over the place
01:30Apage43well unless there's a version of pomegranate that specifies 4.2.2 and a version of the project that requires it which requires that version..
01:31muhoo:-/
01:31muhooit sucks because i found where pomegranate is coming from, it's my repl profile. i have it so i can add libraries on the fly
01:31muhooand if i exclude httpcore like lein is telling me, then pomegranate won't work.
01:31Apage43muhoo: you could add a newer httpcore to your repl profile
01:32Apage43along with the exclusion
01:32muhoooh, hmm, good point, will try that thanks
01:32gauravag_has anyone tried testing clojure code at functional level?
01:32gauravag_or is there a good/recommended way to do it?
01:36muhoogah, clj-http 0.5.8 is a nightmare
01:36Apage43mm?
01:36muhooit's also causing compojure to not resolve, because it requires commons-io 2.4,
01:37sw2wolfthe dependency hell is difficult to resolve
01:37muhoothere are 4 separate clusterfucks caused by clj-http 0.5.8. i need to find what older rev of clj-http that doesn't cause compojure and pomegranate to break
01:38ro_stwe're using 0.5.5
01:38ro_stwith ring
01:38ro_sts/ring/noir
01:38muhoothanks! i can also do a lein deps :tree on pomegranate and compojure itself to see what clj-http they want
01:39muhoohmm, is there any way to get lein to pick up a project.clj from inside a checkouts instead of from the SNAPSHOT jar?
01:41muhoobecause the dependency hell in this case is coming from a library that i'm developing, once it gets included into a project that uses compojure.
01:42ro_sti don't think checkouts factors in project.clj files
01:42ro_sti think it simply treats the source in there as though it's part of the containing project
01:42ro_stbecause i know your containing project.clj has to include all the deps of the contained ones
01:44Apage43.. that sounds wrong
01:44amalloyro_st: i don't think that last is true
01:44Apage43https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies
01:44ro_stnot? i ran into issues when i didn't add them
01:45amalloyi've never used checkouts, but i've heard technomancy say that it's just used to replace source files, and the dependencies are resolved based on the jar in maven
01:45ro_stah that's probably why i had issues; i didn't have a jar in place when i did my testing
01:45muhooright, that'd explain why i'm stuck in this particular hell
01:46ro_sti had already put everything into containing project.clj by the time i did a lein install in the contained
01:46ro_stgood to know. thanks for correcting me
01:46muhoowell i can manually copy pom files to ~/.m2 and generate sha1's to hack my way around this, but it sucks
01:46muhooand fyi 0.5.6 also fails, will try 0.5.5 next. nothing like brute force and stupidity to solve a problem.
01:47ro_stand a good dose of humour
01:53muhoo0.5.5 fails, still wants 4.2.1
01:53muhoopomegranate insists on an ancient version of clj-http i suspect
01:53muhooand compojure wants an ancient version of commons-io
01:54muhoowill spend some time digging around here: https://clojars.org/clj-http/versions
01:55muhooand maybe the next library will be one i can write to dig through the data on clojars.org to find the minimum least-common-version of all libraries to make the damn project load so i can start working on it
01:56cemerickmuhoo: hardly any library "insists" on particular versions of dependencies
01:56muhootrue, but there are problems with using :exclusions, as i've mentioned earlier
01:57cemerickmuhoo: in conjunction with default profiles, etc?
01:57muhooyes
01:58cemerickwell, I don't suspect there's any magic that's possible in this area. If you include version X of some lib in a default profile, but a project-specific lib wants version Y, that's going to be trouble.
01:58muhooaha! https://clojars.org/clj-http/versions/0.3.6 looks like the winnah
01:59Apage43oh man
01:59muhoocommons-io 2.1, and httpclient 4.1.2. sold.
02:01muhoocemerick: true, it'd be a manual process, assisted with some tool perhaps. i can't think of any way to make it truly automatic.
02:01cemerickmuhoo: have you seen lein-pedantic?
02:02muhooi think i'm running that already, yes. it gave me the list of :exclusions. very helpful.
02:02cemerickok; that's the state of the art at the moment.
02:03cemerickperhaps something interrogatory would be useful, so you can choose a set of alternative project.clj transformations, etc.
02:03muhoomaybe i could submit a patch that'd have it spit out, after the :exclusions, a third option: "or, you could use clj-http 0.3.6 which is the maximum version that doesn't conflict with pomegranate and compojure"
02:03muhooit could get that data from clojars, which is how i found it.
02:04muhooor maybe clojure atlas could be extended to show the web of library dependencies :-)
02:06cemerickwell, all of the data is available via pomegranate for anyone industrious enough to put together a proper visualization :-)
02:07amalloyhow would you figure out, just from information on clojars, what versions don't cause problems?
02:09muhoothe process i just followed was: lein-pedantic told me what version pomegranate wanted of httpclient, and what version of commons-io that compojure wanted. then,
02:10muhoosince it also told me that clj-http was the culprit bringing in newer versions of both those things,
02:10muhooi looked through the older versions of clj-http on clojars, until i found one that satisfied both.
02:11muhoo(if that makes any sense at all)
02:12cemerickamalloy: some have suggested combinatorial exploratory testing, for these purposes as well as for determining e.g. what one might break in downstream projects given a particular changeset, etc
02:12amalloynot really a general solution, though - it's perfectly possible for there to be no set of version that satisfies all the constraints
02:12muhooyes, that's what makes me wonder if it might be an interesting problem.
02:13amalloyhah. well, as long as you're aware that the reason you find it interesting is that it's impossible. otherwise you could wind up disappointed
02:14muhoop/np? it might be in the realm of the solvable. i haven't given it enough thought, and not even sure i'm capable of giving it the right kind of thought.
02:21lpvbwhy doesn't counterclockwise have basic REPL input history?
02:22ivanmaybe you have to hold down ctrl or alt or something? (haven't tried it)
02:22sw2wolfsorry, What's counterclockwise ?
02:22ivanindeed or you've launched the wrong REPL?
02:22ivaner, indeed http://stackoverflow.com/questions/5924228/last-input-in-counterclockwise-repl
02:23lpvbeclipse plugin
02:23lpvboh okay
02:23sw2wolfoh, i dont use eclipse
02:29ro_stcemerick: cljx stuff looks interesting
02:30cemerickyup; quite useful, and a good stopgap until feature expressions come around
04:13maleghastMorning All :-)
04:55ambrosebsIs there a library like Trammel or core.contracts for CLJS?
04:59ambrosebsHmm seems like such a library wouldn't be as useful for CLJS.
04:59ambrosebsI've just got a ton of Trammeled code I was thinking of porting.
05:14deu5Hi i have a little problem. I've wrote web app in noir. I have run in on my server. Now i problem with links. My "localhost" directory is the directory where i run my app ? (i'va commpiled it to jar)
05:18thorwildeu5: i think you will have to tell a little more about your setup and what exactly goes wrong
05:26deu5Ok i have a web app which i run in my home directory. There i have a directory with files (over 6GB) I would like to make a link in my web app to files from this directory.
05:26otfromNext London Clojure dojo is up: http://london-clojure-dojo-tw-2012-11.eventbrite.co.uk/
05:28deu5thorwil I can recompile my project with this dir
05:28thorwildeu5: do you know how to serve files in general? if not, the 2nd section of http://yogthos.net/blog/25 might help
05:30thorwildeu5: no waut, forget about that, as they put files into a database
05:30rodnaphotfrom: those dojo's look ace, if i lived in london i'd be there.
05:31deu5thorwil I need to know how to make links to file which are not in the project directories.
05:31maleghastrodnaph: They are ace, but if you can't come to London why not start one where you are..?
05:32rodnaphmaleghast: actually yes, me and a few others are thinking of trying a hack night that would run along the dojo idea.
05:32thorwildeu5: locally you can do that with symlinks, i suppose. but hat happens if you deploy, then?
05:34maleghastrodnaph: The organisers behind the London one, otfrom and others (whose names may or may not have IRC analogues in this room) are one of the core reasons that I've had the confidence to start using Clojure more and more and to push it as a viable technology at my job. You could be that dude for a whole new community!
05:34AnderkentHow do I read a file into a byte array? to-byte-array from contrib.io doesn't seem to be anywhere
05:34clgvAnderkent: via filestream e.g.
05:35rodnaphmaleghast: i've already got that crackpot reputation! ;)
05:36deu5so there is no other easy option?
05:42otfromrodnaph: I did a smallish post on how to run a dojo here: http://otfrom.wordpress.com/2012/07/04/how-to-run-a-london-clojure-dojo-in-20ish-easy-steps/
05:43rodnaphotfrom: yes i've already read it thanks - that's pretty much what we were going to follow :)
05:43otfromoh, and from a general grow the community PoV, @jr0cket has 109 people signed up for his clojure for java devs talk http://www.meetup.com/Londonjavacommunity/events/90658542/
05:44otfromrodnaph: cool, I hope it is useful
05:44otfromrodnaph: what will your silly question be?
05:45otfromI feel that is the most important bit (well, that and the hacking)
05:45rodnaphotfrom: yes it was. i help run a cardiff tech meetup called unifieddiff.co.uk, so was thinking of possibly involving a dojo in that somehow.
05:46otfromcool
05:47rodnaphotfrom: i like that silly question idea, no idea what to ask though... heh. what kind of things do u usually do? tech based? or just general personal fun stuff?
05:48Anderkentclgv: I can't see any filestream classes/functions with byte array output, can you point me at one?
05:48otfromlast night it was what preposition would you want added to your name
05:49otfromanswers were: that, not only, around, under, with, in
05:49otfrommy fave was: if you couldn't be called Bruce, what would you like to be called
05:49otfromonly one person said that their own name was fine
05:49otfromand I was the only Bruce in the room
05:49rodnaphhaha
06:03deu5Ok. When I run web app in Noir and i would like to make link to a file then Noir search this file in "public" folder in my project. Is there an option that it will search this file somewhere else ?
06:09Anderkentdeu5: you probably don't want to do that, how do you check whether the file should be publicly visible?
06:10deu5I must do that. I have compiled my project to a JAR. Directories with all those files weight over 6 GB. Can you see any other way to do that?
06:10deu5My web app search a file name in my database then create a link to this file. But all files are in other directories.
06:11deu5Anderkent now you see ? I couldn't find any other way to do this.
06:22Anderkentdeu5: you should symlink all the files you want to expose in one directory, then symlink that directory under public
06:25qerubWho coined "DATA all the things"? :)
06:31Foxboronqerub: http://weknowmemes.com/wp-content/gallery/x-all-the-things/x-all-the-things-template.jpg
06:32qerubFoxboron: I meant DATA as in DATA: https://twitter.com/mike_ivanov/status/269079215197024256 :)
06:33qerubI've heard lynaghk use it too. He said he heard it from any of his friends.
06:33qerubOh, well, not so important. Sorry for the noise.
06:38Foxboronqerub, the reff from ClojureCon says it emerged last year and was "hammered home here.", where i believe "here" is the blog
06:38Foxboronhttp://corfield.org/blog/post.cfm/clojure-conj-2012
06:46deu5Compiled noir project to jar is faster ?
06:48ambrosebsany other Conj 2012 posts?
06:49maleghastI so wish I'd been able to go to Clojure Conj this year… :-(
06:53qerubFoxboron: Thank you for digging that up! <3
06:55Foxboronqerub, digging? First hit on google m8 :P
06:56qerubThe Google-fu is strong with this one.
07:13Foxboroni was just thinking:
07:13FoxboronSince you got noir for Clojure, and ClojureScript for Javascript
07:13Foxborondoesnt that mean you could basically build an entire website just by using clojure..?
07:14Foxboron<- newb making sudden discoveries.
07:15trinakriaThat is what I am actually trying to build: A dummy web site using only a clojure stack (datomic as db)
07:16FoxboronInteresting.
07:18trinakriayou'd really have to master only one technology
07:29bordatouei need your opinion on this issue, every time when i am editing a file , do i need to reload the file and then explicitly mention (use 'editedfile) in the repl to see the modified code or there any other way to do it
07:29Foxborontrinakria, i feel that is a rather downside of it all, but its more fun :P
07:30thorwilbordatoue: nrepl or slime?
07:30bordatouethorwil: slime
07:31bordatouein eclipse it seems to work just by reloading a file, but in slime i need to explicity type use every time i reload a file
07:32thorwilbordatoue: not 100% sure, but i think there are commands to reload a file (no need for use then) and to evaluate a region or sexp "into" the repl
07:32bordatouei do evaluate region, that i need to specify the name space in repl each time
07:33bordatouei am using C-c C-r for region evaluation and C-c C-l for loading
07:33thorwilbordatoue: http://stackoverflow.com/questions/2596222/how-to-reload-files-upon-save-when-using-swankleiningenemacs perhaps?
07:35bordatoue so i need to compile the file rather than reloading them
07:37mpenetthere is an alternative I use sometimes: you do your testing on the file itself (in a comment form or after a fn), and just use C-c C-c to relaod the fn you are working on and the same for the "tests
07:37mpenetyou need to C-c C-k the file first, if you do that
07:37bordatouempenet: thorwil thanks, interesting idea
07:38thorwilthis is also very interesting: http://stackoverflow.com/questions/11306704/reloading-a-ns-in-repl
07:38trinakriaFoxborn: why do you see it as a downside?
07:39bordatouewhat is the actual common lisp way of doing this
07:39Foxborontrinakria, staying with only one language todo everything is not very good in my eyes.
07:39FoxboronIf Ruby is better suited for the task, you still stick with clojure, and clojure only. because it can do everything
07:40FoxboronYou stop learning and just stick with repetitons.
07:41trinakriaI am not a clojure expert but it seems to me a general purpose programming language
07:41Foxboronme either, i started 3 days ago :P
07:42FoxboronBut well, diversity is gold in my eyes :)
07:42algernondiversity is good if a certain tool is better for a task than the other.
07:42ambrosebsI'm trying to write a leiningen 2 plugin. Is it possible to make it run with clojure 1.5.0-beta1? It seems lein automatically uses 1.4 or something.
07:42trinakriapolyglot programming I'd say
07:42trinakria:-)
07:42thorwilgeneral purpose except everything where startup time is critical, or where you need low leel hardware access, or where (soft) realtime performance is an issue
07:43Foxboronindeed ^^
07:43FoxboronImagen if Clojure could do it all.
07:43clgvambrosebs: better ask in #leiningen
07:43ambrosebsclgv: ah!
07:43trinakriastartup time is an issue of the JVM
07:43algernon(diversity also sucks when the codebase will have to be maintained by a different team. a stack in a single language is much easier to maintain)
07:44Foxboronalgernon, ah. Great argument :D
07:44Foxborontrinakria, i know. Like 1,3 sec for a Hello World
07:44trinakriaindeed :-)
07:44Foxboronyou got a project saving the JDK stuff in memory
07:44Foxboronreducing the startup from 1,3 sec to 0,3 sec
07:44Foxboron(along those lines)
08:04gauravaghello
08:14bruceadamsgauravag: good morning!
08:55fojurelein profiles FTW!
08:55fojureThanks technomancy
09:15ivenkysafternoon folks - i am missing something obvious here - how does this work ? http://sprunge.us/aWFg
09:16ucbivenkys: try following the recursion with pen and paper :)
09:17ivenkysucb: actually i did - i still dont get it - there is no checking if n is divisible by 2 - so how is it working ?
09:18bordatouehello, how do i update nth char in a string, for example in python it would be like s[nth]=char
09:18ucb+1 nDuff
09:18ivenkysnDuff: yup i noted that as well -
09:18ivenkysbordatoue: (nth [] index)
09:19ivenkysbordatoue: ignore me - i read your question incorrectly -
09:20ucbivenkys: the trick is that you're composing N times (not ...) ultimately with true. If N is odd, you'll have odd-nots and hence get a fals
09:20ucbfalse
09:20bordatoueivenkys: thats alrite, your returns the char
09:20nDuffbordatoue: convert to an array of chars first
09:20nDuffbordatoue: replacing individual characters in immutable strings is inefficient, in Python as well as Java.
09:20bordatouenDuff: then i can do a seq on string to get it
09:20nDuffbordatoue: ...pardon?
09:21ivenkysucb: penny drops - yes of course
09:21nDuffbordatoue: see getChars() in http://docs.oracle.com/javase/6/docs/api/java/lang/String.html
09:21ucbivenkys: :)
09:21ivenkysucb: thank you sir - i have it here all drawn out and still did not get it -
09:21nDuffbordatoue: ...there's also getBytes(), but that gets ugly when dealing with multi-byte characters.
09:21ucbivenkys: it's ok; it's nearly identical to church-numerals, so that's why I figured it out
09:22bordatouenDuff: can i use any form of indexing to update a char after i covnert it into an array, say i use seq to get sequence then how can i update a value in an index
09:22ucbivenkys: that's something you may want to check out
09:22nDuffbordatoue: sequences aren't updatable
09:22nDuffbordatoue: so you'd want it in a vector if you want fast random-access writes.
09:23bordatouenDuff: as you mentioned if i used getCharArray then how do i update an idx location
09:23nDuffbordatoue: ...or you can keep it in a Java array
09:23nDuffbordatoue: ...which is the format the String methods will return it to you in anyhow...
09:23nDuffbordatoue: ...and use interop calls to modify.
09:23ucbivenkys: see this for some fun application of church numerals https://www.refheap.com/paste/5073
09:23nDuffbordatoue: aset, aget, &c.
09:23ucbivenkys: shameless plug: I adapted that to clojure from a Ruby post :)
09:24bordatouenDuff: okay, thanks aset aget is similar to operations on array
09:24nDuffbordatoue: not just similar, that's exactly what they are.
09:24nDuff,(doc aset)
09:24clojurebot"([array idx val] [array idx idx2 & idxv]); Sets the value at the index/indices. Works on Java arrays of reference types. Returns val."
09:24bordatouethanks very much
09:25antoineBhello, i don't manage to modify the macro http://www.50ply.com/blog/2012/07/08/extending-closure-from-clojurescript/ in https://gist.github.com/2830a82227d881a9d90a
09:25antoineBi don't understand at all
09:25ivenkysucb: ta - looks like its time to refresh calculus as well -
09:26ucbivenkys: it depends on how pragmatic you're feeling really
09:34ivenkysucb: true that -
09:34ivenkysucb: i guess at some point to really understand functional programming i will have to learn lambda-calculus
09:35ucbivenkys: I learnt it many many moons ago and I don't remember it; can't claim to be a guru but I know a thing or two about FP :)
09:35ivenkysor if i get very ambitious and decide to learn haskell
09:36ucbivenkys: my point is: don't beat yourself too much with it, build things, have fun and you'll learn a thing or two in the process
09:37ivenkysucb: tkx - appreciate the help -
09:37antoineBivenkys: don't lean fp as a dogma, but as a way of doing better/quicker programs
09:37ucb+1 antoineB
09:37antoineBif you know clojure, i don't think you will have problems with haskell, i am right?
09:37ucband no worries; just build stuff and have fun ivenkys
09:38ucbwell, there's that type-system thing ...
09:38brainproxyantoineB: the focus on types and monads could lead to some head-scratching at first
09:38antoineBnot a big deal, clojure also have type and give me some exception some type
09:39brainproxyantoineB: I have found, though, that after spending 6 months w/ clojure, I'm having an easier time experimenting with / understanding some beginner's haskell stuff
09:40brainproxynow, what I would like to see, is the ability to fluidly mix Frege and Clojure in the same project
09:40antoineBi will bet that scala is harder to learn (i mean the whole stuff) than haskell
09:41brainproxyso maybe a Frege-Clojure runtime bridge at some point, and leiningen integration
09:41ivenkysone of my mate says - With Lisp/Clojure you write 10 lines in 30 minutes and 5 of them work , with Haskell you right 1 line after 30 minutes of thinking but it works"
09:42nDuffivan: your mate may find Typed Clojure interesting
09:43miloshadzicfrom my Haskell days, I remember there being a horribly steep learning curve unless you were already studying programming lanugages
09:43ivenkysnDuff: he does Typed Racket - and Haskell - one of the only guys i know who actually gets paid for working with those languages
09:44nDuffivan: *nod*. Typed Clojure borrows a fair bit from Typed Racket, so I doubt it'd be unfamiliar.
09:44ivenkysnDuff: you probly mean ivenkys :-) - ( i am hoping there is no ivan getting pinged )
09:44nDuff...ahh, yes.
09:45randomenduserhello, I'm reading http://www.clojurebook.com/ and I don't understand why https://gist.github.com/4118317 returns ({:age 34, :name "Sara", :location "NYC"}) . shouldn't it return the other 2? (where age is actually <= 25)
09:45randomenduserand then (remove ... would return the above?
09:45brainproxyrandomenduser: did you check the errata page?
09:45randomenduserremoving the ones that satisfy the condition
09:45nDuffrandomenduser: ...so, it runs (<= 25 21), (<= 25 20) and (<= 25 34)
09:45randomenduserbrainproxy: no, I'll bring it up now
09:46randomendusernDuff: ohh, that makes sense. still getting used to prefix I guess :S
09:47deu5Do you know any lib for creating and reading office xls with clojure?
09:47brainproxyrandomenduser: I found it pretty helpful to keep the "unconfirmed errata" page close at hand when working through the book
09:47ivenkys~ pastebin
09:47clojurebotI don't understand.
09:48randomenduserbrainproxy: thanks, found it :)
09:48brainproxyrandomenduser: cool :)
09:48ivenkysis there a default pastebin ?
09:48nDuffivenkys: refheap and gist.github.com are both welcome here
09:48babilenivenkys: http://refheap.com is one that is frequently used in here
09:49ivenkysnDuff: babilen : ta
09:49nDuff...well, Raynes might harass you a bit for gist, being as it is not-refheap. :)
09:52babilenivenkys: There are plenty of others, but I've been criticised in the past for using a "wrong" one ...
09:54ivenkysyeah i have seen that happen on other channels as well - - usually there happens to be a default one
09:54nDuffthere aren't _that_ many ones wrong enough to draw criticism... mostly just pastebin.com
09:57S11001001"has ads" is a good proxy for "wrong"
09:57S11001001rather "has ads or lacks clojure syntax highlighting"
09:59S11001001some chans put one in the /topic; that seems to be a good indicator of strictness too
10:00clgvI have a problem with primitive functions (https://www.refheap.com/paste/6873) it seems that at the end of the function Double.valueOf(prevResult).doubleValue() is executed. why is that?
10:01clgvah right. it is clojure 1.3 right now
10:06bryanlI'm looking for a way to sample non-uniform discrete probability distributions in clojure. Any suggestions before i go looking for some monte carlo support?
10:06clgvthat defeats the whole point of having a primitive function :(
10:06pyrwhen using the history to figure out where we are in a cljscript app
10:06pyrfor instance with snout, is there a concept of "default" route
10:08pyrhmm, i suppose i could fire up an event myself
10:11xcliteIs clojure/tools.cli the common route to go for a command-line arg parser?
10:14clgvxclite: it's working.
10:14babilenxclite: It's the best there is AFAIK even though it lacks a lot of functionality
10:16xcliteclgv, babilen thanks - just wanted to make sure i wasn't using something that everybody knew had been replaced long ago
10:34fojureAnyone notice NREPL eating return values?
10:35fojureThat is, nrepl.el + emacs + nrepl-jack-in. It seems that if I ever add a println to a function, the reporting its return value gets lost until I restart nrepl :-(
10:37brainproxyclojure-tco looks interesting
10:43clgvbrainproxy: oh indeed
10:43tgoossensis it overkill if i try to make a board game with no identity at all. I want to see how far i can push it
10:44clgvtgoossens: by "identity" you mean "mutable state"?
10:44tgoossensyes
10:45tgoossensno
10:45tgoossens"mutable references" i try to avoid "mutable state" (detail)
10:45randomenduserif I have a tuple [a b], and b is a vector contaning some maps (for instance: ["cool" [{:story "and"} {:stuff "yep"}]]), how can I remove some key-value pair from the map in each vector?
10:47clgvrandomenduser: repeated update-in might work. depends on how a larger dataset looks like
10:47randomenduserclgv: it's just a small piece in the repl
10:47tgoossensclgv: do you think i'm trying to push it too much ?
10:48randomenduserI'm just trying to figure out how to do it to get more practice w/these types
10:48clgvtgoossens: no. I think there are others who did something similar. you can search the ML for it
10:49tgoossensML ?
10:49clgvmailing list
10:49tgoossensok
10:51uvtcWhat is the purpose of putting a `defn` inside a `let` (where the `let` is at the top-level)? For example, right after the `ns` macro at https://github.com/ato/lein-clojars/blob/master/src/leiningen/push.clj .
10:51randomenduserclgv: hmm, I'm trying to use group-by, then remove the key that was used for the grouping (because it's now a key of the parent map)
10:52babilenrandomenduser: Hmm, I've written something like that recently ... let me check
10:52clgvuvtc: to define a local binding which that defn statement can close over
10:53randomenduserbabilen: thanks. it seems like it should be easy but I'm fairly new to this
10:53mpenet(def (let [...] (fn [] ...))) looks better imho
10:53uvtcclgv: But couldn't you always put the `let` inside the `defn` instead?
10:54uvtc(defn foo "docs" [x] (let [first-thing ...] ...))
10:54Bronsathat's not the same thing
10:54clgvuvtc: but then its executed on every function invocation. if it's just a value than it does not matter
10:54clgv*then
10:55uvtcOh, so you'd use a `let` on the outside when you want to compute something only once, and then use the result thereafter in every call to the function.
10:56babilenrandomenduser: Do you have an example of the behaviour you want, so that I could test?
10:56uvtcBronsa: were you addressing me or mpenet above?
10:56Bronsauvtc: you :)
10:56uvtcBronsa: thanks.
10:57Bronsauvtc: eg (let [counter (atom 1)] (defn unuque-int [] (swap! counter inc)))
10:57Bronsait's called a closure
10:58uvtcBronsa: right. Thanks. I'm familiar with closures. But my understanding was that defns should always only go at the top-level.
10:58randomenduserbabilen: https://gist.github.com/4118756
10:58uvtcEven though the `defn` is inside the `let`, looks like you still get a regular function --- just as if the `defn` was made at the top-level.
10:58uvtcclgv: thanks.
10:59antoineBuvtc: defn use def, and def always go to the top level
11:00uvtcantoineB: gotcha. Thanks.
11:01babilenrandomenduser: yeah, that would be it. I've done something like https://www.refheap.com/paste/6876 (but you have to come up with a better name!)
11:01randomenduserooo dang, this refheap thing is shiny
11:01randomenduserhas persona too
11:03clgvuvtc: `def` forms are always toplevel even if you nest them
11:03uvtcclgv: check
11:05babilenrandomenduser: You might want to use sets as values though (if appropriate)
11:05babilenrandomenduser: Is that more or less what you are looking for?
11:06randomenduserbabilen: yeah, I have to sift through the docs a bit to understand it. but it seems pretty minimal, so thank you
11:08babilenrandomenduser: Let me know if you have a question -- I'll get a coffee in the meanwhile. :)
11:16lnostdaldoes nrepl.el support "clickable" stack traces yet? .. e.g. via the V key? .. i'm flipping back and forth between it and swank-clojure + slime ..
11:23babilenrandomenduser: Hmm, you can probably implement that in terms of reduce-by too
11:25randomenduserbabilen: is that not in clojure.core?
11:25randomenduseractually I g2g... I'll bb in ~1:30 though
11:26babilenrandomenduser: (reduce-by :artist #(conj %1 (dissoc %2 :artist)) [] playlist) -- reduce-by is introduced in the Clojure Programming book
11:36jsabeaudryWhat is the most idiomatic way to compare two floats up to the third decimal? (apply = (map #(Math/round (* 1000 %)) [float1 float2]))
11:39babilenjsabeaudry: https://www.refheap.com/paste/6877 + http://www.gettingclojure.com/cookbook:numbers
11:39babilenjsabeaudry: That doesn't really compare them up to the third decimal though ...
11:42bordatouewhat would be the best way to handle situation where loop has fewer binding than the recur, for exmpl i have (loop b1 b2 b3) .....(recur b1 b2 b3 b4) i need to execute b4 as it is depended on b3 but the value is not important
11:42babilenbordatoue: Introduce it in the loop with a dummy value?
11:43bordatouebabilen: is that recommended way is there any thing like [ _ _]
11:44babilenbordatoue: nil comes to mind
11:44bordatouebabilen: thats an idea , can i use nil in the loop binding it make it even with the recur binding
11:46babilenbordatoue: What do you mean by "make it even" ?
11:47bordatouebabilen: to have the same amount of binding for both loop and recur
11:47babilenbordatoue: Yeah, that was the general idea
11:47bordatouebabilen: cool then
11:48babilenbordatoue: Something along the lines of (loop [b1 foo b2 bar b3 quux b4 nil] .... (recur foo' bar' quux' something-new))
11:49bordatoueif i a have a form (op1 (op x1) (op x2) (op x3)) is the order of evaluation always going to be from left to right is it definied
11:49bordatouebabilen: thatnk
11:50bordatouehorrible spelling , ==> thanks
11:50jsabeaudrybabilen, excellent resources, many thanks!
11:50babilenbordatoue: Can't be more specific without knowing the problem domain though. And yes, they will be evaluated in that order IIRC
11:51babilenjsabeaudry: Is that a better solution than what you were trying to do? I found that the method described therein works okay for what I am doing, but it might not be what you want.
11:52jsabeaudrybabilen, Yes It's better, mainly because it is much more readable :)
11:52babilenheh :)
11:53jsabeaudryToo bad everyone has to define these functions though
11:53babilenindeed
11:58yediwhy is liberal use of 'let' considered a bad thing?
12:00TimMcyedi: Perhaps a better question is "when", not "why". :-)
12:03S11001001yedi: let causes mental indirections
12:04TimMcS11001001: You're referring to repeated rebinding?
12:05S11001001TimMc: in the expression (let [x blah] (f x)) you have to mentally chase the x
12:05thorwillet is good for avoiding having one thing computed several times
12:06uvtcI tend to think of functions as, `let` sets everything up, then the body of the function does something with it.
12:06S11001001TimMc: and if x is a bad name (which it frequently is) its name can get in the way of understanding what it *is*
12:06uvtcHeh. Sorry for stating the obvious, I guess. :)
12:07babilenyedi: It also causes the code to flow right quite rapidly ... That issue has been discussed on the mailing list recently and people mentioned ways to deal with it.
12:07babilenuvtc: sometimes you have to do just that ;)
12:08babilenyedi: https://groups.google.com/forum/?fromgroups=#!msg/clojure/B2Wo5Oe1OrI/V9WGOJXkJQUJ
12:12tgoossensIn a board game. i defined a robot. It has a type and health. The position of a robot is stored in the board.
12:12tgoossensBecause i want to define a robot (in general piece) indepentently of position in a world
12:12tgoossensthe problem i have is
12:12tgoossenswhere do i put facing direction?
12:13tgoossensin order to be consistent with my premise
12:14tgoossensalso i'm using not using references here. A robot is just a value
12:14tgoossensi'm not sure whether i'm going to run into problems when i want to move a robot.
12:14tgoossensbecause of the question "what robot? do you want to move"
12:15tgoossenswhat is there is a robot on the board with exactly the same values
12:15tgoossensor it might not matter because. you could say
12:16tgoossens "move that piece on position [x y] on this board forward"
12:16tgoossensnot sure :)
12:16tgoossensany advice?
12:16seangroveAnyone else using Domina & recent cljsbuild in a project? Domina.css causes a java.lang.NullPointerException, having trouble tracking it down
12:18thorwiltgoossens: isn't facing-direction independent of the board (eg "north")?
12:18seangroveIn fact, in general, how does one track down a bug like this?
12:18tgoossensthorwil: i was thinking that as well yes
12:19tgoossensthorwil: but not entirely sure. But it is probably the best solution i can think of
12:20tgoossensthorwil: do you think it is a good or a bad idea that i'm avoiding using state here ?
12:20clgvtgoossens: represent the robot as map like {:robot-id 1, :facing-direction :north}. when the game advance you can use assoc to create the new incarnation of the robot with a different direction
12:22tgoossensclgv: maybe the idea is not such a bad idea... . I'm wondering whether the id is better than using identity. I guess so
12:22thorwiltgoossens: you can't avoid state. you can only manage it
12:23clgvtgoossens: oh the id was not what I wanted to show, I just added it to make clear that's the robot
12:24tgoossensthorwil: i think it might be possible to completely avoid state here. But i'm not sure whether that would be a good thing
12:24technomancyany lein-cljsbuild users want to let me know if trampoline is still necessary on lein master?
12:26thorwiltgoossens: posistions, health, directions of all robots are all state. how could you make that disappear? it's just that there are several ways to model it and a number of strategies for state changes
12:28TimMcYou could have each robot be an agent.
12:29TimMc(if they didn't need to advance in lockstep)
12:30clgvTimMc: I think he wants to write it pure functional
12:31TimMcIn that case, keep a vector of robots separate from the board. Both can live in a gamestate map (or record).
12:31TimMcThe robot's ID is its index in the vector.
12:33hiredmanI think http://blip.tv/clojure/clojure-concurrency-819147 has rich talking about ants.clj, which may be interesting if you are writing a simulation / game
12:33tgoossensclgv: yes. as an exercise i'm trying to see how far I can push this by using only pure functional stuff. To then, review the result afterwards and compare it with pure OO
12:33TimMcOO is not the opposite of functional.
12:33tgoossensi didn't say that
12:34ChongLican anything be the opposite of functional?
12:34ChongLiseems like a weird idea
12:34tgoossensi merely suggested they have different idiomatic concepts
12:34TimMc(Well, depending on how one defines "functional".)
12:34tgoossensconcretely
12:34ChongLiahhh
12:34tgoossensi've done the game with mutables now.
12:34tgoossensand
12:35TimMcI guess what I meant was: OO does not necessarily imply mutable.
12:35ChongLiidiomatic is starting to become a pet peeve of mine
12:35tgoossensnow i want to try to see how much immutable stuff i can put into it
12:35ChongLiit's turning into the new "literally"
12:35tgoossensTimmc: i agree on that one
12:35ChongLiat least in programming circles
12:35ChongLiwhat do we really mean when we say idiomatic?
12:35TimMcChongLi: YOU ARE NOT IDIOMATIC. *BAN*
12:36tgoossensmaybe better would be to say
12:36tgoossensi tried to make the game idiomatically in java
12:36tgoossens(not in general OO)
12:36ChongLiI know what idiomatic means in natural language (such as english)
12:36ChongLiand it has nothing to do with the programming term idiomatic
12:36TimMcMy new hobby: Every time someone says "non-idiomatic", I mentally replace it with "un-American". (cf https://en.wikipedia.org/wiki/McCarthyism)
12:37ChongLiidioms in english are weird phrases such as "she's pulling my leg" or "the devil is in the details"
12:37nDuffChongLi: I tend find the parallels between the meanings easier to draw. In both cases, there are a conventional way to say a thing.
12:37alexnixonChongLi: see the first definition http://en.wiktionary.org/wiki/idiomatic
12:38ChongLithey violate the principle of compositionality because the truth of those statements does not follow from their component parts
12:38alexnixonChongLi: I'd say that applies equally to natural and programming languages
12:38t-goossensHmm
12:38maleghastChongLi: I'm afraid that you are not correct about that. In general the word "idiomatic" has another meaning and that meaning is "in keeping with the style and form of the language" for example a literal translation of "I am warm" into French would be "Je suis chaud", but the correct, idiomatic French is "J'ai chaud" which means "I have warm".
12:38nDuffChongLi: ...see also the musical definition given behind alexnixon's link.
12:39lynaghkqerub: I first heard the "Data all the things" expression from Alan Dipert this past summer.
12:39ChongLiit sounds to me like we have a blanket definition
12:39ChongLithat covers related but distinct ideas
12:39alexnixonmaleghast: well, "je suis chaud" is not "un-idiomatic", it's a mistranslation..
12:40qerublynaghk: ok! Thanks! :)
12:40maleghastin other words, idiomatic is a perfectly valid word to use when talking about the clojure-esque way of approaching a solution or the way in which Rubyists refer to "the Ruby way"
12:40ChongLiI want to tackle the first definition then
12:40ChongLiforget about esoteric idioms
12:40ChongLiPertaining or conforming to the mode of expression characteristic of a language.
12:40ChongLithat's the first definition
12:41ChongLito conform to such a definition isn't it sufficient that one conform to a valid expression in the language?
12:41maleghastChongLi: Precisely - as such there is an entirely appropriate use of the word here.
12:42t_goossensIts probably
12:42alexnixonChongLi: take 100 seasoned clojure developers and give them a problem to solve in clojure. The majority will have solutions which look similar - that's idiomatic clojure.
12:42maleghastalexnixon: Thanks - quicker and better than I could manage :-) +1
12:42t_goossensMe not quite sure yet what I want to achieve
12:42ChongLiso the definition of idiomatic now depends on an appeal to popularity?
12:42alexnixonChongLi: yes
12:42thorwilideomatic is a cromulent word, a nice way to embiggen your vocabulary
12:43maleghastChongLi: popularity based on a consensus opinion of best practice
12:43ChongLiisn't a consensus something different?
12:43t_goossensJust been busy with clojure for two months. Just experimenting I guess :)
12:43maleghastthorwil: "corpulent" Nice word! ;-)
12:44maleghasts/corpulent/cromulent - Bloody auto-correct!
12:44nDuffChongLi: Things can be valid within a language without being characteristic of it.
12:44ChongLinDuff: I'm not sure what you mean
12:44ChongLiisn't a computer language defined only by its rules?
12:45thorwilno. a computer language also comes with intentions of the creators that might not fully reduce to said rules
12:45thorwiladd many users and you start to see "culture"
12:45alexnixonChongLi: (defn add-two [x] (+ x 12 (- 10))
12:45nDuffChongLi: Determining whether a given piece of expression written in a language is characteristic of that language is a determination which can be made by humans, in terms of whether the expression is a "typical" example.
12:46ChongLiI see
12:46nDuffChongLi: ...consider how someone reading a passage in a human language can tell if it's written by a native speaker, even if it perfectly conforms to the rules of grammar.
12:47ChongLiso how do you make a determination whether a program is idiomatic or not if it has never been written by anyone else before?
12:47ChongLinDuff: that's very, very subjective
12:47nDuffChongLi: Yes, it is.
12:47alexnixonChongLi: break it into sub-problems, and see if the solutions to those are idiomatic
12:47nDuffChongLi: likewise, programming language idioms are subjective.
12:47nDuffChongLi: ...but eventually, consensus emerges.
12:47ChongLialexnixon: what if the program is non-compositional?
12:48alexnixonChongLi: I don't understand what you mean by that
12:48nDuffChongLi: the manner in which the program is composed or built is, itself, a characteristic which can be used in the evaluation.
12:48ChongLisomething is compositional if it can be broken into sub-problems which make any sense
12:49ChongLifor example, "the devil in the details" is non-compositional
12:49alexnixonChongLi: I don't believe there's any program you can't break down
12:49ChongLibecause you cannot examine the parts to learn the truth of the whole
12:50alexnixonI think we're in danger of getting overly philosophical
12:50ChongLiif you were to do that, you'd be stuck with a literal devil
12:50ChongLiwhich doesn't make any sense
12:50ChongLino, philosophy has great implications for computer programs
12:51ChongLione such case is referentially transparent/opaque contexts
12:52ChongLiyou cannot substitute into a referentially opaque context without changing the meaning of the expression
12:52alexnixonsure
12:52ChongLiwell in a language like clojure (indeed any lisp) you run into these whenever you talk about symbols
12:53alexnixonlogic is a concern of philosophy, as is computability. I'm just saying that in this specific instance I don't think it's helpful.
12:53ChongLihow so?
12:54ChongLianother good example might be mutual recursion
12:55ChongLibreaking apart a mutual recursion makes little sense, as the parts are defined in terms of eachother
12:57alexnixonthe use of mutual recursion implies you've broken your problem down into components. I'm not saying they're useful when taken in isolation, just that you can look at each piece and evaluate it (and also evaluate the program in its entirety).
12:59ChongLiyeah I suppose
12:59ChongLibut I don't see how you could determine whether it was idiomatic or not
12:59ChongLiespecially if it expressed something you had never seen before
13:01alexnixonyou might not have seen the *exact* same problem before, but it's a pretty safe bet the same 'shape' of problem will have been tackled many, many times before.
13:01ChongLiperhaps, but then you're making a value judgment
13:02ChongLiwhich I guess is really at the core of what idiomatic means
13:02ChongLiit's a value judgment
13:02alexnixonyep
13:02alexnixonyou might find kibit interesting
13:03ChongLiI think people ought to be aware of that
13:03ChongLibecause sometimes I see people use the term as a kind of attack
13:03ChongLiwhen it really isn't fair to do so
13:03ChongLiI'm not accusing anyone here of that, I haven't seen it happen here
13:04ChongLiI still need to look into core.logic
13:04alexnixonattacking people is rarely helpful but non-idiomatic code is expensive and so it's right to discourage it, imo
13:05TimMcWhen code is more "idiomatic" (however you define it), the implication is that other developers will be able to glance at it and see what it is up to more easily.
13:05ChongLiyeah and that is good
13:05TimMc(well, *one* implication, anyway)
13:06ChongLibut I think it's also important to help beginners realize what idiomatic means
13:06ChongLibecause it can be a cultural minefield
13:06alexnixonin terms of non-native speakers, you mean?
13:06ChongLiyeah
13:07ChongLisimilar to cultural faux pas
13:09ChongLiso kibit is a lint-like?
13:09ChongLiis that a term?
13:09TimMcsure
13:09ChongLiI had some trouble using hlint with haskell
13:10ChongLiit occasionally suggested program transformations which were ill-typed
13:12alexnixonI believe kibit can do the same (I saw a mailing list post about it not being aware of reducers)
13:13ChongLiso it's definitely a tool intended for experienced programmers
13:13alexnixonno I don't think so
13:13abphell-o
13:13alexnixonaiui it's aimed at beginners, to help make them aware of existing functions they might not be aware of
13:13ChongLithen are beginners going to be able to cope with transformations which damage their program?
13:14alexnixonthat's a bug :-)
13:14ChongLiahhh, ok
13:14alexnixonmost of its transformations are very, very simple
13:14ChongLiI thought it was merely a limitation
13:15ChongLiI don't know how core.logic works, but in SICP they talk about the closed world assumption
13:15ChongLiand how that leads down many a dark path to paradoxes
13:17alexnixonI haven't looked at it in detail, but my impression is that kibit suggest transforms based on simple pattern matching of s-expressions
13:17AnderkentSo clojure compiler seems a bit crap at assigning line numbers to bytecode, is that worked on or a limitation of jvm?
13:20dnolenAnderkent: compiler usually gives pretty accurate line numbers - malformed sexprs and macros are the cases where you may not get a line number.
13:22Anderkentdnolen: not in my experience, see https://gist.github.com/4119799. Everything from (zero?...) to the 1 refers to the first instruction, surely it can be more specific
13:27dnolenAnderkent: it could be improved I'm sure - but it's not been a real pain point for me at least. And I hear many more complaints here about no line no information for the obvious reasons.
13:28Anderkentwell, it's a pain when trying to get code coverage working ;S
13:33Luytre-reading http://www.paulgraham.com/avg.html and it's always a good read. Is Clojure the modern blub?
13:33TimMcLuyt: No, Java is.
13:33technomancyLuyt: silly question; the whole point of blub is you can't tell
13:33TimMc(In my own experience with multiple languages.)
13:33LuytTimMc: You might be right.
13:34TimMctechnomancy: Fair point, but it's what I would regard as "the most common Blub".
13:34LuytI made a mistake in my answer ;-) of course Clojure is the highest nirvana of Lisp you can attain ;-)
13:34dnolenLuyt: doubtful
13:34langmartinlisp might be a blub re types
13:34TimMcClojure is a compromise.
13:34langmartinsometimes
13:35dnolenTimMc: as far as PLs go that is pretty much a tautology
13:35technomancy"everyone smarter than me is a nerd; everyone dumber than me is an idiot" http://wondermark.com/333/
13:36LuytI'd like to befriend people of equal smartness as me.
13:37uvtcGeorge Carlin on that one: http://i.qkme.me/3qzpsm.jpg
13:38devnDoes anyone know of the paper that's kind of in the Clojure canon, the one about reasoning about programs, the implications largely being about testing software?
13:40devnNevermind, I was thinking of Out of the Tar Pit -- was trying to place the phrase: "Informal reasoning"
13:49abpamalloy: technomancy When I start using emacs, is it advisable to use emacs-starter-kit and emacs-live together to get started writing clojure?
13:49technomancyabp: I recommend writing your own dotfiles
13:50technomancybut read over other peoples to find good tricks
13:50technomancyand check out what packages other people use
13:50ivanI like all of the packages emacs-starter-kit uses by default
13:50lynaghkdnolen: here's the gist about the unifier constraints you requested: https://gist.github.com/4116442
13:50technomancythe emacs defaults are often comically bad, so you need at least a page or two of elisp to work around that, then the rest can come in via packages
13:51Iceland_jackAin't that the truth
13:52lynaghkdnolen: not sure if it's what you had in mind or how complex it might be to implement.
13:54abptechnomancy: Sounds like pretty much to do when searching for a new editor to write my libs in.
13:54technomancyabp: yeah, definitely. there are easier editors.
13:56llasramHave the defaults gotten better with Emacs 24?
13:56llasramI definitely remember some stuff being kind of bizarre, but I just re-wrote my emacs config from scratch, and there's de facto standard stuff which isn't on by default (like ido), but the only insane default I ran into is the C-j vs C-m behavior.
13:57technomancyllasram: not really IMO
13:57technomancyyou still have the toolbar and menubar on by default, uniquify off, and a bunch of other nonsense
13:57llasramOhhhhhh, right
13:57llasramYeah, ok. That's fair, esp for uniquify. Toolbar and menubar though -- maybe most people want those?
13:58technomancyno
13:58technomancywell, maybe they do, but they're wrong
13:58llasramWell *I* agree with you :-)
13:58technomancythe toolbar actually reflects a somewhat insulting attitude of emacs-devel towards newbies
13:58llasramBut it kind of makes sense. If you know emacs, you turn them off. If you're a new user, the defaults have them on to make things discoverable in a more typical way
13:59dnolenlynaghk: thanks, I'd like to see some more examples - in particular examples of :where of all the cases you had in your other gist.
14:00lynaghkdnolen: This syntax would complement the current metadata-based approach. The example in that gist is the only one where I need to put a constraint between two lvars that exist within the unification
14:00tgoossenssublime pleases me as well. But there might be better editors for clojrue
14:01lynaghkdnolen: also, since the lvars would need to be projected before the predicate could be applied, this approach could also be used to implement "or".
14:02dnolenlynaghk: hmm, I'd like to see how it could work w/o metadata, everything in the 3rd argument to the unifier.
14:02TimMctechnomancy: As a noob, I *loved* the toolbar. It was very important in my transition to learning the keyboard shortcuts.
14:02lynaghkdnolen: ah, I see. yeah, I can throw that together; give me 5 min.
14:02dnolenlynaghk: projection is not required w/ constraints.
14:03dnolenlynaghk: but that's neither here nor there really for consumers of the simple unifier
14:03lynaghkdnolen: how so? Don't the lvars need to come down from logic-world before they can be given to regular ol' predicate functions?
14:04dnolenlynaghk: constraints run on events - they don't run until their vars satisfy some condition - domain change, grounding etc
14:04dnolenlynaghk: projection requires you to consider order - constraints free you from that.
14:05lynaghkdnolen: ah, okay. I should read up about the implementation
14:05dnolenlynaghk: but like i said, implementation detail as far as what you want :)
14:06lynaghkdnolen: as an aside: unifier order shouldn't matter, correct?
14:07lynaghkdnolen: https://www.refheap.com/paste/6878
14:07dnolenlynaghk: as in which argument the spec is?
14:07lynaghkdnolen: I was just playing around and ran into this non-intuitive situation
14:07lynaghkat least, it was a surprise to me.
14:08dnolenlynaghk: that past doesn't make sense unifier only takes 2 arguments right now.
14:08dnolens/past/paste
14:09dnolenlynaghk: oh wait ... right
14:09dnolenI added that
14:09lynaghk= )
14:10dnolenlynaghk: can you add the output to that so I can see what's going on? :)
14:10lynaghkdnolen: as I'm writing up these new examples, do you have thoughts on annon functions?
14:10dnolenlynaghk: what about them?
14:11lynaghkdnolen: if you think it'd be a good or bad idea to support them in the where clause
14:11lynaghkboth in terms of the implementation complexity and the difficulty of reading unifier calls.
14:11dnolenlynaghk: like anon predicate you mean?
14:12dnolenlynaghk: add an example of what you're thinking
14:12lynaghkdnolen: yeah. To support "or", for instance, my instinct would be to write [#(or (numeric? %) (nil? %)) ?the-var]
14:13lynaghkdnolen: but then these unifier constraint statements might turn into a big mess---also, not sure if there are pitfalls running prep across annon-fn forms.
14:14lynaghkdnolen: updated paste: https://www.refheap.com/paste/6879. output is [{:x 2} nil]
14:15dnolenlynaghk: yeah that could work. I'm not sure the constraint argument to the unifier should prep the constraints. that is it should just be real data and if you want to specify an anon fn then you need to quote your vars.
14:15dnolenlynaghk: also constraint arg should maybe be a map
14:16dnolen{'?x ... '?y ... #(or (numeric? %) (nil? %)) '#{?x ?y}}
14:16dnolenwe can treat symbols specially from fn keys.
14:16lynaghkdnolen: not sure I see. What's that a map of?
14:16dnolenvars -> constraints
14:16dnolenor group constraints -> var set
14:17lynaghkdnolen: for that latter case, shouldn't the value be a vector since the args should be provided in order?
14:17dnolenlynaghk: what does order indicate here?
14:18lynaghkdnolen: I need to implement constraints with a fn of specific lvars. E.g. (data-numeric data dimension)
14:18lynaghkso the map would need to be {data-numeric [?data ?dimension]}
14:19dnolenlynaghk: I don't see why order matters. can you explain?
14:20dnolenlynaghk: the problem that gist is that you reify vars too early - ?x gets bound to _.0, you need to wrap in in (binding [*reify-vars* false] ...)
14:20lynaghkdnolen: data-numeric is a plain function with the signature [data dimension]. It looks into the dimension of the data to see if the value is numeric.
14:20dnolenlynaghk: er the refheap I mean.
14:21lynaghkdnolen: ah. is that an implementation detail? It's a surprise to me. I've been thinking of unifier as just taking the args, prepping, and chaining them all together in the same way as == within a run.
14:21lynaghk(unifier a b c) <=> (run* [q] (== q a) (== q b) (== q c))
14:22dnolenlynaghk: yeah I guess it's pretty annoying ... I could change it set that automatically if we have more than 2 args.
14:22lynaghkdnolen: well, that's a side issue. We might decide to change the signature of unifier so it takes only two args with an optional third-arg map = )
14:22jcromartiedo all futures evaluate on the same thread?
14:23lynaghkdnolen: does this data-numeric question make sense? The predicate does not treat its arguments symetrically.
14:23dnolenlynaghk: http://dev.clojure.org/jira/browse/LOGIC-71
14:23llasramjcromartie: No -- uses the same thread-pool as agent send-off
14:23TimMcjcromartie: I think they share a thread ppol.
14:24dnolenlynaghk: hmm not really. ?data either does or doesn't exist, if it does then all you care about is whether ?dimension is numeric right?
14:24jcromartieI was Doing It Wrong™
14:24lynaghkdnolen: nope. ?data is a seq of maps, and ?dimension is a key of those maps. The data-numeric predicate needs to look to see if ?dimension's values are numeric
14:25dnolenlynaghk: it needs to check all of them is that what you're saying?
14:25lynaghkdnolen: line 10 https://gist.github.com/4116442
14:26lynaghkdnolen: the point is that we should support arbitrary predicates of multiple lvars.
14:26lynaghkdnolen: via user-provided functions, which don't necessarily treat their arguments symmetrically.
14:27dnolenlynaghk: right I'm starting to get it ...
14:28dnolenlynaghk: it can be done, it'll have to be a different constraint from the cvar stuff that I've shown.
14:29dnolenlynaghk: it's a constraint that runs once both of it arguments have become ground
14:29lynaghkdnolen: aren't the constraints on a single argument only---the lvar?
14:30dnolenlynaghk: the one's we've talked about yes - but not in general. Otherwise how could we solve sudoku? :)
14:30lynaghkdnolen: hehe.
14:31lynaghkdnolen: syntax wise I think the map is a good idea. A map of functions to a vector of their arguments?
14:31mefistoanyone done much with clj-record? is it fun to use
14:31dnolenlynaghk: yep
14:32lynaghkdnolen: I wonder why datomic's syntax is with the vectors, then.
14:32lynaghkdnolen: seems like we're doing the exact same thing.
14:34dnolenlynaghk: again I think we should support both symbol keys and fn keys.
14:34lynaghkdnolen: that's fine with me. I'll update the gist with more examples.
14:34dnolenlynaghk: I think in the case of datomic the tuple form simplifies the implementation quite a bit. I don't think it matters much here.
14:35dnolenlynaghk: excellent
14:44lynaghkdnolen: https://gist.github.com/4116442/
14:45lynaghkdnolen: I just added what we just talked about.
14:48dnolenlynaghk: cool, for case where users want to provide fns in the map, the whole map should not be quoted.
14:49lynaghkdnolen: I just edited the gist = )
14:49lynaghkdnolen: was thinking the same thing. this lvar quoting stuff is a bit tricky.
14:50lynaghkdnolen: I am liking this syntax much better than the metadata, now that I think about it. Much cleaner when the unification contains the same lvar in multiple places.
14:50dnolenlynaghk: yep, I suspected that would be the case so I wanted to explore. The metadata thing may very well go the way of the dodo.
14:55lynaghkdnolen: unless I am missing something, though, the unifier cannot be used to do a fully general rewrite (e.g., removing keys)
14:55dnolenlynaghk: is there a case where you need that?
14:57lynaghkdnolen: yes, because I'm trying to do full rewrites. See line 16 here: https://gist.github.com/4004131
14:58lynaghkdnolen: the match is saying "you asked for a boxplot with x and y aesthetics, but there is no y aesthetic for a boxplot. You really wanted that to be a value in the statistic record"
14:58dnolenlynaghk: I don't see any rewriting in 16
14:59lynaghkdnolen: refresh please. The first item in that vector (line 15) is the match, the second bit is the rewrite
14:59lynaghkdnolen: the :y !_ means "take this out of the map"
15:00lynaghkdnolen: the second item in the vector is the rewrite, which I was deep-merging into the user-provided spec.
15:01lynaghkdnolen: here's a simpler example of what I'd want: (unifier {:a 1 :b 1} '{:a ?a :c ?a}) ;; => {:a 1 :b 1 :c 1}
15:03dnolenlynaghk: ok, yeah - we'd need something like rewriter which respects the same rules as the simple unifier that we've talked about.
15:03dnolen(rewriter [match => rewrite :where ...] ...)
15:04lynaghkdnolen: okay, yeah. I can open source that based on what I have thus far
15:04lynaghkdnolen: basically, unify spec with the match, then the rewrite has the same lvars as spec and gets deep-merged into the spec.
15:04dnolenit's ok, it's pretty trivial to embed that into a simple run.
15:05dnolen(run* [q] (== user-data spec) (== q rewrite))
15:05dnolenand constraints are implicitly added on the vars via :where
15:06lynaghkdnolen: that won't cut it in my case because of the partial map stuff---I want to refer to only the things I care about in the match, not every possible key
15:06lynaghkdnolen: that's why I have to deep merge the rewrite onto the spec; it overwrites certain values but carries the rest along
15:07dnolenlynaghk: I guess I don't see how that isn't handle by defaults and partial map in what I just said above?
15:07dnolenhandled
15:08lynaghkdnolen: it's an open system, so the user might add new keys that aren't in the record definitions
15:10dnolenlynaghk: I see, so this sounds like something you can handle on your end then? the unifier isn't really about rewriting - we just need to make sure you can get the data you need.
15:11lynaghkdnolen: yes, correct.
15:11dnolenlynaghk: sounds good
15:11lynaghkdnolen: I think people would be interested in the rewrite case so I'll try to factor it out of the system or at least put together a pretty comprehensive gist about it.
15:12dnolenlynaghk: yes I think a rewriter based on core.logic would be a pretty sweet lib.
15:12lynaghkdnolen: thanks again for all of your help on this. I'd be more than happy to take a stab at some implementation stuff if you think I'd speed you up rather than slow you down.
15:13dnolenlynaghk: if you've got the bandwidth sweet. First thing would be a unifier that takes n args but looks for :where constraint-map at the end. The patch doesn't need to actually process it, just change the unifier so that this form is valid.
15:14dnolenlynaghk: if I get that I can do the constraint processing and the var w/ default value unification pretty easily.
15:14lynaghkdnolen: so you want to keep the multi-arity unifier?
15:14dnolenlynaghk: I dont' see why we shouldn't.
15:15lynaghkdnolen: fair enough. Yeah, I'll get that pushed up later today. Do you want me to handle the walk fix too?
15:15dnolenlynaghk: yeah that would be cool.
15:16lynaghkdnolen: okay, I can get both of those done today. I've got to run for now, though. catch you later.
15:17dnolenlynaghk: later
15:45simonadameithi
15:47simonadameitThe interfaces that are defined in clojure.lang like ISeq, etc. - is there some documentation / overview and explanation for them?
15:48simonadameitThis seems to be important for implementing data structures that work the same as all the clojure data structures
15:49dnolensimonadameit: nothing that I know of beyond the source - maybe some of the books cover them.
15:59mpenetsimonadameit: there is a handy fn from cgrand that helps to get and overview: https://gist.github.com/2053633
16:01mpenetsimonadameit: example of output https://gist.github.com/4121044
16:02simonadameitthanks, thats cool
16:03simonadameitIs there some library in clojure for defining binary formats and manipulating binary data (e.g. on a Java ByteBuffer) ?
16:04mpenetsimonadameit: gloss
16:08simonadameitmpenet: looks great, i did not find this library, though i was looking
16:10simonadameitthis is more of a general question: does it make sense to copy data that resides in a memory mapped file into clojure data structures (like gloss does) or should i write accessors to directly look at the data in the buffer in a structured way?
16:14simonadameiti.e. write deftypes that maybe implement some clojure collections interfaces and call .getInt (etc.) at just the right time?
16:14simonadameitany idea whats the better approach?
16:22S11001001simonadameit: for most programs, the former.
16:22ifesdjeenhi guys, does anyone know why alter-var-root doesn't work within (defmacro)?.. it simply doesn't change dynamic variable at all...
16:22ifesdjeenat least when execution is deferred (quote)
16:22S11001001simonadameit: implementing crap in deftype is for optimization, and you know what they say about doing that too soon....
16:22TimMcOr even at all. :-P
16:23TimMcifesdjeen: Do you have a public example somewhere that doesn't work as you expect?
16:23ifesdjeenTimMc: sec, posting gist
16:24TimMcMy immediate suspicion is that you're confusing runtime and compile-time in some way...
16:26simonadameitS11001001: ok, for what kind of programs would the latter make sense?
16:27technomancysimonadameit: implementing Clojure
16:28dnolen_simonadameit: any code where performance really matters including Clojure
16:28dnolen_simonadameit: also it's the only way to create your types that can interoperate w/ Clojure transparently
16:28dnolen_so it's not just about performance.
16:28dnolen_your own types.
16:28TimMcWrite that part in Erlang or OCaml or something.
16:28ifesdjeenTimMc: https://gist.github.com/c10c4cf6f9e7f9db05ac
16:29ifesdjeenTimMc: it seems that I do, i did run into one of the issues lie that, but i've inserted a couple of printlns to verify flows, and everything kind of made sense
16:31ifesdjeenit works perfectly fine until I insert macro into macro... then it just uses binding value, ignoring alter-var-root
16:31ifesdjeenprobably it's an expected behavior
16:31ifesdjeeni'm just wondering what would be a better way to do the same thing
16:32TimMcifesdjeen: You're altering the var root, but your printlns are getting the dynamically bound value.
16:35jcromartiewhy does this fail with "Wrong number of args (1) passed to: core$reduce": https://gist.github.com/ba9030abda9c8a3ed0bc
16:35jcromartieI don't see reduce being called with 1 arg
16:36jcromartienever mind
16:36jcromartiestack trace interpretation FAIL
16:36TimMcIt was actually your fn literal?
16:36ifesdjeenTimMc: i understand that. So, basically, there's no way do change dynamic var while having a binding?..
16:37TimMcI don't happen to know of a way to change the current dynamic scope, no.
16:38ifesdjeengot disconnected
16:38ifesdjeenthank you TimMc
16:39jsabeaudry(contains? [1 2 3] 1) -> true, (contains ["a" "b" "c"] "a") -> false, huh?
16:39TimMc~contains?
16:39clojurebotcontains is gotcha
16:39technomancyclojurebot: contains?
16:39clojurebotcontains? checks whether an indexed collection (set, map, vector) contains an object as a key. to search a sequence for a particular object, use the `some` function, which accepts a predicate. if you want to only match a certain object, you can use a set as the predicate: for example, (some #{5} (range)) finds the first occurrence of 5
16:39technomancyoh snap
16:41TimMcclojurebot: contains? is a sneaky way of getting people to learn about computational complexity
16:41clojurebot'Sea, mhuise.
16:41Bronsaifesdjeen: what about set!?
16:42TimMcOh hah, good call.
16:42_ulisesthis is a gloss question: when I define a codec using header, does the header frame get consumed? preliminary tests suggest yes but the docs suggest otherwise?
16:42llasramifesdjeen, Bronsa: what about bound-fn ?
16:43jsabeaudrytechnomancy, thanks!
16:54simonadameithow do I access static nested classes from clojure?
16:55TimMcsimonadameit: Inner classes use $ instead of .
16:55TimMc~inner classes
16:55clojurebotIt's greek to me.
16:55simonadameitthanks, that works! :)
16:57TimMcclojurebot: inner classes are a Java fiction; for the Double "inner class" in Point2D, write Point2D$Double (not Point2D.Double).
16:57clojurebotjava generics are http://en.wikipedia.org/wiki/Generics_in_Java
17:01dnolen_unnali: btw, pretty sure your issue got resolved - will see if we can push out a new CLJS release this Friday.
17:07abuilesI'm setting up nrepl in emacs, so far everything works well, with nrepl-jack-in I get the nrepl buffer, but when I tried to evaluate something with C-c-C-r, I get "inferior-lisp-proc: No Lisp subprocess; see variable `inferior-lisp-buffer'", am I missing something?
17:09unnalidnolen_: woah! amazing!
17:09unnaligreat to hear!
17:13FrozenlockI'm trying to set a field using (set! (. object field-name) value), but the expression (. object field-name) throws an exception "no matching field found". I know the field exists, I can see it in the Slime inspector. Is there another way to get to a field?
17:13simonadameitwhat is the preferred construct in clojure to manage side effects?
17:14nDuffsimonadameit: that very much depends on the details.
17:14ChongLisimonadameit: mostly convention, from what I know
17:14ChongLiconvention and the concurrency primitives
17:15nDuffsimonadameit: could you be more specific?
17:15simonadameiti want something like agent (multiple readers, single writer) but agent may not have side effects, and i want the data to reside in a file
17:15nDuffsimonadameit: I/O (ie. writing to a file) _is_ a side effect.
17:15simonadameitexactly
17:16simonadameitthats why i cannot use an agent
17:16nDuffWaitamoment.
17:16nDuffHuh?
17:16simonadameitand ask for the clojure way to manage side effects
17:16nDuffAgents are certainly allowed to do IO.
17:16ChongLihow do you plan to write to a file without side effects?
17:17nDuff...for that matter, the behavior of agent send operations within transactions is one of the useful ways to coordinate between side-effect-free dosync blocks and side-effect-ful IO
17:17simonadameitChongLi: i want the side effects
17:17ChongLiyeah that's a very good point
17:17simonadameiti just dont want them to happen twice because stm decides to do so.
17:18ivanabuiles: try closing and reopening your .clj file
17:18ChongListm works with agents
17:18nDuffsimonadameit: What were you reading that implied that agents shouldn't do things with side effects?
17:18ChongLiso that agent actions are not repeated if the transaction restarts
17:18nDuffsimonadameit: STM doesn't cause agents to retry.
17:18ivanabuiles: or try calling nrepl-eval-buffer directly, maybe you have key binding problem
17:18nDuffsimonadameit: maybe you're thinking of refs.
17:19ChongLiso yeah, you can use an agent to implement a transaction log
17:19ChongLior whatever it is you want to do
17:19simonadameit"Agents are integrated with the STM - any dispatches made in a transaction are held until it commits, and are discarded if it is retried or aborted."
17:19nDuffsimonadameit: things added to an agent's queue from within a transaction are never run until after that transaction has successfully completed.
17:20simonadameitso this means the agent dispatch is not retried?
17:20ChongLithere you go
17:20simonadameitthats good
17:20ChongLiyeah
17:20abuilesivan: yeah, seems like a key-binding problem :( thanks
17:20simonadameitChongLi, nDuff: thanks, seems I can use agents after all
17:21ChongLisimonadameit: it does require discipline, however
17:21ChongLiif you try to do a side effect directly within a transaction, you'll throw an exception (I beleive)
17:21ChongLibelieve
17:22TimMcChongLi: Not in general.
17:22xcliteI thought you could do one, it just might happen... a lot
17:22simonadameitChongLi: I want to do it in a function that i send to an agent
17:22simonadameitthat should work, shouldn't it?
17:22xclitesimonadameit, that's how I do it. I have an agent to whom I send logging calls.
17:22ChongLiTimMc: isn't there something you can wrap around your side-effecting function so that it throws an exception if you call it in a transaction?
17:23nDuffio!
17:23TimMcSure, but it's not automatic.
17:23ChongLiit's a good convention to have then
17:23ChongLiif it's really important to you
17:23TimMcI'm not sure when I'd really use it...
17:24TimMcIt seems like something that's only useful if you don't know all the code paths through your application.
17:24ChongLiyeah, when building a really large and complex system
17:24ChongLiwith a large team
17:26TimMcI still don't see it.
17:27ChongLiI wonder if you could devise some static analysis that'd go through the entire library (including any java libs you use) and flag everything with the io! macro
17:28ChongLiseems like it'd be feasible
17:28TimMcheh
17:29TimMcThe channel has visited this topic in the past...
17:29ChongLihaha
17:29ChongLiI guess it's silly for me to bring it up again then
17:29TimMcno no, I'm just hunting through the logs
17:32TimMcIncidentally, ref operations themselves are side-effecting -- but they're coordination with the dosync.
17:39TimMcBah, I can't find it.
17:40TimMcAnyway, the short version is that static analysis can't tell when a side-effect is "safe" or not.
17:43ChongLiTimMc: ahhh
17:43ChongLiwell that makes sense
17:43ChongLiI guess a lot of java calls would be false positives
17:46TimMcIt also can't predict all your code paths, so you'd have to have both liberal and conservative versions to handle some higher-order usage of functions.
17:47ChongLiit'd have some granularity issues I guess
17:47TimMc(I'm not particularly well-versed in this topic, so I'm being a bit hand-wavey.)
17:47ChongLithen again, even haskell's IO monad has these issues
17:47ChongLihence the need for unsafePerformIO
17:50wingy500 members
17:51FrozenlockSo, any java knowledgeable person that can tell me how misguided I am in my attempt to modify a java field? :)
17:52amalloyjava loves it when you modify fields, man
17:52brehautthe unsafe part of unsafePerformIO is not the IO, its calling it in pure code; theres no garuntees on how many times it will evaluate (it could be zero or more); you are banking on the strictness analyiser doing what you think
17:52kencauseyI've updated to ritz-nrepl 0.6.0 both on the clj and elisp side and now when I do alt-x nrepl and try to use the connection I get 'No Lisp subprocess; see variable `inferior-lisp-buffer`'
17:53kencauseyI'm running a git checkout of Emacs 24.3.50.1 built locally yesterday
17:53simonadameitdo agents behave like a volatile in regard to memory synchronization? I.e. when a thread reads a value from an agent, will it also see everything that the agent wrote into unsynchronized memory regions during its change function?
17:54Frozenlockamalloy: was that sarcasm?
17:54tbaldridge_anyone know how to negate something in core.logic? Instead of (nilo q) I want (not-nilo q)
17:54amalloynope, java is field-modification-oriented programming :P
17:55brainproxyFrozenlock: you've never had your jvm kiss you on the cheek when you get busy modifying fields?
17:55kencauseyPerhaps symptomatic, ido can't find any command including ritz other then nrepl-ritz-jack-in, it doesnt s3ee nrepl-ritz-break-on-exception by the way, and it doesn't work if I type it out.
17:55FrozenlockEh, the only contact I had with the JVM is through Clojure.
17:55kencauseytbaldridge_: not
17:56actsasgeekis anyone else having a problem with lein not being able to find noir-lein-template:pom:1.3.0?
17:56hugodkencausey: you could try M-: (require 'nrepl-ritz)
17:56nDuffFrozenlock: Have a standalone reproducer handy? The Java standard library isn't exactly full of public fields, so I don't have anything off-the-top-of-my-head handy to test.
17:56tbaldridge_ah...just found it, it seems != does what I need, thanks
17:58kencauseyhugod: That changes the second issue, but does nothing regarding making c-x c-e work.
17:59kencauseytbaldridge: I ignored the fact that you said core.logic, best you just ignore me, sorry.
17:59hugodkencausey: what buffers do you have with names starting with "*nrepl"?
17:59tbaldridgekencausey: np
18:00kencauseyhugod: *nrepl* *nrepl-connection*
18:05FrozenlocknDuff: Other than the library I'm currently bashing my head on, I don't have anything that comes to mind. My problem is with this https://github.com/Frozenlock/Bacnet-scan-utils . If you load bacnet.clj, then create a new device (def ld (new-local-device)), you can inspect ld and see there's a configuration field. However I can't get access to it using (. ld configuration). Yes, that's enough to confuse me.
18:07dnolen_tbaldridge: there is no general form of negation in core.logic (similar to Prolog)- disequality may cover your use case as you've discovered
18:10nDuffFrozenlock: it's a bean. (.getConfiguration (bacnet-scan-utils.bacnet/new-local-device))
18:11nDuffFrozenlock: ...which us the usual way of doing things in Java -- public fields are very, very rare.
18:11FrozenlockSo to set it, I should do something like (set! (.getConfiguration
18:11Frozenlock (bacnet-scan-utils.bacnet/new-local-device)) some-configuration-object) ?
18:11nDuffFrozenlock: no, it has a setter.
18:12nDuffFrozenlock: ...or, it should, if it's being a well-behaved bean.
18:12FrozenlockIt has? I didn't seen it in the docs...
18:12nDuffWhere are these docs?
18:12Frozenlockdidn't see*
18:12nDuffAnyhow -- no sane Java API will expect 3rd-party users to directly interact with its fields.
18:12nDuff...it's just not a thing that's done.
18:13hugodkencausey: perhaps try it in a fresh emacs instance?
18:13nDuffFrozenlock: ...so, they may have a different way to do that, ie. expecting you to mutate the configuration rather than replacing it, or expecting it to be provided at configuration time, or whatever.
18:14nDuffFrozenlock: If you can provide a pointer to the javadocs, I may be able to be more helpful.
18:14FrozenlockHere: http://dl.dropbox.com/u/40737386/bacnet4J-doc/index.html
18:14FrozenlockAaand there's frame... damnit.
18:15Frozenlockhttp://dl.dropbox.com/u/40737386/bacnet4J-doc/com/serotonin/bacnet4j/LocalDevice.html
18:15nDuffFrozenlock: Notably, that documentation doesn't say anything about there being a public field.
18:15FrozenlockOk, so if a field isn't public, I can't touch it?
18:16nDuffFrozenlock: Exactly.
18:16Frozenlock-_-
18:16nDuff...well, not without doing a bunch of magic with reflection, and if you need to ask, the answer is "no". :)
18:16tgoossens(maybe by using reflection you can :p )
18:16nDuffFrozenlock: ...so -- if there aren't other docs or examples showing configuration, ask the developers behind the library.
18:16FrozenlockYeah, I'll stick with no. I ain't wantin any java black magic
18:17nDuffFrozenlock: ...by the way, the configuration object it gives you _does_ have methods for updating properties.
18:17kencauseyhugod: I've restarted emacs multiple times, I've been dealing with this for a day or more.
18:17FrozenlockYes, but one at the time. I wanted to grab a config using getConfiguration and stick it in another device.
18:18FrozenlockI suppose I'll have to make an helperfn for that.
18:18FrozenlocknDuff: Thank you very much for your help!
18:21hugodkencausey: M-x nrepl to a repl started with `lein repl :headless` work?
18:22kencauseyhugod: OK, a moment...
18:25tgoossensOn a gameboard. I have a map of position->list of pieces on that place
18:25kencauseyhugod: I get the same error
18:26tgoossensi am struggling with making pieces "unique"
18:26tgoossensthere are several paths i'm following:
18:27tgoossens* it doesn't matter. I don't need to uniquely identify a piece. because if it has the same internal values with a piece on position then it is that piece
18:27tgoossens* use identity: references
18:27tgoossens* giving an "id" to a piece
18:27tgoossensnot sure what I should go for
18:28hugodkencausey: that suggests a general nrepl issue then. I can't see a reference to inferior-lisp-buffer in nrepl.el. Is it possible you have some nrepl customisation hooks?
18:28tgoossensunique id seems ok but difficult to ensure the id is unique
18:29tgoossensidentity makes it trivial. but then i'm working on a very "low" level in my program with identity already. Maybe i should avoid doing that
18:29tgoossensand using no uniqueness identifier how i'm going to say then: "move this robot forward"
18:31technomancykencausey: if you're invoking inferior-lisp functions that means nrepl.el isn't enabled
18:32Frozenlocktgoossens: id with (gensym) perhaps?
18:32kencauseyfor what it's worth nrepl-eval-region works
18:32kencauseytechnomancy: Can you suggest how I might go about debugging/fixing that?
18:33tgoossensFrozenlock: what i mean is. How do you ensure that some external party provides a unique id?
18:33flying_rhinohello guys
18:33kencauseyhugod: I may indeed have some customization, commenting it out now and retrying.
18:36technomancykencausey: see if enabling the minor mode by hand helps I guess
18:36kencauseytechnomancy: for a .clj buffer?
18:36flying_rhinoI have a question: Say I have several collections (lists vectors hashes whatever) of records. I want to have the structure similar to database. What you say is the best way for one item to link to the other? Maybe to make every collection hash map and use it's key as a primary key ?
18:37kencauseytechnomancy: I'm not clear on which buffer you mean or for that matter what mode
18:38technomancykencausey: connecting to nrepl is supposed to enable nrepl-interaction-mode on all .clj buffers belonging to the project, but apparently that's not happening
18:39kencauseytechnomancy: Yep, that fixed it
18:39technomancyprobably want to report that in github issues
18:41kencauseytechnomancy: Prior to hugod's suggestion regarding customization I had the stuff from kingtim/nrepl.el readme including the add-hook, which is commented out now. That said, it wasn't working when it wasn't commented out.
18:41kencauseytechnomancy: to kingtim/nrepl?
18:41technomancyyeah
18:42kencauseythanks, at least I can work around it for now
18:42technomancynp
18:42kencauseyhugod: and to you as well
18:43flying_rhinoI mean I know how to solve the problem but I wanted to run it through hive mind to see what everyone thinks.
18:47kencauseyflying_rhino: the hive thinks and speaks slowly. That said I find that these sorts of questions are very hard to answer without a lot more context.
18:48kencauseyContext that is often better formatted in an email or blog entry
18:52kencauseytechnomancy/hugod: Hmm, I uncommented out the nrepl add-hook and other customization stuff and then added the (add-hook 'nrepl-interaction-mode 'paredit-mode) line which either wasn't there before or I overlooked. And now it works.
18:52flying_rhinookay then here's very simple question (concernig performance) : If yiu have the key for something in hashmap, how slower is to access that value, compared when you have java reference to that value?
18:52flying_rhino*you
18:53brehautO(approximately 1)
18:54brehautbut slower than a direct reference
18:59kencauseytechnomancy: I can confirm that without (add-hook 'nrepl-interaction-mode 'paredit-mode) in my init nrepl-interaction-mode isn't enabled.
19:00kencauseytechnomancy: Sound like something I should report to you? It doesn't read in the readme like it is mean to be a requirement.
19:00flying_rhinothe thing is that my favorite way of developing thing is using something called Entity Systems. It is pattern where you separate data from code and put all your data in collections of structs. This roughly resembles how data is stored and connected in a database. You often use references as foreign keys to link data.
19:00flying_rhino*developing things
19:01kencauseyflying_rhino: you aren't perhaps trying to optimize too early?
19:02flying_rhinokencausey: you caught me red handed there. But I do have one question which is not just about optimization.
19:04flying_rhinookay see you guys later
19:07technomancykencausey: that's not going to make a difference
19:07technomancyI'm not the maintainer anyway though
19:12kencauseytechnomancy: I'm not sure what you mean. In any case I'm submitting a report now.
19:14technomancyI mean whether paredit is triggered when you enable nrepl-interaction-mode or not isn't going to change whether nrepl-interaction-mode is enabled at the right time
19:17kencauseytechnomancy: um, it does though
19:17kencauseytechnomancy: Simply commenting out one line and restarting or uncommenting and doing so makes it either work or not work
19:18kencauseyhttps://github.com/kingtim/nrepl.el/issues/168
19:25seancorfieldfwiw kencausey I have (add-hook 'nrepl-mode-hook (lambda () (paredit-mode 1))) in my init.el to turn on paredit for nrepl
19:27kencauseyseancorfield: OK, but just to be clear my problem is when I have nothing regarding linking nrepl and paredit explicitly stated in my init.
19:28kencauseyIt's fine when I use (add-hook 'nrepl-interaction-mode 'paredit-mode) as shown in the readme
19:30kencauseyIt does seem that in 0.1.5 there was nothing about (add-hook 'nrepl-interaction-mode 'paredit-mode) in the readme and probably explains why I did not have that in my init previously.
19:39seancorfieldIf I've had an nREPL session open in Emacs and I kill all the nrepl-related buffers and run nrepl-jack-in again, I often get "Not connected" when trying to load file / evaluate code... Known issue? Workaround?
19:42kencauseyseancorfield: have you tried nrepl-quit?
19:42seancorfieldno... will try that to reset the state...
19:43kencauseyMy guess is that it chokes on an existing buffer, an unlisted one
19:44hiredmanseancorfield: nrepl.el has some kind of issue with evaluating code in a namespace if you haven't loaded it via load file, regardless if it is already loaded in the jvm
19:45seancorfieldkencausey: nrepl-quit didn't help unfortunately
19:45hiredmanloaded in
19:45kencauseyseancorfield: boo
19:45seancorfieldthe buffer with the .clj file is marked nREPL after nrepl-jack-in, the *nrepl* buffer "works" but the .clj file cannot be loaded because of the "Not connected" error
19:46seancorfieldnormally when i run into this, i have to restart Emacs :(
19:48xeqiseancorfield: can you turn off nrepl-mode for that clj file
19:48xeqiand then see if turning it on again helps
19:48seancorfieldah, slime-mode had somehow turned on for that buffer! when i turned that off, it worked just fine
19:49seancorfieldi guess since we just switched from swank to nrepl in production today i can uninstall slime now?
19:50seancorfieldhmm, or will i still need slime for elisp stuff?
19:55wingyive got a problem with form-encode
19:55wingyits creating a query string from a map .. but a map can't have identical keys and i need to create a to=foo&to=bar query string
19:55wingyso this wont work: (form-encode {:to "foo" :to "bar"})
19:56wingyany idea?
19:57kencauseywingy: I know nothing about it, but what happens with {:to ["foo" "bar"]}? Just a thought
19:57wingykencausey: you are the man!
19:57kencauseypure luck (with a touch of experience)
19:58wingy:)
19:58wingyim using this one: (:require [ring.util.codec :refer [form-encode]])
19:58wingya good method for restful apis
20:32FrozenlockUgh... I've done a simple macro to easily convert symbols (and their values) to a map, but turns out I "can't eval locals"... https://www.refheap.com/paste/6883
20:33FrozenlockAny workaround?
20:33derridaIs penumbra still the best option as far as OpenGL bindings go?
20:34Frozenlock... for example this will fail--> (let [aa 12 bb 134] (mapify aa bb))
20:36derridaI'd like to use something idiomatic, I'm just a little apprehensive because of the "not actively developed" disclaimer though.
20:38dnolenderrida: probably still the best open source thing - I know Zach is open to someone taking over.
20:46FrozenlockAh! My 'eval' was apparently unnecessary!
20:52kencauseyFrozenlock: Do you really want a macro? That's evaluated at load/compile time, not runtime.
20:54derridadnolen: I just read the thread about the future of penumbra, somewhat disheartening. I had thought the JVM would simplify distributing opengl projects making it a strong platform for game development. The comments by Zach seem to indicate he did not find this to be the case and that the JVM presents obstacles. I'm not familiar enough with the JVM to understand why this would be the case but it's worrisome to
20:54derridame since one impetus for me to use clojure instead of common lisp was to mitigate distribution headaches.
20:55derridasorry to throw that on you after you were kind enough to answer my initial question :D
20:56dnolenderrida: I don't think it's as bad as Zach lets on, games are made in Java, people figure it out. I just think he was interested in figuring out those problem himself.
20:56dnolenjust don't think he is.
20:57Frozenlockkencausey: Well I don't *really* want a macro, but I don't really see how I could capture the symbol name otherwise...
20:58derridadnolen: any idea what kind of problems he might be referring to?
20:58dnolenderrida: I have no idea - it never seemed like he ever worked on that problem much.
20:58kencauseyFrozenlock: What is the benefit of your admittedly simple example above over [:aa 12 :bb 134]?
20:58dnolenderrida: he relied on something I built called native-deps
20:58kencauseyor ['aa 12 'bb 134]
20:59dnolenderrida: it wasn't a real solution tho - I think you need to have a custom classloader thing in order forit to really be distributable - I believe that's what Java games do.
20:59derridadnolen: what exactly was the "problem" he never worked on though?
20:59derridahm
20:59dnolenderrida: load the right native libs at runtime instead of resolving it through dev tools.
20:59derridaah
20:59derridathat doesn't sound like a terribly hard thing to resolve, just a bit tedious
20:59dnolenderrida: yep
21:00dnolenderrida: I looked into it, but I never got so far to car, I just wanted to see what 3D programming with Lisp was like. fun stuff.
21:00dnolenso far as to try.
21:01derridaIt's wonderful, I've been doing it with CL for a while and it's not fun to go back! :D
21:01Frozenlockkencausey: I often find myself in functions with multiple local vars. Say v1 v2 v3. I want to send these to another function that's waiting for a map-argument, such as {:v1 _ :v2 _ :v3}. Well (mapify v1 v2 v3) ---> {:v1 _ :v2 _ :v3}
21:02FrozenlockIt's really just to avoid doing {:v1 v1 :v2 v2 :v3 v3} by hand
21:02dnolenderrida: I hope somebody tries to build a decent game lib for Clojure, the Java support is there. Quil is is fun but you can't really do anything serious with it.
21:03lynaghk`ping: dnolen. What's the story with test-unifier-3 and dotted pairs in core.logic? Are there special semantics about '(?x . ?y)
21:03dnolenlynaghk: yes . means ?y should match the rest of the sequence on the other side.
21:03lynaghk`dnolen: my walk fix blows those tests, but I'm not sure what exactly those forms mean.
21:03Frozenlockkencausey: Am I crazy? :P
21:04lynaghk`dnolen: ahh. I'll try to work around it, thanks.
21:04dnolenlynaghk`: like a Scheme-y dotted pair - meant to be analogous to the pattern matching support in core.logic
21:06kencauseyFrozenlock: No offense, but I suspect so.
21:07kencauseyFrozenlock: How about a paste of a real usage example?
21:09FrozenlockSure, perhaps you will be able to provide me with a better approach :)
21:09Frozenlockhttps://www.refheap.com/paste/6884
21:10kencauseyI'll look, but don't get your hopes up ;)
21:10FrozenlockOh wait-
21:11FrozenlockDoes ':as arg' capture the initial argument value, or the final value?
21:12Frozenlock[&{:keys [some-ks] :or {...} :as args}]. Will args inherit the 'or' values?
21:13kencauseyI suggest you test it
21:14Frozenlockin the middle of :)
21:15FrozenlockOk, args will NOT get any 'or' values.
21:15Frozenlock&(let [{:keys [a b c] :or {c 0} :as args} {:a 1 :b 2}] args)
21:15lazybot⇒ {:a 1, :b 2}
21:15Frozenlock&(let [{:keys [a b c] :or {c 0} :as args} {:a 1 :b 2}] c)
21:15lazybot⇒ 0
21:15dnolenderrida: Zach also had some enthusiasm for WebGL based lib - that could pretty interesting because of node-webkit
21:18derridadnolen: yeah, that would be very cool
21:19dnolenderrida: and more sensible distribution story to be honest.
21:19derridaif web distribution suits you, yes.
21:20derridaI don't think it's a silver bullet
21:20dnolenderrida: no node-webkit lets you ship your app as an executable - like LightTable
21:20derridaah
21:21derridadnolen: cool, i'll read up on that now.
21:21derridaI imagine there's a significant performance tax
21:22dnolenderrida: yeah for a game that's the major downside.
21:44a|ihow is the performance of clojure.xml comparing to other jvm xml parser?
21:46amalloyi suspect clojure.xml is awful, ajl. clojure.data.xml is probably competitive, since it mostly delegates
21:47a|iamalloy: why is that 2 xml parsers come with clojure?
21:47amalloyclojure.data.xml is a separate library
21:48a|iamalloy: any benchmarks to see how it performces better?
21:48amalloy*shrug*
21:49ivanaleph has a thing that chooses between .xml and .data.xml depending on whether you pass in a map or a vector :(
21:52bbloomdnolen: do we have anything for packaging/publishing clojurescript libraries?
21:52amalloyhaha that's awful, ivan. does it use hiccup-style syntax for one of them, or what?
21:53ivanyes
21:53amalloyfor data.xml, i hope? that code's my only contribution to data.xml
21:53ivanyes
21:53amalloyscore
21:53ivanit was using prxml until I got rid of that
21:54ivanhopefully nobody noticed the breaking API change
21:54amalloyhaha
21:55amalloyyeah, i forgot about prxml (thank god). that was actually the reason i added the stuff to data.xml, because prxml was the only contrib lib 4clojure was still using
21:55tomojcan you write a goal permuteo* like permuteo but for which (run 1 [y] (permuteo* l y)) draws a permutation at random?
21:57tomojI guess if you just are going to run 1 you can just shuffle and pass that in
21:58ivana|i: clojure.xml doesn't escape things, you can probably inject arbitrary XML
21:59a|iivan: I just want to read remote xml, not write. the thing is the xml size could be big, and want to know how good data.xml handles memory.
21:59amalloylogic programming doesn't sound very well-suited to random choices, tomoj, since every function is reversible
22:02dnolentomoj: might be possible with Will's new condp that he showed at the Conj, need to ponder that some more and I think he was going to revise.
22:03dnolento be renamed condw if I implement it.
22:03dnolenbbloom: yes lein works great
22:04bbloomdnolen: yeah, i found :jar true for lein-cljsbuild .. is that what you meant?
22:05dnolenbbloom: I haven't produce a CLJS only jar myself, but putting CLJS into JARs "just works"
22:06dnolenbbloom: core.logic provides both CLJS and CLJ versions in the same JAR, one day one can hope it'll just be the same set of files in the JAR.
22:06bbloomdnolen: ok cool
22:06bbloomdnolen: so i've got a crazy idea i've been working on that you might like
22:07dnolenbbloom: heh, cool
22:07bbloomdnolen: i've implemented a very small postfix interpreter in the spirit of Factor language
22:07bbloomdnolen: my idea is to define a little post-fix DSL for mutating the dom
22:08bbloomso you could do something like ("body" select "div" tag "button" class "i am a button" text append)
22:08bbloomdnolen: and that would create a <div class="button">i am a button</div> and append it to the document body
22:08bbloomdnolen: the main idea is to treat the DOM like a printer and send programs to it a la postscript
22:09dnolenbbloom: haha, sounds fun, gotta run will check it out if you got a link at some point.
22:09bbloomdnolen: hopefully by end of week :-)
22:16tomojthis seems to work a bit https://www.refheap.com/paste/187886d48ea290d3650f8512c
22:17tomojeh, that won't be very useful
22:21amalloytomoj: it's great as long as you don't mind searching all 2^64 longs in order to run your program, i think :). unless i'm misunderstanding
22:25wingywhere will the clojure conj 2012 videos be available?
22:25wingyhttp://clojure-conj.org
22:27amalloywingy: i think they turned up on infoq last time, or something? usually the interesting ones get into my twitter feed somehow or other
22:28wingyamalloy: interesting presentations
22:28ivanwingy: if anything like last time, february-march 2013
22:28wingy:(
22:32amalloythree months seems pretty fast. i thought it went into summer last time
22:33wingyfor apple it takes 2 days!
22:34mabesthe conj videos typically show up on clojure's blip.tv channel
22:34mabeshttp://blip.tv/clojure
22:35wingy(y)
22:35brehautwingy: oen of these is an open source community project conference, the other is one of the largest corps in the world…
22:37amalloyapple's are an advertisement, clojure's are informational/lecutre-style; they provide value rather than asking you for money
22:37amalloylecutre! that sounds like a lovely french word
22:39atom_Speaking of lectures, although non-conj related, upenn has a 554 level course using clojure and the professors powerpoints, assignments and recommended reading are available for free.
22:39wingyatom_: where?
22:39atom_wingy: just a moment, I'll get the link for you.
22:40atom_wingy: http://www.cis.upenn.edu/~matuszek/cis554-2012/ there you go.
22:40wingythx
22:40atom_wingy: are you in the process of learning clojure?
22:40wingyatom_: i have read some books
22:40wingyand now i am using it to build my app
22:41atom_excellent :) I'm learning currently. Using marick's book off of leanpub and finding it very helpful.
22:41xeqithe goggles, they do nothing
22:42atom_xeqi: those aren't goggles, just your hands formed in a circle
22:44wingyi wonder if i can read the books on my iPad on the run
22:44wingythe tricky thing is when you need to eval some code
22:44amalloyeval isn't so hard with websites like tryclojure. it's typing that's tough on an ipad, i imagine
22:46brehautyeah, (, ) and - are not easily accessible
22:47amalloyand paredit
22:48atom_I hear the surface has a nice keyboard, though I can't speak for the rest of the device. >.>
22:48amalloyapple would probably not like me to call it iPaderit
22:48wingyatom_: i was thinking about buying one just because of the keyboard
22:49devnDid you guys know tpope is working on a set of Clojure plugins for vim that rule?
22:49brehautapparently steve was mighty pissed at the safari team for calling JSC's JIT 'Squirrelfish Extreme'
22:49wingyseems very portable .. i hope apple would make a similar one for ipad
22:49aperiodicdevn: i'd heard about an nrepl client
22:49aperiodicdevn: what else?
22:49devnIf you don't know tpope -- he's written an insane amount of vim plugins.
22:50atom_wingy: well if you decide to, let us know :)
22:50brehautdevn: 1 vim plugin? ;)
22:50devnaperiodic: well, I've worked with him a little bit, it was years ago now, but he tweeted something the other day which was along the lines of: "no janky repls"
22:50devnbrehaut: lol, knowing tim it will be 10 of them
22:50devnand they will be done on monday
22:50devnhe's insanely good
22:50devnthe *only* reason I use vim for ruby and rails development is because of tim
22:50atom_I'm getting along well currently with intellij, although I'm also new.
22:51brehautatom_: learning some other editor while learning clojure is not advised. keep on going with whatevers working for you
22:51devnaperiodic: if you PM me stuff you want in a clojure vim environment, I can pass it along
22:52devncommunicating current annoyances and so on would be much appreciated, as tim is pretty new to clj
22:52devnbut like most things he does, he's not going to get into it until he has his editor set up properly :)
22:53atom_brehaut: Thanks for the advice! I'm not a programmer by trade, more by request so I'm trying to use tools that make it easy to learn the language and teach me best practices like source control and proper unit testing. IntelliJ seems to accomplish all of those.
22:53royaldarkhey all, I'm working to develop a Clojure intro course at U of Minnesota Morris, using a beginner-friendly environment. the one issue we haven't figured out is an easy way to reload students' source code without starting a new JVM every time - we currently use remove-ns, load-file and in-ns
22:53brehautatom_: great. don't let anyone tell you otherwise.
22:53royaldarkanyone have a better/more canonical idea?
22:53devnactually aperiodic & friends, ill try and get this to be more of an open discussion, but I should talk to him first, I just heard he was hacking on some vim clojure stuff and I'm really excited to see what he comes up with. his vim skills are beyond.
22:54brehautroyaldark: (require :reload-all 'students.namespace)
22:54devnso if you have suggestions for vim and clojure -- how it ought to work, ping me and ill pass it on
22:54aperiodicparedit.vim should let me strip quotation marks like any other set of paired delimiters
22:54devnplease PM it to me so i dont lose it
22:55devnand keep the requests coming
22:55devni have to run, but ill be back in a bit -- grabbing a cab
22:55devncheers
22:56royaldarkbrehaut: didn't know about :reload-all, thanks
22:57brehautroyaldark: there is also :reload for just the named namespace
22:59atom_brehaut: indeed, thanks for the tip. I screwed up a _function_ (my terminology may be wrong) and couldn't get it back to normal. Just used reload-all and the _namespace_(?) and it reset it. Thanks :)
23:00atom_urg, sorry. I've been markdowning to take notes and it seems to have bled into my irc.
23:01Bergle_1 doesnt everyone automatically interpret markdown anyway ? :)
23:02amalloyi chose to interpret it as "a blank spot in my vocabulary, speculatively filled in with the word namespace"
23:02wingyatom_: you should try Light Table .. its a good editor for clojure
23:03wingyalthough in alpha stage
23:03amalloymore like ultra-super-pre-alpha, i think?
23:03atom_wingy: I have tried it :) I find intellij to be easier to use for me at this time. Once I'm comfortable with clojure I will likely try to find a different tool.
23:04wingyamalloy: now you scared him away!
23:11amalloyi'm more interested in helping atom_ get used to clojure than in helping chris's sales numbers :P
23:11amalloy(and, i suspect, so is chris)
23:15wingyjust that Light Table is helping newcomers tremendously with its instarepl
23:16Bergle_1yeah the instarepl is fun
23:16Bergle_1im a noob ;)
23:16Bergle_1at clojure anyway
23:16wingyyou can connect it to your lein project and run your project code there .. it makes stuff easy to test
23:17Bergle_1i have yet to grok lein, beyond 'lein repl' :)
23:17atom_wingy: The instarepl is very nice. I do have LightTable, and I'm certain as I get more comfortable with clojure I'll be utilizing it more. I currently use intellij with it's built in repl and when I see an example I don't understand I put it in Light Table to see what is happening where. I'll most certainly be a customers of Chris' in the future
23:18atom_royaldark: I'm new to clojure and saw you were creating a course. What text or book are you using as an instruction for your class?
23:30augustlI'm currently doing this: [true, {:_id "123abc" :title "foo"}] and [false {:title "An error", ...}]] to separate success with data and failure with error messages in a "save" call. Anyone got some suggestions for different methods to separate success and failure?
23:30atom_Would anyone mind evaluating my explanation of my solution?
23:35amalloy~anyone
23:35clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
23:35amalloyaugustl: that looks fine to me, though i'd probably make it a map like {:success true :data x} or {:type :success :data x}
23:38augustlamalloy: makes sense, thanks
23:38augustlnamed > nth :)
23:41flying_rhinosmall style question? Why everyone stack closed parenthesis instead of putting them in new line?
23:42brehautflying_rhino: re:"It is pattern where you separate data from code and put all your data in collection" (http://clojure-log.n01se.net/#19:00a) that is all functional programming
23:42amalloybecause you don't)
23:42amalloywant)
23:42amalloyyour whole)
23:42amalloyfile)
23:42amalloywasted on )s)
23:42brehautflying_rhino: everyone does that
23:42brehaut(inc amalloy)
23:42lazybot⇒ 35
23:42brehautlols
23:42flying_rhinobrehaut: but why? C and java are more readable largely because they don't
23:43amalloythey're more readable largley because you've spent more time reading them in the past, mate
23:43brehautclojure isnt C or Java. its not remotely from the same family
23:44augustlflying_rhino: editors make it readable, such as currently matching paren highlighting and rainbow-mode in emacs
23:45atom_It seems like in OOP languages, you jump around the program a lot. The )'s help separate the different chunks. Functional seems to be more like reading a mathematical proof where you're not hopping around everywhere, just evaluating as you go through it.
23:45amalloythat's a neat perspective, atom_
23:45flying_rhinobrehaut: not quite, both have tree like code. Or XML. Lisp can be thought as programmable XML and even there is formatting nicer.
23:45brehautim pretty sure naggum has something to say to you
23:46royaldarkatom_: Sorry, was afk. I'm working with Elena Machkasova, a professor at my school. She plans to write an introductory textbook on clojure
23:46augustlflying_rhino: seems to me that the answer to your question is that some people prefer stack closed parenthesis and you don't :)
23:46augustlprefer = finds more readable
23:46atom_royaldark: No worries, thanks for responding. I'll keep an eye out for it in the future then. :)
23:46augustlflying_rhino: and it's the other way around! XML is pointy lisp ;)
23:47technomancyspacing your parentheses out is bad because it makes it easier for you to keep track of them in your head
23:47brehauthttp://harmful.cat-v.org/software/xml/s-exp_vs_XML
23:47alandipertflying_rhino: why not just write your code in a way that you find readable? take this on when you deal with your first pull request :-)
23:47brehauti dont necessarily agree with all that, but its funny as hell
23:47brehauttechnomancy: how is your australian beer?
23:48technomancybrehaut: heh. don't tell anyone k?
23:48brehauttechnomancy: i am thinking of drinking a summer ale in solidarity
23:48brehautalthough it is actually summer here
23:48amalloyflying_rhino: if you're going to compare lisp to xml you should probably have read http://www.defmacro.org/ramblings/lisp.html first
23:48augustlbtw, people who attended the conj should go to http://techmeshconf.com/, to get a reprise of the keynote
23:49flying_rhinoamalloy: I read this
23:49brehautamalloy: thats much more polite than naggum :)
23:49flying_rhinoamalloy: that article is one of the reasons I am in this shit
23:50flying_rhinoi mean what is more readable
23:50amalloyme too
23:50flying_rhino(defn fast-run []
23:50flying_rhino (let [x (future (long-calculation 11 13))
23:50flying_rhino y (future (long-calculation 13 17))
23:50flying_rhino z (future (long-calculation 17 19))]
23:50flying_rhino (* @x @y @z)))
23:50amalloybrehaut: i look forward to reading what naggum has to say, though
23:51flying_rhinoor
23:51amalloyflying_rhino: the first version
23:51amalloyi don't even have to see the second
23:51flying_rhino(defn fast-run []
23:51flying_rhino (let [x (future (long-calculation 11 13))
23:51flying_rhino y (future (long-calculation 13 17))
23:51flying_rhino z (future (long-calculation 17 19))]
23:51flying_rhino (* @x @y @z)
23:51flying_rhino))
23:51royaldarkatom_: our of curiosity, since you said you're new to clojure, what drew you into it?
23:51augustlflying_rhino: I'd say the first version, and as mentioned my editor makes it look even nicer
23:52flying_rhinoaugustl: what's your editor?
23:52augustlflying_rhino: emacs
23:52Bergle_1heh that was going to be my question to.
23:53augustlmore specifically, if I absolutely need to know where the last parens belong (which I rarely/never do), emacs highlights any matching paren automatically for me
23:53augustlthen there's things like paren-mode which basically stops you from manually handling indents and whitespace and lets you edit code structurally
23:53augustlI don't use it though, because it takes a while to get productive in it
23:54brehautflying_rhino: re:lisp and c are both tree shaped. thats only useful in really abstract forms. C is statement oriented (the return keyword is a good indicator) while Lisp is expression oriented. it has a huge difference on how the two languages are written and read
23:54augustlflying_rhino: example: http://imgur.com/5q1s4
23:54augustlhighlights based on cursor position
23:55atom_royaldark: I started learning Java, didn't quite take with me. I stumbled upon 4clojure, started checking it out and something about functional programming clicked with me where OOP and all it's constructs did not.
23:57apwalkflying_rhino: stacked parens are a convention, and by following a convention, your mind can reduce what it needs to figure out when scanning a piece of foreign code. the reason for stacked parens is probably along the lines of what atom_ said, but it could also be justified from a cog sic perspective because when scanning vertically, you see the important parts, symbols, instead of the bits for the compiler, parens.
23:57flying_rhinobrehaut: yeah but even stuff like json and xml are formatted that way. Lisp is only one that just stacks parens at the end. I find that weird. You don't have to put every closing paren in new line, but I like to put stack of parens that aren't opened in last line in new line. Like in my example defn and let are in new line
23:58flying_rhinomakes (* @x @y @z) stand out more
23:59atom_flying_rhino: One difference I notice between the two examples as it pertains to the last line is that your last line seems obligatory, superfluous. It also, to me, looks sloppy.