#clojure log - Nov 20 2012

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:10 alexyk: what's the mainstream way to do RESTful APIs nowadays?

0:11 wingy: i 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

0:11 how do i do this? with the datalog in datomic or clojure.logic?

0:12 alexyk: i wonder that too

0:12 apigee? :)

0:15 Sgeo: Is there a find-in similar to get-in?

0:15 (doc find-in)

0:15 clojurebot: Excuse me?

0:15 Sgeo: Or should I just use get-in with a sentinal value?

0:21 amalloy: i think you want get-in, Sgeo, though of course you can fake it like (-> m (get-in [a b c]) (find d))

0:26 sw2wolf: Are there window-manager developed using clojure ?

0:29 amalloy: sw2wolf: technomancy has written some gnome extensions in cljs, but that's all i know of

0:35 sw2wolf: I am clojure newbie and i am using stumpwm every day. thx

0:37 ivan: someone barely started one at https://github.com/abrooks/prion

0:47 ambrosebs: RE: 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.

0:57 bjorkintosh: why does (*) return 1, and (+) return 0?

0:57 what are they using as arguments?

0:57 ivan: no arguments, it's a useful identity for folds

0:58 sw2wolf: it is relative to mathematic

0:58 ivan: that is, reduce

1:01 &(reduce * [10])

1:01 lazybot: ⇒ 10

1:24 muhoo: lein is complaining:

1:24 [com.cemerick/pomegranate "0.0.13"] -> [org.apache.maven.wagon/wagon-http "2.2"] -> [org.apache.httpcomponents/httpclient "4.1.2"]

1:25 where is pomegranate 0.0.13 coming from?

1:26 ambrosebs: tried lein deps :tree ?

1:26 muhoo: good call, i'd forgotten about that.

1:27 the 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

1:28 haha, lein deps :tree fails, because of that conflict

1:28 Apage43: muhoo: exclude httpclient from whatever is bringing in pomegranate

1:29 I had to do a similar thing; https://github.com/apage43/cbdrawer/blob/master/project.clj

1:29 muhoo: that's what it says to do, but still... i'd rather have everything agree than have to have exclusions all over the place

1:30 Apage43: well 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..

1:31 muhoo: :-/

1:31 it 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

1:31 and if i exclude httpcore like lein is telling me, then pomegranate won't work.

1:31 Apage43: muhoo: you could add a newer httpcore to your repl profile

1:32 along with the exclusion

1:32 muhoo: oh, hmm, good point, will try that thanks

1:32 gauravag_: has anyone tried testing clojure code at functional level?

1:32 or is there a good/recommended way to do it?

1:36 muhoo: gah, clj-http 0.5.8 is a nightmare

1:36 Apage43: mm?

1:36 muhoo: it's also causing compojure to not resolve, because it requires commons-io 2.4,

1:37 sw2wolf: the dependency hell is difficult to resolve

1:37 muhoo: there 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

1:38 ro_st: we're using 0.5.5

1:38 * Apage43 used 0.5.6 w/ compojure successfully rather recently

1:38 ro_st: with ring

1:38 s/ring/noir

1:38 muhoo: thanks! i can also do a lein deps :tree on pomegranate and compojure itself to see what clj-http they want

1:39 hmm, is there any way to get lein to pick up a project.clj from inside a checkouts instead of from the SNAPSHOT jar?

1:41 because 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.

1:42 ro_st: i don't think checkouts factors in project.clj files

1:42 i think it simply treats the source in there as though it's part of the containing project

1:42 because i know your containing project.clj has to include all the deps of the contained ones

1:44 Apage43: .. that sounds wrong

1:44 amalloy: ro_st: i don't think that last is true

1:44 Apage43: https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies

1:44 ro_st: not? i ran into issues when i didn't add them

1:45 amalloy: i'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

1:45 ro_st: ah that's probably why i had issues; i didn't have a jar in place when i did my testing

1:45 muhoo: right, that'd explain why i'm stuck in this particular hell

1:46 ro_st: i had already put everything into containing project.clj by the time i did a lein install in the contained

1:46 good to know. thanks for correcting me

1:46 muhoo: well i can manually copy pom files to ~/.m2 and generate sha1's to hack my way around this, but it sucks

1:46 and fyi 0.5.6 also fails, will try 0.5.5 next. nothing like brute force and stupidity to solve a problem.

1:47 ro_st: and a good dose of humour

1:53 muhoo: 0.5.5 fails, still wants 4.2.1

1:53 pomegranate insists on an ancient version of clj-http i suspect

1:53 and compojure wants an ancient version of commons-io

1:54 will spend some time digging around here: https://clojars.org/clj-http/versions

1:55 and 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

1:56 cemerick: muhoo: hardly any library "insists" on particular versions of dependencies

1:56 muhoo: true, but there are problems with using :exclusions, as i've mentioned earlier

1:57 cemerick: muhoo: in conjunction with default profiles, etc?

1:57 muhoo: yes

1:58 cemerick: well, 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.

1:58 muhoo: aha! https://clojars.org/clj-http/versions/0.3.6 looks like the winnah

1:59 Apage43: oh man

1:59 muhoo: commons-io 2.1, and httpclient 4.1.2. sold.

2:01 cemerick: true, it'd be a manual process, assisted with some tool perhaps. i can't think of any way to make it truly automatic.

2:01 cemerick: muhoo: have you seen lein-pedantic?

2:02 muhoo: i think i'm running that already, yes. it gave me the list of :exclusions. very helpful.

2:02 cemerick: ok; that's the state of the art at the moment.

2:03 perhaps something interrogatory would be useful, so you can choose a set of alternative project.clj transformations, etc.

2:03 muhoo: maybe 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"

2:03 it could get that data from clojars, which is how i found it.

2:04 or maybe clojure atlas could be extended to show the web of library dependencies :-)

2:06 cemerick: well, all of the data is available via pomegranate for anyone industrious enough to put together a proper visualization :-)

2:07 amalloy: how would you figure out, just from information on clojars, what versions don't cause problems?

2:09 muhoo: the 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,

2:10 since it also told me that clj-http was the culprit bringing in newer versions of both those things,

2:10 i looked through the older versions of clj-http on clojars, until i found one that satisfied both.

2:11 (if that makes any sense at all)

2:12 cemerick: amalloy: 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

2:12 amalloy: not really a general solution, though - it's perfectly possible for there to be no set of version that satisfies all the constraints

2:12 muhoo: yes, that's what makes me wonder if it might be an interesting problem.

2:13 amalloy: hah. 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

2:14 muhoo: p/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.

2:21 lpvb: why doesn't counterclockwise have basic REPL input history?

2:22 ivan: maybe you have to hold down ctrl or alt or something? (haven't tried it)

2:22 sw2wolf: sorry, What's counterclockwise ?

2:22 ivan: indeed or you've launched the wrong REPL?

2:22 er, indeed http://stackoverflow.com/questions/5924228/last-input-in-counterclockwise-repl

2:23 lpvb: eclipse plugin

2:23 oh okay

2:23 sw2wolf: oh, i dont use eclipse

2:29 ro_st: cemerick: cljx stuff looks interesting

2:30 cemerick: yup; quite useful, and a good stopgap until feature expressions come around

4:13 maleghast: Morning All :-)

4:13 * maleghast tips hat to the room

4:55 ambrosebs: Is there a library like Trammel or core.contracts for CLJS?

4:59 Hmm seems like such a library wouldn't be as useful for CLJS.

4:59 I've just got a ton of Trammeled code I was thinking of porting.

5:14 deu5: Hi 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)

5:18 thorwil: deu5: i think you will have to tell a little more about your setup and what exactly goes wrong

5:26 deu5: Ok 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.

5:26 otfrom: Next London Clojure dojo is up: http://london-clojure-dojo-tw-2012-11.eventbrite.co.uk/

5:28 deu5: thorwil I can recompile my project with this dir

5:28 thorwil: deu5: do you know how to serve files in general? if not, the 2nd section of http://yogthos.net/blog/25 might help

5:30 deu5: no waut, forget about that, as they put files into a database

5:30 rodnaph: otfrom: those dojo's look ace, if i lived in london i'd be there.

5:31 deu5: thorwil I need to know how to make links to file which are not in the project directories.

5:31 maleghast: rodnaph: They are ace, but if you can't come to London why not start one where you are..?

5:32 rodnaph: maleghast: actually yes, me and a few others are thinking of trying a hack night that would run along the dojo idea.

5:32 thorwil: deu5: locally you can do that with symlinks, i suppose. but hat happens if you deploy, then?

5:34 maleghast: rodnaph: 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!

5:34 Anderkent: How do I read a file into a byte array? to-byte-array from contrib.io doesn't seem to be anywhere

5:34 clgv: Anderkent: via filestream e.g.

5:35 rodnaph: maleghast: i've already got that crackpot reputation! ;)

5:36 deu5: so there is no other easy option?

5:42 otfrom: rodnaph: 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/

5:43 rodnaph: otfrom: yes i've already read it thanks - that's pretty much what we were going to follow :)

5:43 otfrom: oh, 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/

5:44 rodnaph: cool, I hope it is useful

5:44 rodnaph: what will your silly question be?

5:45 I feel that is the most important bit (well, that and the hacking)

5:45 rodnaph: otfrom: 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.

5:46 otfrom: cool

5:47 rodnaph: otfrom: 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?

5:48 Anderkent: clgv: I can't see any filestream classes/functions with byte array output, can you point me at one?

5:48 otfrom: last night it was what preposition would you want added to your name

5:49 answers were: that, not only, around, under, with, in

5:49 my fave was: if you couldn't be called Bruce, what would you like to be called

5:49 only one person said that their own name was fine

5:49 and I was the only Bruce in the room

5:49 rodnaph: haha

6:03 deu5: Ok. 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 ?

6:09 Anderkent: deu5: you probably don't want to do that, how do you check whether the file should be publicly visible?

6:10 deu5: I 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?

6:10 My web app search a file name in my database then create a link to this file. But all files are in other directories.

6:11 Anderkent now you see ? I couldn't find any other way to do this.

6:22 Anderkent: deu5: you should symlink all the files you want to expose in one directory, then symlink that directory under public

6:25 qerub: Who coined "DATA all the things"? :)

6:31 Foxboron: qerub: http://weknowmemes.com/wp-content/gallery/x-all-the-things/x-all-the-things-template.jpg

6:32 qerub: Foxboron: I meant DATA as in DATA: https://twitter.com/mike_ivanov/status/269079215197024256 :)

6:33 I've heard lynaghk use it too. He said he heard it from any of his friends.

6:33 Oh, well, not so important. Sorry for the noise.

6:38 Foxboron: qerub, the reff from ClojureCon says it emerged last year and was "hammered home here.", where i believe "here" is the blog

