#clojure log - Feb 06 2012

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

0:24 cemerick: I'm reading vim documentation right now. Damn you Raynes, damn you. ;-)

0:25 Raynes: Heh.

0:26 cemerick: Raynes: did you just stumble your way through learning everything, or is there a recommended resource?

0:27 * cemerick is in macvim docs at the moment

0:27 Raynes: $google janus vim

0:27 lazybot: [carlhuda/janus - GitHub] https://github.com/carlhuda/janus

0:27 Raynes: That and any given cheatsheet.

0:27 Just get ready to deal with looking everything up six times before you memorize it.

0:27 After that, smooth sailing.

0:28 cemerick: Also, if you already use the arrow keys for movement, just keep using them. Tell everyone who tells you otherwise to go be l33t haxxors and leave you alone.

0:29 cemerick: Raynes: oh, as opposed to that hjkl stuff? yeah

0:29 Raynes: Some people dig it, I'm not one of them.

0:30 cemerick: Perhaps I should install a toggle switch on the side of my macbook and diddle it at just the right frequency to correspond with an 'up' keypress.

0:30 Raynes: Hah

0:30 cemerick: The macvim UI is decent enough that I've not gone mad yet. :-)

0:30 zxcxzc: hrm, trying and failing to insall leiningen on windows :/ (lein self-insall always says "<folderimin> already exists. Delete and retry.". just lein throws an exception sayinbg there's no main (i downloaded a standalone jar))

0:30 Raynes: Macvim is excellent.

0:31 cemerick: If you get tired of the menubar at the top, set go-=T

0:31 cemerick: That vimrc stuff looks like a tangle tho. If only extensions, etc. defined settings along with styles and such to build e.g. preference panes.

0:31 Nah, that'd be too easy. :-P

0:32 Raynes: Some plugins do add menu items.

0:32 cemerick: Raynes: you mean the toolbar?

0:32 Raynes: Yes.

0:32 * cemerick is just snarking to keep up appearances

0:32 cemerick: Raynes: or you can just click the toolbar toggle button at the upper-right of any OS X window ;-)

0:33 Raynes: I'm… not sure we're talking about the same thing then.

0:33 cemerick: entirely possible

0:33 Raynes: Anywasys.

0:33 Anyways, even.

0:35 cemerick: People worry so much about security, but then installation instructions for all sorts of stuff is e.g. `curl http://random.url.ru/script.sh | bash`

0:35 Raynes: Heh

0:35 But you can look at the script before bashing it.

0:36 cemerick: security-by-bash-script-scanning

0:37 It's just funny what we all choose to care about.

0:38 amalloy: those installation instructions drive me nuts, cemerick

0:38 * cemerick is waiting for the rm -rf / to finish right now

0:39 amalloy: and i'm not even a terribly security-conscious person. it just seems so presumptuous: "of course the reader will trust me enough to just run this curl"

0:39 Raynes: Yeah, I'd much rather make them work harder because I'm too lazy to read a 10 line installation script and am too afraid.

0:39 cemerick: amalloy: and yet…

0:42 amalloy: "to install my software, please send your email address to foo@bar.com - i'll send you an .exe which you should double-click in Outlook"

0:42 rlb: it's not as trivial when it's multiplied by 30000 packages.

0:42 qmx: cemerick: these bash scripts remember me of this => https://github.com/MrMEEE/bumblebee-Old-and-abbandoned/commit/a047be85247755cdbe0acce6f1dafc8beb84f2ac

0:43 ibdknox: woah.. am I hearing this right? cemerick is trying VIM?

0:44 cemerick: ibdknox: never gave it an honest shot. Things are on a low simmer lately, so it's now or never. :-)

0:46 ibdknox: awesome. :)

0:46 good luck!

0:47 cemerick: heh

0:47 I'll need it, I'm sure.

0:48 ibdknox: vim has a very steep initial curve, but once you're over that you're good to go

0:48 cemerick: macvim is absolutely more polished than any emacs "shell" I've seen on OS X though, I'll give it that.

0:48 ibdknox: cemerick: yeah I've not had any issues with it and I've been using it for quite some time :)

0:49 G0SUB: relevant - http://unix.rulez.org/~calver/pictures/curves.jpg

0:51 amalloy: meta-relevant: http://i4.photobucket.com/albums/y105/Mortimier/LearningCurve-1.jpg

0:51 ibdknox: lol

0:51 amalloy: ew, except someone changed the legends to be for crappy games instead of good ones. bad link from me

0:55 zxcxzc: huh, i just found this in the lein.bat script: "%USERPROFILE%\.m2\repository\org\clojure\clojure\1.2.1\clojure-1.2.1.jar" apparently it wants clojure 1.2.1 to be there? but isnt the current clojure already 1.3? (i dont know what i have, all i did so far was install counterclockwise)

0:58 hm, seems like installing ccw installed clojure 1.2.0 somewhere in ecplise/plugins

1:10 seancorfield: zxcxzc: fwiw, leiningen's plugins and core run on 1.2.1 - many plugins are not compatible with 1.3.0 yet

1:21 zxcxzc: huh, all the clojure 1.3.0 zip files in github say "alpha". i thought clojure 1.3.0 was the current version by now. is that wrong?

1:22 seancorfield: clojure 1.3.0 is on maven central

1:22 1.4.0 beta 1 is also available

1:23 ysph: Are you looking at this page? https://github.com/clojure/clojure/tags

1:23 seancorfield: what zip files in github?? you can download the JAR from clojure.org or just specify dependencies in your leiningen project.clj file

1:23 ysph: github will zip tags, 1.3.0 release is there

1:24 seancorfield: i see clojure-1.3.0.zip there - september 23 - but it sorts below the prerelease builds

1:24 zxcxzc: i havent even gotten leiningen to work yet

1:24 seancorfield: you're on windows?

1:24 zxcxzc: yes

1:24 seancorfield: sorry :(

1:25 clojure tooling is pretty poor on windows

1:25 amalloy: i can't think of any project where downloading a zip from github is a good choice. it's a feature i wish github didn't provide

1:25 Raynes: amalloy: I've downloaded zips where I needed the source code of a project but didn't need the outrageously big history because the author didn't understand that git isn't the place to put binaries.

1:26 zxcxzc: it's not like can find a good description of how to install all this stuff on windows, i just try everything and leave lots of remnants of failed attempts all over the place :D

1:26 seancorfield: fwiw, in the cfml world, source zips are the norm...

1:26 zxcxzc: see if this helps you http://corfield.org/articles/emacs_win.html

1:27 that details my windows xp adventure setting up leiningen and emacs

1:27 Raynes: In Soviet Russia, etc etc.

1:30 zxcxzc: seancorfield: it doenst mention how you installed clojure

1:31 seancorfield: you don't "install clojure" - it's a library, you depend on it in your project

1:31 zxcxzc: but he lein.bat file already uses clojure... and fails to find it

1:32 seancorfield: follow the instructions there to install leiningen properly on windows...

1:32 Raynes: It is meant to download all of its dependencies for you and bootstrap.

1:32 seancorfield: right, but it needs curl or wget

1:32 or you can in theory download the leiningen standalone jar and let it go from there

1:33 zxcxzc: hrm. i tried it with the standalone jar because i didnt want wget and curl

1:33 Raynes: Why not?

1:33 zxcxzc: but it wouldnt work cause it cant find clojure

1:33 so i wanted to install clojure manually but dont really know how

1:33 alright ill get those then

1:33 seancorfield: follow the instructions on that page and see how it goes

1:34 are you on win xp or win 7?

1:34 zxcxzc: 7

1:34 amalloy: heh, i love that those are the two choices. nobody considers vista

1:34 Raynes: amalloy: I was thinking the exact same thing.

1:35 seancorfield: no sane person is still running vista :)

