2012-02-06
| 00:24 | cemerick | I'm reading vim documentation right now. Damn you Raynes, damn you. ;-) |
| 00:25 | Raynes | Heh. |
| 00:26 | cemerick | Raynes: did you just stumble your way through learning everything, or is there a recommended resource? |
| 00:27 | Raynes | $google janus vim |
| 00:27 | lazybot | [carlhuda/janus - GitHub] https://github.com/carlhuda/janus |
| 00:27 | Raynes | That and any given cheatsheet. |
| 00:27 | Raynes | Just get ready to deal with looking everything up six times before you memorize it. |
| 00:27 | Raynes | After that, smooth sailing. |
| 00:28 | Raynes | 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. |
| 00:29 | cemerick | Raynes: oh, as opposed to that hjkl stuff? yeah |
| 00:29 | Raynes | Some people dig it, I'm not one of them. |
| 00: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. |
| 00:30 | Raynes | Hah |
| 00:30 | cemerick | The macvim UI is decent enough that I've not gone mad yet. :-) |
| 00: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)) |
| 00:30 | Raynes | Macvim is excellent. |
| 00:31 | Raynes | cemerick: If you get tired of the menubar at the top, set go-=T |
| 00: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. |
| 00:31 | cemerick | Nah, that'd be too easy. :-P |
| 00:32 | Raynes | Some plugins do add menu items. |
| 00:32 | cemerick | Raynes: you mean the toolbar? |
| 00:32 | Raynes | Yes. |
| 00:32 | cemerick | Raynes: or you can just click the toolbar toggle button at the upper-right of any OS X window ;-) |
| 00:33 | Raynes | I'm… not sure we're talking about the same thing then. |
| 00:33 | cemerick | entirely possible |
| 00:33 | Raynes | Anywasys. |
| 00:33 | Raynes | Anyways, even. |
| 00: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` |
| 00:35 | Raynes | Heh |
| 00:35 | Raynes | But you can look at the script before bashing it. |
| 00:36 | cemerick | security-by-bash-script-scanning |
| 00:37 | cemerick | It's just funny what we all choose to care about. |
| 00:38 | amalloy | those installation instructions drive me nuts, cemerick |
| 00: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" |
| 00: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. |
| 00:39 | cemerick | amalloy: and yet… |
| 00: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" |
| 00:42 | rlb | it's not as trivial when it's multiplied by 30000 packages. |
| 00:42 | qmx | cemerick: these bash scripts remember me of this => https://github.com/MrMEEE/bumblebee-Old-and-abbandoned/commit/a047be85247755cdbe0acce6f1dafc8beb84f2ac |
| 00:43 | ibdknox | woah.. am I hearing this right? cemerick is trying VIM? |
| 00:44 | cemerick | ibdknox: never gave it an honest shot. Things are on a low simmer lately, so it's now or never. :-) |
| 00:46 | ibdknox | awesome. :) |
| 00:46 | ibdknox | good luck! |
| 00:47 | cemerick | heh |
| 00:47 | cemerick | I'll need it, I'm sure. |
| 00:48 | ibdknox | vim has a very steep initial curve, but once you're over that you're good to go |
| 00:48 | cemerick | macvim is absolutely more polished than any emacs "shell" I've seen on OS X though, I'll give it that. |
| 00:48 | ibdknox | cemerick: yeah I've not had any issues with it and I've been using it for quite some time :) |
| 00:49 | G0SUB | relevant - http://unix.rulez.org/~calver/pictures/curves.jpg |
| 00:51 | amalloy | meta-relevant: http://i4.photobucket.com/albums/y105/Mortimier/LearningCurve-1.jpg |
| 00:51 | ibdknox | lol |
| 00:51 | amalloy | ew, except someone changed the legends to be for crappy games instead of good ones. bad link from me |
| 00: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) |
| 00:58 | zxcxzc | hm, seems like installing ccw installed clojure 1.2.0 somewhere in ecplise/plugins |
| 01:10 | seancorfield | zxcxzc: fwiw, leiningen's plugins and core run on 1.2.1 - many plugins are not compatible with 1.3.0 yet |
| 01: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? |
| 01:22 | seancorfield | clojure 1.3.0 is on maven central |
| 01:22 | seancorfield | 1.4.0 beta 1 is also available |
| 01:23 | ysph | Are you looking at this page? https://github.com/clojure/clojure/tags |
| 01: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 |
| 01:23 | ysph | github will zip tags, 1.3.0 release is there |
| 01:24 | seancorfield | i see clojure-1.3.0.zip there - september 23 - but it sorts below the prerelease builds |
| 01:24 | zxcxzc | i havent even gotten leiningen to work yet |
| 01:24 | seancorfield | you're on windows? |
| 01:24 | zxcxzc | yes |
| 01:24 | seancorfield | sorry :( |
| 01:25 | seancorfield | clojure tooling is pretty poor on windows |
| 01: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 |
| 01: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. |
| 01: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 |
| 01:26 | seancorfield | fwiw, in the cfml world, source zips are the norm... |
| 01:26 | seancorfield | zxcxzc: see if this helps you http://corfield.org/articles/emacs_win.html |
| 01:27 | seancorfield | that details my windows xp adventure setting up leiningen and emacs |
| 01:27 | Raynes | In Soviet Russia, etc etc. |
| 01:30 | zxcxzc | seancorfield: it doenst mention how you installed clojure |
| 01:31 | seancorfield | you don't "install clojure" - it's a library, you depend on it in your project |
| 01:31 | zxcxzc | but he lein.bat file already uses clojure... and fails to find it |
| 01:32 | seancorfield | follow the instructions there to install leiningen properly on windows... |
| 01:32 | Raynes | It is meant to download all of its dependencies for you and bootstrap. |
| 01:32 | seancorfield | right, but it needs curl or wget |
| 01:32 | seancorfield | or you can in theory download the leiningen standalone jar and let it go from there |
| 01:33 | zxcxzc | hrm. i tried it with the standalone jar because i didnt want wget and curl |
| 01:33 | Raynes | Why not? |
| 01:33 | zxcxzc | but it wouldnt work cause it cant find clojure |
| 01:33 | zxcxzc | so i wanted to install clojure manually but dont really know how |
| 01:33 | zxcxzc | alright ill get those then |
| 01:33 | seancorfield | follow the instructions on that page and see how it goes |
| 01:34 | seancorfield | are you on win xp or win 7? |
| 01:34 | zxcxzc | 7 |
| 01:34 | amalloy | heh, i love that those are the two choices. nobody considers vista |
| 01:34 | Raynes | amalloy: I was thinking the exact same thing. |
| 01:35 | seancorfield | no sane person is still running vista :) |
| 01:35 | seancorfield | i ran it for six months then went back to xp, then ran 7 for six months and went back to xp |
| 01: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. |
| 01:36 | Raynes | I'm still running vista for various definitions of 'running'. |
| 01: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... |
| 01: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. |
| 01:37 | seancorfield | it's to do with paths beginning with \u it seems |
| 01:37 | seancorfield | emacs thinks that's unicode |
| 01:37 | seancorfield | Raynes: i spent $200 on windows vista OEM and thought that was outrageous |
| 01:38 | seancorfield | i ran win 7 during the public beta but wouldn't pay $200+ again for an upgrade... outrageous! |
| 01:38 | ysph | another option is CCW, though i haven't used it in some time, so i don't know the current state |
| 01:38 | ekoontz | ,(= (symbol ":foo") :foo) |
| 01:38 | clojurebot | false |
| 01:38 | ekoontz | hmm why is it false..? |
| 01:39 | ysph | = is object identity? |
| 01:39 | seancorfield | ,(symbol ":foo") |
| 01:39 | clojurebot | :foo |
| 01:39 | seancorfield | and that's a symbol not a keyword - :foo is a keyword |
| 01:39 | ekoontz | oh ok, didn't see the difference, thanks |
| 01:39 | seancorfield | ,(= (keyword (name (symbol ":foo"))) :foo) |
| 01:40 | clojurebot | false |
| 01:40 | seancorfield | hah... not what i expected |
| 01:40 | scottj | seancorfield: I think win7 upgrade was like $70 before release. |
| 01:40 | ekoontz | (= (keyword "obj") :obj) |
| 01:40 | seancorfield | oh, of course ##(keyword "foo") is not equal to ##(keyword ":foo") |
| 01:40 | lazybot | (keyword "foo") ⇒ :foo |
| 01:40 | lazybot | (keyword ":foo") ⇒ ::foo |
| 01: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 |
| 01:40 | ekoontz | ,(= (keyword "obj") :obj) |
| 01:40 | clojurebot | true |
| 01:40 | ekoontz | thanks, that makes sense now :) |
| 01:41 | seancorfield | scottj: not for the "ultimate" edition or whatever it was called |
| 01:41 | seancorfield | i liked apple's Lion price: $29 |
| 01:41 | adam_ | identical? returns true only when the two objects are the same |
| 01:41 | seancorfield | ,(doc identical?) |
| 01:41 | clojurebot | "([x y]); Tests if 2 arguments are the same object" |
| 01: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 |
| 01:42 | levi | Apple has a nice hardware business to subsidize their software. Microsoft doesn't do quite so well there. |
| 01:42 | ekoontz | thanks for identical |
| 01:42 | ekoontz | (to adam_ and seancorfield) |
| 01:42 | seancorfield | levi: true, microsoft only has Office to shore up its O/S pricing :) |
| 01:42 | adam_ | thank Joy Of Clojure, pg. 71! |
| 01:42 | ekoontz | ha, i should get it :) |
| 01:42 | seancorfield | it's a good book adam_ ekoontz :) |
| 01:43 | seancorfield | buy all of the clojure books! |
| 01:43 | adam_ | its my favorite, out of the four books out |
| 01:43 | adam_ | clojure in action is pretty good too, but its more project based |
| 01:43 | seancorfield | i have Clojure Programming, Clojure in Action, Programming Clojure 2nd Ed, Joy of Clojure |
| 01:43 | ekoontz | i have Clojure In Action, which i like a lot |
| 01:43 | seancorfield | looking forward to 2nd Ed of Practical Clojure - no point in buying the 1st Ed now... :) |
| 01:44 | adam_ | Clojure Programming the is O'rielly one? |
| 01:44 | seancorfield | I like Clojure Programming best of the introductory books and then Joy Of Clojure as the follow up |
| 01:44 | seancorfield | yes adam_ |
| 01:44 | seancorfield | in Rough Cuts right now but due for release in April |
| 01:44 | adam_ | okay, that's what I thought |
| 01:44 | seancorfield | Programming Clojure is in beta too (Pragmatic Bookshelf) |
| 01:44 | scottj | seancorfield: is programming clojure 2nd ed a free upgrade for 1ed buyers? |
| 01:45 | seancorfield | scottj: i don't think books work like that :) |
| 01:45 | scottj | electronic copy that is |
| 01:47 | seancorfield | zxcxzc: if you have any suggestions for my emacs_win.html article, i'll appreciate it |
| 01: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 |
| 01:54 | seancorfield | does lein.bat help work now? |
| 01:56 | zxcxzc | yeah |
| 01:56 | zxcxzc | so the standalone jar actually contains clojure 1.2.1... i guess |
| 01:56 | seancorfield | then do: lein.bat new test |
| 01:57 | zxcxzc | already did |
| 01:57 | seancorfield | drop into that new test folder and run: lein test |
| 01:57 | seancorfield | it should fail but it will show that clojure is installed/running for you |
| 01:57 | zxcxzc | yeah it works |
| 01:57 | seancorfield | then you're off to the races |
| 01:58 | zxcxzc | yeah, thanks :) |
| 03:23 | manuel_ | hi |
| 03:24 | manuel_ | let's do 10 4clojures before getting started for the day :) |
| 03:26 | depy | We already started.. :S |
| 03: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? |
| 03:27 | manuel_ | sparce matrices for example |
| 03:30 | depy | manuel_ : you could use maps: http://inclojurewetrust.blogspot.com/2009/10/dijkstra-in-clojure.html |
| 03:40 | manuel_ | yes depends on what your algorithms are going to be i guess |
| 03:40 | manuel_ | knuth 4a has obviously a much in-depth overview |
| 03:44 | Blkt | good morning everyone |
| 03: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.. |
| 05:08 | clj_newb | is there a builtin clojure function that takes two lists and produces their cartesian product? |
| 05:11 | alandipert | clj_newb: for, kinda... eg (for [x xs, y ys] [x y]) |
| 05:12 | alandipert | ,(for [x [:a :b :c :d] y [1 2 3 4]] [x y]) |
| 05:12 | clojurebot | ([:a 1] [:a 2] [:a 3] [:a 4] [:b 1] ...) |
| 05:16 | clj_newb | wtf |
| 05:16 | clj_newb | that is much much shorter than the (map ... (map ... ) .. ) I was using |
| 05:17 | clj_newb | ,(doc for) |
| 05: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 ...], ... |
| 05:17 | rafl | alandipert++ |
| 05:17 | clj_newb | clojure supports list comprehensions ... |
| 05:19 | darq | hi. i have a question about core.logic.. Why is the "_" not mapped to (lvar)? |
| 05:27 | tsdh | darq: Could you please be a bit more specific? |
| 05: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: |
| 05:32 | tsdh | darq: Do you have a link to the examples? |
| 05:33 | tsdh | darq: Most probably, these examples define some custom macro that replace every occurence of _ with a new fresh variable. |
| 05: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 |
| 05:35 | darq | sry: this one http://www.intensivesystems.net/tutorials/code/zebra.clj |
| 05:36 | darq | I think i see the answer now:) This guy used the kanren version from jduey :) |
| 05:36 | tsdh | darq: Exactly. ;-) |
| 05:37 | darq | But whay isn't this the default in core.logic? |
| 05:39 | darq | The more important part ... how do i create a macro synonym? |
| 05:44 | jheander | good morning! |
| 05:44 | G0SUB | jheander |
| 05:44 | tsdh | darq: That's what I use: http://pastebin.com/LFg1YSrs |
| 05: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? |
| 05:48 | G0SUB | jheander, the protocol itself and the protocol fns live in the declaring ns. |
| 05: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 |
| 05:49 | jheander | (core_deftype.clj:495)" |
| 05:50 | jheander | GOSUB: that makes sense, but clojure seems sensitive to import order if I want the protocol methods to resolve properly on an implementing object. |
| 05:51 | G0SUB | jheander, that's why you should avoid calling protocol functions directly. |
| 05:51 | G0SUB | 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. |
| 05:51 | jheander | GOSUB: so I should wrap them in the declaring ns? would that make a difference? |
| 05:52 | G0SUB | jheander, for example, clojure.core/reduce |
| 05:52 | amalloy | huh? both of you guys are saying crazy things |
| 05:52 | G0SUB | amalloy, lol |
| 05:52 | Fossi | :D |
| 05:52 | jheander | :) |
| 05:52 | amalloy | calling protocol functions directly is standard operating procedure, and it doesn't have any reliance on import order |
| 05:53 | G0SUB | amalloy, +1 |
| 05:53 | amalloy | you shouldn't call protocol functions as if they were methods, but that doesn't look like it's happening here |
| 05:54 | amalloy | jheander: if you gist your actual code we can see what's going wrong, but what you're describing doesn't make sense |
| 05: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. |
| 05:57 | G0SUB | jheander, (protocols/mymethod (impl/reify-mytype)) |
| 05:58 | G0SUB | that's how it should look like IMHO. |
| 05:58 | jheander | GOSUB: agree :) |
| 05:59 | G0SUB | jheander, you don't need to bring in the protocol in the third ns. |
| 06:00 | G0SUB | jheander, just the protocol fn & the fn that returns the reified obj should suffice. |
| 06:00 | jheander | GOSUB, amalloy: link to gist https://gist.github.com/8e14398ebff2d459caae/cd31f94cb23f8ac971adbdfc1de083dedc941b54 |
| 06:02 | amalloy | this is probably caused by you reloading the protocol definition |
| 06:02 | jheander | amalloy: what does that cause and how can I avoid it? |
| 06: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 |
| 06: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? |
| 06:04 | amalloy | it won't |
| 06:05 | amalloy | 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 |
| 06:05 | G0SUB | is this the repl causing the problem? |
| 06:05 | amalloy | eg, (1) paste protocol/reify, (2) play around with stuff and it works, (3) paste protocol, (4) stuff no longer works |
| 06:07 | amalloy | anyway, i have to get to bed. good luck |
| 06: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? |
| 06:08 | jheander | amalloy: thanks for the help! |
| 06:10 | thheller | how does one use javascript constants in clojurescript? (ex. goog.positioning.Corner.TOP_LEFT) |
| 06:10 | jheander | gotta go get some lunch here :) bye! |
| 06:16 | broquaint | Presumably the same way you access properties, thheller. |
| 06:16 | broquaint | (.-TOP_LEFT goog.positioning.Corner) ; I think. |
| 06:17 | thheller | ah thx |
| 06:17 | thheller | went with (js* "goog.positioning.Corner.TOP_LEFT") |
| 06:17 | thheller | hackety hack :P |
| 06:46 | faust45 | hi guys |
| 06:47 | faust45 | can any one point me to HttpClient long polling req? |
| 06:47 | ordnungswidrig | faust45: what's your problem? |
| 06:47 | faust45 | i use apache http client |
| 06:47 | faust45 | i ordnungswidrig: i need some example, to see the way |
| 06:48 | faust45 | ordnungswidrig: how consume content from long pool |
| 06:49 | ordnungswidrig | faust45: you mean, consuming the response body part by part? |
| 06:49 | faust45 | ordnungswidrig: yes |
| 06:56 | ordnungswidrig | faust45: you should use getResponseBodyAsStream on the GetMethod instance and read what you need. |
| 06:58 | faust45 | ordnungswidrig: GetMethod ? |
| 06:58 | ordnungswidrig | faust45: the class from apache http client. |
| 06:59 | ordnungswidrig | faust45: http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/methods/GetMethod.html |
| 06:59 | ordnungswidrig | faust45: or post if you prefer. doesn't matter |
| 07:03 | faust45 | ordnungswidrig: i using this code http://pastebin.com/uq7KTWGw |
| 07: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 | trptcolin | however, the way i have it now does imply that the completion code needs to live on the nrepl/project side |
| 10:07 | trptcolin | 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 | cemerick | Alternatively, it can be loaded in from the client, which is what ccw does. |
| 10:08 | cemerick | 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 | cemerick | 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 | trptcolin | 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 | trptcolin | 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 | trptcolin | for every use case |
| 10:18 | cemerick | The more we standardize on a single tooling lib, the easier the whole thing gets |
| 10:19 | cemerick | 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 | trptcolin | 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 | cemerick | http://news.ycombinator.com/item?id=3557620 |
| 10:28 | cemerick | carp, wrong window |
| 10:29 | cemerick | 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 | raek | "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 | raek | 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 | kensho | 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 | raek | I guess you didn't want to create one project per script |
| 10:50 | raek | 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 | kensho | 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 | dbushenko | 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 | dbushenko | 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 | dbushenko | sorry |
| 12:09 | dbushenko | yes, I want to reload the code |
| 12:09 | dbushenko | 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 | raek | 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 | dbushenko | thanks |
| 12:11 | raek | add-classpath is deprecated because (apparently) it couldn't always work |
| 12:11 | raek | but it might work anyway |
| 12:13 | raek | 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 | nickmbailey | 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 | TimMc | There are many kinds. |
| 12:48 | codonnel_ | Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error. |
| 12:48 | codonnel_ | It loads just fine if I leave out https |
| 12:49 | nickmbailey | and no error logging from ring? |
| 12:49 | codonnel_ | Nope |
| 12:50 | codonnel_ | 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 | technomancy | 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 | faust45 | ? |
| 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 | codonnel_ | 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 | codonnel_ | 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 | codonnel_ | That may be true, but I think I'm having an issue with jetty as well. |
| 13:04 | codonnel_ | 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 | nickmbailey | 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 | codonnel_ | The guy who wrote the blog post also passed it the ssl-port. |
| 13:20 | codonnel_ | 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 | r0adrunner | like that: (defpage newuser-html "/newuser" [] |
| 13:27 | r0adrunner | (slurp "resources/templates/newuser.html")). |
| 13:27 | r0adrunner | |
| 13:27 | r0adrunner | if i change the body of this in repl, it does not update the output of the url |
| 13:27 | r0adrunner | |
| 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 | r0adrunner | 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 | r0adrunner | 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 | pandeiro | (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 | dnolen | ,'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 | amalloy | 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 | jsabeaudry | 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 | r0adrunner | 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 | r0adrunner | 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 | osa1 | 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 | jsabeaudry | r0adrunner, I simply need to eval the defpage form |
| 14:16 | jsabeaudry | 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 | r0adrunner | 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 | r0adrunner | 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 | chipdude | 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 | chipdude | it creates an object based on the compiltie specialization, and the -object- survives erasure |
| 14:43 | chipdude | *complete |
| 14:44 | chipdude | http://www.mkyong.com/java/how-to-convert-java-map-to-from-json-jackson/ |
| 14:44 | chipdude | 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 | chipdude | bleh |
| 14:45 | TimMc | Ugh, Jackson... |
| 14:45 | TimMc | 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 | TimMc | 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 | chipdude | 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 | chipdude | just building a test framework, not invested in this much |
| 14:48 | chipdude | but it has to be faster than JSON-Simple |
| 14:49 | chipdude | 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 | amalloy | 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 | pjstadig | 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 | amalloy | &(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 | chipdude | 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 | amalloy | 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 | faust45 | ? |
| 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 | faust45 | (or *json-factory* |
| 15:30 | faust45 | json-factory) |
| 15:30 | faust45 | 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 | morphling | faust45: `or` returns its first non-nil/non-false argument or nil |
| 15:35 | faust45 | morphling: thanks |
| 15:37 | faust45 | 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 | faust45 | 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 | faust45 | 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 | TimMc | 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 | faust45 | dakrone: looks working ) |
| 16:27 | faust45 | 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 | faust45 | 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 | technomancy | ^ close to the metal |
| 16:43 | faust45 | dakrone: issue about org.apache.http.conn.EofSensorInputStream |
| 16:43 | faust45 | ? |
| 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 | Raynes | 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 | brehaut | multis |
| 17:16 | TimMc | and by dispatch, I mean the fast JVM stuff, not reflection |
| 17:16 | brehaut | then i think no |
| 17:16 | brehaut | 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 | TimMc | 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 | TimMc | 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 | amalloy | 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 | TimMc | This macro does reflection and creates private fns in the namespace that call static methods with their args. |
| 17:23 | TimMc | 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 | aperiodic | i can't seem to find a reference for paredit.vim in particular |
| 17:27 | emezeske | aperiodic: :help paredit |
| 17:28 | emezeske | 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 | TimMc | 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 | TimMc | 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 | aperiodic | 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 | TimMc | ...and then used by this macro. |
| 18:33 | TimMc | 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 | TimMc | It can't rely on other Clojure or Java stuff, it has to go straight to JVM APIs. |
| 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 | TimMc | Wait.. maybe reify does this! |
| 18:36 | TimMc | 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 | TimMc | not a very Clojure-y thing, but oh well. |
| 18:38 | TimMc | (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 | arohner | 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: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 | TimMc | 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 | lnostdal | 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 | arohner | I'm just not sure what assumptions the compiler makes re: .invoke() and boxing |
| 18:49 | arohner | 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 | TimMc | 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 | emezeske | 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 | cran1988 | ,(neg? (- 4 3)) |
| 18:55 | clojurebot | false |
| 18:56 | cran1988 | ok cool |
| 18:56 | cran1988 | i thought i was insane |
| 18:57 | arohner | TimMc: your code is always boxes primitives, unless it takes a primitive type hint. |
| 18:57 | arohner | 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 | arohner | 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 | arohner | 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 | rlb | (iirc it deletes that path, no matter what, with no possibility of cancellation) |
| 19:54 | rlb | 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 | TimMc | 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 | 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 | TimMc | 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 | dgrnbrg | I just got jan22 delivered |
| 22:53 | dgrnbrg | or something weird |
| 22:53 | seancorf` | hmm, no, can't say i've seen that sort of strange behavior |
| 22:54 | seancorf` | 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 | xuser | sdfdsfsa |
| 23:53 | adiabatic | same to you, bub |
| 23:53 | xuser | ' |
| 23:57 | seancorfield | ibdknox: you around? |
| 23:57 | seancorfield | emezeske: you? |
| 23:59 | seancorfield | 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? |