6:38 http://corfield.org/blog/post.cfm/clojure-conj-2012

6:46 deu5: Compiled noir project to jar is faster ?

6:48 ambrosebs: any other Conj 2012 posts?

6:49 maleghast: I so wish I'd been able to go to Clojure Conj this year… :-(

6:53 qerub: Foxboron: Thank you for digging that up! <3

6:55 Foxboron: qerub, digging? First hit on google m8 :P

6:56 qerub: The Google-fu is strong with this one.

7:13 Foxboron: i was just thinking:

7:13 Since you got noir for Clojure, and ClojureScript for Javascript

7:13 doesnt that mean you could basically build an entire website just by using clojure..?

7:14 <- newb making sudden discoveries.

7:15 trinakria: That is what I am actually trying to build: A dummy web site using only a clojure stack (datomic as db)

7:16 Foxboron: Interesting.

7:18 trinakria: you'd really have to master only one technology

7:29 bordatoue: i 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

7:29 Foxboron: trinakria, i feel that is a rather downside of it all, but its more fun :P

7:30 thorwil: bordatoue: nrepl or slime?

7:30 bordatoue: thorwil: slime

7:31 in 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

7:32 thorwil: bordatoue: 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

7:32 bordatoue: i do evaluate region, that i need to specify the name space in repl each time

7:33 i am using C-c C-r for region evaluation and C-c C-l for loading

7:33 thorwil: bordatoue: http://stackoverflow.com/questions/2596222/how-to-reload-files-upon-save-when-using-swankleiningenemacs perhaps?

7:35 bordatoue: so i need to compile the file rather than reloading them

7:37 mpenet: there 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

7:37 you need to C-c C-k the file first, if you do that

7:37 bordatoue: mpenet: thorwil thanks, interesting idea

7:38 thorwil: this is also very interesting: http://stackoverflow.com/questions/11306704/reloading-a-ns-in-repl

7:38 trinakria: Foxborn: why do you see it as a downside?

7:39 bordatoue: what is the actual common lisp way of doing this

7:39 Foxboron: trinakria, staying with only one language todo everything is not very good in my eyes.

7:39 If Ruby is better suited for the task, you still stick with clojure, and clojure only. because it can do everything

7:40 You stop learning and just stick with repetitons.

7:41 trinakria: I am not a clojure expert but it seems to me a general purpose programming language

7:41 Foxboron: me either, i started 3 days ago :P

7:42 But well, diversity is gold in my eyes :)

7:42 algernon: diversity is good if a certain tool is better for a task than the other.

7:42 ambrosebs: I'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.

7:42 trinakria: polyglot programming I'd say

7:42 :-)

7:42 thorwil: general purpose except everything where startup time is critical, or where you need low leel hardware access, or where (soft) realtime performance is an issue

7:43 Foxboron: indeed ^^

7:43 Imagen if Clojure could do it all.

7:43 clgv: ambrosebs: better ask in #leiningen

7:43 ambrosebs: clgv: ah!

7:43 trinakria: startup time is an issue of the JVM

7:43 algernon: (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)

7:44 Foxboron: algernon, ah. Great argument :D

7:44 trinakria, i know. Like 1,3 sec for a Hello World

7:44 trinakria: indeed :-)

7:44 Foxboron: you got a project saving the JDK stuff in memory

7:44 reducing the startup from 1,3 sec to 0,3 sec

7:44 (along those lines)

8:04 gauravag: hello

8:14 bruceadams: gauravag: good morning!

8:55 fojure: lein profiles FTW!

8:55 Thanks technomancy

9:15 ivenkys: afternoon folks - i am missing something obvious here - how does this work ? http://sprunge.us/aWFg

9:16 ucb: ivenkys: try following the recursion with pen and paper :)

9:17 ivenkys: ucb: actually i did - i still dont get it - there is no checking if n is divisible by 2 - so how is it working ?

9:17 * nDuff notes that it *doesn't* work for negative numbers.

9:18 bordatoue: hello, how do i update nth char in a string, for example in python it would be like s[nth]=char

9:18 ucb: +1 nDuff

9:18 ivenkys: nDuff: yup i noted that as well -

9:18 bordatoue: (nth [] index)

9:19 bordatoue: ignore me - i read your question incorrectly -

9:20 ucb: ivenkys: 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

9:20 false

9:20 bordatoue: ivenkys: thats alrite, your returns the char

9:20 nDuff: bordatoue: convert to an array of chars first

9:20 bordatoue: replacing individual characters in immutable strings is inefficient, in Python as well as Java.

9:20 bordatoue: nDuff: then i can do a seq on string to get it

9:20 nDuff: bordatoue: ...pardon?

9:21 ivenkys: ucb: penny drops - yes of course

9:21 nDuff: bordatoue: see getChars() in http://docs.oracle.com/javase/6/docs/api/java/lang/String.html

9:21 ucb: ivenkys: :)

9:21 ivenkys: ucb: thank you sir - i have it here all drawn out and still did not get it -

9:21 nDuff: bordatoue: ...there's also getBytes(), but that gets ugly when dealing with multi-byte characters.

9:21 ucb: ivenkys: it's ok; it's nearly identical to church-numerals, so that's why I figured it out

9:22 bordatoue: nDuff: 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

9:22 ucb: ivenkys: that's something you may want to check out

9:22 * ivenkys goes out to check church-numerals

9:22 nDuff: bordatoue: sequences aren't updatable

9:22 bordatoue: so you'd want it in a vector if you want fast random-access writes.

9:23 bordatoue: nDuff: as you mentioned if i used getCharArray then how do i update an idx location

9:23 nDuff: bordatoue: ...or you can keep it in a Java array

9:23 bordatoue: ...which is the format the String methods will return it to you in anyhow...

9:23 bordatoue: ...and use interop calls to modify.

9:23 ucb: ivenkys: see this for some fun application of church numerals https://www.refheap.com/paste/5073

9:23 nDuff: bordatoue: aset, aget, &c.

9:23 ucb: ivenkys: shameless plug: I adapted that to clojure from a Ruby post :)

9:24 bordatoue: nDuff: okay, thanks aset aget is similar to operations on array

9:24 nDuff: bordatoue: not just similar, that's exactly what they are.

9:24 ,(doc aset)

9:24 clojurebot: "([array idx val] [array idx idx2 & idxv]); Sets the value at the index/indices. Works on Java arrays of reference types. Returns val."

9:24 bordatoue: thanks very much

9:25 antoineB: hello, 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

9:25 i don't understand at all

9:25 ivenkys: ucb: ta - looks like its time to refresh calculus as well -

9:26 ucb: ivenkys: it depends on how pragmatic you're feeling really

9:34 ivenkys: ucb: true that -

9:34 ucb: i guess at some point to really understand functional programming i will have to learn lambda-calculus

9:35 ucb: ivenkys: 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 :)

9:35 ivenkys: or if i get very ambitious and decide to learn haskell

9:36 ucb: ivenkys: 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

9:37 ivenkys: ucb: tkx - appreciate the help -

9:37 antoineB: ivenkys: don't lean fp as a dogma, but as a way of doing better/quicker programs

9:37 ucb: +1 antoineB

9:37 antoineB: if you know clojure, i don't think you will have problems with haskell, i am right?

9:37 ucb: and no worries; just build stuff and have fun ivenkys

9:38 well, there's that type-system thing ...

9:38 brainproxy: antoineB: the focus on types and monads could lead to some head-scratching at first

9:38 antoineB: not a big deal, clojure also have type and give me some exception some type

9:39 brainproxy: antoineB: 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

9:40 now, what I would like to see, is the ability to fluidly mix Frege and Clojure in the same project

9:40 antoineB: i will bet that scala is harder to learn (i mean the whole stuff) than haskell

9:41 brainproxy: so maybe a Frege-Clojure runtime bridge at some point, and leiningen integration

9:41 ivenkys: one 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"

9:42 nDuff: ivan: your mate may find Typed Clojure interesting

9:43 miloshadzic: from my Haskell days, I remember there being a horribly steep learning curve unless you were already studying programming lanugages

9:43 ivenkys: nDuff: he does Typed Racket - and Haskell - one of the only guys i know who actually gets paid for working with those languages

9:44 nDuff: ivan: *nod*. Typed Clojure borrows a fair bit from Typed Racket, so I doubt it'd be unfamiliar.

9:44 * nDuff has a local friend who's paid for Haskell work as well.

9:44 ivenkys: nDuff: you probly mean ivenkys :-) - ( i am hoping there is no ivan getting pinged )

9:44 nDuff: ...ahh, yes.

9:45 randomenduser: hello, 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)

9:45 and then (remove ... would return the above?

9:45 brainproxy: randomenduser: did you check the errata page?

9:45 randomenduser: removing the ones that satisfy the condition

9:45 nDuff: randomenduser: ...so, it runs (<= 25 21), (<= 25 20) and (<= 25 34)

9:45 randomenduser: brainproxy: no, I'll bring it up now

9:46 nDuff: ohh, that makes sense. still getting used to prefix I guess :S

9:47 deu5: Do you know any lib for creating and reading office xls with clojure?

9:47 brainproxy: randomenduser: I found it pretty helpful to keep the "unconfirmed errata" page close at hand when working through the book

9:47 ivenkys: ~ pastebin

9:47 clojurebot: I don't understand.

9:48 randomenduser: brainproxy: thanks, found it :)

9:48 brainproxy: randomenduser: cool :)

9:48 ivenkys: is there a default pastebin ?

9:48 nDuff: ivenkys: refheap and gist.github.com are both welcome here

9:48 babilen: ivenkys: http://refheap.com is one that is frequently used in here

9:49 ivenkys: nDuff: babilen : ta

9:49 nDuff: ...well, Raynes might harass you a bit for gist, being as it is not-refheap. :)

9:52 babilen: ivenkys: There are plenty of others, but I've been criticised in the past for using a "wrong" one ...

9:54 ivenkys: yeah i have seen that happen on other channels as well - - usually there happens to be a default one

9:54 nDuff: there aren't _that_ many ones wrong enough to draw criticism... mostly just pastebin.com

9:57 S11001001: "has ads" is a good proxy for "wrong"

9:57 rather "has ads or lacks clojure syntax highlighting"

9:59 some chans put one in the /topic; that seems to be a good indicator of strictness too

10:00 clgv: I 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:01 ah right. it is clojure 1.3 right now

10:06 bryanl: I'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:06 clgv: that defeats the whole point of having a primitive function :(

10:06 pyr: when using the history to figure out where we are in a cljscript app

10:06 for instance with snout, is there a concept of "default" route

10:08 hmm, i suppose i could fire up an event myself

10:11 xclite: Is clojure/tools.cli the common route to go for a command-line arg parser?