1:35 i ran it for six months then went back to xp, then ran 7 for six months and went back to xp

1:36 ysph: I can attest it is possible to have a good working Emacs and Java setup on windows, though it does require some determination and persistence.

1:36 Raynes: I'm still running vista for various definitions of 'running'.

1:36 seancorfield: ysph: yeah, several folks on win 7 have tried my instructions and got leiningen running but had problems with clojure-jack-in in emacs...

1:36 Raynes: Because I don't use Windows and it is just sitting there and even if I did need to use Windows, I wouldn't pay that insane amount of money for Windows 7.

1:37 seancorfield: it's to do with paths beginning with \u it seems

1:37 emacs thinks that's unicode

1:37 Raynes: i spent $200 on windows vista OEM and thought that was outrageous

1:38 i ran win 7 during the public beta but wouldn't pay $200+ again for an upgrade... outrageous!

1:38 ysph: another option is CCW, though i haven't used it in some time, so i don't know the current state

1:38 ekoontz: ,(= (symbol ":foo") :foo)

1:38 clojurebot: false

1:38 ekoontz: hmm why is it false..?

1:39 ysph: = is object identity?

1:39 seancorfield: ,(symbol ":foo")

1:39 clojurebot: :foo

1:39 seancorfield: and that's a symbol not a keyword - :foo is a keyword

1:39 ekoontz: oh ok, didn't see the difference, thanks

1:39 seancorfield: ,(= (keyword (name (symbol ":foo"))) :foo)

1:40 clojurebot: false

1:40 seancorfield: hah... not what i expected

1:40 scottj: seancorfield: I think win7 upgrade was like $70 before release.

1:40 ekoontz: (= (keyword "obj") :obj)

1:40 seancorfield: oh, of course ##(keyword "foo") is not equal to ##(keyword ":foo")

1:40 lazybot: (keyword "foo") ⇒ :foo

1:40 (keyword ":foo") ⇒ ::foo

1:40 amalloy: seancorfield: sounds kinda like people's experience with clojure 1.3: tried it for a while, none of my programs worked, went back to 1.2

1:40 ekoontz: ,(= (keyword "obj") :obj)

1:40 clojurebot: true

1:40 ekoontz: thanks, that makes sense now :)

1:41 seancorfield: scottj: not for the "ultimate" edition or whatever it was called

1:41 i liked apple's Lion price: $29

1:41 adam_: identical? returns true only when the two objects are the same

1:41 seancorfield: ,(doc identical?)

1:41 clojurebot: "([x y]); Tests if 2 arguments are the same object"

1:41 scottj: seancorfield: yeah perhaps, but not a home edition either. I'm hoping msft will move to apple pricing to get people to upgrade from xp

1:42 levi: Apple has a nice hardware business to subsidize their software. Microsoft doesn't do quite so well there.

1:42 ekoontz: thanks for identical

1:42 (to adam_ and seancorfield)

1:42 seancorfield: levi: true, microsoft only has Office to shore up its O/S pricing :)

1:42 adam_: thank Joy Of Clojure, pg. 71!

1:42 ekoontz: ha, i should get it :)

1:42 seancorfield: it's a good book adam_ ekoontz :)

1:43 buy all of the clojure books!

1:43 adam_: its my favorite, out of the four books out

1:43 clojure in action is pretty good too, but its more project based

1:43 seancorfield: i have Clojure Programming, Clojure in Action, Programming Clojure 2nd Ed, Joy of Clojure

1:43 ekoontz: i have Clojure In Action, which i like a lot

1:43 seancorfield: looking forward to 2nd Ed of Practical Clojure - no point in buying the 1st Ed now... :)

1:44 adam_: Clojure Programming the is O'rielly one?

1:44 seancorfield: I like Clojure Programming best of the introductory books and then Joy Of Clojure as the follow up

1:44 yes adam_

1:44 in Rough Cuts right now but due for release in April

1:44 adam_: okay, that's what I thought

1:44 seancorfield: Programming Clojure is in beta too (Pragmatic Bookshelf)

1:44 scottj: seancorfield: is programming clojure 2nd ed a free upgrade for 1ed buyers?

1:45 seancorfield: scottj: i don't think books work like that :)

1:45 scottj: electronic copy that is

1:47 seancorfield: zxcxzc: if you have any suggestions for my emacs_win.html article, i'll appreciate it

1:53 zxcxzc: it seems all lein self-install id was download the standalone jar and put it in C:/Users/matt/.lein/self-installs. well i dont know if it did anything else, but if that's it i think i could have managed it on my own

1:54 seancorfield: does lein.bat help work now?

1:56 zxcxzc: yeah

1:56 so the standalone jar actually contains clojure 1.2.1... i guess

1:56 seancorfield: then do: lein.bat new test

1:57 zxcxzc: already did

1:57 seancorfield: drop into that new test folder and run: lein test

1:57 it should fail but it will show that clojure is installed/running for you

1:57 zxcxzc: yeah it works

1:57 seancorfield: then you're off to the races

1:58 zxcxzc: yeah, thanks :)

3:23 manuel_: hi

3:24 let's do 10 4clojures before getting started for the day :)

3:26 depy: We already started.. :S

3:27 dunib: how would you go about representing a graph? (with Nodes and Edges) I could do something with vectors and indices, but that would feel a lot like "coding fortran in any language" Is there some canonical way of representing them?

3:27 manuel_: sparce matrices for example

3:30 depy: manuel_ : you could use maps: http://inclojurewetrust.blogspot.com/2009/10/dijkstra-in-clojure.html

3:40 manuel_: yes depends on what your algorithms are going to be i guess

3:40 knuth 4a has obviously a much in-depth overview

3:44 Blkt: good morning everyone

3:47 depy: manuel_, yes. You probably wouldn't use maps for all the way. I guess you would build an abstraction upon it to handle graphs..

5:08 clj_newb: is there a builtin clojure function that takes two lists and produces their cartesian product?

5:11 alandipert: clj_newb: for, kinda... eg (for [x xs, y ys] [x y])

5:12 ,(for [x [:a :b :c :d] y [1 2 3 4]] [x y])

5:12 clojurebot: ([:a 1] [:a 2] [:a 3] [:a 4] [:b 1] ...)

5:16 clj_newb: wtf

5:16 that is much much shorter than the (map ... (map ... ) .. ) I was using

5:17 ,(doc for)

5:17 clojurebot: "([seq-exprs body-expr]); List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more modifiers, and yields a lazy sequence of evaluations of expr. Collections are iterated in a nested fashion, rightmost fastest, and nested coll-exprs can refer to bindings created in prior binding-forms. Supported modifiers are: :let [binding-form expr ...], ...

5:17 * rafl deletes a zip implementation in his code

5:17 rafl: alandipert++

5:17 clj_newb: clojure supports list comprehensions ...

5:19 darq: hi. i have a question about core.logic.. Why is the "_" not mapped to (lvar)?

5:27 tsdh: darq: Could you please be a bit more specific?

5:31 darq: tsdh: i mean when i :use core.logic from repl and try _ i get "Unable to resolve symbol: _" ... but i saw some code examples that use it :confused:

5:32 tsdh: darq: Do you have a link to the examples?

5:33 darq: Most probably, these examples define some custom macro that replace every occurence of _ with a new fresh variable.

