2010-09-01
| 00:09 | anonymouse89 | how do I make something like ((a) (b) (c)) -> (a) (b) (c) ? |
| 00:13 | anonymouse89 | more concretely, I have something like `(do ~(for [foo bar] `(my-fn ~foo))) |
| 00:13 | arbscht | ~@ instead of ~ |
| 00:13 | clojurebot | @ has nothing to do with whether sth is evaluated or not |
| 00:14 | anonymouse89 | and want (do (my-fn foo1) (my-fn foo2)) |
| 00:16 | anonymouse89 | so my question is, how do I prevent "for" from returning a single seq |
| 00:17 | arbscht | anonymouse89: use ~@ instead of ~ |
| 00:17 | arbscht | ~@ will splice |
| 00:17 | Raynes | anonymouse89: What he said. ~@ will do it. |
| 00:17 | clojurebot | @ splices in a seq and foo# is a symbol, not a seq |
| 00:17 | Raynes | clojurebot: We got this one bro. S'okay. |
| 00:17 | clojurebot | Excuse me? |
| 00:17 | arbscht | ,`(do ~(for [foo [1 2 3]] `(my-fn ~foo))) |
| 00:17 | clojurebot | (do ((sandbox/my-fn 1) (sandbox/my-fn 2) (sandbox/my-fn 3))) |
| 00:17 | arbscht | ,`(do ~@(for [foo [1 2 3]] `(my-fn ~foo))) |
| 00:17 | clojurebot | (do (sandbox/my-fn 1) (sandbox/my-fn 2) (sandbox/my-fn 3)) |
| 00:17 | anonymouse89 | bah, sorry I was not looking at names and the bot fooled me :( |
| 00:18 | anonymouse89 | thanks |
| 00:18 | Raynes | :p |
| 00:19 | Raynes | ->`(do ~(for [foo [1 2 3]] `(~'my-fn ~foo))) |
| 00:19 | sexpbot | => (do ((my-fn 1) (my-fn 2) (my-fn 3))) |
| 00:19 | Raynes | Neat. |
| 01:32 | defn | real neat. |
| 01:38 | Bahman | Hi all! |
| 01:39 | defn | hola |
| 01:39 | Bahman | Hola defn! |
| 01:39 | defn | I don't know if I can match your intensity. |
| 02:30 | bartj | to get a subset of key/values from a map |
| 02:31 | bartj | I do this: (zipmap keys-subset (map #(me-a-map %) keys-subset) |
| 02:31 | bartj | Is there any better (in terms of performance, idiomatic) way to do this ? |
| 02:31 | bartj | eg: |
| 02:31 | bartj | , (def g #{:a :b :c}) |
| 02:31 | clojurebot | DENIED |
| 02:32 | bartj | , (zipmap #{:a :b :c} (map #({:a 1 :b 2 :c 3 :d 4 :e 5} %) #{:a :b :c})) |
| 02:32 | clojurebot | {:b 2, :c 3, :a 1} |
| 02:35 | bartj | suggestions please ? |
| 02:38 | hoeck | ,(select-keys {:a 1 :b 2 :c 3} [:b :c]) |
| 02:38 | clojurebot | {:c 3, :b 2} |
| 02:38 | hoeck | bartj: ^ |
| 02:43 | bartj | hoeck, thanks! |
| 02:45 | bartj | hoeck, the caret means something :) ? |
| 02:46 | hoeck | bartj: in this case just "look above" (to make your irc client blinking on your name :) |
| 02:58 | LauJensen | Whats available for Java GUIs nowadays? Miglayout? GridLayout? More? |
| 04:03 | zkim | Anybody know what the 'Prefer updating over setting' bullet point on the lib coding standard page means? http://www.assembla.com/wiki/show/clojure/Clojure_Library_Coding_Standards |
| 04:33 | notsonerdysunny | can anybody suggest a maven-repository which contains jogl.jar ? |
| 04:34 | fliebel | Is there a way to listen for key events with Clojure? I mean the type of events that work when your app is not in focus. |
| 04:34 | bobo_ | notsonerdysunny: http://stackoverflow.com/questions/1962718/maven-and-the-jogl-library tried that one? |
| 04:39 | notsonerdysunny | bobo_: I have tried a couple of things .. I have tried using the ones on clojars.org unfortunately they didn't confirm to conventions of native-deps so downloaded those jars and repackaged it and uploaded it to clojars.org/sunilnandihalli/jogl .. but it does not seem to be working I am not sure if the problem is with the jogl .. or is it something else.. I am new to java/jar stuff.. so I... |
| 04:39 | notsonerdysunny | ...might be doing something wrong.. I was just hoping somebody had a "native-deps" compatible jogl.jar some-where on the web |
| 04:41 | hoeck | fliebel: don't know if that helps but you can install your own java.awt.EventQueue to process all events the application gets |
| 04:43 | hoeck | fliebel: (-> (java.awt.Toolkit/getDefaultToolkit) .getSystemEventQueue (.push <your-custom-java.awt.EventQueue>)) |
| 04:43 | fliebel | hoeck: iirc, awt doesn't even receive any events when it's not focused. It's just made to do the user-clicked-some-button-in-yout-gui type of stuff. |
| 04:44 | fliebel | hoeck: While I want to have the global events, for doing stuff like quicksilver, or gnome do, if you're into linux. |
| 04:47 | hoeck | fliebel: ah, ok |
| 04:48 | fliebel | hoeck: I tried to do it in Jython once, for mouse events… fail… Must be a way to do it... |
| 04:50 | hoeck | I guess one has to hook into some gnome or X libraries, or some use some strange windows messaging API |
| 04:58 | gregh | on windows you might use the CBT hooks but I doubt you can write one of those without introducing native code |
| 05:05 | fliebel | gregh: Then I might as well do it in Python, since I already wrote cross-platform native mouse bindings for that. |
| 06:24 | jave | it would be nice if clojure docs where available in info format |
| 06:26 | esj | is that a volonteer I spy ? |
| 06:27 | jave | yes maybe |
| 06:28 | jave | how are the docs made today? |
| 06:28 | jave | if I can do some form of hack to achieve it I can have a try |
| 06:28 | esj | http://github.com/tomfaulhaber/autodoc |
| 06:29 | esj | I really like them actually |
| 06:29 | jave | but is docs for core fns such as defn made the same way? |
| 06:30 | esj | yeah, believe so |
| 06:30 | jave | cool |
| 06:30 | esj | but I'm usually wrong :) |
| 06:31 | jave | heh |
| 06:31 | esj | have fun ! |
| 06:31 | jave | Thanks |
| 06:31 | fliebel | is info format those frames generated for java docs? or what? |
| 06:31 | jave | no for reading in emacs |
| 06:37 | fliebel | I think it'd be great to have references to other functions in the docs. |
| 06:54 | esj | fliebel: ^^ :P |
| 07:05 | bartj | why aren't optional arguments in functions, accessible inside the function ? |
| 07:06 | bartj | (defn blah [a b & c] |
| 07:06 | bartj | (when c (println "hi"))) |
| 07:06 | bartj | (blah 1 2 true) ;will *not* print hi |
| 07:06 | bartj | ah, never mind |
| 07:07 | __debaser | doesn't c stand for a list with the rest of the args? |
| 07:08 | fliebel | I thought so, but still: |
| 07:08 | fliebel | ,(when '(true) "yes") |
| 07:08 | clojurebot | "yes" |
| 07:09 | bartj | ok, I find this behaviour very weird: |
| 07:09 | bartj | I don't know what I am doing wrong |
| 07:09 | bartj | let me illustrate |
| 07:09 | bartj | (defn blah [a b & c] |
| 07:09 | bartj | (when-not c (println "hi"))) |
| 07:09 | bartj | (blah 1 2 false) ;will *not* print hi |
| 07:09 | bartj | (defn blah2 [a b c] |
| 07:09 | bartj | (when-not c (println "hi"))) |
| 07:09 | bartj | (blah 1 2 true) ;will print hi |
| 07:10 | bartj | er, the last statement must be: |
| 07:10 | bartj | (blah2 1 2 true) ;will print hi |
| 07:10 | LauJensen | ,(when-not false 1) |
| 07:10 | clojurebot | 1 |
| 07:10 | opqdonut | bartj: [false] is true |
| 07:10 | opqdonut | use & [c] |
| 07:11 | bartj | opqdonut, you mean everything after & is in a vector ? |
| 07:11 | opqdonut | (def blah [a b & [c]] (when-not c (println "hi"))) |
| 07:11 | opqdonut | yes |
| 07:11 | bartj | oh thanks! |
| 07:11 | opqdonut | that's why its usually called & rest |
| 07:11 | opqdonut | it grabs the rest of the arguments |
| 07:11 | bartj | I was getting excited that I had found a bug or something ;) |
| 07:12 | fliebel | Is there any way to have Python style optional arguments? Like: def test(a b c="default") |
| 07:13 | fliebel | I think this is what bartj was expecting. |
| 07:13 | esj | fliebel: i usually do that with multimethods |
| 07:13 | esj | sorry, i'm lying, |
| 07:13 | bartj | is there a technical term for this sort of behaviour ? |
| 07:13 | esj | with variadic functions |
| 07:13 | fliebel | esj: difference? |
| 07:14 | bartj | I mean in the functional sense. |
| 07:14 | esj | (defn foo ([] (foo :default) ([a] (str a))) |
| 07:14 | esj | or suchlike |
| 07:14 | esj | so if you call foo with no args, it calls foo with one arg |
| 07:14 | esj | dunno how canonical that sort of carrying on is , though |
| 07:15 | fliebel | esj: ah, and multimethods are the actual fancy things with functions to determine the correct thing and stuff? |
| 07:15 | esj | multimethods are another thing that allow you to dispatch a function based on a function of the arguments |
| 07:16 | esj | so like in most languages you can dispatch a function on the type of an argument to get your usual polymorphism |
| 07:16 | fliebel | very fancy… so you could have a different method for positive and negative numbers for example? |
| 07:16 | esj | with them you can dispatch on any function of the arguments |
| 07:16 | esj | yup |
| 07:20 | bartj | esj: the difference b/w multimethods and protocols is that protocols accept only one argument unlike multimethods ? |
| 07:20 | esj | bartj: no, there's much more to it |
| 07:21 | bartj | esj, and protocols is much better performance-wise |
| 07:21 | bartj | esj, s/is/are |
| 07:22 | dnolen | cgrand: around? moustache question. |
| 07:23 | esj | bartj: that's true, but there is a lot going on under the hood |
| 07:24 | esj | i gotta dash, so can't continue this, which is probably just as well, as I'd just mangle it. There's lots on the web you can read though. |
| 07:24 | bartj | esj, ok, no problemo |
| 07:25 | LauJensen | dnolen: whats the question? |
| 07:26 | dnolen | wondering if it's possible to define a route match like "*/foo" |
| 07:26 | LauJensen | So to disregard the first level and only match on the second ? |
| 07:26 | dnolen | where we don't care what comes before at all, no matter how many levels. |
| 07:26 | dnolen | would a regex work? |
| 07:27 | LauJensen | [& levels] (when (= "match" (last levels)) ...) ? |
| 07:28 | dnolen | LauJensen, if a handle returns false it moves on to the next handler? |
| 07:28 | dnolen | s/handle/handler |
| 07:28 | LauJensen | Im not entirely sure how app dispatches |
| 07:28 | dnolen | or nil rather I mean |
| 07:30 | dnolen | hmm sounds like that would work, if handler returns nil it continues on. |
| 07:30 | LauJensen | I think it calls match-route on all requests, returning a seq of those that match. Then it might be up to emit-validator to decide which gets run. You'll have to 2x check the source, I think Christophe is a little tied up these days |
| 07:31 | LauJensen | I guess what you could do - depending on your situation - was to introduce a middleware that checked for those phrases you want to match ? |
| 07:38 | dnolen | LauJensen: Raynes had an interesting idea, would cool to be able to destructure from the end of something, thought clearly perf implications for anything but vectors. |
| 07:38 | kumarshantanu | LauJensen: I have a question about Ring -- does it lay down how to match URIs? I can't find any mention of that in the SPEC file in master |
| 07:38 | LauJensen | kumarshantanu: No, Ring has nothing to do with routing as far as I know |
| 07:39 | LauJensen | dnolen: {dstruc from end} (rseq vec) ? |
| 07:39 | dnolen | kumarshantanu: you'll need to use Compojure/Clout/Moustache for that |
| 08:01 | mrBliss | is there somebody here with a Mac who is willing to show the output of (. System (getProperty "os.name")) ? |
| 08:01 | mrBliss | I'm too lazy to turn mine on ;-) |
| 08:02 | kumarshantanu | ,(. System (getProperty "os.name")) |
| 08:02 | clojurebot | java.security.AccessControlException: access denied (java.util.PropertyPermission os.name read) |
| 08:02 | nlogax | mrBliss: i get "Mac OS X" |
| 08:02 | mrBliss | thanks |
| 08:03 | fliebel | mrBliss: I'm to slow, but mine also says "Mac OS X" |
| 08:04 | mrBliss | just found this: http://lopica.sourceforge.net/os.html |
| 08:14 | LauJensen | Is there a Javacomponents which renders html and evalutes JS? (aside from the Qt/webkit) |
| 08:29 | cemerick | LauJensen: http://www.webrenderer.com is the only viable "lightweight" option for swing AFAIK. Besides that, DJProject does a very good job of integrating swt's browser control into swing (resolving tough issues like interleaving of heavyweight and lightweight components). Then there's SWT, which supports mozilla across all platforms (defaulting to webkit on OS X and IE 7/8 on Windows). |
| 08:30 | LauJensen | Excellent, I'll check them out, thanks Chas |
| 08:31 | LauJensen | btw - I wasn't trying to scare that guy with the Windows perf question last night - I was just reminded of some benchmarking results I saw a while back, where Clojure on Windows had some nasty spikes not seen on *nix |
| 08:35 | LauJensen | cemerick: ^^ |
| 08:36 | cemerick | LauJensen: you know me, always looking out for the great unwashed masses not using linux and emacs. ;-) |
| 08:37 | LauJensen | I know - And you had a valid point so Im glad you injected it - Im just saying it wasnt purely unbased Windows hatred :) |
| 08:37 | cemerick | well, "windows is slow" isn't very ambiguous |
| 08:38 | cemerick | It's fine, as long as you're holding up the extremist front, I can look like a moderate :-D |
| 08:38 | LauJensen | hehe |
| 08:38 | LauJensen | Don't worry, Im not going anywhere |
| 08:44 | bozhidar | I'm not an Windows user, but lets be fair |
| 08:44 | bozhidar | if almost everyone is using it - it can't be that bad |
| 08:44 | bozhidar | :-) |
| 08:45 | LauJensen | bozhidar: That kind of logic will get you killed |
| 08:45 | bozhidar | LauJensen: life will get me killed anyways ;-) |
| 08:46 | cemerick | bozhidar: Indeed, just another bargain between vendor and user, and a product of its history (just like everything else). |
| 08:46 | bozhidar | cemerick: I totally agree |
| 08:46 | LauJensen | bozhidar: By that logic PHP is the 5th best programming language in the world |
| 08:46 | bozhidar | LauJensen: good and bad are extremely subjective words |
| 08:47 | LauJensen | 'if everybody uses it, it cant be that BAD' => PHP is the 5.th most deployed language in the world |
| 08:47 | bozhidar | if something has become that wide spread - it has to have some merits |
| 08:47 | cemerick | LauJensen: There's no "good" or "bad" involved -- just "works" or "doesn't work" for particular people/orgs and use-cases. |
| 08:47 | LauJensen | Alright - Lets leave it here while you ponder a career in PHP development :) |
| 08:47 | bozhidar | I personally don't like it very much, but I can see the appeal it has to many developers |
| 08:48 | bobo_ | yes, join me in php hell! |
| 08:48 | bozhidar | lots of docs lying around, easy to get started, easy to deploy |
| 08:48 | bozhidar | compare that to a java web app :-) |
| 08:48 | bobo_ | honestly, php is less horrible then swing |
| 08:48 | cemerick | bozhidar: a much stronger comparison would be between mysql and SQLServer admin, but sure. :-) |
| 08:49 | bozhidar | bobo_: I've coded a lot of Swing - at first I hated it, but once you get used to it, it's not that bad. Actually that awful api gives you a lot of flexibility |
| 08:49 | chouser | I'm actually using PHP these days, and am rapidly cementing an informed opinion. |
| 08:50 | chouser | ...which is entirely off topic, not to mention rude, so I'll keep it to myself. |
| 08:50 | cemerick | chouser: I think #clojure has been off topic all summer. |
| 08:50 | fliebel | chouser: I've used PHP for years, and still don't have any. PHP is like Rails in that respect, you don't need to know the language to produce something usefull. |
| 08:50 | bozhidar | chouser: I have such secret opinion about Visual Basic ;-) |
| 08:51 | fliebel | What does this mean? "Aleph conforms to the interface described by http://github.com/mmcgrana/ring, with one small difference: the request and response are decoupled." |
| 08:51 | chouser | bozhidar: me too! though mine wasn't secert. I made a web page detailing my opinion back in '97 or so. |
| 08:53 | bozhidar | real story, guys - I go to a job interview for Java developer, they approve me and on the day of the contract signing the HR lady tells me this. "I saw in your resume that you worked 3 months on a PHP project, are you interested in becoming a PHP team leader instead of java developer?" |
| 08:53 | bozhidar | I was shocked and amused at the same time |
| 08:53 | bozhidar | :-) |
| 08:55 | chouser | I'm guessing your shocking and amusing answer was: "no" |
| 08:55 | LauJensen | bozhidar: why? 3 months of steady employment should be more than enough qualification to be a PHP team lead :) |
| 08:55 | fliebel | bozhidar: You became the PHP team leader I suppose? |
| 08:55 | bozhidar | chouser: indeed |
| 08:55 | bozhidar | LauJensen: I wasn't even working on something mainstream |
| 08:56 | bozhidar | we were migrating the web UI of our flights booking engine |
| 08:56 | bozhidar | and there were to enough PHP devs to meet the deadline |
| 08:56 | bozhidar | so the C++ and Java teams were involved as well |
| 08:57 | bozhidar | before that I hadn't written a line of PHP code in my life and the framework we used for the UI was developed internally so this was not knowledge one could apply somewhere else |
| 08:58 | bozhidar | my old employers were pretty fond of useless custom solutions to generic problems |
| 08:58 | LauJensen | I said 'steady employment', I meant the ability to get up in the morning and show up for work :) |
| 08:58 | bozhidar | before the PHP stint they had developed a programming language(!!!) that according to them was better than PHP :-) |
| 08:59 | bobo_ | i can belive that |
| 08:59 | LauJensen | Yea sounds plausible |
| 08:59 | bozhidar | bobo_: you haven't seen HTTL ;-) |
| 08:59 | chouser | the Hyper Text Template Language! |
| 08:59 | mrBliss | I would like to see it! |
| 08:59 | LauJensen | There was a story on HN a few months ago, about this guy being hired to work in JoeX ro something, a personal PHP variant |
| 09:00 | LauJensen | s/ro/or/ |
| 09:00 | bozhidar | chouser: yes, have you heard of it? |
| 09:00 | chouser | bozhidar: no |
| 09:00 | bozhidar | chouser: lucky man |
| 09:01 | bozhidar | btw on the subject of Clojure |
| 09:02 | bozhidar | as I mentioned I do a lot of Swing dev and I was wondering something |
| 09:02 | bozhidar | generally a Swing frame/dialog has a lot of GUI components in it |
| 09:03 | bozhidar | what is the preferred approach to model this in Clojure |
| 09:04 | bozhidar | in Java you'd usually have private fields for everything you plan to refer more than once(which is generally everything except labels and separators) |
| 09:04 | LauJensen | bozhidar: check out clojure.contrib.miglayout |
| 09:05 | bozhidar | LauJensen: 10x |
| 09:05 | bozhidar | miglayout is my favourite layout manager, probably this is exactly what I need |
| 09:06 | LauJensen | There's a nice wrapper for it, which also lets you label components and refer to them later by id |
| 09:07 | bozhidar | great |
| 09:07 | bozhidar | just what the doctor ordered |
| 09:25 | mrBliss | what's the recommended name for a test of a function (for example defn ms-to-minutes and deftest ms-to-minutes-test)? |
| 09:44 | pdk | ,(sym "complex phrase as a symbol name") |
| 09:44 | clojurebot | java.lang.Exception: Unable to resolve symbol: sym in this context |
| 09:44 | pdk | ,(symbol "complex phrase as a symbol name") |
| 09:44 | clojurebot | complex phrase as a symbol name |
| 09:44 | pdk | \o/ |
| 09:45 | pdk | ,(symbol "\"that\'s amazing!\"") |
| 09:45 | clojurebot | Unsupported escape character: \' |
| 09:45 | pdk | welp |
| 09:45 | pdk | ,(symbol "\"that's amazing!\"") |
| 09:45 | clojurebot | "that's amazing!" |
| 09:46 | pdk | NOW THE QUESTION IS |
| 09:46 | pdk | ,(keyword "\"that's amazing!\"") |
| 09:46 | clojurebot | :"that's amazing!" |
| 09:49 | chouser | pdk: that could stop working at any moment. Well, at any moment during which you upgrade clojure. Just so you know. |
| 09:51 | nlogax | is anyone using aleph for something other than http stuff? i want to write an irc bot as my first project, but i can't find any good examples (and clojure is still fairly alien to me) |
| 09:52 | nlogax | aleph looks inviting because it appears to hide the java stuff :) |
| 09:52 | fliebel | nlogax: I'm planing to do smtp and imap with it, but nothing done yet. |
| 09:53 | fliebel | (i'm planning A LOT, but not doing everything I plan) |
| 09:53 | nlogax | heheh, same here |
| 09:55 | mrBliss | (inc that) |
| 09:55 | chouser | nlogax: there are some nice Java IRC libs that would let you work at a higher level of abstraction |
| 09:55 | chouser | and even some clojure wrappers around those |
| 09:55 | fliebel | clojurebot: where are you? |
| 09:55 | clojurebot | http://github.com/hiredman/clojurebot/tree/master |
| 09:55 | bobo_ | http://github.com/Raynes/irclj isnt a wrapper |
| 09:55 | bobo_ | belive clojurebot uses that aswell |
| 10:03 | nlogax | i looked briefly at clojurebot, but it was a bit overwhelming. i'll try and pick it apart if i don't find anything else :) |
| 10:04 | bobo_ | nlogax: what part is it you want to look at? the irc part? |
| 10:05 | nlogax | bobo_: ideally i'd just like a socket to put stuff into and read stuff from |
| 10:06 | bobo_ | i think you can look att irclj then |
| 10:06 | nlogax | so i can learn something |
| 10:06 | nlogax | will do! |
| 10:10 | LauJensen | Anybody here tried Apache Pivot for a Desktop App? |
| 10:26 | jkkramer | is it ok to assoc a boatload of entries into a record? is it better to give it a single map field that you assoc into instead? |
| 10:27 | jkkramer | like thousands or millions of entries |
| 10:28 | chouser | jkkramer: it's essentially a single map on the end of record anyway, so go ahead and dump in whatever you need. |
| 10:28 | jkkramer | chouser: thanks. i wasn't sure if there was some class field-generating magic behind the scenes or something |
| 10:29 | mrBliss | how do you rebind private functions from another namespace? (for testing purposes ofc) |
| 11:02 | simard | can clojure use java libs ? |
| 11:02 | yacin | yup |
| 11:03 | simard | well, then it's perfect isn't it ? |
| 11:03 | simard | more seriously, I was wondering why one would use clojure instead of, say, Lisp |
| 11:03 | LauJensen | simard: getting there |
| 11:03 | LauJensen | simard: Clojure is a Lisp dialect |
| 11:03 | simard | which makes it very attractive to me |
| 11:04 | LauJensen | If you're wondering if why one would use Clojure instead of Common Lisp there are more reasons than I can count, and few against doing so |
| 11:04 | simard | but I kinda dislike the way common lisp has relatively few libs |
| 11:07 | LauJensen | Why the 'but' ? |
| 11:07 | AWizzArd | simard: with ABCL it has exactly the same available as Clojure |
| 11:07 | simard | dunno :) |
| 11:07 | AWizzArd | it also has all the datastructures of Clojure available |
| 11:09 | LauJensen | AWizzArd: interesting, I didn't know that |
| 11:09 | AWizzArd | ABCL is an implementation for the JVM. |
| 11:09 | AWizzArd | vice versa it means that you can compile tons of CL code with it to .class files and use those from Clojure. |
| 11:10 | LauJensen | AWizzArd: Why would you want to ? |
| 11:10 | slyrus | LauJensen: why would you want java interop? |
| 11:10 | AWizzArd | people may have a code base of a few ten thousand LOC written in CL• |
| 11:10 | slyrus | I have far more CL code than java code lying around I'd like to use from my clojure code |
| 11:11 | slyrus | clearly I am in the minority |
| 11:11 | LauJensen | Ah like so |
| 11:11 | LauJensen | I guess I solved that with a rm -rf, once Clojure was released to the public :) |
| 11:11 | AWizzArd | ;) |
| 11:11 | AWizzArd | Anyway, there are still plenty of highly experienced lisp users who prefer CL over Clojure. |
| 11:11 | cemerick | Wow, what a niche: people with existing CL codebases that are usable in ABCL who would like to use them from clojure! |
| 11:12 | AWizzArd | They will probably stick with CL. |
| 11:12 | LauJensen | cemerick: Yea, you shouldn't start a business doing those ports |
| 11:12 | AWizzArd | I must mean that it is possible. |
| 11:12 | LauJensen | 'CommonHarvest' |
| 11:12 | AWizzArd | must => just |
| 11:15 | chouser | http://gist.github.com/560765#file_abomination_desolation.clj |
| 11:20 | _fogus_ | chouser: now to allow forms like k = i + j :o |
| 11:21 | chouser | _fogus_: right, clearly this belongs in unfix |
| 11:21 | _fogus_ | oooooooo! |
| 11:21 | chouser | though without any parens at all, we'd need an expression terminator sigil -- but ; is taken. |
| 11:21 | _fogus_ | "Are you tired of so-called "let-blocks"? |
| 11:21 | chouser | but k = (i + j) could be made to work easily enough. |
| 11:23 | LauJensen | chouser: I dont understand, why would you do such a thing? |
| 11:24 | chouser | I think it would be possible to have a (start-using-dolet) macro that, when put just after your (ns ...) would make all do-blocks act like dolet |
| 11:24 | chouser | ...allowing (fn [a] b = (inc a), (prn b)) |
| 11:25 | chouser | LauJensen: for the sheer twisted joy of it. |
| 11:25 | metagov | chouser: I'd prefer the alternate abomination in that case: (fn [a] (let b (inc a)), (prn b)) |
| 11:26 | chouser | metagov: hm.. that would actually be a breaking change. we'd need a different word than 'let' |
| 11:26 | chouser | oh, or maybe just look for a vector. |
| 11:27 | LauJensen | in pom.xml, what is modelversion ? |
| 11:27 | chouser | (let a b) is for the outer scope, (let [a b] ...) creates a new scope. |
| 11:29 | LauJensen | modelVersion This element indicates what version of the object model this POM is using. The version of the model itself changes very infrequently but it is mandatory in order to ensure stability of use if and when the Maven developers deem it necessary to change the model. |
| 11:31 | lpetit | hello |
| 11:31 | lpetit | chouser: what are you talking about ? |
| 11:31 | chouser | lpetit: http://gist.github.com/560765#file_abomination_desolation.clj |
| 11:33 | lpetit | chouser: it's for more easily be able to write code with side-effects ? :) |
| 11:33 | chouser | it's to demonstrate that Clojure's syntax is what it is not because it can't be like more imperative languages, but because it chooses not to be. |
| 11:35 | lpetit | chouser: ok. final touch for you book ? :) |
| 11:36 | LauJensen | lpetit: I think he's holding off until he's implemented (defmacro c++ [& body] ...) |
| 11:36 | slyrus | chouser: what is outer scope? |
| 11:36 | lpetit | LauJensen: rofl |
| 11:36 | lpetit | Bjarne, GET OUT of chouser's body :) :) |
| 11:37 | chouser | lpetit: nah, but maybe an addition to http://www.fogus.me/fun/unfix/ |
| 11:37 | LauJensen | hehe |
| 11:37 | LauJensen | man fogus has the sickest webdesign chops |
| 11:38 | chouser | slyrus: the containing 'do' block that would have been converted to a 'dolet', so the enclosing do, fn, let, etc. |
| 11:39 | LauJensen | chouser: did you guys ever finish that shell on his site? |
| 11:39 | chouser | LauJensen: That's all _fogus_ -- I know nothing. |
| 11:39 | LauJensen | Oh |
| 11:40 | chouser | well, that didn't stir up nearly enough uproar. Should I tweet it? |
| 11:41 | LauJensen | chouser: naah just commit it to master, then tweet |
| 11:42 | chouser | heh. I think that would be my last commit. |
| 11:43 | cemerick | I don't think there'll be much uproar. People'll shrug here, and either not grok it elsewhere. |
| 11:50 | chouser | hm. dull. |
| 12:03 | bortreb | the DESOLATION!!!!!! |
| 12:03 | bortreb | NOOOOOOOOOOOOOOO11111111111 |
| 12:05 | bortreb | chouser: you sir, are a mad genius |
| 12:43 | chouser | bortreb: that's better. thanks! |
| 12:43 | chouser | :-) |
| 12:43 | chouser | I should mention this came out of dangerous conversations with metagov |
| 14:01 | LauJensen | You get the funniest referers when running a website: http://www.ask.com/web?q=I+found+a+red+pill+that+was+cut+in+half+what+could+it+be%3F&qsrc=0&o=0&l=dir |
| 14:02 | raek | løl |
| 14:03 | _fogus_ | chouser: I added you to the unfix contributors, so feel free to add dolet if you feel motivated. :-) http://github.com/fogus/unfix |
| 14:04 | LauJensen | _fogus_: got push ? |
| 14:04 | chouser | _fogus_: :-) thanks |
| 14:05 | _fogus_ | LauJensen: Sorry, I meant to but had a kid issue yesterday. I will try again tonight, unless a tar works better right now |
| 14:06 | LauJensen | No problem, kid issues take priority 10 out of 10 times :) |
| 14:07 | Raynes | LauJensen: 9.5 out of 10 times if you can type and change diapers at the same time. |
| 14:09 | s450r1 | but still 10 out of 10 times if you can type and change diapers at diapers at the same time but have twins |
| 14:09 | LauJensen | Raynes: I guess that explains your code.... :) |
| 14:12 | jfields | (= (:price-in-pennies desired) (:price-in-pennies resting)) |
| 14:12 | jfields | is there a more elegant way to do that? |
| 14:14 | Raynes | LauJensen: I don't change diapers while I code. I have a strange habit of eating difficult foods while coding, however. |
| 14:14 | LauJensen | difficult foods? Sounds unproductive, just have a slice of bread |
| 14:15 | Raynes | :p |
| 14:16 | dnolen | jfields: a little shorter (reduce = (map :prince-in-pennies) [desired resting]) |
| 14:16 | _fogus_ | jfields: (apply = (map :price-in-pennies [desired resting])) might make for a more generic approach |
| 14:16 | _fogus_ | dnolen: too fast! |
| 14:17 | dnolen | _fogus_: but you win by being 2 chars shorter ;) |
| 14:17 | _fogus_ | YAY! |
| 14:18 | jfields | thanks guyas |
| 14:18 | jfields | guys |
| 14:18 | _fogus_ | guyas means "gentlemen of great passion" in cambodian |
| 14:23 | _fogus_ | Someone kick me for ever thinking that discussing parens was a good idea |
| 14:34 | _fogus_ | Is there a better way to do (f (butlast s) (last s)) ? |
| 14:35 | danlarkin | (apply f (drop (- (count s) s) s)) |
| 14:36 | danlarkin | but that is certainly not better |
| 14:36 | danlarkin | er |
| 14:36 | danlarkin | I typoed it |
| 14:36 | LauJensen | _fogus_: only if its a vector |
| 14:36 | _fogus_ | yeah, it's actually (fn [& s] ...) |
| 14:37 | dnolen | _fogus_: perhaps another reason to support destructuring from the end? |
| 14:38 | _fogus_ | dnolen: That would be very nice. |
| 14:38 | _fogus_ | Although my specific case is too obscure to warrant a change |
| 14:38 | _fogus_ | http://gist.github.com/561132 |
| 14:39 | dnolen | (fn [$head x] ...) ? |
| 14:40 | _fogus_ | (fn [[front &middle end]] ...) ? |
| 14:42 | Anniepoo_ | this should be trivial, but it's driving me nuts - I want to write a concurrancy-safe 'pop' operation. |
| 14:43 | LauJensen | Anniepoo_: (swap! atom pop) |
| 14:43 | replaca | jave: are you there? |
| 14:43 | Anniepoo_ | Lau, I want the top item |
| 14:44 | Anniepoo_ | if I do (first @atom) beforehand it's not in the transaction |
| 14:44 | LauJensen | (dosync (let [p (first @ref)] (alter ref pop) p)) ? |
| 14:45 | Anniepoo_ | ok, thanks. |
| 14:45 | Anniepoo_ | dunno why that seemed so hard. |
| 14:45 | chouser | it's hard with an atom |
| 14:45 | Anniepoo_ | I'd convinced myself that wouldn't work |
| 14:45 | LauJensen | chouser: impossible you mean? |
| 14:46 | chouser | no |
| 14:46 | chouser | messy |
| 14:47 | LauJensen | Can you demo ? |
| 14:49 | chouser | (defn atom-pop [a] (let [box (clojure.lang.Box. nil)] (swap! a #(do (set! (.val box) (peek %)) (pop %))) (.val box))) |
| 14:50 | chouser | ^^ messy |
| 14:50 | LauJensen | Nasty |
| 14:50 | LauJensen | But yes, it would work :) |
| 14:50 | jave | replaca: hello |
| 14:52 | chouser | http://clojure-log.n01se.net/date/2010-08-18.html#11:14 |
| 14:55 | LauJensen | chouser: Thats really one of the charms of #clojure, on the one hand you and Rich are discussing concurrency semtantics, and at the same time Raynes is pondering how to manually crack eggs - true concurrency! :) |
| 14:57 | AWizzArd | a bit cleaner: (defn atom-pop [a] (let [p (promise)] (swap! a #(do (deliver p (first %)) (pop %))) @p)) |
| 14:58 | AWizzArd | Promise injection rocks :) |
| 14:58 | chouser | AWizzArd: nice. though that's likely heavier. |
| 14:59 | AWizzArd | yes |
| 14:59 | chouser | the Box in mine never escapes so there's no need for concurrency support (extra atoms, countdown latches, etc) |
| 14:59 | chouser | you really do want what rhickey described. |
| 15:00 | chouser | (swap2! stack (fn [v] [(pop v) (peek v)])) |
| 15:00 | AWizzArd | chouser: he described this where you just linked to? |
| 15:00 | chouser | (defn swap2! [a f & args] (let [box (clojure.lang.Box. nil)] (swap! a #(let [[state rtn] (apply f % args)] (set! (.val box) rtn) state)) (.val box))) |
| 15:00 | chouser | all he said was "you might want a version of swap! that takes a fn that returns 2 values, the one to swap and a return" |
| 15:01 | AWizzArd | ic |
| 15:02 | chouser | I would guess it would act something like my swap2! above |
| 15:02 | chouser | I wonder if 2 fns would be better than returning a vector. |
| 15:04 | chouser | (swap2! stack pop peek) |
| 15:05 | raek | implicit juxt... |
| 15:06 | chouser | hm, yeah. |
| 15:06 | raek | (swap2! stack (juxt pop peek)) |
| 15:06 | _fogus_ | implicit juxt is the point of th my cleave fn |
| 15:07 | _fogus_ | "my" as in the one I stole from countless others |
| 15:10 | slyrus | oh, I've been wanting something like juxt and forgot that was there. |
| 15:14 | slyrus | except that the one I was thinking of would have been more like (my-juxt [+ - +] 42 7) |
| 15:18 | replaca | jave: sorry, got pulled into a meeting :-) |
| 15:18 | replaca | jave: if you add info-file building to the autodoc stuff, I'd be happy to merge it into the normal autodoc build |
| 15:19 | raek | _fogus_: what is this "cleave fn"? (loved the part about functions returning functions in JoY, btw) |
| 15:19 | jave | replaca: cool |
| 15:19 | replaca | jave: I don't think it should be too hard, you should be able to just have a "copy" of build-html.clj that is a build-info.clj |
| 15:22 | @rhickey | chouser: you wouldn't want to define sawp2! in terms of swap! |
| 15:22 | chouser | rhickey: yeah |
| 15:22 | chouser | those were just meant to demonstrate the api |
| 15:22 | chouser | demonstrate and try out |
| 15:25 | @rhickey | 2 fns is interesting, because it demonstrates the only interesting case is where they are both functions of the prior value |
| 15:25 | @rhickey | since a function of the resulting value could be called after swap! returned |
| 15:26 | chouser | passing the same extra args to both seems a little arbitrary though |
| 15:26 | chouser | fine when there are no extras as with pop and peek, but otherwise not obviously desirable |
| 15:26 | @rhickey | I'm wondering about the utility in general. Does someone have a use case that doesn't involve side effects? |
| 15:27 | jave | replaca: I tried to run autodocs, but couldnt get it to run. README.md could mention how to run it maybe? I guessed "lein deps" but that failed on a missing artifact |
| 15:30 | chouser | There'd be a potential use case anytime you're doing something destructive to the value in the atom. |
| 15:30 | chouser | pop is one such, but also dissoc and disj |
| 15:30 | chouser | possibly even rest or next, I suppose. |
| 15:32 | replaca | jave: it's in a little bit of an intermediate state at the moment. It won't work with lein 1.2/1.3 as a plug-in, but I think it will work standalone |
| 15:33 | jave | but I need to build it to run it standalone right? |
| 15:33 | replaca | if you want to do it against clojure core, you'll need to set up the directories right casue that one is done mostly by magic |
| 15:33 | raek | could one make a priority (set-)queue using this and a sorted-set? the pop operation would let (first queue) and dissoc it... |
| 15:34 | @rhickey | chouser: it could just return both values and be done with it |
| 15:34 | replaca | more doc on running standalone is at http://tomfaulhaber.github.com/autodoc/ |
| 15:34 | replaca | but it may have some probs right now |
| 15:35 | jave | ah Thanks |
| 15:35 | replaca | jave: to set up a clojure build you need to make a ../autodoc-work-area directory and make a clojure subdirectory there |
| 15:35 | chouser | rhickey: hm, nice. The cost of constructing the return value wouldn't be prohibitive? |
| 15:36 | hiredman | you could also use binding and set! to emulate multiple returns |
| 15:36 | jave | replaca: but in order to hack in info support I need to build autodocs right? |
| 15:37 | @rhickey | chouser: impossible to answer generally |
| 15:37 | replaca | jave: then clone clojure sources into src/ and autodoc/ and, in autodoc, do a "git checkout gh-pages" |
| 15:37 | replaca | jave: yeah, but that should work ... |
| 15:38 | chouser | rhickey: maybe two (or three?) flavors of swap! then? return old, return new, return both? :-/ |
| 15:38 | @rhickey | chouser: pass in a pod |
| 15:38 | hiredman | (binding [*r1* nil] (swap some-atom (fn [x] (set! *r1* (pop x)) (peek x)))) |
| 15:38 | replaca | jave: maybe it's breaking cause of new leiningen |
| 15:38 | hiredman | swap! |
| 15:38 | replaca | jave: I still have lein 1.1 on my machine and lein deps, lein uberjar seems to work fine |
| 15:39 | hiredman | s/clojurians/pod people/ |
| 15:40 | chouser | oh, you just mean use a pod the way I used Box and hiredman used a Var? |
| 15:40 | jave | replaca: I commented out the lein dev deps in the project.clj, lein deps works then |
| 15:42 | jave | replaca: and "lein autodocs" seems to do something. crashes, but at least starts. |
| 15:42 | replaca | oh, ok. I'll check out what's up there. |
| 15:42 | simard | what is better practice, using [1 2 3] or '(1 2 3) and why ? |
| 15:42 | replaca | jave: don't use the lein plugin |
| 15:42 | replaca | are you aiming to create info file for clojure itself? |
| 15:42 | jave | yes |
| 15:43 | ihodes | simard: it depends on the situation, but generally [x y z] is used in favor of '(x y z) because it's easier to type and read, and vectors are often faster for the job. |
| 15:43 | jave | replaca: but I could try something simpler 1st |
| 15:43 | jave | |
| 15:43 | replaca | jave: clojure itself is different than other things cause autodoc needs to play more games wrt versions and assumptions |
| 15:43 | simard | ihodes: k |
| 15:43 | replaca | jave: but it should be fine - just a different setup and invocation path |
| 15:44 | replaca | jave: in fact it may be better because I've been exercising it a lot lately :-) |
| 15:44 | raek | simard: when containing self-evaluating things only, they're pretty much equivalent (unless you care about what data structure it is). the vector form is the one I tend to see most as a sequential data literal (and has the most clojure-y feel, for me) |
| 15:45 | replaca | jave: just create the directories as described above and then run "./run.sh clojure false" from the root of your autodoc checkout tree |
| 15:45 | jave | replaca: ok |
| 15:46 | jlf` | anyone have a recommendation about which of the many couchdb clojars to use? |
| 15:46 | replaca | jave: it will generate new doc in ../autodoc-work-area/clojure/autodoc |
| 15:46 | jlf` | i initially tried the-kenny's, but compilation fails with " error: java.io.FileNotFoundException: Could not locate clojure/contrib/json/read__init.class or clojure/contrib/json/read.clj on classpath:" |
| 15:46 | @rhickey | chouser: pass the pod in |
| 15:46 | replaca | jave: interesting config stuff for clojure is in params/clojure/ |
| 15:47 | s450r1 | jlf`: clutch worked nicely for me |
| 15:48 | jlf` | s450r1: that narrows it to 6 :) which one in particular? |
| 15:53 | s450r1 | jlf`: http://github.com/ashafa/clutch |
| 15:55 | jlf` | thanks |
| 15:57 | hiredman | I wonder if the clojure mailing list could just move to a new address and not tell people who want to argue about paren placement |
| 15:57 | Raynes | hiredman: I second that motion. |
| 15:58 | slyrus | :) |
| 15:58 | LauJensen | hehe |
| 15:59 | LauJensen | Whats the name of that thread? |
| 15:59 | LauJensen | "Lisp/Scheme style guide" ? |
| 15:59 | lancepantz | maybe just a faq would do |
| 16:00 | lancepantz | then point those qs at the faq and ignore thme |
| 16:00 | LauJensen | _fogus_: "The beauty of the painting is not that you hang it upside down" haha, classic |
| 16:02 | _fogus_ | LauJensen: I've decided to never talk about parens again |
| 16:02 | hiredman | or just have gmail mark emails from greg as spam |
| 16:02 | LauJensen | _fogus_: Im sorry to hear that, I thought your post was hillarious |
| 16:02 | LauJensen | I actually never thought I would get to meet someone who could out-troll me :) |
| 16:02 | _fogus_ | Funny, but pointless |
| 16:05 | _fogus_ | If I would have first read the post equating people who dislike that style with segregationists, I would have never bothered to post in the first place. |
| 16:05 | _fogus_ | Oh well, live and learn |
| 16:05 | somnium | waaay late just noticed 'the abomination', and can't resist pointing out that its the identity monad: `do x <- blah; y <- blarg; blotz; quux' |
| 16:06 | LauJensen | I love how monads turn everything into 'blah blarg blotz quux' :) |
| 16:06 | hiredman | what abomination? |
| 16:06 | somnium | LauJensen: ooh, let me dig up something really abomniable |
| 16:06 | LauJensen | hiredman: http://gist.github.com/560765#file_abomination_desolation.clj |
| 16:07 | somnium | https://gist.github.com/0508e6219da9ee0adc01 |
| 16:08 | hiredman | yeah, it does look like chouser is reaching for do notation |
| 16:08 | somnium | (maybe it could scare some sense into the paren haters) |
| 16:08 | hiredman | well, there is the monad namespace in contrib |
| 16:08 | somnium | its awfully ungainly though |
| 16:09 | LauJensen | somnium: I cant look at that |
| 16:09 | somnium | :D |
| 16:09 | hiredman | somnium: but it also comes with a modaic io namespace |
| 16:09 | somnium | hiredman: isnt that just absurd in a non-lazy impure language? |
| 16:10 | somnium | or, you were probably being ironic |
| 16:10 | hiredman | but clojure operations can be lazy |
| 16:10 | hiredman | e.g. line-seq |
| 16:10 | hiredman | which can cause problems |
| 16:11 | hiredman | being able to safely compose that stuff is good |
| 16:12 | hiredman | I think arkham is an interpreter monad |
| 16:12 | hiredman | hmmm |
| 16:12 | somnium | hmm, Ill have to actually look at monadic io |
| 16:12 | hiredman | maybe not |
| 16:13 | somnium | I found a way to spoof return type inference, with a deftype UnTyped, then a protocol for each Monad that 'injects' its type into the UnTyped object |
| 16:13 | hiredman | not to say I have ever used contrib monads or the io stuff |
| 16:13 | ihodes | hiredman: maybe clojurebot could auto-kick anyone who mentions "style" and "parens" in the same sentence? |
| 16:13 | somnium | but once I got it working it all seemed a bit ridiculous |
| 16:13 | hiredman | clojurebot doesn't have ops |
| 16:13 | hiredman | or there would be a lot more kickage |
| 16:15 | hiredman | I've been trying to get return type inference for Archimedes working |
| 16:15 | hiredman | given two numeric types, and a hierarchy of numeric types and rules for return types based on that hierarchy |
| 16:15 | danlarkin | hindley milner? |
| 16:16 | hiredman | I have haerd of it, but I don't know anything about it except for the name |
| 16:16 | danlarkin | clojurebot: google hindley milner |
| 16:17 | hiredman | maybe I should look into it |
| 16:17 | danlarkin | noooooooo where's clojurebot |
| 16:17 | hiredman | oh |
| 16:18 | hiredman | huh |
| 16:18 | hiredman | netplit out in lalaland maybe |
| 16:24 | jlf | s450r1: would you mind sharing your [query_servers] incantation from local.ini? i get a 500 error when i run the usage example in the clutch readme, and i suspect i'm not specifying the clutch view server properly |
| 16:27 | s450r1 | jlf: sorry, I never played with clutch's view server |
| 16:28 | jlf | oh, you just omit :language "clojure" from the get-database map? |
| 16:29 | hiredman | clojurebot: google hindley milner |
| 16:29 | clojurebot | First, out of 4760 results is: |
| 16:29 | clojurebot | Type inference - Wikipedia, the free encyclopedia |
| 16:29 | clojurebot | http://en.wikipedia.org/wiki/Type_inference |
| 16:34 | s450r1 | jlf: I used (clutch/set-clutch-defaults! {:host host :port port}) and clutch/with-db to connect |
| 16:38 | somnium | maybe we should get comp.lang.lisp involved in the Lisp/Scheme Style Guide thread |
| 16:39 | Raynes | Oh boy. |
| 16:46 | LauJensen | I vaguely recall that theres some repl trick for seeing the constructors of a class? |
| 16:48 | somnium | ,(ancestors (class 'foo)) |
| 16:48 | clojurebot | #{java.util.concurrent.Callable clojure.lang.IMeta java.lang.Runnable java.io.Serializable java.lang.Object clojure.lang.IObj :clojure.contrib.generic/any clojure.lang.Named java.lang.Comparable clojure.lang.AFn clojure.lang.IFn} |
| 16:48 | somnium | like that? |
| 16:49 | LauJensen | No - I mean something like (Constructor type1 type2 type3) |
| 16:49 | somnium | oh, c.c.repl-utils/show? |
| 16:49 | LauJensen | maybe, I'll check |
| 16:51 | chouser | (show Integer #(re-find #"<init>" (:text %))) |
| 16:56 | LauJensen | nice chouser, thanks |
| 16:56 | LauJensen | and thanks to somnium for pointing the way |
| 17:03 | chouser | (doseq [c (.getConstructors Integer)] (println c)) |
| 17:04 | LauJensen | nice |
| 17:04 | jfields | would you use update-in here: (swap! resting update-in [client-order-id] - quantity) |
| 17:06 | Chousuke | looks fine to me. |
| 17:07 | jfields | cool. just wanted to make sure there's not a better fn to use when your keyseq is (count 1) |
| 17:07 | Chousuke | heh, yeah. a special case called just "update" or update-key would look a bit better. |
| 17:22 | AWizzArd | Anyone here who programmed an application for Android in Clojure? |
| 17:36 | defn | "Wait, what does your startup do?" |
| 17:36 | Anniepoo_ | AWizzArd - find George Jahad, he's done it |
| 17:36 | defn | So, basically, it's like an API for pets. |
| 17:37 | kotarak | It starts up? |
| 17:37 | defn | So basically, it's like Flickr for ex-convicts! |
| 17:37 | defn | lol. http://itsthisforthat.com/ |
| 17:39 | tomoj | "node.js server for collegiate jewish women" |
| 17:39 | defn | bahahaha. |
| 17:39 | defn | Finally! |
| 17:39 | defn | I like the ones that are for 'nature blogs'. |
| 17:40 | Anniepoo_ | lol - a plugin manager for government corruption |
| 17:41 | defn | hahahahahahahaha. ah man, brilliant site. |
| 17:42 | Anniepoo_ | lol - the scariest part is that one small part of my brain is going 'hmm... that's not a bad idea' |
| 17:42 | defn | yeah I know -- same here... |
| 17:42 | defn | So basically, it's like a mac app for ugg boots. |
| 17:43 | defn | a mapreduce query for baristas. lol |
| 17:46 | Anniepoo_ | even scarier, I've seen some of these deployed - there IS a flickr for Second Life |
| 17:46 | defn | yeah i think ive seen a "jewbook" or something -- so there's your collegiate jewish women app |
| 17:47 | Anniepoo_ | LOL - 'eco friendly marketplace for hunters' |
| 17:47 | Anniepoo_ | hey, government corruption's a multi-trillion dollar business globally |
| 17:47 | Anniepoo_ | owning the API for it would be worth big bucks |
| 17:49 | Anniepoo_ | 8c( sadly, the truth is, 'they get paid' |
| 17:49 | defn | slyrus: yeah, they only pay a dime (literally 10c) for each layer of depth in the hierarchy |
| 17:49 | defn | gotta get deeper! (that's what she said) |
| 17:49 | Anniepoo_ | viral marketer for medical marijuana - sadly, done thousands of times |
| 17:49 | defn | seriously? |
| 17:50 | defn | So basically it's like a cloud storage provider for the homeless. |
| 17:50 | Anniepoo_ | hmm.... probably not commercial - a wikipedia for Erlang |
| 17:51 | Anniepoo_ | LOL - CRM for adult dating |
| 17:52 | Anniepoo_ | oh heck, there's one I seriously considered |
| 18:00 | defn | game-based incentive for beer. |
| 18:00 | defn | been done. |
| 18:00 | defn | brick-and-mortar solution for government corruption. heh |
| 18:01 | Anniepoo_ | been done |
| 18:01 | Anniepoo_ | recommendation engine for ex-convicts |
| 18:05 | Anniepoo_ | somewhere there's a movie treatment generator that scrapes IMDB |
| 18:09 | defn | haha -- this one produces a lot of funny results: playboy for ____ |
| 18:09 | defn | as in playboy for government corruption, ex-convicts |
| 18:18 | Chousuke | "cash4gold for world of warcraft" duh |
| 18:21 | defn | digg for highway accidents |
| 18:47 | slyrus | what the hell is an artefact anyway? and why don't they spell it artifact? |
| 18:58 | Anniepoo_ | hmm.... should be possible to make a version of this that actually generates the code....socially, that seems like a bad idea. |
| 18:58 | Anniepoo_ | maybe you could automate the entire startup process |
| 18:59 | slyrus | "Normally you do not need to set the level of a logger programmatically. This is usually done in configuration files." Oh java-people, why, oh why, do you crave such needless complexity? Oh wait, it's because gosling et al. didn't give you a REPL. nvm. |
| 19:00 | Anniepoo_ | for that matter, exactly WHY do we need to change languages to set the level of the logger? |
| 19:02 | slyrus | which, for me, is another way of saying how-the-&$!)^% do I meaningfully turn on logging in one of these accursed, omnipresent log4j loggers from the clojure REPL? |
| 19:03 | slyrus | I can .setLevel the relevant logger, but darned if I know where the output is going |
| 19:03 | Anniepoo_ | I'm glad to hear I'm not the only person who finds this immensely annoying |
| 19:04 | Anniepoo_ | slyrus, I think you have to change the class of the logger to change where it's going |
| 19:04 | ssideris | persumably stdout for warnings and such, and stderr for errors |
| 19:04 | slyrus | holy-misguided object orientation batman! |
| 19:05 | Anniepoo_ | log4j has a bunch of kinds of loggers - the idea is to plug in the one you need |
| 19:05 | slyrus | then again the logger has to work in tomcat, netbeans, eclipse and a bunch of other crap I have absolutely no interest in |
| 19:05 | Anniepoo_ | which is borked |
| 19:05 | slyrus | oh, clearly I just need to call the AbstractDelegateLoggerFactoryGeneratorFactory |
| 19:27 | ihodes | is there a particular reason line-seq is in the core lib instead of in, e.g., clojure.java.io? |
| 19:28 | hiredman | c.l.i didn't exist when line-seq was written |
| 19:28 | hiredman | c.j.i |
| 19:28 | ihodes | hiredman: right, but it's 1.2 now; couldn't it have been moved? |
| 19:29 | ihodes | hiredman: i guess i'm more interested if it was usuable sans BufferedReasder. direct interop before (reader… and the like |
| 19:29 | ihodes | usable* and BufferedReader* excuse me |
| 19:29 | hiredman | it is |
| 19:29 | hiredman | and was |
| 19:29 | hiredman | moving it would break any code that uses it |
| 19:30 | ihodes | how was it usable? |
| 19:30 | hiredman | (line-seq (-> "foo.txt" File. FileReader. BufferedReader.)) |
| 19:30 | hiredman | pardon me |
| 19:31 | hiredman | (-> "foo.txt" File. FileReader. BufferedReader. line-seq) |
| 19:31 | ihodes | right, that used BufferedReader directly. which is fine, i was just wondering if that'd always been the case, or if there used to be something in clojure.core that could be used with line-seq |
| 19:32 | hiredman | whats wrong with using BufferedReader directly? |
| 19:32 | ihodes | nothing at all, just wondering |
| 19:42 | bhenry | is there anything in clojure that works kind of like a reverse engineer of format? ie (extract "%d-%d-%d %d:%d:%d" "2010-08-31 14:52:31") => [2010 8 31 14 52 31] |
| 19:42 | defn | regex? |
| 19:42 | clojurebot | Sometimes people have a problem, and decide to solve it with regular expressions. Now they have two problems. |
| 19:42 | defn | haha |
| 19:45 | bhenry | defn i think python has something like what i'm talking about. i was curious about an existing function. i don't really want to write crazy reg-ex beasts |
| 19:45 | defn | bhenry: im not familiar with one but well |
| 19:45 | defn | you could write a macro |
| 19:46 | bhenry | i think i'll just pull apart the pieces |
| 19:46 | Anniepoo_ | you're looking for something equivilent to sscanf? |
| 19:47 | bhenry | Anniepoo_: yes |
| 19:48 | Anniepoo_ | I'd write the regex monster once |
| 19:49 | ssideris | the regex is not that big anyway: \d{4}-\d\d-\d\d\s+\d\d:\d\d:\d\d |
| 19:49 | ssideris | xm... no groups though |
| 19:50 | ihodes | (re-split #"-| |:" "string") right? don't recall offhand |
| 19:50 | ihodes | then map int |
| 19:51 | ihodes | ,(clojure.string/split "2010-08-31 14:52:31" #":|-| ") |
| 19:51 | clojurebot | java.lang.ClassNotFoundException: clojure.string |
| 19:52 | ihodes | (map #(Integer. %) (clojure.string/split "2010-08-31 14:52:31" #":|-| ")) works in my REPL |
| 19:53 | ihodes | though it's not extracting your specific format. |
| 19:53 | bhenry | i'll see if i can make it work |
| 19:54 | ihodes | another option for parsing times is looking at clj-time. you can specify a time format, and it'll return a DateSomething object that you can do whatever with. |
| 19:55 | bhenry | (map #(Integer. %) (clojure.contrib.string/split #":|-| " "2010-08-31 14:52:31")) worked in my repl |
| 19:55 | bhenry | ,(map #(Integer. %) (clojure.contrib.string/split #":|-| " "2010-08-31 14:52:31")) |
| 19:55 | clojurebot | (2010 8 31 14 52 31) |
| 19:55 | bhenry | nice thanks ihodes |
| 19:56 | chouser | you can just use .split on a regex |
| 19:56 | chouser | ,(map #(Integer. %) (.split #":|-| " "2010-08-31 14:52:31")) |
| 19:56 | clojurebot | (2010 8 31 14 52 31) |
| 19:58 | ihodes | right, and split is on clojure.string now anyway :) |
| 20:12 | ninjudd | hmm, does anyone know why the separator is the second argument of clojure.string/split but it is the first argument of clojure.string/join? |
| 20:17 | chouser | oh man |
| 20:17 | chouser | seriously? |
| 20:18 | ninjudd | chouser: yeah. i thought there might be some deep reason for it |
| 20:19 | chouser | probably because the string is the first arg to all of them. |
| 20:19 | tomoj | ninjudd: which clojure.string/split are you looking at? |
| 20:19 | tomoj | oh, I see |
| 20:20 | ninjudd | hmm |
| 20:20 | ihodes | ninjudd: i always have to go back to the docs when i use split… |
| 20:20 | ihodes | maybe one day i'll remember |
| 20:20 | chouser | I wouldn't bother using it. Just use .split |
| 20:21 | ihodes | but it has the *dot* yecck. ;) i think i will-thanks for the pointer |
| 20:22 | ninjudd | yeah. the only thing i don't like about String.split is that you can't pass a regex in, it has to be a string that it compiles to a regex |
| 20:22 | chouser | well, and it'll come back to bite me as clojure reaches other platforms. |
| 20:22 | chouser | ninjudd: use regex's split instead of string's. |
| 20:23 | chouser | ,(.split #"/" "a/b/c/d/e/f" 4) |
| 20:23 | clojurebot | #<String[] [Ljava.lang.String;@92949f> |
| 20:23 | chouser | ,(map keyword (.split #"/" "a/b/c/d/e/f" 4)) |
| 20:23 | clojurebot | (:a :b :c :d/e/f) |
| 20:23 | ninjudd | aha. of course! |
| 20:25 | sleepynate | clojurebox on windows makes me sad :/ |
| 20:26 | chouser | ninjudd: it took me a surprisingly long time to find that. |
| 20:28 | defn | sleepynate: is that the one that includes emacs and stuff? |
| 20:28 | sleepynate | defn: yea. i'm a vim guy... and i have all linux boxes except the one vista machine. transitioning is rough :) |
| 20:29 | sleepynate | without starting and editor war: "the only emacs command I know is C-c C-x" |
| 20:30 | sleepynate | but getting vimclojure working on *nix boxes was hard enough... screw trying it on windows |
| 20:31 | ssideris | in perl, there is this compiler hack (built-in) that allows you to write qw(a b c) and it compiles as ("a", "b", "c"). Is the following a correct re-implementation of something equivalent in clojure? |
| 20:31 | ssideris | (defmacro qw [& symbols] `(quote ~(map #(str %) symbols))) |
| 20:31 | defn | sleepynate: on windows ive been using netbeans |
| 20:32 | sleepynate | defn: ahh yea. counterclockwise was my fallback for a while |
| 20:32 | defn | using emacs on windows is kind of painful |
| 20:32 | sleepynate | but i'm also a scheme-not-java person.. and eclipse took care of that til i got used to it |
| 20:32 | defn | so many of the things written for it are not for windows |
| 20:32 | defn | plus windows sucks and i hate it |
| 20:33 | defn | so there's that |
| 20:33 | sleepynate | haha, right? |
| 20:35 | defn | I think Clojure running on the CLR is awesome because it's the CLR |
| 20:35 | defn | err because it's clojure |
| 20:36 | defn | not because it's on the CLR :) |
| 20:36 | sleepynate | sure. doesn't that break things like Math/sqrt though? |
| 20:39 | chouser | ssideris: looks good to me |
| 20:42 | ssideris | chouser: thanks... my main problem is that I don't think I fully grasp what's going on here... the macro is passed a number of symbols that are then converted to a Seq of strings which is then what? |
| 20:42 | ssideris | ...inserted into the parse tree? |
| 20:42 | ssideris | i think i'm having trouble getting rid of the idea that macros are about generating text |
| 20:43 | ssideris | generating text as in generating code |
| 20:43 | defn | macros are about generating macros that generate macros that generate macros that generate macros...that generate text |
| 20:43 | coldhead | yo dawg i heard you like generating macros? |
| 20:43 | ssideris | hahaha |
| 20:43 | ssideris | yeah i know about the recursiveness and all |
| 20:44 | ssideris | but is the end result really text? |
| 20:44 | ssideris | in rhickey's talk he seems to imply that they generate sexps |
| 20:45 | defn | code is data |
| 20:45 | defn | wouldn't be a lisp without it |
| 20:47 | ssideris | yes, but you said "text" |
| 20:47 | ssideris | you didn't say "code" |
| 20:50 | Derander | sleepynate: my dependence on *nix has gotten to the point where when I'm forced to use windows for a sustained period of time I will use a linux vm. |
| 20:56 | sleepynate | Derander: yea... i really only boot windows to play battlefield with all my buddies who married or moved away :) |
| 20:57 | sleepynate | Derander: "no honey, go on out with the girls... you need some woman time!" ... <launch vent> ... "k guys, game on" |
| 20:59 | Derander | hahaha. |
| 21:27 | simard | is there a function/macro that does the same thing as macroexpand but recursively ? |
| 21:28 | sleepynate | simard: http://github.com/richhickey/clojure/blob/a1eff35124b923ef8539a35e7a292813ba54a0e0/src/clj/clojure/core.clj#L3086 <--- looks pretty recursive to me |
| 21:29 | tomoj | maybe you want c.c.macro-utils/mexpand-all |
| 21:31 | sleepynate | good call |
| 22:48 | slyrus | oh, this makes me feel better: "All of this content is automatically generated by Maven on behalf of the project." |
| 22:51 | slyrus | java: "we've got a lot of libraries!" or "you're going to need a lot of libraries, even if you only want one or two!" |
| 23:01 | AWizzArd | /away away |
| 23:01 | AWizzArd | oops |