10:14 clgv: xclite: it's working.

10:14 babilen: xclite: It's the best there is AFAIK even though it lacks a lot of functionality

10:16 xclite: clgv, babilen thanks - just wanted to make sure i wasn't using something that everybody knew had been replaced long ago

10:34 fojure: Anyone notice NREPL eating return values?

10:35 That 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:37 brainproxy: clojure-tco looks interesting

10:43 clgv: brainproxy: oh indeed

10:43 tgoossens: is 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:44 clgv: tgoossens: by "identity" you mean "mutable state"?

10:44 tgoossens: yes

10:45 no

10:45 "mutable references" i try to avoid "mutable state" (detail)

10:45 randomenduser: if 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:47 clgv: randomenduser: repeated update-in might work. depends on how a larger dataset looks like

10:47 randomenduser: clgv: it's just a small piece in the repl

10:47 tgoossens: clgv: do you think i'm trying to push it too much ?

10:48 randomenduser: I'm just trying to figure out how to do it to get more practice w/these types

10:48 clgv: tgoossens: no. I think there are others who did something similar. you can search the ML for it

10:49 tgoossens: ML ?

10:49 clgv: mailing list

10:49 tgoossens: ok

10:51 uvtc: What 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:51 randomenduser: clgv: 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:52 babilen: randomenduser: Hmm, I've written something like that recently ... let me check

10:52 clgv: uvtc: to define a local binding which that defn statement can close over

10:53 randomenduser: babilen: thanks. it seems like it should be easy but I'm fairly new to this

10:53 mpenet: (def (let [...] (fn [] ...))) looks better imho

10:53 uvtc: clgv: But couldn't you always put the `let` inside the `defn` instead?

10:54 (defn foo "docs" [x] (let [first-thing ...] ...))

10:54 Bronsa: that's not the same thing

10:54 clgv: uvtc: but then its executed on every function invocation. if it's just a value than it does not matter

10:54 *then

10:55 uvtc: Oh, 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:56 babilen: randomenduser: Do you have an example of the behaviour you want, so that I could test?

10:56 uvtc: Bronsa: were you addressing me or mpenet above?

10:56 Bronsa: uvtc: you :)

10:56 uvtc: Bronsa: thanks.

10:57 Bronsa: uvtc: eg (let [counter (atom 1)] (defn unuque-int [] (swap! counter inc)))

10:57 it's called a closure

10:58 uvtc: Bronsa: right. Thanks. I'm familiar with closures. But my understanding was that defns should always only go at the top-level.

10:58 randomenduser: babilen: https://gist.github.com/4118756

10:58 uvtc: Even 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:58 clgv: thanks.

10:59 antoineB: uvtc: defn use def, and def always go to the top level

11:00 uvtc: antoineB: gotcha. Thanks.

11:01 babilen: randomenduser: 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:01 randomenduser: ooo dang, this refheap thing is shiny

11:01 has persona too

11:03 clgv: uvtc: `def` forms are always toplevel even if you nest them

11:03 uvtc: clgv: check

11:05 babilen: randomenduser: You might want to use sets as values though (if appropriate)

11:05 randomenduser: Is that more or less what you are looking for?

11:06 randomenduser: babilen: yeah, I have to sift through the docs a bit to understand it. but it seems pretty minimal, so thank you

11:08 babilen: randomenduser: Let me know if you have a question -- I'll get a coffee in the meanwhile. :)

11:16 lnostdal: does 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:23 babilen: randomenduser: Hmm, you can probably implement that in terms of reduce-by too

11:25 randomenduser: babilen: is that not in clojure.core?

11:25 actually I g2g... I'll bb in ~1:30 though

11:26 babilen: randomenduser: (reduce-by :artist #(conj %1 (dissoc %2 :artist)) [] playlist) -- reduce-by is introduced in the Clojure Programming book

11:36 jsabeaudry: What is the most idiomatic way to compare two floats up to the third decimal? (apply = (map #(Math/round (* 1000 %)) [float1 float2]))

11:39 babilen: jsabeaudry: https://www.refheap.com/paste/6877 + http://www.gettingclojure.com/cookbook:numbers

11:39 jsabeaudry: That doesn't really compare them up to the third decimal though ...

11:42 bordatoue: what 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:42 babilen: bordatoue: Introduce it in the loop with a dummy value?

11:43 bordatoue: babilen: is that recommended way is there any thing like [ _ _]

11:44 babilen: bordatoue: nil comes to mind

11:44 bordatoue: babilen: thats an idea , can i use nil in the loop binding it make it even with the recur binding

11:46 babilen: bordatoue: What do you mean by "make it even" ?

11:47 bordatoue: babilen: to have the same amount of binding for both loop and recur

11:47 babilen: bordatoue: Yeah, that was the general idea

11:47 bordatoue: babilen: cool then

11:48 babilen: bordatoue: Something along the lines of (loop [b1 foo b2 bar b3 quux b4 nil] .... (recur foo' bar' quux' something-new))

11:49 bordatoue: if 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:49 babilen: thatnk

11:50 horrible spelling , ==> thanks

11:50 jsabeaudry: babilen, excellent resources, many thanks!

11:50 babilen: bordatoue: Can't be more specific without knowing the problem domain though. And yes, they will be evaluated in that order IIRC

11:51 jsabeaudry: 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:52 jsabeaudry: babilen, Yes It's better, mainly because it is much more readable :)

11:52 babilen: heh :)

11:53 jsabeaudry: Too bad everyone has to define these functions though

11:53 babilen: indeed

11:58 yedi: why is liberal use of 'let' considered a bad thing?

12:00 TimMc: yedi: Perhaps a better question is "when", not "why". :-)

12:03 S11001001: yedi: let causes mental indirections

12:04 TimMc: S11001001: You're referring to repeated rebinding?

12:05 S11001001: TimMc: in the expression (let [x blah] (f x)) you have to mentally chase the x

12:05 thorwil: let is good for avoiding having one thing computed several times

12:06 uvtc: I tend to think of functions as, `let` sets everything up, then the body of the function does something with it.

12:06 S11001001: TimMc: and if x is a bad name (which it frequently is) its name can get in the way of understanding what it *is*

12:06 uvtc: Heh. Sorry for stating the obvious, I guess. :)

12:07 babilen: yedi: 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:07 uvtc: sometimes you have to do just that ;)

12:08 yedi: https://groups.google.com/forum/?fromgroups=#!msg/clojure/B2Wo5Oe1OrI/V9WGOJXkJQUJ

12:12 tgoossens: In a board game. i defined a robot. It has a type and health. The position of a robot is stored in the board.

12:12 Because i want to define a robot (in general piece) indepentently of position in a world

12:12 the problem i have is

12:12 where do i put facing direction?

12:13 in order to be consistent with my premise

12:14 also i'm using not using references here. A robot is just a value

12:14 i'm not sure whether i'm going to run into problems when i want to move a robot.

12:14 because of the question "what robot? do you want to move"

12:15 what is there is a robot on the board with exactly the same values

12:15 or it might not matter because. you could say

12:16 "move that piece on position [x y] on this board forward"

12:16 not sure :)

12:16 any advice?

12:16 seangrove: Anyone else using Domina & recent cljsbuild in a project? Domina.css causes a java.lang.NullPointerException, having trouble tracking it down

12:18 thorwil: tgoossens: isn't facing-direction independent of the board (eg "north")?

12:18 seangrove: In fact, in general, how does one track down a bug like this?

12:18 tgoossens: thorwil: i was thinking that as well yes

12:19 thorwil: but not entirely sure. But it is probably the best solution i can think of

12:20 thorwil: do you think it is a good or a bad idea that i'm avoiding using state here ?

12:20 clgv: tgoossens: 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:22 tgoossens: clgv: maybe the idea is not such a bad idea... . I'm wondering whether the id is better than using identity. I guess so

12:22 thorwil: tgoossens: you can't avoid state. you can only manage it

12:23 clgv: tgoossens: oh the id was not what I wanted to show, I just added it to make clear that's the robot

12:24 tgoossens: thorwil: i think it might be possible to completely avoid state here. But i'm not sure whether that would be a good thing

12:24 technomancy: any lein-cljsbuild users want to let me know if trampoline is still necessary on lein master?

12:26 thorwil: tgoossens: 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:28 TimMc: You could have each robot be an agent.

12:29 (if they didn't need to advance in lockstep)

12:30 clgv: TimMc: I think he wants to write it pure functional

12:31 TimMc: In that case, keep a vector of robots separate from the board. Both can live in a gamestate map (or record).

12:31 The robot's ID is its index in the vector.

12:33 hiredman: I 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:33 tgoossens: clgv: 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:33 TimMc: OO is not the opposite of functional.

12:33 tgoossens: i didn't say that

12:34 ChongLi: can anything be the opposite of functional?

12:34 seems like a weird idea

12:34 tgoossens: i merely suggested they have different idiomatic concepts

12:34 TimMc: (Well, depending on how one defines "functional".)

12:34 tgoossens: concretely

12:34 ChongLi: ahhh

12:34 tgoossens: i've done the game with mutables now.

12:34 and

12:35 TimMc: I guess what I meant was: OO does not necessarily imply mutable.

12:35 ChongLi: idiomatic is starting to become a pet peeve of mine

12:35 tgoossens: now i want to try to see how much immutable stuff i can put into it

12:35 ChongLi: it's turning into the new "literally"

12:35 tgoossens: Timmc: i agree on that one

12:35 ChongLi: at least in programming circles

12:35 what do we really mean when we say idiomatic?

12:35 TimMc: ChongLi: YOU ARE NOT IDIOMATIC. *BAN*

12:36 tgoossens: maybe better would be to say

12:36 i tried to make the game idiomatically in java

12:36 (not in general OO)

12:36 ChongLi: I know what idiomatic means in natural language (such as english)

12:36 and it has nothing to do with the programming term idiomatic

12:36 TimMc: My new hobby: Every time someone says "non-idiomatic", I mentally replace it with "un-American". (cf https://en.wikipedia.org/wiki/McCarthyism)

12:37 ChongLi: idioms in english are weird phrases such as "she's pulling my leg" or "the devil is in the details"

12:37 nDuff: ChongLi: I tend find the parallels between the meanings easier to draw. In both cases, there are a conventional way to say a thing.

12:37 alexnixon: ChongLi: see the first definition http://en.wiktionary.org/wiki/idiomatic

12:38 ChongLi: they violate the principle of compositionality because the truth of those statements does not follow from their component parts

12:38 alexnixon: ChongLi: I'd say that applies equally to natural and programming languages

12:38 t-goossens: Hmm

12:38 maleghast: ChongLi: 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:38 nDuff: ChongLi: ...see also the musical definition given behind alexnixon's link.

12:39 lynaghk: qerub: I first heard the "Data all the things" expression from Alan Dipert this past summer.

12:39 ChongLi: it sounds to me like we have a blanket definition

12:39 that covers related but distinct ideas

12:39 alexnixon: maleghast: well, "je suis chaud" is not "un-idiomatic", it's a mistranslation..

12:40 qerub: lynaghk: ok! Thanks! :)

12:40 maleghast: in 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:40 ChongLi: I want to tackle the first definition then

12:40 forget about esoteric idioms

12:40 Pertaining or conforming to the mode of expression characteristic of a language.

12:40 that's the first definition

12:41 to conform to such a definition isn't it sufficient that one conform to a valid expression in the language?

12:41 maleghast: ChongLi: Precisely - as such there is an entirely appropriate use of the word here.

12:42 t_goossens: Its probably

12:42 alexnixon: ChongLi: 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:42 maleghast: alexnixon: Thanks - quicker and better than I could manage :-) +1