5:34 darq: for example from intensivesystems.net the zebra puzzle... i know that it's pretty old but i dont se a macro : http://github.com/jduey/mini-kanren

5:35 sry: this one http://www.intensivesystems.net/tutorials/code/zebra.clj

5:36 I think i see the answer now:) This guy used the kanren version from jduey :)

5:36 tsdh: darq: Exactly. ;-)

5:37 darq: But whay isn't this the default in core.logic?

5:39 The more important part ... how do i create a macro synonym?

5:44 jheander: good morning!

5:44 G0SUB: jheander

5:44 tsdh: darq: That's what I use: http://pastebin.com/LFg1YSrs

5:45 jheander: What's the required order to use and require namespaces in in order to make reify work with protocols that are defined in another namespacE?

5:48 G0SUB: jheander, the protocol itself and the protocol fns live in the declaring ns.

5:49 jheander: right now I have a protocol defined in ns protocols and an implementation defined in ns impl using reify. If I'm currently in ns foo and call the function in impl that works fine and returns a reify reference. However, if I call any of the protocol methods on the reify reference the repl tells me "No implementation of method: :list-config of protocol: #'protocols/Backend found for class: tzrest.backend.zmq$create$reify__867 clojure.core/-cache-protocol-fn

5:49 (core_deftype.clj:495)"

5:50 GOSUB: that makes sense, but clojure seems sensitive to import order if I want the protocol methods to resolve properly on an implementing object.

5:51 G0SUB: jheander, that's why you should avoid calling protocol functions directly.

5:51 jheander, the user of the protocol shouldn't call the protocol fns directly but rather, the protocol implementer should expose simple functions that invoke the protocol functions instead.

5:51 jheander: GOSUB: so I should wrap them in the declaring ns? would that make a difference?

5:52 G0SUB: jheander, for example, clojure.core/reduce

5:52 amalloy: huh? both of you guys are saying crazy things

5:52 G0SUB: amalloy, lol

5:52 Fossi: :D

5:52 jheander: :)

5:52 amalloy: calling protocol functions directly is standard operating procedure, and it doesn't have any reliance on import order

5:53 G0SUB: amalloy, +1

5:53 amalloy: you shouldn't call protocol functions as if they were methods, but that doesn't look like it's happening here

5:54 jheander: if you gist your actual code we can see what's going wrong, but what you're describing doesn't make sense

5:54 jheander: amalloy: but if I'm extremely careful and only include the implementing namespace and then use the protocol functions with their fully qualified name like (protocols/list-config obj) it works fine. However if I try to call from a third namespace with both the protocols and the impl required it says that the protocol is not implemented.

5:57 G0SUB: jheander, (protocols/mymethod (impl/reify-mytype))

5:58 that's how it should look like IMHO.

5:58 jheander: GOSUB: agree :)

5:59 G0SUB: jheander, you don't need to bring in the protocol in the third ns.

6:00 jheander, just the protocol fn & the fn that returns the reified obj should suffice.

6:00 jheander: GOSUB, amalloy: link to gist https://gist.github.com/8e14398ebff2d459caae/cd31f94cb23f8ac971adbdfc1de083dedc941b54

6:02 amalloy: this is probably caused by you reloading the protocol definition

6:02 jheander: amalloy: what does that cause and how can I avoid it?

6:03 amalloy: if you eval a (defprotocol) twice, you get a new protocol with the same name. any reifies or deftypes compiled against the old protocol don't "register" implementations for the new one

6:04 jheander: amalloy: that makes sense considering the symptoms. But if I need to use the protocol in different namespaces I need to (use) or (require) it again, right? Will that cause it to be reloaded?

6:04 amalloy: it won't

6:05 i don't see you doing that anywhere in this gist, and your code looks fine, so i have to guess it's something sloppy during your repl interactions. i don't see how you can create this error message with this code unless you're running some parts of it twice

6:05 G0SUB: is this the repl causing the problem?

6:05 amalloy: eg, (1) paste protocol/reify, (2) play around with stuff and it works, (3) paste protocol, (4) stuff no longer works

6:07 anyway, i have to get to bed. good luck

6:08 jheander: Hmm...I have a proxy function for the "create"-function in another namespace and that namespace also had (:require tzrest.backend.protocols) in its ns-form. If I remove that require it starts to work. Could it be that that require triggered the eval twice?

6:08 amalloy: thanks for the help!

6:10 thheller: how does one use javascript constants in clojurescript? (ex. goog.positioning.Corner.TOP_LEFT)

6:10 jheander: gotta go get some lunch here :) bye!

6:16 broquaint: Presumably the same way you access properties, thheller.

6:16 (.-TOP_LEFT goog.positioning.Corner) ; I think.

6:17 thheller: ah thx

6:17 went with (js* "goog.positioning.Corner.TOP_LEFT")

6:17 hackety hack :P

6:46 faust45: hi guys

6:47 can any one point me to HttpClient long polling req?

6:47 ordnungswidrig: faust45: what's your problem?

6:47 faust45: i use apache http client

6:47 i ordnungswidrig: i need some example, to see the way

6:48 ordnungswidrig: how consume content from long pool

6:49 ordnungswidrig: faust45: you mean, consuming the response body part by part?

6:49 faust45: ordnungswidrig: yes

6:56 ordnungswidrig: faust45: you should use getResponseBodyAsStream on the GetMethod instance and read what you need.

6:58 faust45: ordnungswidrig: GetMethod ?

6:58 ordnungswidrig: faust45: the class from apache http client.

6:59 faust45: http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/methods/GetMethod.html

6:59 faust45: or post if you prefer. doesn't matter

7:03 faust45: ordnungswidrig: i using this code http://pastebin.com/uq7KTWGw

7:08 ordnungswidrig: faust45: instead of using .getEntity use .getResponseBodyAsStream and keep reading from the stream.

10:04 trptcolin: Raynes: just in here for a sec before work, but wanted to give a heads-up that cross-classloader completion should be possible now (not sure if you've run into that already or not): https://github.com/trptcolin/reply/commit/80a448bf551877d54d654ad93f6913a05251fcb6

10:05 however, the way i have it now does imply that the completion code needs to live on the nrepl/project side

10:07 p.s. i'm willing to change just about anything in reply to make things easier to use, both from the user and tool perspective

10:07 cemerick: trptcolin: yeah, tooling stuff always has to be added to the target project's classpath

10:08 Alternatively, it can be loaded in from the client, which is what ccw does.

10:08 The latter is more general, as it allows you to have complete, etc. when you connect to remote, already-running REPLs.

10:09 trptcolin: just sending the code over in eval forms, stuff like that?

10:09 cemerick: yup

10:09 I'd love to get all this sort of stuff into a single clojure tooling library

10:10 trptcolin: so the way clojure-complete works, it takes an ns in whose context to do completion

10:10 cemerick: I think we talked about this for ~5 seconds at the conj. :-)

10:10 trptcolin: sure

10:11 i think the method of sending code over the wire for a needed library makes sense - but don't the same problems exist for conflicts as including it on the classpath?

10:12 granted, it's more dynamic

10:12 cemerick: well, classpath conflict is easier to catch; before launching the server process, you can look to see if nrepl is available via a new URLClassLoader, etc.

10:13 trptcolin: yeah, makes sense

10:14 cemerick: Once you're connected, and want to have tooling available, you can find-ns to see if your tooling is loaded, and if not, shove it all down the pipe.

10:17 trptcolin: ok, so version conflicts could still be nasty, depending on the library, but that definitely sounds simpler that trying to construct the classpath ad-hoc

10:18 for every use case

