#clojure logs

2012-02-06

00:24cemerickI'm reading vim documentation right now. Damn you Raynes, damn you. ;-)
00:25RaynesHeh.
00:26cemerickRaynes: did you just stumble your way through learning everything, or is there a recommended resource?
00:27Raynes$google janus vim
00:27lazybot[carlhuda/janus - GitHub] https://github.com/carlhuda/janus
00:27RaynesThat and any given cheatsheet.
00:27RaynesJust get ready to deal with looking everything up six times before you memorize it.
00:27RaynesAfter that, smooth sailing.
00:28Raynescemerick: 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.
00:29cemerickRaynes: oh, as opposed to that hjkl stuff? yeah
00:29RaynesSome people dig it, I'm not one of them.
00:30cemerickPerhaps 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.
00:30RaynesHah
00:30cemerickThe macvim UI is decent enough that I've not gone mad yet. :-)
00:30zxcxzchrm, 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))
00:30RaynesMacvim is excellent.
00:31Raynescemerick: If you get tired of the menubar at the top, set go-=T
00:31cemerickThat vimrc stuff looks like a tangle tho. If only extensions, etc. defined settings along with styles and such to build e.g. preference panes.
00:31cemerickNah, that'd be too easy. :-P
00:32RaynesSome plugins do add menu items.
00:32cemerickRaynes: you mean the toolbar?
00:32RaynesYes.
00:32cemerickRaynes: or you can just click the toolbar toggle button at the upper-right of any OS X window ;-)
00:33RaynesI'm… not sure we're talking about the same thing then.
00:33cemerickentirely possible
00:33RaynesAnywasys.
00:33RaynesAnyways, even.
00:35cemerickPeople 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`
00:35RaynesHeh
00:35RaynesBut you can look at the script before bashing it.
00:36cemericksecurity-by-bash-script-scanning
00:37cemerickIt's just funny what we all choose to care about.
00:38amalloythose installation instructions drive me nuts, cemerick
00:39amalloyand 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"
00:39RaynesYeah, I'd much rather make them work harder because I'm too lazy to read a 10 line installation script and am too afraid.
00:39cemerickamalloy: and yet…
00:42amalloy"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"
00:42rlbit's not as trivial when it's multiplied by 30000 packages.
00:42qmxcemerick: these bash scripts remember me of this => https://github.com/MrMEEE/bumblebee-Old-and-abbandoned/commit/a047be85247755cdbe0acce6f1dafc8beb84f2ac
00:43ibdknoxwoah.. am I hearing this right? cemerick is trying VIM?
00:44cemerickibdknox: never gave it an honest shot. Things are on a low simmer lately, so it's now or never. :-)
00:46ibdknoxawesome. :)
00:46ibdknoxgood luck!
00:47cemerickheh
00:47cemerickI'll need it, I'm sure.
00:48ibdknoxvim has a very steep initial curve, but once you're over that you're good to go
00:48cemerickmacvim is absolutely more polished than any emacs "shell" I've seen on OS X though, I'll give it that.
00:48ibdknoxcemerick: yeah I've not had any issues with it and I've been using it for quite some time :)
00:49G0SUBrelevant - http://unix.rulez.org/~calver/pictures/curves.jpg
00:51amalloymeta-relevant: http://i4.photobucket.com/albums/y105/Mortimier/LearningCurve-1.jpg
00:51ibdknoxlol
00:51amalloyew, except someone changed the legends to be for crappy games instead of good ones. bad link from me
00:55zxcxzchuh, 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)
00:58zxcxzchm, seems like installing ccw installed clojure 1.2.0 somewhere in ecplise/plugins
01:10seancorfieldzxcxzc: fwiw, leiningen's plugins and core run on 1.2.1 - many plugins are not compatible with 1.3.0 yet
01:21zxcxzchuh, 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?
01:22seancorfieldclojure 1.3.0 is on maven central
01:22seancorfield1.4.0 beta 1 is also available
01:23ysphAre you looking at this page? https://github.com/clojure/clojure/tags
01:23seancorfieldwhat zip files in github?? you can download the JAR from clojure.org or just specify dependencies in your leiningen project.clj file
01:23ysphgithub will zip tags, 1.3.0 release is there
01:24seancorfieldi see clojure-1.3.0.zip there - september 23 - but it sorts below the prerelease builds
01:24zxcxzci havent even gotten leiningen to work yet
01:24seancorfieldyou're on windows?
01:24zxcxzcyes
01:24seancorfieldsorry :(
01:25seancorfieldclojure tooling is pretty poor on windows
01:25amalloyi 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
01:25Raynesamalloy: 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.
01:26zxcxzcit'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
01:26seancorfieldfwiw, in the cfml world, source zips are the norm...
01:26seancorfieldzxcxzc: see if this helps you http://corfield.org/articles/emacs_win.html
01:27seancorfieldthat details my windows xp adventure setting up leiningen and emacs
01:27RaynesIn Soviet Russia, etc etc.
01:30zxcxzcseancorfield: it doenst mention how you installed clojure
01:31seancorfieldyou don't "install clojure" - it's a library, you depend on it in your project
01:31zxcxzcbut he lein.bat file already uses clojure... and fails to find it
01:32seancorfieldfollow the instructions there to install leiningen properly on windows...
01:32RaynesIt is meant to download all of its dependencies for you and bootstrap.
01:32seancorfieldright, but it needs curl or wget
01:32seancorfieldor you can in theory download the leiningen standalone jar and let it go from there
01:33zxcxzchrm. i tried it with the standalone jar because i didnt want wget and curl
01:33RaynesWhy not?
01:33zxcxzcbut it wouldnt work cause it cant find clojure
01:33zxcxzcso i wanted to install clojure manually but dont really know how
01:33zxcxzcalright ill get those then
01:33seancorfieldfollow the instructions on that page and see how it goes
01:34seancorfieldare you on win xp or win 7?
01:34zxcxzc7
01:34amalloyheh, i love that those are the two choices. nobody considers vista
01:34Raynesamalloy: I was thinking the exact same thing.
01:35seancorfieldno sane person is still running vista :)
01:35seancorfieldi ran it for six months then went back to xp, then ran 7 for six months and went back to xp
01:36ysphI can attest it is possible to have a good working Emacs and Java setup on windows, though it does require some determination and persistence.
01:36RaynesI'm still running vista for various definitions of 'running'.
01:36seancorfieldysph: yeah, several folks on win 7 have tried my instructions and got leiningen running but had problems with clojure-jack-in in emacs...
01:36RaynesBecause 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.
01:37seancorfieldit's to do with paths beginning with \u it seems
01:37seancorfieldemacs thinks that's unicode
01:37seancorfieldRaynes: i spent $200 on windows vista OEM and thought that was outrageous
01:38seancorfieldi ran win 7 during the public beta but wouldn't pay $200+ again for an upgrade... outrageous!
01:38ysphanother option is CCW, though i haven't used it in some time, so i don't know the current state
01:38ekoontz,(= (symbol ":foo") :foo)
01:38clojurebotfalse
01:38ekoontzhmm why is it false..?
01:39ysph= is object identity?
01:39seancorfield,(symbol ":foo")
01:39clojurebot:foo
01:39seancorfieldand that's a symbol not a keyword - :foo is a keyword
01:39ekoontzoh ok, didn't see the difference, thanks
01:39seancorfield,(= (keyword (name (symbol ":foo"))) :foo)
01:40clojurebotfalse
01:40seancorfieldhah... not what i expected
01:40scottjseancorfield: I think win7 upgrade was like $70 before release.
01:40ekoontz(= (keyword "obj") :obj)
01:40seancorfieldoh, of course ##(keyword "foo") is not equal to ##(keyword ":foo")
01:40lazybot(keyword "foo") ⇒ :foo
01:40lazybot(keyword ":foo") ⇒ ::foo
01:40amalloyseancorfield: 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
01:40ekoontz,(= (keyword "obj") :obj)
01:40clojurebottrue
01:40ekoontzthanks, that makes sense now :)
01:41seancorfieldscottj: not for the "ultimate" edition or whatever it was called
01:41seancorfieldi liked apple's Lion price: $29
01:41adam_identical? returns true only when the two objects are the same
01:41seancorfield,(doc identical?)
01:41clojurebot"([x y]); Tests if 2 arguments are the same object"
01:41scottjseancorfield: yeah perhaps, but not a home edition either. I'm hoping msft will move to apple pricing to get people to upgrade from xp
01:42leviApple has a nice hardware business to subsidize their software. Microsoft doesn't do quite so well there.
01:42ekoontzthanks for identical
01:42ekoontz(to adam_ and seancorfield)
01:42seancorfieldlevi: true, microsoft only has Office to shore up its O/S pricing :)
01:42adam_thank Joy Of Clojure, pg. 71!
01:42ekoontzha, i should get it :)
01:42seancorfieldit's a good book adam_ ekoontz :)
01:43seancorfieldbuy all of the clojure books!
01:43adam_its my favorite, out of the four books out
01:43adam_clojure in action is pretty good too, but its more project based
01:43seancorfieldi have Clojure Programming, Clojure in Action, Programming Clojure 2nd Ed, Joy of Clojure
01:43ekoontzi have Clojure In Action, which i like a lot
01:43seancorfieldlooking forward to 2nd Ed of Practical Clojure - no point in buying the 1st Ed now... :)
01:44adam_Clojure Programming the is O'rielly one?
01:44seancorfieldI like Clojure Programming best of the introductory books and then Joy Of Clojure as the follow up
01:44seancorfieldyes adam_
01:44seancorfieldin Rough Cuts right now but due for release in April
01:44adam_okay, that's what I thought
01:44seancorfieldProgramming Clojure is in beta too (Pragmatic Bookshelf)
01:44scottjseancorfield: is programming clojure 2nd ed a free upgrade for 1ed buyers?
01:45seancorfieldscottj: i don't think books work like that :)
01:45scottjelectronic copy that is
01:47seancorfieldzxcxzc: if you have any suggestions for my emacs_win.html article, i'll appreciate it
01:53zxcxzcit 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
01:54seancorfielddoes lein.bat help work now?
01:56zxcxzcyeah
01:56zxcxzcso the standalone jar actually contains clojure 1.2.1... i guess
01:56seancorfieldthen do: lein.bat new test
01:57zxcxzcalready did
01:57seancorfielddrop into that new test folder and run: lein test
01:57seancorfieldit should fail but it will show that clojure is installed/running for you
01:57zxcxzcyeah it works
01:57seancorfieldthen you're off to the races
01:58zxcxzcyeah, thanks :)
03:23manuel_hi
03:24manuel_let's do 10 4clojures before getting started for the day :)
03:26depyWe already started.. :S
03:27dunibhow 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?
03:27manuel_sparce matrices for example
03:30depymanuel_ : you could use maps: http://inclojurewetrust.blogspot.com/2009/10/dijkstra-in-clojure.html
03:40manuel_yes depends on what your algorithms are going to be i guess
03:40manuel_knuth 4a has obviously a much in-depth overview
03:44Blktgood morning everyone
03:47depymanuel_, yes. You probably wouldn't use maps for all the way. I guess you would build an abstraction upon it to handle graphs..
05:08clj_newbis there a builtin clojure function that takes two lists and produces their cartesian product?
05:11alandipertclj_newb: for, kinda... eg (for [x xs, y ys] [x y])
05:12alandipert,(for [x [:a :b :c :d] y [1 2 3 4]] [x y])
05:12clojurebot([:a 1] [:a 2] [:a 3] [:a 4] [:b 1] ...)
05:16clj_newbwtf
05:16clj_newbthat is much much shorter than the (map ... (map ... ) .. ) I was using
05:17clj_newb,(doc for)
05:17clojurebot"([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 ...], ...
05:17raflalandipert++
05:17clj_newbclojure supports list comprehensions ...
05:19darqhi. i have a question about core.logic.. Why is the "_" not mapped to (lvar)?
05:27tsdhdarq: Could you please be a bit more specific?
05:31darqtsdh: 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:
05:32tsdhdarq: Do you have a link to the examples?
05:33tsdhdarq: Most probably, these examples define some custom macro that replace every occurence of _ with a new fresh variable.
05:34darqfor 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
05:35darqsry: this one http://www.intensivesystems.net/tutorials/code/zebra.clj
05:36darqI think i see the answer now:) This guy used the kanren version from jduey :)
05:36tsdhdarq: Exactly. ;-)
05:37darqBut whay isn't this the default in core.logic?
05:39darqThe more important part ... how do i create a macro synonym?
05:44jheandergood morning!
05:44G0SUBjheander
05:44tsdhdarq: That's what I use: http://pastebin.com/LFg1YSrs
05:45jheanderWhat's the required order to use and require namespaces in in order to make reify work with protocols that are defined in another namespacE?
05:48G0SUBjheander, the protocol itself and the protocol fns live in the declaring ns.
05:49jheanderright 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
05:49jheander(core_deftype.clj:495)"
05:50jheanderGOSUB: that makes sense, but clojure seems sensitive to import order if I want the protocol methods to resolve properly on an implementing object.
05:51G0SUBjheander, that's why you should avoid calling protocol functions directly.
05:51G0SUBjheander, 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.
05:51jheanderGOSUB: so I should wrap them in the declaring ns? would that make a difference?
05:52G0SUBjheander, for example, clojure.core/reduce
05:52amalloyhuh? both of you guys are saying crazy things
05:52G0SUBamalloy, lol
05:52Fossi:D
05:52jheander:)
05:52amalloycalling protocol functions directly is standard operating procedure, and it doesn't have any reliance on import order
05:53G0SUBamalloy, +1
05:53amalloyyou shouldn't call protocol functions as if they were methods, but that doesn't look like it's happening here
05:54amalloyjheander: if you gist your actual code we can see what's going wrong, but what you're describing doesn't make sense
05:54jheanderamalloy: 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.
05:57G0SUBjheander, (protocols/mymethod (impl/reify-mytype))
05:58G0SUBthat's how it should look like IMHO.
05:58jheanderGOSUB: agree :)
05:59G0SUBjheander, you don't need to bring in the protocol in the third ns.
06:00G0SUBjheander, just the protocol fn & the fn that returns the reified obj should suffice.
06:00jheanderGOSUB, amalloy: link to gist https://gist.github.com/8e14398ebff2d459caae/cd31f94cb23f8ac971adbdfc1de083dedc941b54
06:02amalloythis is probably caused by you reloading the protocol definition
06:02jheanderamalloy: what does that cause and how can I avoid it?
06:03amalloyif 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
06:04jheanderamalloy: 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?
06:04amalloyit won't
06:05amalloyi 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
06:05G0SUBis this the repl causing the problem?
06:05amalloyeg, (1) paste protocol/reify, (2) play around with stuff and it works, (3) paste protocol, (4) stuff no longer works
06:07amalloyanyway, i have to get to bed. good luck
06:08jheanderHmm...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?
06:08jheanderamalloy: thanks for the help!
06:10thhellerhow does one use javascript constants in clojurescript? (ex. goog.positioning.Corner.TOP_LEFT)
06:10jheandergotta go get some lunch here :) bye!
06:16broquaintPresumably the same way you access properties, thheller.
06:16broquaint(.-TOP_LEFT goog.positioning.Corner) ; I think.
06:17thhellerah thx
06:17thhellerwent with (js* "goog.positioning.Corner.TOP_LEFT")
06:17thhellerhackety hack :P
06:46faust45hi guys
06:47faust45can any one point me to HttpClient long polling req?
06:47ordnungswidrigfaust45: what's your problem?
06:47faust45i use apache http client
06:47faust45i ordnungswidrig: i need some example, to see the way
06:48faust45ordnungswidrig: how consume content from long pool
06:49ordnungswidrigfaust45: you mean, consuming the response body part by part?
06:49faust45ordnungswidrig: yes
06:56ordnungswidrigfaust45: you should use getResponseBodyAsStream on the GetMethod instance and read what you need.
06:58faust45ordnungswidrig: GetMethod ?
06:58ordnungswidrigfaust45: the class from apache http client.
06:59ordnungswidrigfaust45: http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/methods/GetMethod.html
06:59ordnungswidrigfaust45: or post if you prefer. doesn't matter
07:03faust45ordnungswidrig: i using this code http://pastebin.com/uq7KTWGw
07:08ordnungswidrigfaust45: instead of using .getEntity use .getResponseBodyAsStream and keep reading from the stream.
10:04trptcolinRaynes: 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:05trptcolinhowever, the way i have it now does imply that the completion code needs to live on the nrepl/project side
10:07trptcolinp.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:07cemericktrptcolin: yeah, tooling stuff always has to be added to the target project's classpath
10:08cemerickAlternatively, it can be loaded in from the client, which is what ccw does.
10:08cemerickThe latter is more general, as it allows you to have complete, etc. when you connect to remote, already-running REPLs.
10:09trptcolinjust sending the code over in eval forms, stuff like that?
10:09cemerickyup
10:09cemerickI'd love to get all this sort of stuff into a single clojure tooling library
10:10trptcolinso the way clojure-complete works, it takes an ns in whose context to do completion
10:10cemerickI think we talked about this for ~5 seconds at the conj. :-)
10:10trptcolinsure
10:11trptcolini 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:12trptcolingranted, it's more dynamic
10:12cemerickwell, 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:13trptcolinyeah, makes sense
10:14cemerickOnce 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:17trptcolinok, 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:18trptcolinfor every use case
10:18cemerickThe more we standardize on a single tooling lib, the easier the whole thing gets
10:19cemerickThe only classpath mod you *might* have to make is adding nrepl.
10:20trptcolinyep, 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:23trptcolinneed 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:23cemericktrptcolin: 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:23trptcolinawesome
10:23cemerickshouldn't be too much of a transition
10:23samaaroncemerick: do you see any possibility of unifying aspects of swank and nrepl?
10:28cemericksamaaron: it's tough. swank assumes slime and emacs, to the point that, IIRC, some of its responses are emacs commands
10:28cemerickhttp://news.ycombinator.com/item?id=3557620
10:28cemerickcarp, wrong window
10:29cemericksamaaron: it would be possible to get swank running on top of nrepl, but I don't think that really helps anyone
10:34kenshoHi. 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:41raekkensho: you can use swank-clojure from that script and start a repl. then you can connect to it with slime-connect from emacs
10:42raek"standalone scripts outside a leiningen project" <-- what exactly does this mean? an application that you have started from an uberjar?
10:44kenshoraek: with standalone I mean an independent clj file.
10:45raekwell, then you're on your own
10:45TimMckensho: How would the REPL know what libs to pull in?
10:45raekyou need to start a clojure instance with the swank-clojure jar file and the directory containing the source file on the classpath
10:46raekthe way clojure is launched is not script friendly at all
10:47kenshoTimMc: yeah of course this can only work if the script has no external dependencies.
10:48kenshoHm ok I see, so I will have to start swank manually and connect with slime from within emacs?
10:48raekkensho: yes, your script will need to call the swank function that starts a repl server
10:49kenshoraek: Ok I get it now. Thank you!
10:49raekkensho: one thing you could do is to create one leiningen project for all your scripts
10:50raekI guess you didn't want to create one project per script
10:50raekleiningen was built to make this classpath handling simple
10:51kenshoraek: yeah it's a good idea but in my particular case this is not practical unfortunately.
10:51babilenkensho: https://github.com/mtyaka/lein-oneoff might come in handy as well
10:52kenshobabilen: that looks interesting thank you
11:05kenshobabilen: thanks again, lein oneoff is pretty much what I was looking for and it seems to work like a charm.
11:05babilenwonderful :)
11:08gtrak``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:17dbushenkohi all!
11:17gtrak``hola
11:17dbushenkoI've got a vector [:a 1, :b 2, :c 3]. How to create a map from it?
11:20dbushenkook, I guess it's array-map func
11:20gtrak``apply array-map?
11:21dbushenkoyep, thanks
11:23gtrak``there's a hash-map too
11:23cran1988dbushenko: (apply hash-map [:a 1 :c 3 :d 4] )
11:23dbushenkocran1988, thanks!
11:24gtrak``"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:30TimMcdbushenko: How did you end up with that data structure?
11:31dbushenkoI've ended up with completely different solution :-)
11:31dbushenkoactually that doesn't matter, I'm just experimenting
12:03AWizzArdWhile 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:07raekAWizzArd: yep. they haven't been implemented in swank-clojure.
12:07AWizzArdAh okay, I see. Thx.
12:07dbushenkohow can I reload slime/swank without closing the connection?
12:08raekdbushenko: reload the code of some namespaces or add a new dependency?
12:08dbushenkoyes
12:08raekboth? :-)
12:09dbushenko:-D :-D :-D
12:09dbushenkosorry
12:09dbushenkoyes, I want to reload the code
12:09dbushenkoand yes, I want to add a new jar
12:10raekto reload a namespace, press C-c C-k in the buffer with its source file
12:10raekto add a new dependency, restart swank
12:10dbushenkois it possible to restart swank without closing the connection?
12:11raekdbushenko: what you need to do is to add additional entries to the classpath (not restart swank per se)
12:11dbushenkohmmm... probably you're right...
12:11dbushenkothanks
12:11raekadd-classpath is deprecated because (apparently) it couldn't always work
12:11raekbut it might work anyway
12:13raekbut 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:24cemerickdbushenko: 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:24dbushenkocemerick, thanks!
12:34codonnelHi, 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:47nickmbaileycodonnel_: what is the error?
12:47nickmbaileywe use ring with an ssl connection in our application
12:48codonnel_Whenever I try to load up the page in chrome using https, I get an ssl connection error.
12:48TimMccodonnel_: What is the actual error?
12:48TimMcThere are many kinds.
12:48codonnel_Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error.
12:48codonnel_It loads just fine if I leave out https
12:49nickmbaileyand no error logging from ring?
12:49codonnel_Nope
12:50codonnel_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:51technomancyscottj: hey, the stickers I ordered came in
12:51technomancyand you are qualified!
12:52TimMchell yes, stickers!
12:52technomancyindeed
12:52faust45which lib in clijure allow do some thing like jr = new JsonReader(inputStream);
12:52faust45?
12:52technomancyanyone with a patch accepted is qualified
12:54nickmbaileycodonnel_: not sure what the problem is then, the info in that post seems correct
12:56codonnel_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:56codonnel_I can access the site just fine as long as I don't try to use https.
12:56TimMcfaust45: You just want to read JSON?
12:57faust45TimMc: yes JSON from long polling connection
12:57TimMcfaust45: https://github.com/dakrone/cheshire
12:57faust45TimMc: can i pass (parsed-smile-seq (clojure.java.io/reader "/tmp/foo")) InputStream ?
12:59TimMcfaust45: Check the docs on clojure.java.io/reader
13:00dakronereader will work on InputStreams
13:01codonnel_If it's any help, I get a slightly different error on firefox.
13:01codonnel_SSL received a record that exceeded the maximum permissible length. (Error code: ssl_error_rx_record_too_long)
13:02nickmbaileycodonnel_: sounds like the certificate you generated is bad or something
13:03codonnel_hmm, ok. I'll try recreating it.
13:04codonnel_That may be true, but I think I'm having an issue with jetty as well.
13:04codonnel_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:06nickmbaileyso its running a non ssl connector on the ssl port and nothing on the regular port?
13:06codonnel_Yeah, that's what it looks like.
13:06faust45TimMc: thanks will try
13:09codonnel_Maybe there's something borked with my server.clj? Pasted it here: http://pastebin.com/i2rcFreK
13:15nickmbaileyhmm not familiar with noir we just use ring, my guess would be you shouldn't be passing the ssl-port to server/start
13:16nickmbaileyit 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:16codonnel_I tried passing it the normal port, but then it doesn't even connect on the ssl port.
13:17codonnel_The guy who wrote the blog post also passed it the ssl-port.
13:20codonnel_Well, I need to head off to class now. Thanks for the help, nickmbailey.
13:21r0adrunnerHi. noob question: anyone knows how to redefine a macro in repl?
13:24dnolenr0adrunner: just redefine it
13:25r0adrunnerdnolen: im trying with the defpage macro of noir. does not seem to work
13:27r0adrunnerlike that: (defpage newuser-html "/newuser" []
13:27r0adrunner (slurp "resources/templates/newuser.html")).
13:27r0adrunner
13:27r0adrunner if i change the body of this in repl, it does not update the output of the url
13:27r0adrunner
13:28dnolenr0adrunner: ah, that's a noir question really - I'm not sure how defpage works
13:30r0adrunnerIf i recompile it with ^c ^k in emacs, then it gets redefined..
13:31r0adrunnerAnyone 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:32technomancyjark!
13:33morphlingr0adrunner: macros get evaluated during compilation. when you change the macro nothing happens, you have to reevaluate its users
13:34dnolenr0adrunner: 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:35osa1which library should I use to read JSON data?
13:35r0adrunnerim just calling the macro.
13:35dnolenr0adrunner: again, I'm not sure what noir does behinds the scenes, best to ask on the Noir mailing list
13:36r0adrunnerWhen is it compiled? when i call it? when the program is loadae?
13:36r0adrunnerloaded
13:36morphlingosa1: https://github.com/clojure/data.json
13:37dnolenr0adrunner: macros are just functions that take source and return source - they are expanded during compilation.
13:38pandeirodnolen: 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:39r0adrunnerok ty.. i will go google more..
13:41dnolenpandeiro: 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:42pandeirodnolen: you're right per the clojure.org/reader link, but in clojure (pr-str {:9k true}) works, whereas in cljs it doesn't
13:42jsabeaudryr0adrunner, Try with C-c C-l [enter] this works fine for me
13:43dnolenpandeiro: 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:44pandeirodnolen: i see, thanks for the feedback... i guess it's a larger issue than just cljs
13:46r0adrunnerjsabeaudry: 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:46seancorfieldibdknox: was looking at jayq - nice! - how do I use it in a Clojure/ClojureScript project?
13:46jsabeaudryr0adrunner, have you tried evaluating your defpage (C-x C-e) ?
13:47dnolenpandeiro: that said, for UUIDs it seems like strings are a better rep anyway? instead of prepending weird unicode chars to the front.
13:48seancorfieldibdknox: i see there's a snapshot on clojars - is it as simple as adding a regular dependency to project.clj?
13:48r0adrunneryes.. in the code and in repl.. strange thing is that, just saving the file updates the url..
13:48pandeirodnolen: you're right, that's a solution... i just think of clojure maps always being keyed by keywords, and the benefits they bring
13:49amalloydnolen: judging by that regex i'd say rich isn't a regex expert either
13:50pandeirodnolen: rereading the reader document, I don't think it's clear that keywords cannot begin with numeric chars
13:50amalloyit 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:51pandeiroamalloy: eg it's totally possible?
13:51pandeiro(for keywords i mean)
13:52amalloythat regex matches for symbols too, it just never gets passed a string that starts with a number
13:52r0adrunnerjsabeaudry: i mean C-x C-e does not work in the source, but saving the file without evaluating the function does
13:53jsabeaudryr0adrunner, that must be magic caused by load-views, does the saving work if you use load-views-ns ?
13:53amalloy&(let [p (java.util.regex.Pattern/compile "[:]?([\\D&&[^/]].*/)?([\\D&&[^/]][^/]*)")] (re-seq p "foo 1foo :1foo"))
13:53lazybot⇒ (["foo 1foo :1foo" nil "foo 1foo :1foo"])
13:53amalloyoh, i guess it's not designed to split whitespace. still, all three of those would match
13:54pandeiroseancorfield: you can always just cp the jayq dir to your src/* or src/cljs/* too
13:54dnolen'1foo
13:54dnolen,'1foo
13:54clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.NumberFormatException: Invalid number: 1foo>
13:54amalloythe second one never gets passed to it, because the number-recognizing code gets in first ands says "that's a number!"
13:54amalloybut when the : is first, that regex gets trotted out
13:57r0adrunnerjsabeaudry: deactivated load-views, restarted and it is the same behavior
13:57jsabeaudryseancorfield, git clone it, lein install it and then add a dep in your project
13:59jsabeaudryr0adrunner, the page shouldnt even load if you removed your load-views, I'm lost
14:03r0adrunnerjsabeaudry: yeah.. checked it again, it does not..
14:07r0adrunnerjsabeaudry: ...and the saving works with load-views-ns
14:07osa1does anyone know a markdown library for clojure?
14:08jsabeaudryr0adrunner, what about evaluating the defpage form, does that work with load-views-ns?
14:09r0adrunnerjsabeaudry: nope
14:09r0adrunnerjsabeaudry: not without saving
14:09jsabeaudryosa1, google knows clj-markdown
14:10amalloyosa1: i don't think any good ones exist; there might be some bad ones. i'd just look for a java lib
14:11osa1jsabeaudry: it looks like clj-markdown is alpha and needs improvements
14:11osa1amalloy: ok, thanks
14:11faust45i 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:15jsabeaudryr0adrunner, 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:15jsabeaudryr0adrunner, I simply need to eval the defpage form
14:16jsabeaudryr0adrunner, i.e. C-x C-e
14:16r0adrunnerjsabeaudry: changed something inside the function body, and it gets redefined?
14:17wjcHi! 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:17jsabeaudryr0adrunner, If I change the content that is served and eval the defpage the new content is served
14:18emezeskewjc: I use http://github.com/emezeske/paredit.vim and http://github.com/vim-scripts/VimClojure
14:18TimMcwjc: Plenty of people use vim with Clojure.
14:18r0adrunnerjsabeaudry: ok ty...
14:18TimMcDon't worry, the channel is pretty laid-back over editors, other than insisting that you use something parens-aware. :-)
14:19jsabeaudryr0adrunner, Compiling with C-c C-c also works
14:20r0adrunnerjsabeaudry: yeah.. but then i lose the power of the repl...
14:20wjcTimMc: 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:22jsabeaudryr0adrunner, I have a hard time following you, how does compiling with C-c C-c make you lose anything?
14:22emezeskewjc: 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:23r0adrunnerjsabeaudry: sorry, what works for me is C-c C-k, not C-c C-c
14:25r0adrunnerjsabeaudry: is your program started with lein run?
14:26jsabeaudryr0adrunner, no, with clojure-jack-in
14:32r0adrunnerjsabeaudry: tried without lein run, only with clojure-jack-in and it worked..
14:33r0adrunnerjsabeaudry: is it wrong to start the server with lein run???
14:33lazybotr0adrunner: How could that be wrong?
14:33r0adrunnerlazybot: what?
14:35jsabeaudryr0adrunner, I wouldn't know, I don't think I've ever used lein run
14:35technomancyit's fine to start servers with lein run
14:36r0adrunnerso its definitely a noir issue
14:36jsabeaudrymight be an issue with your slime setup
14:37r0adrunnerok ty all. bye
14:41chipdudegood day
14:41amalloyhaha high five lazybot
14:41chipdudeGoogle so far is not helping me find how to create a genericized object in straight Clojure
14:41chipdudee.g. (let [a (HashMap<String,Object>.)] ... )
14:42amalloychipdude: as in Foo<T>? those don't exist at the bytecode level
14:42chipdudeno, but Jackson requires me to make one so it can create a type descriptor
14:42amalloyi doubt that. it can't detect at runtime what the generic parameters are
14:43chipdudethe type descriptor hack is common in serialization libs
14:43chipdudeit creates an object based on the compiltie specialization, and the -object- survives erasure
14:43chipdude*complete
14:44chipdudehttp://www.mkyong.com/java/how-to-convert-java-map-to-from-json-jackson/
14:44chipdudeI suppose I would have to dive into the TypeReference object and construct it by hand, or else go out to a .java
14:44chipdudebleh
14:45TimMcUgh, Jackson...
14:45TimMcWhy are you even using that?
14:45amalloyoh yeah, i've seen that trickery with TypeReference but never quite understood it
14:46chipdudeTimMc: fast, featureful.
14:46TimMchrmf
14:46TimMccheshire isn't enough?
14:46brehauttheres more than 2 features for a json serialization lib?
14:46chipdudehehe
14:46TimMcbrehaut: 1) encode, 2) decode?
14:47brehautTimMc: yeah
14:47chipdudeyou should see the gson feature list. it's sweet. multiple selected subsets of fields by annotation, etc.
14:47chipdudewill try cheshire
14:47brehautchipdude: you do know that there are clojure json libs right? and that they are already built on the java libs?
14:48chipdudebrehaut: learning so
14:48chipdudejust building a test framework, not invested in this much
14:48chipdudebut it has to be faster than JSON-Simple
14:49chipdudenot hard, I know
14:50scottjis 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:51amalloyscottj: everything the reader reads has :line meta on it
14:51amalloywhich is the line on which it starts
14:51TimMcchipdude: I'm sure there's already a reasonable Clojure wrapper around Jackson as well.
14:52amalloyclj-json, right?
14:53technomancycheshire wraps jackson
14:53chipdudecheshire seems fine, though classpath hell is blarghing me
14:53pjstadigcheshire is a jackson wrapper
14:53pjstadigoh :)
14:53amalloychipdude: classpath? i haven't had to worry about classpaths since i started using lein/cake
14:54hiredmanamalloy: actaully only lists last I checked. last I checked maps, sets, and vectors don't get :line for some reason
14:54amalloylame. what about symbols?
14:55amalloy&(map (juxt identity meta) '[symbol (list) [vector]])
14:55lazybot⇒ ([symbol nil] [(list) {:line 1}] [[vector] nil])
14:56scottjbummer
14:57amalloyi wonder if there's a reason for that. like, it might be convenient for the reader to return identical? symbols
14:58scottjI 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:05chipdudeamalloy: classpath hell is just a metaphor
15:06chipdudeI have to make an uberjar for Storm, and use HBase, and the cascading dependencies land on three distinct Jackson versions
15:06amalloyscottj: you can look at (meta &form)
15:08amalloythat isn't as good as you'd like, of course - it would give them all the same source line
15:08scottjamalloy: yeah, that's what I currently have
15:11romanandregis there a jenkins console for the clojure libraries?
15:12TimMcromanandreg: http://build.clojure.org/ ?
15:12romanandregTimMc: that's the one I was looking for! thanks
15:25faust45what dose mean syntax with * ? for instance fun call (*fun-name*)
15:25faust45?
15:26emezeskefaust45: http://stackoverflow.com/questions/3579063/conventions-style-and-usage-for-clojure-constants
15:26faust45emezeske: thanks )
15:27morphlingfaust45: emezeske: usually the earmuffs denote variables intended to be rebound, like *out*, not contstants like \pi
15:28emezeskemorphling: read the top answer :)
15:29morphlingemezeske: oh right, there are answers ^^
15:30faust45i this code http://friendpaste.com/1wngZOTZcaDQHIZEd1NVj5 what does mean this code
15:30faust45(or *json-factory*
15:30faust45 json-factory)
15:30faust45sorry guys for stupid questions
15:33morphlingfaust45: 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:35morphlingfaust45: `or` returns its first non-nil/non-false argument or nil
15:35faust45morphling: thanks
15:37faust45morphling: (dynamically) bound its mean in let block ?
15:38morphlingfaust45: no, in a binding block
15:40faust45morphling: binding its mean in (defn name [binding] ?
15:41Rayneshttp://en.wikipedia.org/wiki/Language_barrier
15:42morphlingfaust45: http://stackoverflow.com/questions/1523240/let-vs-binding-in-clojure#1523385
15:43faust45morphling: but i don't see any binding in this function http://friendpaste.com/1wngZOTZcaDQHIZEd1NVj5
15:43faust45morphling: what does he check?
15:43morphlingfaust45: that's the point of dynamically rebinding stuff
15:44faust45morphling: sorry don't get you
15:47TimMcfaust45: You should go learn about dynamic scope and thread-local binding.
15:54faust45TimMc: ok thanks
16:03faust45one 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:06TimMcWhat is this code you pasted?
16:06TimMcCancel that... what are you trying to do?
16:09faust45TimMc: 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:11TimMcOh, 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:22dakronefaust45: you shouldn't have to worry about binding it unless you need some of the advanced Jackson features
16:24faust45dakrone: can you help me? i just try pass org.apache.http.conn.EofSensorInputStream to (clojure.java.io/reader
16:24dakronefaust45: what is your end goal?
16:24faust45dakrone: accept and parse json stream come from http long poll connection
16:25dakronefaust45: you should be able to do (parse-stream (clojure.java.io/reader <your-stream>))
16:25faust45dakrone: not parsed-smile-seq ?
16:26dakronethat's for parsing SMILE, you said JSON right?
16:26faust45dakrone: yes
16:26faust45dakrone: looks working )
16:27faust45thanks
16:28dakronenp, good luck
16:31faust45dakrone: parse-stream will waiting until EOF ?
16:31dakroneit will read the stream
16:33amalloyhas 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:34faust45dakrone: but can i get access to first item? until stream EOF
16:36dakronefaust45: you need to just read only the first json object?
16:37faust45dakrone: i need read one by one upon receipt
16:38dakronefaust45: that's on the roadmap, but right now it reads the entire stream and returns a decoded object
16:39faust45dakrone: its read stream until EOF ?
16:39faust45dakrone: but my stream never EOF
16:39dakroneuntil 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:40faust45dakrone: its apache http org.apache.http.conn.EofSensorInputStream
16:40dakronefaust45: are you using clj-http by any chance?
16:41faust45dakrone: no, i use raw apache lib, i prefer be close to metal )
16:42TimMc>_<
16:42dakronealright, well I will test it next time I get a shot, there is already an issue open for cheshire about it
16:42technomancyorg.metallica.BassLineInputStream
16:43technomancy^ close to the metal
16:43faust45dakrone: issue about org.apache.http.conn.EofSensorInputStream
16:43faust45?
16:44dakronefaust45: that's just a regular InputStream that closes itself when it's been completely read
16:44faust45dakrone: yes i know
16:44dakronehttps://github.com/dakrone/cheshire/issues/17
17:07emezeskeseancorfield: Is this you? If so, nice write-up! :) http://corfield.org/blog/post.cfm/getting-started-with-clojurescript-and-fw-1
17:13RaynesIt is him.
17:13RaynesSean Corfield is my sheppard. I shall not want.
17:15TimMcIs there any mechanism in Clojure for functions that dispatch on the types in their full argument list, not just arity or first arg?
17:15brehautmutlis right?
17:15brehautmultis
17:16TimMcand by dispatch, I mean the fast JVM stuff, not reflection
17:16brehautthen i think no
17:16brehautthe JVM doesnt have any mechanism like that right?
17:16TimMcHrmf.
17:16emezeskeRaynes: :P
17:17TimMcbrehaut: I may be confusing myself.
17:18TimMcbrehaut: 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:18TimMcMath/abs is presenting a challenge, since it is overloaded with 4 unary versions that take different prim types.
17:18Raynesamalloy just corrected my spelling of shepherd in another channel, and for that we thank him.
17:18amalloyTimMc: multis are not reflective
17:19amalloybut they're not nearly as optimized as protocols
17:19TimMcand protocols would not get me where I want to go, right?
17:19amalloyright
17:20brehautTimMc: i presume you already know that overload types are computed at compile time
17:22TimMcyeah
17:23TimMcThis macro does reflection and creates private fns in the namespace that call static methods with their args.
17:23TimMcI was hoping there was a way to hook into that compile-time overload identification from Clojure.
17:26aperiodicare all the hotkeys for paredit.vim the same as in emacs?
17:26aperiodici can't seem to find a reference for paredit.vim in particular
17:27emezeskeaperiodic: :help paredit
17:28emezeskeaperiodic: or https://github.com/emezeske/paredit.vim/blob/master/doc/paredit.txt
17:29aperiodicemezeske: thanks! ':help paredit' gives me 'no help for paredit', though that text file is in my doc folder
17:30emezeskeaperiodic: I think you have to tell vim to update your help docs (I forget the command)
17:32aperiodicemezeske: ':helptags /path/to/doc'
17:32emezeskeaperiodic: nice, thanks :)
17:32aperiodicemezeske: just returning the favor :)
18:24TimMcUgh, 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:27TimMcwhich would compile to somethign like (do (defn- ^double abs [^double x#] (. Math abs x#)) ...)
18:28aperiodicis that specifying the argument type, the return value, or both?
18:28TimMcJust the args.
18:29TimMcIf the arg types are known, the macro can get the return type by reflection.
18:31aperiodici 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:31aperiodicthat's unfortunate
18:32TimMcI think the only way to avoid this would be via a bytecode-generating thing inspired by Protocol.
18:32TimMc...and then used by this macro.
18:33TimMcAh well.
18:33aperiodichow would bytecode generation help?
18:33TimMcIsn't that how the implementation of protocols in Clojure is done?
18:34TimMcIt can't rely on other Clojure or Java stuff, it has to go straight to JVM APIs.
18:34aperiodicI'm just asking for my own edification
18:35TimMcBasically, you need soemthing that can generate methods with specific signatures.
18:36TimMcWait.. maybe reify does this!
18:36TimMcOh hell, I'm sure it can. WTF.
18:37arohnerTimMc: you absolutely can generate fns w/ type hints. Just stick metadata on the symbols for the arguments
18:37TimMcarohner: I need type-based dispatch to the correct fn body.
18:38TimMcnot a very Clojure-y thing, but oh well.
18:38TimMc(it's for interop with Java static methods)
18:38arohnertype-based dispatch sounds a lot like protocols
18:39TimMcarohner: That only dispatches on first arg, right?
18:39arohnerTimMc: yes
18:39TimMcYeah, I need for than that, unfortunately.
18:39arohneryou can always use multimethods
18:40TimMcNah, that would incur reflection and boxing.
18:40arohnerthose can dispatch on arbitrary fns of the arguments
18:41arohnerI'm pretty sure those are your options
18:41franksamalloy: Q about "useful.utils/thread-local", did I test it correctly that a thread does not inherit the thread local state by default?
18:41aperiodicnaw, you can definitely do this with reify or gen-class
18:42arohnerwhat is 'this', exactly?
18:42amalloyinherit? from what, its parent thread? java threads don't have parents
18:42TimMcarohner: The idea here is to automatically create inlineable fns for static methods. tmciver and I are trying to put import-static on steroids.
18:42seancorfieldemezeske: 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:43arohnerso you can use gen-class or reify to do your dispatching 'manually', but you'll definitely box across clojure fn boundaries
18:44seancorfieldguess 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:44TimMcarohner: Even for small-arity fns? I thought 1.3 added support for that.
18:44arohneroh, 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:44franksamalloy: 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:45TimMcarohner: Yes. contrib's import-static creates macros, which can't be passed around. Very limited.
18:45emezeskeseancorfield: I threw jayq into my project's :dependencies and it's working great
18:45TimMcamalloy: Not entirely true -- there is InheritableThreadLocal, which has the semantics of parent/child.
18:46arohnerTimMc: clj 1.3 added .invoke() for several permutations of primitives, but not arbitrary primitives
18:46TimMcYou specify how you want state to be inherited.
18:46TimMcarohner: I guess that will have to be good enough. :-/
18:47arohnerTimMc: very cool idea though. I hope it works
18:47lnostdalgah, the default laziness of stuff doesn't seem very useful most of the time ...
18:47lnostdalit's just a source of unexpected weirdness and bugs
18:47TimMcarohner: Me too! At the very least, we'll release an import+ that does some other import-related tricks.
18:47franksinteresting: "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:48arohnerTimMc: I think you have more options than just what 1.3 provides
18:48arohnerI'm just not sure what assumptions the compiler makes re: .invoke() and boxing
18:49arohnerand I'm not sure why rhickey listed the permutations of .invoke() overrides, rather than just generating them
18:50amalloyarohner: because java doesn't have macros?
18:50seancorfieldemezeske: did you have to do anything beyond adding it to :dependencies and just :require it in the ns?
18:51TimMcarohner: Ah, so I could add the necessary permutations in the reify I generate?
18:52TimMcAt some point I'll have to figure out how to tell when my code is boxing. :-)
18:52emezeskeseancorfield: not that I recall!
18:52emezeskeseancorfield: I'm actually using jayq+crate+fetch, and it was all pretty easy
18:55cran1988,(neg? (-4 (-4)))
18:55clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
18:55cran1988why?????????????
18:55cran1988,(neg? (- 4 3))
18:55clojurebotfalse
18:56cran1988ok cool
18:56cran1988i thought i was insane
18:57arohnerTimMc: your code is always boxes primitives, unless it takes a primitive type hint.
18:57arohnerTimMc: 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:58arohneri.e. the compiler is not going to look if your specific fn implements a non-standard primitive override at runtime
18:59konrIf I define foo with defrecord on namespace bar, and then on namespace baz use bar, shouldn't foo be available there?
18:59arohnerkonr: import defrecords
19:00arohnerkonr: records are java classes, not fns
19:00konrarohner: thanks!
19:01arohnerkonr: however, the protocol methods are clojure fns
19:20hagnado libraries found with lein search have docs or is that not a rule?
19:24konrIs there a format to document the arguments of a function?
19:24technomancyhagna: all well-behaved projects will have docstrings, but not many have the docs published in HTML
19:27hagnatechnomancy: so to decide what to call in the library I probably just need to look at the source; how do you do that?
19:28technomancyM-. if you're using Emacs; otherwise you can peek inside your lib directory or search github.
19:32hagnatechnomancy: ok that's nothing new but thanks
19:51rlbamalloy: thanks, I saw .deleteOnExit, but I wanted something more immediate (and flexible).
19:51amalloyrlb: right, so you can do the immediate/flexible thing for convenience, with .deleteOnExit as a fallback for an unexpected C-c
19:52rlbamalloy: true, but I didn't want the irrevocability of delete on exit.
19:53rlb(iirc it deletes that path, no matter what, with no possibility of cancellation)
19:54rlbIn any case, I think I know what I want to do instead (if/when I get around to it).
20:20TimMcarohner: 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:29TimMcI 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:31arohnerTimMc: I believe that's correct, yes
20:31TimMcOK, thanks. I guess I'll write this all down so the next person doesn't have to figure it out. >_<
20:39zztwhttp://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:10dakronethe worst part of releasing OSS is having to write announcement emails
21:10brehautwhat is the beer stuart halloway is drinking in the ousterhout's dichotomy?
21:11TimMcdakrone: Even worse than dealing with whiny users? :-)
21:11TimMctmciver: 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:12dakroneTimMc: much rather deal with the users, for me
21:17oakwisedakrone: it can be done http://www.esquire.com/features/ESQ0905OUTSOURCING_214
21:31dgrnbrgHas anyone noticed the clojure mailing list not delivering msgs?
21:43lysu\clear
22:53seancorf`dgrnbrg: probably first post moderation to avoid spam?
22:53dgrnbrgI didn't post anything I think--I mean that I got 40 delivered today and none this past week
22:53dgrnbrgI just got jan22 delivered
22:53dgrnbrgor something weird
22:53seancorf`hmm, no, can't say i've seen that sort of strange behavior
22:54seancorf`are you subscribed with a gmail address or something else?
22:55dgrnbrggmail
22:59seancorf`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:07cemerickthe google group mail gateway often acts strangely, both in and out
23:52xuserdsakjfs;fkljsa~
23:53xusersdfdsfsa
23:53adiabaticsame to you, bub
23:53xuser'
23:57seancorfieldibdknox: you around?
23:57seancorfieldemezeske: you?
23:59seancorfieldi'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?