12:42 t_goossens: Me not quite sure yet what I want to achieve

12:42 ChongLi: so the definition of idiomatic now depends on an appeal to popularity?

12:42 alexnixon: ChongLi: yes

12:42 thorwil: ideomatic is a cromulent word, a nice way to embiggen your vocabulary

12:43 maleghast: ChongLi: popularity based on a consensus opinion of best practice

12:43 ChongLi: isn't a consensus something different?

12:43 t_goossens: Just been busy with clojure for two months. Just experimenting I guess :)

12:43 maleghast: thorwil: "corpulent" Nice word! ;-)

12:44 s/corpulent/cromulent - Bloody auto-correct!

12:44 nDuff: ChongLi: Things can be valid within a language without being characteristic of it.

12:44 ChongLi: nDuff: I'm not sure what you mean

12:44 isn't a computer language defined only by its rules?

12:45 thorwil: no. a computer language also comes with intentions of the creators that might not fully reduce to said rules

12:45 add many users and you start to see "culture"

12:45 alexnixon: ChongLi: (defn add-two [x] (+ x 12 (- 10))

12:45 nDuff: ChongLi: 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:46 ChongLi: I see

12:46 nDuff: ChongLi: ...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:47 ChongLi: so how do you make a determination whether a program is idiomatic or not if it has never been written by anyone else before?

12:47 nDuff: that's very, very subjective

12:47 nDuff: ChongLi: Yes, it is.

12:47 alexnixon: ChongLi: break it into sub-problems, and see if the solutions to those are idiomatic

12:47 nDuff: ChongLi: likewise, programming language idioms are subjective.

12:47 ChongLi: ...but eventually, consensus emerges.

12:47 ChongLi: alexnixon: what if the program is non-compositional?

12:48 alexnixon: ChongLi: I don't understand what you mean by that

12:48 nDuff: ChongLi: the manner in which the program is composed or built is, itself, a characteristic which can be used in the evaluation.

12:48 ChongLi: something is compositional if it can be broken into sub-problems which make any sense

12:49 for example, "the devil in the details" is non-compositional

12:49 alexnixon: ChongLi: I don't believe there's any program you can't break down

12:49 ChongLi: because you cannot examine the parts to learn the truth of the whole

12:50 alexnixon: I think we're in danger of getting overly philosophical

12:50 ChongLi: if you were to do that, you'd be stuck with a literal devil

12:50 which doesn't make any sense

12:50 no, philosophy has great implications for computer programs

12:51 one such case is referentially transparent/opaque contexts

12:52 you cannot substitute into a referentially opaque context without changing the meaning of the expression

12:52 alexnixon: sure

12:52 ChongLi: well in a language like clojure (indeed any lisp) you run into these whenever you talk about symbols

12:53 alexnixon: logic 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:53 ChongLi: how so?

12:54 another good example might be mutual recursion

12:55 breaking apart a mutual recursion makes little sense, as the parts are defined in terms of eachother

12:57 alexnixon: the 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:59 ChongLi: yeah I suppose

12:59 but I don't see how you could determine whether it was idiomatic or not

12:59 especially if it expressed something you had never seen before

13:01 alexnixon: you 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:01 ChongLi: perhaps, but then you're making a value judgment

13:02 which I guess is really at the core of what idiomatic means

13:02 it's a value judgment

13:02 alexnixon: yep

13:02 you might find kibit interesting

13:03 ChongLi: I think people ought to be aware of that

13:03 because sometimes I see people use the term as a kind of attack

13:03 when it really isn't fair to do so

13:03 I'm not accusing anyone here of that, I haven't seen it happen here

13:04 I still need to look into core.logic

13:04 alexnixon: attacking people is rarely helpful but non-idiomatic code is expensive and so it's right to discourage it, imo

13:05 TimMc: When 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:05 ChongLi: yeah and that is good

13:05 TimMc: (well, *one* implication, anyway)

13:06 ChongLi: but I think it's also important to help beginners realize what idiomatic means

13:06 because it can be a cultural minefield

13:06 alexnixon: in terms of non-native speakers, you mean?

13:06 ChongLi: yeah

13:07 similar to cultural faux pas

13:09 so kibit is a lint-like?

13:09 is that a term?

13:09 TimMc: sure

13:09 ChongLi: I had some trouble using hlint with haskell

13:10 it occasionally suggested program transformations which were ill-typed

13:12 alexnixon: I believe kibit can do the same (I saw a mailing list post about it not being aware of reducers)

13:13 ChongLi: so it's definitely a tool intended for experienced programmers

13:13 alexnixon: no I don't think so

13:13 abp: hell-o

13:13 alexnixon: aiui it's aimed at beginners, to help make them aware of existing functions they might not be aware of

13:13 ChongLi: then are beginners going to be able to cope with transformations which damage their program?

13:14 alexnixon: that's a bug :-)

13:14 ChongLi: ahhh, ok

13:14 alexnixon: most of its transformations are very, very simple

13:14 * technomancy grumbles about kibit bug #2

13:14 ChongLi: I thought it was merely a limitation

13:15 I don't know how core.logic works, but in SICP they talk about the closed world assumption

13:15 and how that leads down many a dark path to paradoxes

13:17 alexnixon: I haven't looked at it in detail, but my impression is that kibit suggest transforms based on simple pattern matching of s-expressions

13:17 Anderkent: So clojure compiler seems a bit crap at assigning line numbers to bytecode, is that worked on or a limitation of jvm?

13:20 dnolen: Anderkent: compiler usually gives pretty accurate line numbers - malformed sexprs and macros are the cases where you may not get a line number.

13:22 Anderkent: dnolen: 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:27 dnolen: Anderkent: 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:28 Anderkent: well, it's a pain when trying to get code coverage working ;S

13:33 Luyt: re-reading http://www.paulgraham.com/avg.html and it's always a good read. Is Clojure the modern blub?

13:33 TimMc: Luyt: No, Java is.

13:33 technomancy: Luyt: silly question; the whole point of blub is you can't tell

13:33 TimMc: (In my own experience with multiple languages.)

13:33 Luyt: TimMc: You might be right.

13:34 TimMc: technomancy: Fair point, but it's what I would regard as "the most common Blub".

13:34 Luyt: I made a mistake in my answer ;-) of course Clojure is the highest nirvana of Lisp you can attain ;-)

13:34 dnolen: Luyt: doubtful

13:34 langmartin: lisp might be a blub re types

13:34 TimMc: Clojure is a compromise.

13:34 langmartin: sometimes

13:35 dnolen: TimMc: as far as PLs go that is pretty much a tautology

13:35 technomancy: "everyone smarter than me is a nerd; everyone dumber than me is an idiot" http://wondermark.com/333/

13:36 Luyt: I'd like to befriend people of equal smartness as me.

13:37 uvtc: George Carlin on that one: http://i.qkme.me/3qzpsm.jpg

13:38 devn: Does 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:40 Nevermind, I was thinking of Out of the Tar Pit -- was trying to place the phrase: "Informal reasoning"

13:49 abp: amalloy: technomancy When I start using emacs, is it advisable to use emacs-starter-kit and emacs-live together to get started writing clojure?

13:49 technomancy: abp: I recommend writing your own dotfiles

13:50 but read over other peoples to find good tricks

13:50 and check out what packages other people use

13:50 ivan: I like all of the packages emacs-starter-kit uses by default

13:50 lynaghk: dnolen: here's the gist about the unifier constraints you requested: https://gist.github.com/4116442

13:50 technomancy: the 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:51 Iceland_jack: Ain't that the truth

13:52 lynaghk: dnolen: not sure if it's what you had in mind or how complex it might be to implement.

13:54 abp: technomancy: Sounds like pretty much to do when searching for a new editor to write my libs in.

13:54 technomancy: abp: yeah, definitely. there are easier editors.

13:56 llasram: Have the defaults gotten better with Emacs 24?

13:56 I 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:57 technomancy: llasram: not really IMO

13:57 you still have the toolbar and menubar on by default, uniquify off, and a bunch of other nonsense

13:57 llasram: Ohhhhhh, right

13:57 Yeah, ok. That's fair, esp for uniquify. Toolbar and menubar though -- maybe most people want those?

13:58 technomancy: no

13:58 well, maybe they do, but they're wrong

13:58 llasram: Well *I* agree with you :-)

13:58 technomancy: the toolbar actually reflects a somewhat insulting attitude of emacs-devel towards newbies

13:58 llasram: But 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:59 dnolen: lynaghk: 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:00 lynaghk: dnolen: 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:00 tgoossens: sublime pleases me as well. But there might be better editors for clojrue

14:01 lynaghk: dnolen: 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:02 dnolen: lynaghk: hmm, I'd like to see how it could work w/o metadata, everything in the 3rd argument to the unifier.

14:02 TimMc: technomancy: As a noob, I *loved* the toolbar. It was very important in my transition to learning the keyboard shortcuts.

14:02 lynaghk: dnolen: ah, I see. yeah, I can throw that together; give me 5 min.

14:02 dnolen: lynaghk: projection is not required w/ constraints.

14:03 lynaghk: but that's neither here nor there really for consumers of the simple unifier

14:03 lynaghk: dnolen: how so? Don't the lvars need to come down from logic-world before they can be given to regular ol' predicate functions?

14:04 dnolen: lynaghk: constraints run on events - they don't run until their vars satisfy some condition - domain change, grounding etc

14:04 lynaghk: projection requires you to consider order - constraints free you from that.

14:05 lynaghk: dnolen: ah, okay. I should read up about the implementation

14:05 dnolen: lynaghk: but like i said, implementation detail as far as what you want :)

14:06 lynaghk: dnolen: as an aside: unifier order shouldn't matter, correct?

14:07 dnolen: https://www.refheap.com/paste/6878