10:18 cemerick: The more we standardize on a single tooling lib, the easier the whole thing gets

10:19 The only classpath mod you *might* have to make is adding nrepl.

10:20 trptcolin: yep, awesome. and like i said, i'm very willing to extract, change, whatever to get there. using clojure-complete was a step in that direction.

10:23 need to jump off for the workday. wish i could be on here more, i always learn a ton. feel free to email if you've got ideas for things to change in reply (ditto for others!)

10:23 cemerick: trptcolin: So, I'm about 80% of the way there in completing the test suite on the spike of the new nREPL. Hopefully will get that pushed today, and you can start playing w/ it.

10:23 trptcolin: awesome

10:23 cemerick: shouldn't be too much of a transition

10:23 samaaron: cemerick: do you see any possibility of unifying aspects of swank and nrepl?

10:28 cemerick: samaaron: it's tough. swank assumes slime and emacs, to the point that, IIRC, some of its responses are emacs commands

10:28 http://news.ycombinator.com/item?id=3557620

10:28 carp, wrong window

10:29 samaaron: it would be possible to get swank running on top of nrepl, but I don't think that really helps anyone

10:34 kensho: Hi. I use emacs and leiningen and this works great with clojure-jack-in but I'm now wondering what to do about standalone scripts outside a leiningen project? Is there a similiarly easy way to get a repl inside emacs?

10:41 raek: kensho: you can use swank-clojure from that script and start a repl. then you can connect to it with slime-connect from emacs

10:42 "standalone scripts outside a leiningen project" <-- what exactly does this mean? an application that you have started from an uberjar?

10:44 kensho: raek: with standalone I mean an independent clj file.

10:45 raek: well, then you're on your own

10:45 TimMc: kensho: How would the REPL know what libs to pull in?

10:45 raek: you need to start a clojure instance with the swank-clojure jar file and the directory containing the source file on the classpath

10:46 the way clojure is launched is not script friendly at all

10:47 kensho: TimMc: yeah of course this can only work if the script has no external dependencies.

10:48 Hm ok I see, so I will have to start swank manually and connect with slime from within emacs?

10:48 raek: kensho: yes, your script will need to call the swank function that starts a repl server

10:49 kensho: raek: Ok I get it now. Thank you!

10:49 raek: kensho: one thing you could do is to create one leiningen project for all your scripts

10:50 I guess you didn't want to create one project per script

10:50 leiningen was built to make this classpath handling simple

10:51 kensho: raek: yeah it's a good idea but in my particular case this is not practical unfortunately.

10:51 babilen: kensho: https://github.com/mtyaka/lein-oneoff might come in handy as well

10:52 kensho: babilen: that looks interesting thank you

11:05 babilen: thanks again, lein oneoff is pretty much what I was looking for and it seems to work like a charm.

11:05 babilen: wonderful :)

11:08 gtrak``: if you're on heroku, you can't really use clojure's concurrency stuff to share across processes, I guess? has anyone tried to do something with avout?

11:17 dbushenko: hi all!

11:17 gtrak``: hola

11:17 dbushenko: I've got a vector [:a 1, :b 2, :c 3]. How to create a map from it?

11:20 ok, I guess it's array-map func

11:20 gtrak``: apply array-map?

11:21 dbushenko: yep, thanks

11:23 gtrak``: there's a hash-map too

11:23 cran1988: dbushenko: (apply hash-map [:a 1 :c 3 :d 4] )

11:23 dbushenko: cran1988, thanks!

11:24 gtrak``: "Note that an array map will only maintain sort order when un-'modified'. Subsequent assoc-ing will eventually cause it to 'become' a hash-map."

11:30 TimMc: dbushenko: How did you end up with that data structure?

11:31 dbushenko: I've ended up with completely different solution :-)

11:31 actually that doesn't matter, I'm just experimenting

12:03 AWizzArd: While in a repl (slime), how can I read one input value? I tried read and read-line, but those don’t terminate when I press enter.

12:07 raek: AWizzArd: yep. they haven't been implemented in swank-clojure.

12:07 AWizzArd: Ah okay, I see. Thx.

12:07 dbushenko: how can I reload slime/swank without closing the connection?

12:08 raek: dbushenko: reload the code of some namespaces or add a new dependency?

12:08 dbushenko: yes

12:08 raek: both? :-)

12:09 dbushenko: :-D :-D :-D

12:09 sorry

12:09 yes, I want to reload the code

12:09 and yes, I want to add a new jar

12:10 raek: to reload a namespace, press C-c C-k in the buffer with its source file

12:10 to add a new dependency, restart swank

12:10 dbushenko: is it possible to restart swank without closing the connection?

12:11 raek: dbushenko: what you need to do is to add additional entries to the classpath (not restart swank per se)

12:11 dbushenko: hmmm... probably you're right...

12:11 thanks

12:11 raek: add-classpath is deprecated because (apparently) it couldn't always work

12:11 but it might work anyway

12:13 but during the time you spend entering the file:/// urls for each new jar to add-claspath you could as well had restarted the clojure instance

12:24 cemerick: dbushenko: You might be able to use this to add dependencies to a Clojure runtime without restarting it (though it needs to be on your classpath ahead of time to do so). https://github.com/cemerick/pomegranate

12:24 dbushenko: cemerick, thanks!

12:34 codonnel: Hi, does anyone have experience setting up ssl with noir? I'm having all kinds of trouble getting jetty to start up an ssl connection.

12:47 nickmbailey: codonnel_: what is the error?

12:47 we use ring with an ssl connection in our application

12:48 codonnel_: Whenever I try to load up the page in chrome using https, I get an ssl connection error.

12:48 TimMc: codonnel_: What is the actual error?

12:48 There are many kinds.

12:48 codonnel_: Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error.

12:48 It loads just fine if I leave out https

12:49 nickmbailey: and no error logging from ring?

12:49 codonnel_: Nope

12:50 I followed the blog post at http://sharetheconversation.blogspot.com/2012/01/setting-up-self-signed-ssl-certificates.html pretty much to the letter.

12:51 technomancy: scottj: hey, the stickers I ordered came in

12:51 and you are qualified!

12:52 TimMc: hell yes, stickers!

12:52 technomancy: indeed

12:52 faust45: which lib in clijure allow do some thing like jr = new JsonReader(inputStream);

12:52 ?

12:52 technomancy: anyone with a patch accepted is qualified

12:54 nickmbailey: codonnel_: not sure what the problem is then, the info in that post seems correct

12:56 codonnel_: It seems to me that jetty just isn't starting up an ssl connection for some reason even though I passed :ssl? true to jetty.

12:56 I can access the site just fine as long as I don't try to use https.

12:56 TimMc: faust45: You just want to read JSON?

12:57 faust45: TimMc: yes JSON from long polling connection

12:57 TimMc: faust45: https://github.com/dakrone/cheshire

12:57 faust45: TimMc: can i pass (parsed-smile-seq (clojure.java.io/reader "/tmp/foo")) InputStream ?

12:59 TimMc: faust45: Check the docs on clojure.java.io/reader

13:00 dakrone: reader will work on InputStreams

13:01 codonnel_: If it's any help, I get a slightly different error on firefox.

13:01 SSL received a record that exceeded the maximum permissible length. (Error code: ssl_error_rx_record_too_long)

13:02 nickmbailey: codonnel_: sounds like the certificate you generated is bad or something

13:03 codonnel_: hmm, ok. I'll try recreating it.

13:04 That may be true, but I think I'm having an issue with jetty as well.

13:04 Following that blog post, I should be serving through ssl on one port and without on another. But I can't access my app through the normal port that I passed to jetty.