14:07 dnolen: lynaghk: as in which argument the spec is?

14:07 lynaghk: dnolen: I was just playing around and ran into this non-intuitive situation

14:07 at least, it was a surprise to me.

14:08 dnolen: lynaghk: that past doesn't make sense unifier only takes 2 arguments right now.

14:08 s/past/paste

14:09 lynaghk: oh wait ... right

14:09 I added that

14:09 lynaghk: = )

14:10 dnolen: lynaghk: can you add the output to that so I can see what's going on? :)

14:10 lynaghk: dnolen: as I'm writing up these new examples, do you have thoughts on annon functions?

14:10 dnolen: lynaghk: what about them?

14:11 lynaghk: dnolen: if you think it'd be a good or bad idea to support them in the where clause

14:11 both in terms of the implementation complexity and the difficulty of reading unifier calls.

14:11 dnolen: lynaghk: like anon predicate you mean?

14:12 lynaghk: add an example of what you're thinking

14:12 lynaghk: dnolen: yeah. To support "or", for instance, my instinct would be to write [#(or (numeric? %) (nil? %)) ?the-var]

14:13 dnolen: 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:14 dnolen: updated paste: https://www.refheap.com/paste/6879. output is [{:x 2} nil]

14:15 dnolen: lynaghk: 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:15 lynaghk: also constraint arg should maybe be a map

14:16 {'?x ... '?y ... #(or (numeric? %) (nil? %)) '#{?x ?y}}

14:16 we can treat symbols specially from fn keys.

14:16 lynaghk: dnolen: not sure I see. What's that a map of?

14:16 dnolen: vars -> constraints

14:16 or group constraints -> var set

14:17 lynaghk: dnolen: for that latter case, shouldn't the value be a vector since the args should be provided in order?

14:17 dnolen: lynaghk: what does order indicate here?

14:18 lynaghk: dnolen: I need to implement constraints with a fn of specific lvars. E.g. (data-numeric data dimension)

14:18 so the map would need to be {data-numeric [?data ?dimension]}

14:19 dnolen: lynaghk: I don't see why order matters. can you explain?

14:20 lynaghk: 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:20 lynaghk: dnolen: 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:20 dnolen: lynaghk: er the refheap I mean.

14:21 lynaghk: dnolen: 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:21 (unifier a b c) <=> (run* [q] (== q a) (== q b) (== q c))

14:22 dnolen: lynaghk: yeah I guess it's pretty annoying ... I could change it set that automatically if we have more than 2 args.

14:22 lynaghk: dnolen: 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:22 jcromartie: do all futures evaluate on the same thread?

14:23 lynaghk: dnolen: does this data-numeric question make sense? The predicate does not treat its arguments symetrically.

14:23 dnolen: lynaghk: http://dev.clojure.org/jira/browse/LOGIC-71

14:23 llasram: jcromartie: No -- uses the same thread-pool as agent send-off

14:23 TimMc: jcromartie: I think they share a thread ppol.

14:24 dnolen: lynaghk: 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:24 jcromartie: I was Doing It Wrong™

14:24 lynaghk: dnolen: 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:25 dnolen: lynaghk: it needs to check all of them is that what you're saying?

14:25 lynaghk: dnolen: line 10 https://gist.github.com/4116442

14:26 dnolen: the point is that we should support arbitrary predicates of multiple lvars.

14:26 dnolen: via user-provided functions, which don't necessarily treat their arguments symmetrically.

14:27 dnolen: lynaghk: right I'm starting to get it ...

14:28 lynaghk: it can be done, it'll have to be a different constraint from the cvar stuff that I've shown.

14:29 lynaghk: it's a constraint that runs once both of it arguments have become ground

14:29 lynaghk: dnolen: aren't the constraints on a single argument only---the lvar?

14:30 dnolen: lynaghk: the one's we've talked about yes - but not in general. Otherwise how could we solve sudoku? :)

14:30 lynaghk: dnolen: hehe.

14:31 dnolen: syntax wise I think the map is a good idea. A map of functions to a vector of their arguments?

14:31 mefisto: anyone done much with clj-record? is it fun to use

14:31 dnolen: lynaghk: yep

14:32 lynaghk: dnolen: I wonder why datomic's syntax is with the vectors, then.

14:32 dnolen: seems like we're doing the exact same thing.

14:34 dnolen: lynaghk: again I think we should support both symbol keys and fn keys.

14:34 lynaghk: dnolen: that's fine with me. I'll update the gist with more examples.

14:34 dnolen: lynaghk: 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:35 lynaghk: excellent

14:44 lynaghk: dnolen: https://gist.github.com/4116442/

14:45 dnolen: I just added what we just talked about.

14:48 dnolen: lynaghk: cool, for case where users want to provide fns in the map, the whole map should not be quoted.

14:49 lynaghk: dnolen: I just edited the gist = )

14:49 dnolen: was thinking the same thing. this lvar quoting stuff is a bit tricky.

14:50 dnolen: 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:50 dnolen: lynaghk: 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:55 lynaghk: dnolen: unless I am missing something, though, the unifier cannot be used to do a fully general rewrite (e.g., removing keys)

14:55 dnolen: lynaghk: is there a case where you need that?

14:57 lynaghk: dnolen: yes, because I'm trying to do full rewrites. See line 16 here: https://gist.github.com/4004131

14:58 dnolen: 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:58 dnolen: lynaghk: I don't see any rewriting in 16

14:59 lynaghk: dnolen: refresh please. The first item in that vector (line 15) is the match, the second bit is the rewrite

14:59 dnolen: the :y !_ means "take this out of the map"

15:00 dnolen: the second item in the vector is the rewrite, which I was deep-merging into the user-provided spec.

15:01 dnolen: 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:03 dnolen: lynaghk: ok, yeah - we'd need something like rewriter which respects the same rules as the simple unifier that we've talked about.

15:03 (rewriter [match => rewrite :where ...] ...)

15:04 lynaghk: dnolen: okay, yeah. I can open source that based on what I have thus far

15:04 dnolen: basically, unify spec with the match, then the rewrite has the same lvars as spec and gets deep-merged into the spec.

15:04 dnolen: it's ok, it's pretty trivial to embed that into a simple run.

15:05 (run* [q] (== user-data spec) (== q rewrite))

15:05 and constraints are implicitly added on the vars via :where

15:06 lynaghk: dnolen: 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:06 dnolen: that's why I have to deep merge the rewrite onto the spec; it overwrites certain values but carries the rest along

15:07 dnolen: lynaghk: I guess I don't see how that isn't handle by defaults and partial map in what I just said above?

15:07 handled

15:08 lynaghk: dnolen: it's an open system, so the user might add new keys that aren't in the record definitions

15:10 dnolen: lynaghk: 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:11 lynaghk: dnolen: yes, correct.

15:11 dnolen: lynaghk: sounds good

15:11 lynaghk: dnolen: 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:12 dnolen: lynaghk: yes I think a rewriter based on core.logic would be a pretty sweet lib.

15:12 lynaghk: dnolen: 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:13 dnolen: lynaghk: 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:14 lynaghk: if I get that I can do the constraint processing and the var w/ default value unification pretty easily.

15:14 lynaghk: dnolen: so you want to keep the multi-arity unifier?

15:14 dnolen: lynaghk: I dont' see why we shouldn't.

15:15 lynaghk: dnolen: fair enough. Yeah, I'll get that pushed up later today. Do you want me to handle the walk fix too?

15:15 dnolen: lynaghk: yeah that would be cool.

15:16 lynaghk: dnolen: okay, I can get both of those done today. I've got to run for now, though. catch you later.

15:17 dnolen: lynaghk: later

15:45 simonadameit: hi

15:47 The interfaces that are defined in clojure.lang like ISeq, etc. - is there some documentation / overview and explanation for them?

15:48 This seems to be important for implementing data structures that work the same as all the clojure data structures

15:49 dnolen: simonadameit: nothing that I know of beyond the source - maybe some of the books cover them.

15:59 mpenet: simonadameit: there is a handy fn from cgrand that helps to get and overview: https://gist.github.com/2053633

16:01 simonadameit: example of output https://gist.github.com/4121044

16:02 simonadameit: thanks, thats cool

16:03 Is there some library in clojure for defining binary formats and manipulating binary data (e.g. on a Java ByteBuffer) ?

16:04 mpenet: simonadameit: gloss

16:08 simonadameit: mpenet: looks great, i did not find this library, though i was looking

16:10 this 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:14 i.e. write deftypes that maybe implement some clojure collections interfaces and call .getInt (etc.) at just the right time?

16:14 any idea whats the better approach?

16:22 S11001001: simonadameit: for most programs, the former.

16:22 ifesdjeen: hi guys, does anyone know why alter-var-root doesn't work within (defmacro)?.. it simply doesn't change dynamic variable at all...

16:22 at least when execution is deferred (quote)

16:22 S11001001: simonadameit: implementing crap in deftype is for optimization, and you know what they say about doing that too soon....

16:22 TimMc: Or even at all. :-P

16:23 ifesdjeen: Do you have a public example somewhere that doesn't work as you expect?

16:23 ifesdjeen: TimMc: sec, posting gist

16:24 TimMc: My immediate suspicion is that you're confusing runtime and compile-time in some way...

16:26 simonadameit: S11001001: ok, for what kind of programs would the latter make sense?

16:27 technomancy: simonadameit: implementing Clojure

16:28 dnolen_: simonadameit: any code where performance really matters including Clojure

16:28 simonadameit: also it's the only way to create your types that can interoperate w/ Clojure transparently

16:28 so it's not just about performance.

16:28 your own types.

16:28 TimMc: Write that part in Erlang or OCaml or something.

16:28 ifesdjeen: TimMc: https://gist.github.com/c10c4cf6f9e7f9db05ac

16:29 TimMc: 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:31 it works perfectly fine until I insert macro into macro... then it just uses binding value, ignoring alter-var-root

16:31 probably it's an expected behavior

16:31 i'm just wondering what would be a better way to do the same thing

16:32 TimMc: ifesdjeen: You're altering the var root, but your printlns are getting the dynamically bound value.

16:35 jcromartie: why does this fail with "Wrong number of args (1) passed to: core$reduce": https://gist.github.com/ba9030abda9c8a3ed0bc

16:35 I don't see reduce being called with 1 arg

16:36 never mind

16:36 stack trace interpretation FAIL

16:36 TimMc: It was actually your fn literal?

16:36 ifesdjeen: TimMc: i understand that. So, basically, there's no way do change dynamic var while having a binding?..

16:37 TimMc: I don't happen to know of a way to change the current dynamic scope, no.

16:38 ifesdjeen: got disconnected

16:38 thank you TimMc

16:39 jsabeaudry: (contains? [1 2 3] 1) -> true, (contains ["a" "b" "c"] "a") -> false, huh?