13:06 nickmbailey: so its running a non ssl connector on the ssl port and nothing on the regular port?

13:06 codonnel_: Yeah, that's what it looks like.

13:06 faust45: TimMc: thanks will try

13:09 codonnel_: Maybe there's something borked with my server.clj? Pasted it here: http://pastebin.com/i2rcFreK

13:15 nickmbailey: hmm not familiar with noir we just use ring, my guess would be you shouldn't be passing the ssl-port to server/start

13:16 it is probably starting up the normal connector based on that port and then the ssl connector fails to start since something is already running

13:16 codonnel_: I tried passing it the normal port, but then it doesn't even connect on the ssl port.

13:17 The guy who wrote the blog post also passed it the ssl-port.

13:20 Well, I need to head off to class now. Thanks for the help, nickmbailey.

13:21 r0adrunner: Hi. noob question: anyone knows how to redefine a macro in repl?

13:24 dnolen: r0adrunner: just redefine it

13:25 r0adrunner: dnolen: im trying with the defpage macro of noir. does not seem to work

13:27 like that: (defpage newuser-html "/newuser" []

13:27 (slurp "resources/templates/newuser.html")).


13:27 if i change the body of this in repl, it does not update the output of the url


13:28 dnolen: r0adrunner: ah, that's a noir question really - I'm not sure how defpage works

13:30 r0adrunner: If i recompile it with ^c ^k in emacs, then it gets redefined..

13:31 Anyone knows any resource in the web explaining when macros gets evaluated.. like if it is when it is defined, when it gets called or just once at the start of the program...

13:32 technomancy: jark!

13:33 morphling: r0adrunner: macros get evaluated during compilation. when you change the macro nothing happens, you have to reevaluate its users

13:34 dnolen: r0adrunner: the problem that you're probably encountering is that macros are a static feature, redefining a macro doesn't change code where it was used.

13:35 osa1: which library should I use to read JSON data?

13:35 r0adrunner: im just calling the macro.

13:35 dnolen: r0adrunner: again, I'm not sure what noir does behinds the scenes, best to ask on the Noir mailing list

13:36 r0adrunner: When is it compiled? when i call it? when the program is loadae?

13:36 loaded

13:36 morphling: osa1: https://github.com/clojure/data.json

13:37 dnolen: r0adrunner: macros are just functions that take source and return source - they are expanded during compilation.

13:38 pandeiro: dnolen: i saw your response on cljs jira to ticket 142 i posted... do you think there's a legitimate use case for uuids as map keys?

13:39 r0adrunner: ok ty.. i will go google more..

13:41 dnolen: pandeiro: I personally think the idea is fine, but it doesn't make sense to diverge the behavior of Clojure - and Clojure doesn't seem to officially allow for it (I could be wrong).

13:42 pandeiro: dnolen: you're right per the clojure.org/reader link, but in clojure (pr-str {:9k true}) works, whereas in cljs it doesn't

13:42 jsabeaudry: r0adrunner, Try with C-c C-l [enter] this works fine for me

13:43 dnolen: pandeiro: yup, I'm assuming it's an oversight. to be honest I'm not sure why it works in Clojure, but I'm not a regex expert - https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L325

13:44 pandeiro: dnolen: i see, thanks for the feedback... i guess it's a larger issue than just cljs

13:46 r0adrunner: jsabeaudry: Works for me too. im just wondering why my definitions does not work in the repl.. it seems really to be a noir thing.

13:46 seancorfield: ibdknox: was looking at jayq - nice! - how do I use it in a Clojure/ClojureScript project?

13:46 jsabeaudry: r0adrunner, have you tried evaluating your defpage (C-x C-e) ?

13:47 dnolen: pandeiro: that said, for UUIDs it seems like strings are a better rep anyway? instead of prepending weird unicode chars to the front.

13:48 seancorfield: ibdknox: i see there's a snapshot on clojars - is it as simple as adding a regular dependency to project.clj?

13:48 r0adrunner: yes.. in the code and in repl.. strange thing is that, just saving the file updates the url..

13:48 pandeiro: dnolen: you're right, that's a solution... i just think of clojure maps always being keyed by keywords, and the benefits they bring

13:49 amalloy: dnolen: judging by that regex i'd say rich isn't a regex expert either

13:50 pandeiro: dnolen: rereading the reader document, I don't think it's clear that keywords cannot begin with numeric chars

13:50 amalloy: it does look like he was trying to make it impossible for symbols/keywords to start with a number, but there are a number of issues

13:51 pandeiro: amalloy: eg it's totally possible?

13:51 (for keywords i mean)

13:52 amalloy: that regex matches for symbols too, it just never gets passed a string that starts with a number

13:52 r0adrunner: jsabeaudry: i mean C-x C-e does not work in the source, but saving the file without evaluating the function does

13:53 jsabeaudry: r0adrunner, that must be magic caused by load-views, does the saving work if you use load-views-ns ?

13:53 amalloy: &(let [p (java.util.regex.Pattern/compile "[:]?([\\D&&[^/]].*/)?([\\D&&[^/]][^/]*)")] (re-seq p "foo 1foo :1foo"))

13:53 lazybot: ⇒ (["foo 1foo :1foo" nil "foo 1foo :1foo"])

13:53 amalloy: oh, i guess it's not designed to split whitespace. still, all three of those would match