16:39 TimMc: ~contains?

16:39 clojurebot: contains is gotcha

16:39 technomancy: clojurebot: contains?

16:39 clojurebot: contains? 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:39 technomancy: oh snap

16:41 TimMc: clojurebot: contains? is a sneaky way of getting people to learn about computational complexity

16:41 clojurebot: 'Sea, mhuise.

16:41 Bronsa: ifesdjeen: what about set!?

16:42 TimMc: Oh hah, good call.

16:42 _ulises: this 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:42 llasram: ifesdjeen, Bronsa: what about bound-fn ?

16:43 jsabeaudry: technomancy, thanks!

16:54 simonadameit: how do I access static nested classes from clojure?

16:55 TimMc: simonadameit: Inner classes use $ instead of .

16:55 ~inner classes

16:55 clojurebot: It's greek to me.

16:55 simonadameit: thanks, that works! :)

16:57 TimMc: clojurebot: inner classes are a Java fiction; for the Double "inner class" in Point2D, write Point2D$Double (not Point2D.Double).

16:57 clojurebot: java generics are http://en.wikipedia.org/wiki/Generics_in_Java

17:01 dnolen_: unnali: btw, pretty sure your issue got resolved - will see if we can push out a new CLJS release this Friday.

17:07 abuiles: I'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:09 unnali: dnolen_: woah! amazing!

17:09 great to hear!

17:13 Frozenlock: I'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:13 simonadameit: what is the preferred construct in clojure to manage side effects?

17:14 nDuff: simonadameit: that very much depends on the details.

17:14 ChongLi: simonadameit: mostly convention, from what I know

17:14 convention and the concurrency primitives

17:15 nDuff: simonadameit: could you be more specific?

17:15 simonadameit: i 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:15 nDuff: simonadameit: I/O (ie. writing to a file) _is_ a side effect.

17:15 simonadameit: exactly

17:16 thats why i cannot use an agent

17:16 nDuff: Waitamoment.

17:16 Huh?

17:16 simonadameit: and ask for the clojure way to manage side effects

17:16 nDuff: Agents are certainly allowed to do IO.

17:16 ChongLi: how do you plan to write to a file without side effects?

17:17 nDuff: ...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:17 simonadameit: ChongLi: i want the side effects

17:17 ChongLi: yeah that's a very good point

17:17 simonadameit: i just dont want them to happen twice because stm decides to do so.

17:18 ivan: abuiles: try closing and reopening your .clj file

17:18 ChongLi: stm works with agents

17:18 nDuff: simonadameit: What were you reading that implied that agents shouldn't do things with side effects?

17:18 ChongLi: so that agent actions are not repeated if the transaction restarts

17:18 nDuff: simonadameit: STM doesn't cause agents to retry.

17:18 ivan: abuiles: or try calling nrepl-eval-buffer directly, maybe you have key binding problem

17:18 nDuff: simonadameit: maybe you're thinking of refs.

17:19 ChongLi: so yeah, you can use an agent to implement a transaction log

17:19 or whatever it is you want to do

17:19 simonadameit: "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:19 nDuff: simonadameit: things added to an agent's queue from within a transaction are never run until after that transaction has successfully completed.

17:20 simonadameit: so this means the agent dispatch is not retried?

17:20 ChongLi: there you go

17:20 simonadameit: thats good

17:20 ChongLi: yeah

17:20 abuiles: ivan: yeah, seems like a key-binding problem :( thanks

17:20 simonadameit: ChongLi, nDuff: thanks, seems I can use agents after all

17:21 ChongLi: simonadameit: it does require discipline, however

17:21 if you try to do a side effect directly within a transaction, you'll throw an exception (I beleive)

17:21 believe

17:22 TimMc: ChongLi: Not in general.

17:22 xclite: I thought you could do one, it just might happen... a lot

17:22 simonadameit: ChongLi: I want to do it in a function that i send to an agent

17:22 that should work, shouldn't it?

17:22 xclite: simonadameit, that's how I do it. I have an agent to whom I send logging calls.

17:22 ChongLi: TimMc: 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:23 nDuff: io!

17:23 TimMc: Sure, but it's not automatic.

17:23 ChongLi: it's a good convention to have then

17:23 if it's really important to you

17:23 TimMc: I'm not sure when I'd really use it...

17:24 It seems like something that's only useful if you don't know all the code paths through your application.

17:24 ChongLi: yeah, when building a really large and complex system

17:24 with a large team

17:26 TimMc: I still don't see it.

17:27 ChongLi: I 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:28 seems like it'd be feasible

17:28 TimMc: heh

17:29 The channel has visited this topic in the past...

17:29 ChongLi: haha

17:29 I guess it's silly for me to bring it up again then

17:29 TimMc: no no, I'm just hunting through the logs

17:32 Incidentally, ref operations themselves are side-effecting -- but they're coordination with the dosync.

17:39 Bah, I can't find it.

17:40 Anyway, the short version is that static analysis can't tell when a side-effect is "safe" or not.

17:43 ChongLi: TimMc: ahhh

17:43 well that makes sense

17:43 I guess a lot of java calls would be false positives

17:46 TimMc: It 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:47 ChongLi: it'd have some granularity issues I guess

17:47 TimMc: (I'm not particularly well-versed in this topic, so I'm being a bit hand-wavey.)

17:47 ChongLi: then again, even haskell's IO monad has these issues

17:47 hence the need for unsafePerformIO

17:50 wingy: 500 members

17:51 Frozenlock: So, any java knowledgeable person that can tell me how misguided I am in my attempt to modify a java field? :)

17:52 amalloy: java loves it when you modify fields, man

17:52 brehaut: the 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:52 kencausey: I'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:53 I'm running a git checkout of Emacs built locally yesterday

17:53 simonadameit: do 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:54 Frozenlock: amalloy: was that sarcasm?

17:54 tbaldridge_: anyone know how to negate something in core.logic? Instead of (nilo q) I want (not-nilo q)

17:54 amalloy: nope, java is field-modification-oriented programming :P

17:55 brainproxy: Frozenlock: you've never had your jvm kiss you on the cheek when you get busy modifying fields?

17:55 kencausey: Perhaps 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:55 Frozenlock: Eh, the only contact I had with the JVM is through Clojure.

17:55 kencausey: tbaldridge_: not

17:56 actsasgeek: is anyone else having a problem with lein not being able to find noir-lein-template:pom:1.3.0?

17:56 hugod: kencausey: you could try M-: (require 'nrepl-ritz)

17:56 nDuff: Frozenlock: 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:56 tbaldridge_: ah...just found it, it seems != does what I need, thanks

17:58 kencausey: hugod: That changes the second issue, but does nothing regarding making c-x c-e work.

17:59 tbaldridge: I ignored the fact that you said core.logic, best you just ignore me, sorry.

17:59 hugod: kencausey: what buffers do you have with names starting with "*nrepl"?

17:59 tbaldridge: kencausey: np

18:00 kencausey: hugod: *nrepl* *nrepl-connection*

18:05 Frozenlock: nDuff: 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:07 dnolen_: 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:10 nDuff: Frozenlock: it's a bean. (.getConfiguration (bacnet-scan-utils.bacnet/new-local-device))

18:11 Frozenlock: ...which us the usual way of doing things in Java -- public fields are very, very rare.

18:11 Frozenlock: So to set it, I should do something like (set! (.getConfiguration

18:11 (bacnet-scan-utils.bacnet/new-local-device)) some-configuration-object) ?

18:11 nDuff: Frozenlock: no, it has a setter.

18:12 Frozenlock: ...or, it should, if it's being a well-behaved bean.

18:12 Frozenlock: It has? I didn't seen it in the docs...

18:12 nDuff: Where are these docs?

18:12 Frozenlock: didn't see*

18:12 nDuff: Anyhow -- no sane Java API will expect 3rd-party users to directly interact with its fields.

18:12 ...it's just not a thing that's done.

18:13 * nDuff isn't saying insane ones don't exist, but ones that break convention that badly don't make it past code review.

18:13 hugod: kencausey: perhaps try it in a fresh emacs instance?

18:13 nDuff: Frozenlock: ...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:14 Frozenlock: If you can provide a pointer to the javadocs, I may be able to be more helpful.

18:14 Frozenlock: Here: http://dl.dropbox.com/u/40737386/bacnet4J-doc/index.html

18:14 Aaand there's frame... damnit.

18:15 http://dl.dropbox.com/u/40737386/bacnet4J-doc/com/serotonin/bacnet4j/LocalDevice.html

18:15 nDuff: Frozenlock: Notably, that documentation doesn't say anything about there being a public field.

18:15 Frozenlock: Ok, so if a field isn't public, I can't touch it?

18:16 nDuff: Frozenlock: Exactly.

18:16 Frozenlock: -_-

18:16 nDuff: ...well, not without doing a bunch of magic with reflection, and if you need to ask, the answer is "no". :)

18:16 tgoossens: (maybe by using reflection you can :p )

18:16 nDuff: Frozenlock: ...so -- if there aren't other docs or examples showing configuration, ask the developers behind the library.

18:16 Frozenlock: Yeah, I'll stick with no. I ain't wantin any java black magic

18:17 nDuff: Frozenlock: ...by the way, the configuration object it gives you _does_ have methods for updating properties.

18:17 kencausey: hugod: I've restarted emacs multiple times, I've been dealing with this for a day or more.

18:17 Frozenlock: Yes, but one at the time. I wanted to grab a config using getConfiguration and stick it in another device.

18:18 I suppose I'll have to make an helperfn for that.

18:18 nDuff: Thank you very much for your help!

18:21 hugod: kencausey: M-x nrepl to a repl started with `lein repl :headless` work?

18:22 kencausey: hugod: OK, a moment...

18:25 tgoossens: On a gameboard. I have a map of position->list of pieces on that place

18:25 kencausey: hugod: I get the same error

18:26 tgoossens: i am struggling with making pieces "unique"

18:26 there are several paths i'm following:

18:27 * 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:27 * use identity: references

18:27 * giving an "id" to a piece

18:27 not sure what I should go for

18:28 hugod: kencausey: 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:28 tgoossens: unique id seems ok but difficult to ensure the id is unique

18:29 identity 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:29 and using no uniqueness identifier how i'm going to say then: "move this robot forward"

18:31 technomancy: kencausey: if you're invoking inferior-lisp functions that means nrepl.el isn't enabled

18:32 Frozenlock: tgoossens: id with (gensym) perhaps?

18:32 kencausey: for what it's worth nrepl-eval-region works

18:32 technomancy: Can you suggest how I might go about debugging/fixing that?

18:33 tgoossens: Frozenlock: what i mean is. How do you ensure that some external party provides a unique id?