13:54 pandeiro: seancorfield: you can always just cp the jayq dir to your src/* or src/cljs/* too

13:54 dnolen: '1foo

13:54 ,'1foo

13:54 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NumberFormatException: Invalid number: 1foo>

13:54 amalloy: the second one never gets passed to it, because the number-recognizing code gets in first ands says "that's a number!"

13:54 but when the : is first, that regex gets trotted out

13:57 r0adrunner: jsabeaudry: deactivated load-views, restarted and it is the same behavior

13:57 jsabeaudry: seancorfield, git clone it, lein install it and then add a dep in your project

13:59 r0adrunner, the page shouldnt even load if you removed your load-views, I'm lost

14:03 r0adrunner: jsabeaudry: yeah.. checked it again, it does not..

14:07 jsabeaudry: ...and the saving works with load-views-ns

14:07 osa1: does anyone know a markdown library for clojure?

14:08 jsabeaudry: r0adrunner, what about evaluating the defpage form, does that work with load-views-ns?

14:09 r0adrunner: jsabeaudry: nope

14:09 jsabeaudry: not without saving

14:09 jsabeaudry: osa1, google knows clj-markdown

14:10 amalloy: osa1: i don't think any good ones exist; there might be some bad ones. i'd just look for a java lib

14:11 osa1: jsabeaudry: it looks like clj-markdown is alpha and needs improvements

14:11 amalloy: ok, thanks

14:11 faust45: i try pass org.apache.http.conn.EofSensorInputStream (clojure.java.io/reader ) but got error UnsupportedOperationException Can not create generator for non-byte-based target org.codehaus.jackson.smile.SmileFactory._createJsonParser

14:15 jsabeaudry: r0adrunner, Something seems wrong in your setup, I just tested with load-views-ns and I do not need to save the file at all

14:15 r0adrunner, I simply need to eval the defpage form

14:16 r0adrunner, i.e. C-x C-e

14:16 r0adrunner: jsabeaudry: changed something inside the function body, and it gets redefined?

14:17 wjc: Hi! I don't want to start a troll.. but for the people using vim; what plugins do you use for clojure? slimv/vim-slime/vimclojure?

14:17 jsabeaudry: r0adrunner, If I change the content that is served and eval the defpage the new content is served

14:18 emezeske: wjc: I use http://github.com/emezeske/paredit.vim and http://github.com/vim-scripts/VimClojure

14:18 TimMc: wjc: Plenty of people use vim with Clojure.

14:18 r0adrunner: jsabeaudry: ok ty...

14:18 TimMc: Don't worry, the channel is pretty laid-back over editors, other than insisting that you use something parens-aware. :-)

14:19 jsabeaudry: r0adrunner, Compiling with C-c C-c also works

14:20 r0adrunner: jsabeaudry: yeah.. but then i lose the power of the repl...

14:20 wjc: TimMc: I sure hope they do :) I was using slimv until now, but I'm not really satisfied with it... I was wondering if other plugins were any better

14:22 jsabeaudry: r0adrunner, I have a hard time following you, how does compiling with C-c C-c make you lose anything?

14:22 emezeske: wjc: I find vimclojure to be much better than slimv. That's why I ripped paredit.vim out of slimv, which I felt was the only thing vimclojure was lacking.

14:23 r0adrunner: jsabeaudry: sorry, what works for me is C-c C-k, not C-c C-c

14:25 jsabeaudry: is your program started with lein run?

14:26 jsabeaudry: r0adrunner, no, with clojure-jack-in

14:32 r0adrunner: jsabeaudry: tried without lein run, only with clojure-jack-in and it worked..

14:33 jsabeaudry: is it wrong to start the server with lein run???

14:33 lazybot: r0adrunner: How could that be wrong?

14:33 r0adrunner: lazybot: what?

14:35 jsabeaudry: r0adrunner, I wouldn't know, I don't think I've ever used lein run

14:35 technomancy: it's fine to start servers with lein run

14:36 r0adrunner: so its definitely a noir issue

14:36 jsabeaudry: might be an issue with your slime setup

14:37 r0adrunner: ok ty all. bye

14:41 chipdude: good day

14:41 amalloy: haha high five lazybot

14:41 chipdude: Google so far is not helping me find how to create a genericized object in straight Clojure

14:41 e.g. (let [a (HashMap<String,Object>.)] ... )

14:42 amalloy: chipdude: as in Foo<T>? those don't exist at the bytecode level

14:42 chipdude: no, but Jackson requires me to make one so it can create a type descriptor

14:42 amalloy: i doubt that. it can't detect at runtime what the generic parameters are

14:43 chipdude: the type descriptor hack is common in serialization libs

14:43 it creates an object based on the compiltie specialization, and the -object- survives erasure

14:43 *complete

14:44 http://www.mkyong.com/java/how-to-convert-java-map-to-from-json-jackson/

14:44 I suppose I would have to dive into the TypeReference object and construct it by hand, or else go out to a .java

14:44 bleh

14:45 TimMc: Ugh, Jackson...

14:45 Why are you even using that?

14:45 amalloy: oh yeah, i've seen that trickery with TypeReference but never quite understood it

14:46 chipdude: TimMc: fast, featureful.

14:46 TimMc: hrmf

14:46 cheshire isn't enough?

14:46 brehaut: theres more than 2 features for a json serialization lib?

14:46 chipdude: hehe

14:46 TimMc: brehaut: 1) encode, 2) decode?

14:47 brehaut: TimMc: yeah

14:47 chipdude: you should see the gson feature list. it's sweet. multiple selected subsets of fields by annotation, etc.

14:47 will try cheshire

14:47 brehaut: chipdude: you do know that there are clojure json libs right? and that they are already built on the java libs?

14:48 chipdude: brehaut: learning so

14:48 just building a test framework, not invested in this much

14:48 but it has to be faster than JSON-Simple

14:49 not hard, I know

14:50 scottj: is the method that puts :line meta data on defn vars accessible for my own macros? if a sexp spans multiple lines can it tell what symbols appear on what line or just where the sexp begins?

14:51 amalloy: scottj: everything the reader reads has :line meta on it

14:51 which is the line on which it starts

14:51 TimMc: chipdude: I'm sure there's already a reasonable Clojure wrapper around Jackson as well.

14:52 amalloy: clj-json, right?

14:53 technomancy: cheshire wraps jackson

14:53 chipdude: cheshire seems fine, though classpath hell is blarghing me

14:53 pjstadig: cheshire is a jackson wrapper

14:53 oh :)

14:53 amalloy: chipdude: classpath? i haven't had to worry about classpaths since i started using lein/cake

14:54 hiredman: amalloy: actaully only lists last I checked. last I checked maps, sets, and vectors don't get :line for some reason

14:54 amalloy: lame. what about symbols?

14:55 &(map (juxt identity meta) '[symbol (list) [vector]])

14:55 lazybot: ⇒ ([symbol nil] [(list) {:line 1}] [[vector] nil])

14:56 scottj: bummer

14:57 amalloy: i wonder if there's a reason for that. like, it might be convenient for the reader to return identical? symbols

14:58 scottj: I have a defs form that's like def but takes variable number of names and values like (def a 1 b 2) and I was hoping I could assign a line to the appropriate var so M-. would work, but I guess I'd have to do (defs (a 1) (b 2)) for that to work.

15:05 chipdude: amalloy: classpath hell is just a metaphor

15:06 I have to make an uberjar for Storm, and use HBase, and the cascading dependencies land on three distinct Jackson versions

15:06 amalloy: scottj: you can look at (meta &form)

15:08 that isn't as good as you'd like, of course - it would give them all the same source line

15:08 scottj: amalloy: yeah, that's what I currently have

15:11 romanandreg: is there a jenkins console for the clojure libraries?

15:12 TimMc: romanandreg: http://build.clojure.org/ ?

15:12 romanandreg: TimMc: that's the one I was looking for! thanks

15:25 faust45: what dose mean syntax with * ? for instance fun call (*fun-name*)

15:25 ?

15:26 emezeske: faust45: http://stackoverflow.com/questions/3579063/conventions-style-and-usage-for-clojure-constants

15:26 faust45: emezeske: thanks )

15:27 morphling: faust45: emezeske: usually the earmuffs denote variables intended to be rebound, like *out*, not contstants like \pi

15:28 emezeske: morphling: read the top answer :)

15:29 morphling: emezeske: oh right, there are answers ^^

15:30 faust45: i this code http://friendpaste.com/1wngZOTZcaDQHIZEd1NVj5 what does mean this code

15:30 (or *json-factory*

15:30 json-factory)

15:30 sorry guys for stupid questions

15:33 morphling: faust45: it means if *json-factory* is (dynamically) bound and not nil/false use it, otherwise use some default json-factory that is probably (def json-factory ...)'d somewhere in the file

15:35 faust45: `or` returns its first non-nil/non-false argument or nil

15:35 faust45: morphling: thanks

15:37 morphling: (dynamically) bound its mean in let block ?

15:38 morphling: faust45: no, in a binding block

15:40 faust45: morphling: binding its mean in (defn name [binding] ?

15:41 Raynes: http://en.wikipedia.org/wiki/Language_barrier

15:42 morphling: faust45: http://stackoverflow.com/questions/1523240/let-vs-binding-in-clojure#1523385

15:43 faust45: morphling: but i don't see any binding in this function http://friendpaste.com/1wngZOTZcaDQHIZEd1NVj5

15:43 morphling: what does he check?

15:43 morphling: faust45: that's the point of dynamically rebinding stuff

15:44 faust45: morphling: sorry don't get you

15:47 TimMc: faust45: You should go learn about dynamic scope and thread-local binding.

15:54 faust45: TimMc: ok thanks

16:03 one more question: about http://friendpaste.com/1wngZOTZcaDQHIZEd1NVj5 so as i follow, i can define *json-factory* in my app and this lib json cheshire will use it ?

16:06 TimMc: What is this code you pasted?

16:06 Cancel that... what are you trying to do?

16:09 faust45: TimMc: i have a problem, with parsing json feed from http long pool, but just now i am try figure out this piece of code from dakrone/cheshire

16:11 TimMc: Oh, then why didn't you just link to the source code in the git repo for Cheshire? That would have been way less confusing.

16:22 dakrone: faust45: you shouldn't have to worry about binding it unless you need some of the advanced Jackson features

16:24 faust45: dakrone: can you help me? i just try pass org.apache.http.conn.EofSensorInputStream to (clojure.java.io/reader

16:24 dakrone: faust45: what is your end goal?

16:24 faust45: dakrone: accept and parse json stream come from http long poll connection

16:25 dakrone: faust45: you should be able to do (parse-stream (clojure.java.io/reader <your-stream>))

16:25 faust45: dakrone: not parsed-smile-seq ?

16:26 dakrone: that's for parsing SMILE, you said JSON right?

16:26 faust45: dakrone: yes

16:26 dakrone: looks working )

16:27 thanks

16:28 dakrone: np, good luck

16:31 faust45: dakrone: parse-stream will waiting until EOF ?

16:31 dakrone: it will read the stream

16:33 amalloy: has anyone had issues with fieldname munging in 1.4? (defrecord Foo []) (reflect Foo) shows a field named __meta; on 1.2/1.3 you can get at that via (.--meta f), but on 1.4 that fails and (.-meta f) works. in all cases (.__meta f) also works

16:34 faust45: dakrone: but can i get access to first item? until stream EOF

16:36 dakrone: faust45: you need to just read only the first json object?

16:37 faust45: dakrone: i need read one by one upon receipt

16:38 dakrone: faust45: that's on the roadmap, but right now it reads the entire stream and returns a decoded object

16:39 faust45: dakrone: its read stream until EOF ?

16:39 dakrone: but my stream never EOF

16:39 dakrone: until the stream has been entirely read, I'm not sure of the underlying reading mechanism, you should try it with yours and see how it behaves, what is creating this stream?

16:40 faust45: dakrone: its apache http org.apache.http.conn.EofSensorInputStream

16:40 dakrone: faust45: are you using clj-http by any chance?

16:41 faust45: dakrone: no, i use raw apache lib, i prefer be close to metal )

16:42 TimMc: >_<

16:42 dakrone: alright, well I will test it next time I get a shot, there is already an issue open for cheshire about it

16:42 technomancy: org.metallica.BassLineInputStream

16:43 ^ close to the metal

16:43 * technomancy flees

16:43 faust45: dakrone: issue about org.apache.http.conn.EofSensorInputStream

16:43 ?

16:44 dakrone: faust45: that's just a regular InputStream that closes itself when it's been completely read

16:44 faust45: dakrone: yes i know

16:44 dakrone: https://github.com/dakrone/cheshire/issues/17

17:07 emezeske: seancorfield: Is this you? If so, nice write-up! :) http://corfield.org/blog/post.cfm/getting-started-with-clojurescript-and-fw-1

17:13 Raynes: It is him.

17:13 Sean Corfield is my sheppard. I shall not want.

17:15 TimMc: Is there any mechanism in Clojure for functions that dispatch on the types in their full argument list, not just arity or first arg?

17:15 brehaut: mutlis right?

17:15 multis

17:16 TimMc: and by dispatch, I mean the fast JVM stuff, not reflection

17:16 brehaut: then i think no

17:16 the JVM doesnt have any mechanism like that right?

17:16 TimMc: Hrmf.

17:16 emezeske: Raynes: :P

17:17 TimMc: brehaut: I may be confusing myself.

17:18 brehaut: The background is that tmciver and I are trying to update clojure.contrib.import-static to allow for full type-hinting and fast dispatch.

17:18 Math/abs is presenting a challenge, since it is overloaded with 4 unary versions that take different prim types.

17:18 Raynes: amalloy just corrected my spelling of shepherd in another channel, and for that we thank him.

17:18 amalloy: TimMc: multis are not reflective

17:19 but they're not nearly as optimized as protocols

17:19 TimMc: and protocols would not get me where I want to go, right?

17:19 amalloy: right

17:20 brehaut: TimMc: i presume you already know that overload types are computed at compile time

17:22 TimMc: yeah

17:23 This macro does reflection and creates private fns in the namespace that call static methods with their args.

17:23 I was hoping there was a way to hook into that compile-time overload identification from Clojure.

17:26 aperiodic: are all the hotkeys for paredit.vim the same as in emacs?

17:26 i can't seem to find a reference for paredit.vim in particular

17:27 emezeske: aperiodic: :help paredit

17:28 aperiodic: or https://github.com/emezeske/paredit.vim/blob/master/doc/paredit.txt

17:29 aperiodic: emezeske: thanks! ':help paredit' gives me 'no help for paredit', though that text file is in my doc folder

17:30 emezeske: aperiodic: I think you have to tell vim to update your help docs (I forget the command)

17:32 aperiodic: emezeske: ':helptags /path/to/doc'

17:32 emezeske: aperiodic: nice, thanks :)

17:32 aperiodic: emezeske: just returning the favor :)

18:24 TimMc: Ugh, I guess the only way to get type hinting on arbitrary method-proxying functions is to require the user to specify the signature: (import-static (Math {abs (abs double), abs-int (abs int)}))

18:27 which would compile to somethign like (do (defn- ^double abs [^double x#] (. Math abs x#)) ...)

18:28 aperiodic: is that specifying the argument type, the return value, or both?

18:28 TimMc: Just the args.

18:29 If the arg types are known, the macro can get the return type by reflection.

18:31 aperiodic: i was gonna ask why you don't just generate foo-int, foo-double, etc, and let the user select, but that doesn't really save the user any keystrokes

18:31 that's unfortunate

18:32 TimMc: I think the only way to avoid this would be via a bytecode-generating thing inspired by Protocol.

18:32 ...and then used by this macro.

18:33 Ah well.

18:33 aperiodic: how would bytecode generation help?

18:33 TimMc: Isn't that how the implementation of protocols in Clojure is done?

18:34 It can't rely on other Clojure or Java stuff, it has to go straight to JVM APIs.

18:34 * aperiodic doesn't know

18:34 aperiodic: I'm just asking for my own edification

18:35 TimMc: Basically, you need soemthing that can generate methods with specific signatures.

18:36 Wait.. maybe reify does this!

18:36 Oh hell, I'm sure it can. WTF.

18:37 arohner: TimMc: you absolutely can generate fns w/ type hints. Just stick metadata on the symbols for the arguments

18:37 TimMc: arohner: I need type-based dispatch to the correct fn body.

18:38 not a very Clojure-y thing, but oh well.

18:38 (it's for interop with Java static methods)

18:38 arohner: type-based dispatch sounds a lot like protocols

18:39 TimMc: arohner: That only dispatches on first arg, right?

18:39 arohner: TimMc: yes

18:39 TimMc: Yeah, I need for than that, unfortunately.

18:39 arohner: you can always use multimethods

18:40 TimMc: Nah, that would incur reflection and boxing.

18:40 arohner: those can dispatch on arbitrary fns of the arguments

18:41 I'm pretty sure those are your options

18:41 franks: amalloy: Q about "useful.utils/thread-local", did I test it correctly that a thread does not inherit the thread local state by default?

18:41 aperiodic: naw, you can definitely do this with reify or gen-class

18:42 arohner: what is 'this', exactly?

18:42 amalloy: inherit? from what, its parent thread? java threads don't have parents

18:42 TimMc: arohner: The idea here is to automatically create inlineable fns for static methods. tmciver and I are trying to put import-static on steroids.

18:42 seancorfield: emezeske: yeah, corfield.org is me - i've been meaning to write up something simple about clojurescript for a while now that i'm using your leiningen plugin

18:43 arohner: so you can use gen-class or reify to do your dispatching 'manually', but you'll definitely box across clojure fn boundaries

18:44 seancorfield: guess i'll try the project.clj dependency approach to jayq and see if it is that simple (in regards my earlier Q to ibdknox :)

18:44 TimMc: arohner: Even for small-arity fns? I thought 1.3 added support for that.

18:44 arohner: oh, I see. you want to create a thing that implements iFn, and has several implementations of .invoke() that match the semantics of the original fn

18:44 franks: amalloy: right - parent thread... didn't know java does not have "parent" threads... if so, guess expecting state to be avaiable in the threads you kick off does not make sense (?)

18:45 TimMc: arohner: Yes. contrib's import-static creates macros, which can't be passed around. Very limited.

18:45 emezeske: seancorfield: I threw jayq into my project's :dependencies and it's working great

18:45 TimMc: amalloy: Not entirely true -- there is InheritableThreadLocal, which has the semantics of parent/child.

18:45 * amalloy didn't know about that one

18:46 arohner: TimMc: clj 1.3 added .invoke() for several permutations of primitives, but not arbitrary primitives

18:46 TimMc: You specify how you want state to be inherited.

18:46 arohner: I guess that will have to be good enough. :-/

18:47 arohner: TimMc: very cool idea though. I hope it works

18:47 lnostdal: gah, the default laziness of stuff doesn't seem very useful most of the time ...

18:47 it's just a source of unexpected weirdness and bugs

18:47 TimMc: arohner: Me too! At the very least, we'll release an import+ that does some other import-related tricks.

18:47 franks: interesting: "Inheritable thread-local variables are used in preference to ordinary thread-local variables when the per-thread-attribute being maintained in the variable (e.g., User ID, Transaction ID) must be automatically transmitted to any child threads that are created.", which is the use case I'm looking at...

18:48 arohner: TimMc: I think you have more options than just what 1.3 provides

18:48 I'm just not sure what assumptions the compiler makes re: .invoke() and boxing

18:49 and I'm not sure why rhickey listed the permutations of .invoke() overrides, rather than just generating them

18:50 amalloy: arohner: because java doesn't have macros?

18:50 seancorfield: emezeske: did you have to do anything beyond adding it to :dependencies and just :require it in the ns?

18:51 TimMc: arohner: Ah, so I could add the necessary permutations in the reify I generate?

18:52 At some point I'll have to figure out how to tell when my code is boxing. :-)

18:52 emezeske: seancorfield: not that I recall!

18:52 seancorfield: I'm actually using jayq+crate+fetch, and it was all pretty easy

18:55 cran1988: ,(neg? (-4 (-4)))

18:55 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

18:55 cran1988: why?????????????

18:55 ,(neg? (- 4 3))

18:55 clojurebot: false

18:56 cran1988: ok cool

18:56 i thought i was insane

18:57 arohner: TimMc: your code is always boxes primitives, unless it takes a primitive type hint.

18:57 TimMc: re: invoke generation, I believe it's because the compiler only deals with IFn. If you generate a new override for your primitive, that will be as a subclass of IFn

18:58 i.e. the compiler is not going to look if your specific fn implements a non-standard primitive override at runtime

18:59 konr: If I define foo with defrecord on namespace bar, and then on namespace baz use bar, shouldn't foo be available there?

18:59 arohner: konr: import defrecords

19:00 konr: records are java classes, not fns

19:00 konr: arohner: thanks!

19:01 arohner: konr: however, the protocol methods are clojure fns

19:20 hagna: do libraries found with lein search have docs or is that not a rule?

19:24 konr: Is there a format to document the arguments of a function?

19:24 technomancy: hagna: all well-behaved projects will have docstrings, but not many have the docs published in HTML

19:27 hagna: technomancy: so to decide what to call in the library I probably just need to look at the source; how do you do that?

19:28 technomancy: M-. if you're using Emacs; otherwise you can peek inside your lib directory or search github.

19:32 hagna: technomancy: ok that's nothing new but thanks

19:51 rlb: amalloy: thanks, I saw .deleteOnExit, but I wanted something more immediate (and flexible).

19:51 amalloy: rlb: right, so you can do the immediate/flexible thing for convenience, with .deleteOnExit as a fallback for an unexpected C-c

19:52 rlb: amalloy: true, but I didn't want the irrevocability of delete on exit.

19:53 (iirc it deletes that path, no matter what, with no possibility of cancellation)

19:54 In any case, I think I know what I want to do instead (if/when I get around to it).

20:20 TimMc: arohner: I see, yeah. If I want to proxy abs(float) and abs(double), the compiler makes me select from abs(double) and abs(Object) :-/

20:29 I guess this means it is currently impossible in clojure to (map f ...) where f is an unboxed call to a Java fn that takes floats.

20:31 arohner: TimMc: I believe that's correct, yes

20:31 TimMc: OK, thanks. I guess I'll write this all down so the next person doesn't have to figure it out. >_<

20:39 zztw: http://fpaste.org/xvYO/ this clojure code is behaving strangely. i'm trying to track down this stack trace http://fpaste.org/MVkV/ using the nnul function you can see in xvYO. Weird thing is that the printlns work but nothing is printed and no exception is thrown at the nnul between testx and testxx. can someone enlighten me about what's going on?

21:10 dakrone: the worst part of releasing OSS is having to write announcement emails

21:10 * dakrone wishes to hire that part out

21:10 brehaut: what is the beer stuart halloway is drinking in the ousterhout's dichotomy?

21:11 TimMc: dakrone: Even worse than dealing with whiny users? :-)

21:11 tmciver: Here's my brain dump on why we're stuck with macros for the moment with import-static: https://github.com/baznex/imports/blob/master/dev/why-macros.md

21:12 dakrone: TimMc: much rather deal with the users, for me

21:17 oakwise: dakrone: it can be done http://www.esquire.com/features/ESQ0905OUTSOURCING_214

21:31 dgrnbrg: Has anyone noticed the clojure mailing list not delivering msgs?

21:43 lysu: \clear

22:53 seancorf`: dgrnbrg: probably first post moderation to avoid spam?

22:53 dgrnbrg: I didn't post anything I think--I mean that I got 40 delivered today and none this past week

22:53 I just got jan22 delivered

22:53 or something weird

22:53 seancorf`: hmm, no, can't say i've seen that sort of strange behavior

22:54 are you subscribed with a gmail address or something else?

22:55 dgrnbrg: gmail

22:59 seancorf`: hmm, for me the flow of messages has been constant and fairly immediate (i'm subscribed via gmail too)... sorry i can't shed more light...

23:07 cemerick: the google group mail gateway often acts strangely, both in and out

23:52 xuser: dsakjfs;fkljsa~

23:53 sdfdsfsa

23:53 adiabatic: same to you, bub

23:53 xuser: '

23:57 seancorfield: ibdknox: you around?

23:57 emezeske: you?

23:59 i'm try to use jayq - i added the dependency to project.clj and it downloaded it (good), i included jquery 1.7 in my HTML, i see complaint that /deps.js is missing - what is that and what should be in it?

Logging service provided by n01se.net