18:33 flying_rhino: hello guys

18:33 kencausey: hugod: I may indeed have some customization, commenting it out now and retrying.

18:36 technomancy: kencausey: see if enabling the minor mode by hand helps I guess

18:36 kencausey: technomancy: for a .clj buffer?

18:36 flying_rhino: I 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:37 kencausey: technomancy: I'm not clear on which buffer you mean or for that matter what mode

18:38 technomancy: kencausey: 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:39 kencausey: technomancy: Yep, that fixed it

18:39 technomancy: probably want to report that in github issues

18:41 kencausey: technomancy: 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:41 technomancy: to kingtim/nrepl?

18:41 technomancy: yeah

18:42 kencausey: thanks, at least I can work around it for now

18:42 technomancy: np

18:42 kencausey: hugod: and to you as well

18:43 flying_rhino: I mean I know how to solve the problem but I wanted to run it through hive mind to see what everyone thinks.

18:47 kencausey: flying_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:48 Context that is often better formatted in an email or blog entry

18:52 technomancy/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:52 flying_rhino: okay 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:52 *you

18:53 brehaut: O(approximately 1)

18:54 but slower than a direct reference

18:59 kencausey: technomancy: I can confirm that without (add-hook 'nrepl-interaction-mode 'paredit-mode) in my init nrepl-interaction-mode isn't enabled.

19:00 technomancy: Sound like something I should report to you? It doesn't read in the readme like it is mean to be a requirement.

19:00 flying_rhino: the 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:00 *developing things

19:01 kencausey: flying_rhino: you aren't perhaps trying to optimize too early?

19:02 flying_rhino: kencausey: you caught me red handed there. But I do have one question which is not just about optimization.

19:04 okay see you guys later

19:07 technomancy: kencausey: that's not going to make a difference

19:07 I'm not the maintainer anyway though

19:12 kencausey: technomancy: I'm not sure what you mean. In any case I'm submitting a report now.

19:14 technomancy: I 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:17 kencausey: technomancy: um, it does though

19:17 technomancy: Simply commenting out one line and restarting or uncommenting and doing so makes it either work or not work

19:18 https://github.com/kingtim/nrepl.el/issues/168

19:25 seancorfield: fwiw kencausey I have (add-hook 'nrepl-mode-hook (lambda () (paredit-mode 1))) in my init.el to turn on paredit for nrepl

19:27 kencausey: seancorfield: OK, but just to be clear my problem is when I have nothing regarding linking nrepl and paredit explicitly stated in my init.

19:28 It's fine when I use (add-hook 'nrepl-interaction-mode 'paredit-mode) as shown in the readme

19:30 It 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:39 seancorfield: If 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:42 kencausey: seancorfield: have you tried nrepl-quit?

19:42 seancorfield: no... will try that to reset the state...

19:43 kencausey: My guess is that it chokes on an existing buffer, an unlisted one

19:44 hiredman: seancorfield: 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:45 seancorfield: kencausey: nrepl-quit didn't help unfortunately

19:45 hiredman: loaded in

19:45 kencausey: seancorfield: boo

19:45 seancorfield: the 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:46 normally when i run into this, i have to restart Emacs :(

19:48 xeqi: seancorfield: can you turn off nrepl-mode for that clj file

19:48 and then see if turning it on again helps

19:48 seancorfield: ah, slime-mode had somehow turned on for that buffer! when i turned that off, it worked just fine

19:49 i guess since we just switched from swank to nrepl in production today i can uninstall slime now?

19:49 * kencausey thinks so but is far from authoritative

19:50 seancorfield: hmm, or will i still need slime for elisp stuff?

19:55 wingy: ive got a problem with form-encode

19:55 its 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:55 so this wont work: (form-encode {:to "foo" :to "bar"})

19:56 any idea?

19:57 kencausey: wingy: I know nothing about it, but what happens with {:to ["foo" "bar"]}? Just a thought

19:57 wingy: kencausey: you are the man!

19:57 kencausey: pure luck (with a touch of experience)

19:58 wingy: :)

19:58 im using this one: (:require [ring.util.codec :refer [form-encode]])

19:58 a good method for restful apis

20:32 Frozenlock: Ugh... 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:33 Any workaround?

20:33 derrida: Is penumbra still the best option as far as OpenGL bindings go?

20:34 Frozenlock: ... for example this will fail--> (let [aa 12 bb 134] (mapify aa bb))

20:36 derrida: I'd like to use something idiomatic, I'm just a little apprehensive because of the "not actively developed" disclaimer though.

20:38 dnolen: derrida: probably still the best open source thing - I know Zach is open to someone taking over.

20:46 Frozenlock: Ah! My 'eval' was apparently unnecessary!

20:52 kencausey: Frozenlock: Do you really want a macro? That's evaluated at load/compile time, not runtime.

20:54 derrida: dnolen: 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:54 me since one impetus for me to use clojure instead of common lisp was to mitigate distribution headaches.

20:55 sorry to throw that on you after you were kind enough to answer my initial question :D

20:56 dnolen: derrida: 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:56 just don't think he is.

20:57 Frozenlock: kencausey: Well I don't *really* want a macro, but I don't really see how I could capture the symbol name otherwise...

20:58 derrida: dnolen: any idea what kind of problems he might be referring to?

20:58 dnolen: derrida: I have no idea - it never seemed like he ever worked on that problem much.

20:58 kencausey: Frozenlock: What is the benefit of your admittedly simple example above over [:aa 12 :bb 134]?

20:58 dnolen: derrida: he relied on something I built called native-deps

20:58 kencausey: or ['aa 12 'bb 134]

20:59 dnolen: derrida: 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:59 derrida: dnolen: what exactly was the "problem" he never worked on though?

20:59 hm

20:59 dnolen: derrida: load the right native libs at runtime instead of resolving it through dev tools.

20:59 derrida: ah

20:59 that doesn't sound like a terribly hard thing to resolve, just a bit tedious

20:59 dnolen: derrida: yep

21:00 derrida: 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:00 so far as to try.

21:01 derrida: It's wonderful, I've been doing it with CL for a while and it's not fun to go back! :D

21:01 Frozenlock: kencausey: 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:02 It's really just to avoid doing {:v1 v1 :v2 v2 :v3 v3} by hand

21:02 dnolen: derrida: 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:03 lynaghk`: ping: dnolen. What's the story with test-unifier-3 and dotted pairs in core.logic? Are there special semantics about '(?x . ?y)

21:03 dnolen: lynaghk: yes . means ?y should match the rest of the sequence on the other side.

21:03 lynaghk`: dnolen: my walk fix blows those tests, but I'm not sure what exactly those forms mean.

21:03 Frozenlock: kencausey: Am I crazy? :P

21:04 lynaghk`: dnolen: ahh. I'll try to work around it, thanks.

21:04 dnolen: lynaghk`: like a Scheme-y dotted pair - meant to be analogous to the pattern matching support in core.logic

21:06 kencausey: Frozenlock: No offense, but I suspect so.

21:07 Frozenlock: How about a paste of a real usage example?

21:09 Frozenlock: Sure, perhaps you will be able to provide me with a better approach :)

21:09 https://www.refheap.com/paste/6884

21:10 kencausey: I'll look, but don't get your hopes up ;)

21:10 Frozenlock: Oh wait-

21:11 Does ':as arg' capture the initial argument value, or the final value?

21:12 [&{:keys [some-ks] :or {...} :as args}]. Will args inherit the 'or' values?

21:13 kencausey: I suggest you test it

21:14 Frozenlock: in the middle of :)

21:15 Ok, args will NOT get any 'or' values.

21:15 &(let [{:keys [a b c] :or {c 0} :as args} {:a 1 :b 2}] args)

21:15 lazybot: ⇒ {:a 1, :b 2}

21:15 Frozenlock: &(let [{:keys [a b c] :or {c 0} :as args} {:a 1 :b 2}] c)

21:15 lazybot: ⇒ 0

21:15 dnolen: derrida: Zach also had some enthusiasm for WebGL based lib - that could pretty interesting because of node-webkit

21:18 derrida: dnolen: yeah, that would be very cool

21:19 dnolen: derrida: and more sensible distribution story to be honest.

21:19 derrida: if web distribution suits you, yes.

21:20 I don't think it's a silver bullet

21:20 dnolen: derrida: no node-webkit lets you ship your app as an executable - like LightTable

21:20 derrida: ah

21:20 * derrida was unfamiliar with node-webkit

21:21 derrida: dnolen: cool, i'll read up on that now.

21:21 I imagine there's a significant performance tax

21:22 dnolen: derrida: yeah for a game that's the major downside.

21:44 a|i: how is the performance of clojure.xml comparing to other jvm xml parser?

21:46 amalloy: i suspect clojure.xml is awful, ajl. clojure.data.xml is probably competitive, since it mostly delegates

21:47 a|i: amalloy: why is that 2 xml parsers come with clojure?

21:47 amalloy: clojure.data.xml is a separate library

21:48 a|i: amalloy: any benchmarks to see how it performces better?

21:48 amalloy: *shrug*

21:49 ivan: aleph has a thing that chooses between .xml and .data.xml depending on whether you pass in a map or a vector :(

21:52 bbloom: dnolen: do we have anything for packaging/publishing clojurescript libraries?

21:52 amalloy: haha that's awful, ivan. does it use hiccup-style syntax for one of them, or what?

21:53 ivan: yes

21:53 amalloy: for data.xml, i hope? that code's my only contribution to data.xml

21:53 ivan: yes

21:53 amalloy: score

21:53 ivan: it was using prxml until I got rid of that

21:54 hopefully nobody noticed the breaking API change

21:54 amalloy: haha

21:55 yeah, 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:55 tomoj: can you write a goal permuteo* like permuteo but for which (run 1 [y] (permuteo* l y)) draws a permutation at random?

21:57 I guess if you just are going to run 1 you can just shuffle and pass that in

21:58 ivan: a|i: clojure.xml doesn't escape things, you can probably inject arbitrary XML

21:59 a|i: ivan: 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:59 amalloy: logic programming doesn't sound very well-suited to random choices, tomoj, since every function is reversible

22:02 dnolen: tomoj: 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:03 to be renamed condw if I implement it.

22:03 bbloom: yes lein works great

22:04 bbloom: dnolen: yeah, i found :jar true for lein-cljsbuild .. is that what you meant?

22:05 dnolen: bbloom: I haven't produce a CLJS only jar myself, but putting CLJS into JARs "just works"

22:06 bbloom: 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:06 bbloom: dnolen: ok cool

22:06 dnolen: so i've got a crazy idea i've been working on that you might like

22:07 dnolen: bbloom: heh, cool

22:07 bbloom: dnolen: i've implemented a very small postfix interpreter in the spirit of Factor language

22:07 dnolen: my idea is to define a little post-fix DSL for mutating the dom

22:08 so you could do something like ("body" select "div" tag "button" class "i am a button" text append)

22:08 dnolen: and that would create a <div class="button">i am a button</div> and append it to the document body

22:08 dnolen: the main idea is to treat the DOM like a printer and send programs to it a la postscript

22:09 dnolen: bbloom: haha, sounds fun, gotta run will check it out if you got a link at some point.

22:09 bbloom: dnolen: hopefully by end of week :-)

22:16 tomoj: this seems to work a bit https://www.refheap.com/paste/187886d48ea290d3650f8512c

22:17 eh, that won't be very useful

22:21 amalloy: tomoj: 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:25 wingy: where will the clojure conj 2012 videos be available?

22:25 http://clojure-conj.org

22:27 amalloy: wingy: i think they turned up on infoq last time, or something? usually the interesting ones get into my twitter feed somehow or other

22:28 wingy: amalloy: interesting presentations

22:28 ivan: wingy: if anything like last time, february-march 2013

22:28 wingy: :(

22:32 amalloy: three months seems pretty fast. i thought it went into summer last time

22:33 wingy: for apple it takes 2 days!

22:34 mabes: the conj videos typically show up on clojure's blip.tv channel

22:34 http://blip.tv/clojure

22:35 wingy: (y)

22:35 brehaut: wingy: oen of these is an open source community project conference, the other is one of the largest corps in the world…

22:37 amalloy: apple's are an advertisement, clojure's are informational/lecutre-style; they provide value rather than asking you for money

22:37 lecutre! that sounds like a lovely french word

22:39 atom_: 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:39 wingy: atom_: where?

22:39 atom_: wingy: just a moment, I'll get the link for you.

22:40 wingy: http://www.cis.upenn.edu/~matuszek/cis554-2012/ there you go.

22:40 wingy: thx

22:40 atom_: wingy: are you in the process of learning clojure?

22:40 wingy: atom_: i have read some books

22:40 and now i am using it to build my app

22:41 atom_: excellent :) I'm learning currently. Using marick's book off of leanpub and finding it very helpful.

22:41 xeqi: the goggles, they do nothing

22:42 atom_: xeqi: those aren't goggles, just your hands formed in a circle

22:44 wingy: i wonder if i can read the books on my iPad on the run

22:44 the tricky thing is when you need to eval some code

22:44 amalloy: eval isn't so hard with websites like tryclojure. it's typing that's tough on an ipad, i imagine

22:46 brehaut: yeah, (, ) and - are not easily accessible

22:47 amalloy: and paredit

22:48 atom_: I hear the surface has a nice keyboard, though I can't speak for the rest of the device. >.>

22:48 amalloy: apple would probably not like me to call it iPaderit

22:48 wingy: atom_: i was thinking about buying one just because of the keyboard

22:49 devn: Did you guys know tpope is working on a set of Clojure plugins for vim that rule?

22:49 brehaut: apparently steve was mighty pissed at the safari team for calling JSC's JIT 'Squirrelfish Extreme'

22:49 wingy: seems very portable .. i hope apple would make a similar one for ipad

22:49 aperiodic: devn: i'd heard about an nrepl client

22:49 devn: what else?

22:49 devn: If you don't know tpope -- he's written an insane amount of vim plugins.

22:50 atom_: wingy: well if you decide to, let us know :)

22:50 brehaut: devn: 1 vim plugin? ;)

22:50 devn: aperiodic: 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:50 brehaut: lol, knowing tim it will be 10 of them

22:50 * aperiodic dreams about a paredit.vim without weird quirks

22:50 devn: and they will be done on monday

22:50 he's insanely good

22:50 the *only* reason I use vim for ruby and rails development is because of tim

22:50 atom_: I'm getting along well currently with intellij, although I'm also new.

22:51 brehaut: atom_: learning some other editor while learning clojure is not advised. keep on going with whatevers working for you

22:51 devn: aperiodic: if you PM me stuff you want in a clojure vim environment, I can pass it along

22:52 communicating current annoyances and so on would be much appreciated, as tim is pretty new to clj

22:52 but like most things he does, he's not going to get into it until he has his editor set up properly :)

22:53 atom_: 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:53 royaldark: hey 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:53 brehaut: atom_: great. don't let anyone tell you otherwise.

22:53 royaldark: anyone have a better/more canonical idea?

22:53 devn: actually 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:54 brehaut: royaldark: (require :reload-all 'students.namespace)

22:54 devn: so if you have suggestions for vim and clojure -- how it ought to work, ping me and ill pass it on

22:54 aperiodic: paredit.vim should let me strip quotation marks like any other set of paired delimiters

22:54 devn: please PM it to me so i dont lose it

22:55 and keep the requests coming

22:55 i have to run, but ill be back in a bit -- grabbing a cab

22:55 cheers

22:56 royaldark: brehaut: didn't know about :reload-all, thanks

22:57 brehaut: royaldark: there is also :reload for just the named namespace

22:59 atom_: 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:00 urg, sorry. I've been markdowning to take notes and it seems to have bled into my irc.

23:01 Bergle_1: doesnt everyone automatically interpret markdown anyway ? :)

23:02 amalloy: i chose to interpret it as "a blank spot in my vocabulary, speculatively filled in with the word namespace"

23:02 wingy: atom_: you should try Light Table .. its a good editor for clojure

23:03 although in alpha stage

23:03 amalloy: more like ultra-super-pre-alpha, i think?

23:03 atom_: 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:04 wingy: amalloy: now you scared him away!

23:11 amalloy: i'm more interested in helping atom_ get used to clojure than in helping chris's sales numbers :P

23:11 (and, i suspect, so is chris)

23:15 wingy: just that Light Table is helping newcomers tremendously with its instarepl

23:16 Bergle_1: yeah the instarepl is fun

23:16 im a noob ;)

23:16 at clojure anyway

23:16 wingy: you can connect it to your lein project and run your project code there .. it makes stuff easy to test

23:17 Bergle_1: i have yet to grok lein, beyond 'lein repl' :)

23:17 atom_: 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:18 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:30 augustl: I'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:30 atom_: Would anyone mind evaluating my explanation of my solution?

23:35 amalloy: ~anyone

23:35 clojurebot: Just 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:35 amalloy: augustl: that looks fine to me, though i'd probably make it a map like {:success true :data x} or {:type :success :data x}

23:38 augustl: amalloy: makes sense, thanks

23:38 named > nth :)

23:41 flying_rhino: small style question? Why everyone stack closed parenthesis instead of putting them in new line?

23:42 brehaut: flying_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:42 amalloy: because you don't)

23:42 want)

23:42 your whole)

23:42 file)

23:42 wasted on )s)

23:42 brehaut: flying_rhino: everyone does that

23:42 (inc amalloy)

23:42 lazybot: ⇒ 35

23:42 brehaut: lols

23:42 flying_rhino: brehaut: but why? C and java are more readable largely because they don't

23:43 amalloy: they're more readable largley because you've spent more time reading them in the past, mate

23:43 brehaut: clojure isnt C or Java. its not remotely from the same family

23:44 augustl: flying_rhino: editors make it readable, such as currently matching paren highlighting and rainbow-mode in emacs

23:44 * brehaut imagines what C code would be like if expresssions were formated like statements.

23:45 atom_: 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:45 amalloy: that's a neat perspective, atom_

23:45 flying_rhino: brehaut: not quite, both have tree like code. Or XML. Lisp can be thought as programmable XML and even there is formatting nicer.

23:45 brehaut: im pretty sure naggum has something to say to you

23:46 royaldark: atom_: Sorry, was afk. I'm working with Elena Machkasova, a professor at my school. She plans to write an introductory textbook on clojure

23:46 augustl: flying_rhino: seems to me that the answer to your question is that some people prefer stack closed parenthesis and you don't :)

23:46 prefer = finds more readable

23:46 atom_: royaldark: No worries, thanks for responding. I'll keep an eye out for it in the future then. :)

23:46 augustl: flying_rhino: and it's the other way around! XML is pointy lisp ;)

23:47 technomancy: spacing your parentheses out is bad because it makes it easier for you to keep track of them in your head

23:47 brehaut: http://harmful.cat-v.org/software/xml/s-exp_vs_XML

23:47 alandipert: flying_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:47 brehaut: i dont necessarily agree with all that, but its funny as hell

23:47 technomancy: how is your australian beer?

23:48 technomancy: brehaut: heh. don't tell anyone k?

23:48 brehaut: technomancy: i am thinking of drinking a summer ale in solidarity

23:48 although it is actually summer here

23:48 * Bergle_1 is i Aus. Brisbane.

23:48 amalloy: flying_rhino: if you're going to compare lisp to xml you should probably have read http://www.defmacro.org/ramblings/lisp.html first

23:48 augustl: btw, people who attended the conj should go to http://techmeshconf.com/, to get a reprise of the keynote

23:49 flying_rhino: amalloy: I read this

23:49 brehaut: amalloy: thats much more polite than naggum :)

23:49 flying_rhino: amalloy: that article is one of the reasons I am in this shit

23:50 i mean what is more readable

23:50 amalloy: me too

23:50 flying_rhino: (defn fast-run []

23:50 (let [x (future (long-calculation 11 13))

23:50 y (future (long-calculation 13 17))

23:50 z (future (long-calculation 17 19))]

23:50 (* @x @y @z)))

23:50 amalloy: brehaut: i look forward to reading what naggum has to say, though

23:51 flying_rhino: or

23:51 amalloy: flying_rhino: the first version

23:51 i don't even have to see the second

23:51 flying_rhino: (defn fast-run []

23:51 (let [x (future (long-calculation 11 13))

23:51 y (future (long-calculation 13 17))

23:51 z (future (long-calculation 17 19))]

23:51 (* @x @y @z)

23:51 ))

23:51 royaldark: atom_: our of curiosity, since you said you're new to clojure, what drew you into it?

23:51 augustl: flying_rhino: I'd say the first version, and as mentioned my editor makes it look even nicer

23:52 flying_rhino: augustl: what's your editor?

23:52 augustl: flying_rhino: emacs

23:52 Bergle_1: heh that was going to be my question to.

23:53 augustl: more 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:53 then there's things like paren-mode which basically stops you from manually handling indents and whitespace and lets you edit code structurally

23:53 I don't use it though, because it takes a while to get productive in it

23:54 brehaut: flying_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:54 augustl: flying_rhino: example: http://imgur.com/5q1s4

23:54 highlights based on cursor position

23:55 atom_: 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:57 apwalk: flying_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:57 flying_rhino: brehaut: 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:58 makes (* @x @y @z) stand out more

23:59 atom_: 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.

Logging service provided by n01se.net