2011-02-06
| 00:00 | sritchie | would you all consider this the best way to extract a 4 digit year from a filename? |
| 00:00 | sritchie | ,(first (re-find #"(\d{4})" "precl_mon_v1.0.lnx.2000.gri0.5m.gz")) |
| 00:00 | clojurebot | "2000" |
| 00:36 | redline6561 | Hi there. I'm a CL guy so sorry if this is a dumb question. Is there something I can use *from* the SLIME REPL to download and load libraries (ala quicklisp)? |
| 00:36 | redline6561 | I know about leiningen but heard it might not support this use case... |
| 02:37 | ekoontz | anyone know how to set up ring? |
| 02:37 | ekoontz | https://github.com/mmcgrana/ring |
| 02:38 | ekoontz | http://pastebin.com/EjzHHHQ4 |
| 02:43 | ekoontz | ohh i have to run "lein deps" |
| 02:44 | ekoontz | nice, "Hello World from Ring" works :) |
| 02:46 | ztellman | hiredman: can you explain your earlier "that looks familiar" comment? |
| 02:46 | ztellman | if there are any other similar libraries/bits of code around, I'd like to see them |
| 03:33 | LauJensen | ekoontz: make sure you check out Moustache as well |
| 03:34 | ekoontz | hey LauJensen |
| 03:34 | LauJensen | Yo yo :) |
| 03:34 | ekoontz | that's a markup language right? |
| 03:35 | ekoontz | oh ok : https://github.com/cgrand/moustache |
| 03:38 | ekoontz | stuck in dependency hell : https://gist.github.com/813227 |
| 03:40 | ekoontz | how do people set their classpaths while using clojure..maybe dumb question..? |
| 03:40 | brehaut | ekoontz: with lein or cake doing dependancy management |
| 03:41 | ekoontz | i created a ~/bin/clj which is a shell script: https://gist.github.com/813230 |
| 03:42 | ekoontz | but i shouldn't have to keep adding .jars to my CLASSPATH right? |
| 03:43 | brehaut | ekoontz: github.com/technomancy/leiningen/ or https://github.com/ninjudd/cake |
| 03:43 | ekoontz | brehaut: cool |
| 03:43 | ekoontz | but i have leiningen installed |
| 03:43 | ekoontz | i can do lein deps |
| 03:43 | brehaut | you specify your dependancies for a project, and they manage downloading them and other dependancies, and then generate your classpath for you as needed |
| 03:44 | ekoontz | that's in project.clj right? |
| 03:44 | brehaut | yes |
| 03:44 | ekoontz | ok but suppose i want to start clj interactively |
| 03:45 | brehaut | if you want just a random repl, cake might provide one? otherwise i use cljr which is built on lein, and allows you to install packages |
| 03:45 | brehaut | lein repl |
| 03:45 | ekoontz | ok yeah ..repl |
| 03:45 | ekoontz | let me try that..thanks :) |
| 03:45 | brehaut | its all in the tutorial for lein |
| 03:45 | ekoontz | so what is cake about..is that a competitor to lein? |
| 03:45 | brehaut | sort of ? |
| 03:45 | brehaut | for basic usage they are equivalent |
| 03:46 | brehaut | but they diverge on issues of plugins and expert features |
| 03:46 | ekoontz | which do you prefer |
| 03:46 | brehaut | im not a tool using monkey, i get by with the most basic of lein features |
| 03:47 | ekoontz | ok |
| 03:47 | ekoontz | so basically use "lein repl" yeah? |
| 03:47 | brehaut | yeah |
| 03:48 | brehaut | you can also get lein to generate a packaged jar file which contains all your dependancies with uberjar which can make deployment super easy |
| 03:49 | ekoontz | hm ok, thanks, will keep that in mind.. |
| 03:51 | ekoontz | brehaut: sorry, what am i doing wrong here ? https://gist.github.com/813236 |
| 03:51 | brehaut | you dont use ns forms in a repl |
| 03:51 | brehaut | replace that with |
| 03:52 | brehaut | (use 'compojure.core ring.adapter.jetty) (require '[compojure.routes :as routes]) |
| 03:53 | ekoontz | brehaut: https://gist.github.com/813238 |
| 03:54 | brehaut | you have compojure in your dependancies in project.clj and run lein deps? |
| 03:54 | brehaut | and the ring jetty adapter? |
| 03:55 | ekoontz | i have the default project.clj in compojure |
| 03:55 | brehaut | i dont use compojure sorry, so i dont know what that looks like |
| 03:55 | ekoontz | ok |
| 03:56 | brehaut | sorry its late here. i have to head to bed |
| 03:56 | ekoontz | thanks dude :) |
| 03:56 | ekoontz | i'll figure it out eventually |
| 04:08 | fliebel | morning |
| 04:37 | Dranik | hi all! |
| 04:37 | Dranik | is there a way not to specify the exact versions of libs in leiningen project.clj? |
| 04:38 | Dranik | e.g. I want just the latest libs regardless of their exact version |
| 04:43 | fliebel | Dranik: Some offer -SNAPSHOT versions |
| 04:43 | Dranik | fliebel, so the answer is "no" ? |
| 04:43 | fliebel | Other than that, it is considered bad practice, because it can break your code later. |
| 04:44 | fliebel | I think it is. |
| 04:44 | Dranik | fliebel, so how should I learn the exact number of the latest version? |
| 04:45 | fliebel | Dranik: For Clojure code, byt looking at the version in project.clj or by looking at the Clojars page. |
| 04:45 | fliebel | For Java code… Good luck! |
| 04:46 | Dranik | fliebel, thanks! |
| 04:50 | ekoontz | newb clojure q: how do i load a .clj file into the repl? |
| 04:50 | ekoontz | e.g. https://github.com/scottjad/slice/blob/master/src/slice/example.clj |
| 04:50 | fliebel | (use 'slice.example) |
| 04:50 | Dranik | also you may (load-file "my.clj") |
| 04:51 | ekoontz | fleibel: thanks, that works :) |
| 04:52 | ekoontz | Dranik: cool that works too |
| 05:01 | Dranik | I've loaded the namespace using the "use" command, then changed something. How to reload the namespace? |
| 05:12 | fliebel | Could anyone have a look with me at this function? http://pastebin.com/NcuciA3z It's the newer version of https://github.com/pepijndevos/ArmageDOM/blob/master/src/armagedom/dom.clj but it does not work yet. It gives a java.lang.ClassCastException |
| 05:14 | fliebel | The new part is the reduce statement ate line 12 |
| 05:16 | fliebel | OKay, I know what's wrong, but I dont know how to fix it. |
| 05:32 | fliebel | The problem is that I can't return 2 functions to trampoline. |
| 05:39 | fliebel | Oh, whatever, what is the deepest XML file you've ever seen? |
| 05:57 | simonfxr | how can i get the class instance of a certain type? (java syntax: java.lang.Integer.class) |
| 06:03 | gko | (class ...) |
| 06:06 | simonfxr | thx |
| 06:34 | raek | ,java.lang.Integer |
| 06:34 | clojurebot | java.lang.Integer |
| 06:34 | raek | ,(class java.lang.Integer) |
| 06:34 | clojurebot | java.lang.Class |
| 06:34 | raek | ,(class 1) |
| 06:34 | clojurebot | java.lang.Integer |
| 06:34 | raek | simonfxr: ^ |
| 07:33 | shortlord | can I get |
| 07:33 | shortlord | sry |
| 07:34 | shortlord | can I get a value of a ref that I've just changed in a transaction in the same transaction by dereferencing it? |
| 07:43 | dunk | I'm a bit lost on how to get a clojure install with slime. Is there a tutorial somewhere? What's the most up-to-date method? |
| 07:43 | clojurebot | clojureql is http://github.com/LauJensen/clojureql |
| 08:54 | rrc7cz | if you have (ns x (:use y)), then a (gen-class) with a method impl (defn -myEval [this sexpr] (eval (read-string sexpr))), why do calls to (.eval (MyClass.) "some symbol in ns y") throw Unable to resolve symbol? Other methods in the gen-class refer to symbols in y and it's fine. I'm guessing the compiler converts all symbols to fully ns qualified? |
| 08:58 | rrc7cz | thinking about it more, I assume the (:use) in the ns is just for the compiler to resolve everything correctly, but then the class runs in its own ns w/out anything refered except core. I could probably put a (use) call in the myEval impl |
| 09:17 | jaskirat | hey guys, does anyone here use erc? |
| 09:27 | rrc7cz | jaskirat: I'm on it now |
| 11:07 | odyssomay | can I terminate a reduce call if some condition is met? |
| 11:08 | opqdonut | no, not really |
| 11:08 | opqdonut | you'll need to implement a custom breakable-reduce |
| 11:09 | odyssomay | ok |
| 11:36 | odyssomay | Is there a "drop-first" function? |
| 11:38 | jkrueger | pdyssomay: you mean rest ? |
| 11:38 | odyssomay | ... |
| 11:39 | odyssomay | yes |
| 11:39 | odyssomay | :) |
| 11:43 | odyssomay | Is it possible to reload already loaded files? |
| 11:46 | jkrueger | odyssomay: yes. you can also add a hint to the namespace that results in each depending namespace being reloaded as well |
| 11:46 | jkrueger | which is good for unit tests. for example |
| 11:49 | jkrueger | specifically you can add a :reload or :reload-all keyword to each require form |
| 11:50 | odyssomay | jkrueger: thank you |
| 12:43 | ldh | after I (use 'some.namespace) from the REPL, then modify the underlying source file, is there a way to reload the new version? |
| 12:47 | shortlord | is there an easy way to convert a normal java.util.Map directly into a clojure map? |
| 12:49 | zonpantli | ldh: (use :reload-all 'some.namespace) |
| 12:49 | ldh | zonpantli: ah, thanks |
| 13:10 | odyssomay | Is there a function similar to "take-while" which instead of sending each element to the specified function, sends the elements so far? |
| 13:11 | odyssomay | Ex: ("take-while" (fn [x] (not (= (count x) 3))) '(3 6 1 7)) => (3 6 1) |
| 13:11 | odyssomay | or maybe (3 6) |
| 13:14 | pdk | anyone in here familiar with counterclockwise |
| 13:14 | pdk | giving me a null pointer in eclipse whenever i open a file |
| 13:15 | pdk | more specifically file -> open file... on any .clj file = null pointer |
| 13:24 | rindolf | Hi all. Would it be acceptable if I start a philosophical discussion/QA-session about the philosophy of Clojure? |
| 13:25 | odyssomay | rindolf: sounds good to me |
| 13:25 | rindolf | odyssomay: OK. |
| 13:25 | pdk | we're used to em |
| 13:27 | rindolf | First of all an introduction, I am http://www.shlomifish.org/ (Shlomi Fish) and I mostly write Perl 5, shell and C daily (while knowing many other languages to some extent), and I've been waiting for a modern, usable, Lisp dialect for quite a while now. |
| 13:28 | rindolf | I've had some hopes for Paul Graham's Arc, but eventually started my own effort (no code - only planning) called Park, which eventually became Spark, which kinda suffered from the second system effect. |
| 13:28 | rindolf | Then Arc came out, and it was disappointing. While being kinda brief, it lacked many advanced features. |
| 13:28 | rindolf | So I've heard of clojure. |
| 13:29 | rindolf | Now I'm not sure if clojure has all the CSy features that I came to expect and like, but at least it's there and ready and has become somewhat popular and "hip". |
| 13:30 | rindolf | OK, first question - does the core Clojure language aims for Minimalism (e.g: a la Scheme), or does it prefer to have some dark corners so programmers can express themselves and so it will be usable? |
| 13:31 | pdk | it seems to me it doesn't have anything quite as hackish as common lisp loop |
| 13:31 | odyssomay | pdk: for? |
| 13:32 | pdk | though it does have some extra junk intended for java interop that probably isn't as clean as the core language |
| 13:32 | rindolf | I think iterate is a little nicer than loop in CL. |
| 13:32 | pdk | nah cl's loop macro is different from for |
| 13:32 | rindolf | It's a third party extension. |
| 13:32 | pdk | cl's loop slices dices and purees while being a hulking mess from a purity standpoint |
| 13:32 | Raynes | Clojure, first and foremost, tries to be a practical language. It's only as minimal as practicality allows for. |
| 13:33 | pdk | sometimes the java brain damage shows through when you write code for java interop |
| 13:33 | odyssomay | pdk: yes, but I don't quite like the style of for anyway, it reminds me much of loop |
| 13:33 | pdk | coercing primitives and type hints especially |
| 13:34 | pdk | limitations of clojure's host platform also explain why loop/recur and explicit tco exist |
| 13:35 | rindolf | Raynes: OK, that sounds reasonable. |
| 13:40 | odyssomay | How come for example using "reverse" on a string, doesn't result in a string? |
| 13:41 | a_robbins | Hey guys, I'm working through the clojure koans and I am having trouble figuring out some behavior. Apparently (list first-name last-name) is different from '(first-name last-name). Is there a reader macro for making lists? If I just do (first-name last-name), it will try to execute first-name as a function. |
| 13:42 | rindolf | Now regarding APIs, I realise that you can use all the Java APIs in clojure, which is a good thing. Languages without APIs are in my opinion not very attractive. |
| 13:43 | odyssomay | a_robbins: http://www.lisperati.com/clojure-spels/casting.html |
| 13:44 | odyssomay | a_robbins: http://www.lisperati.com/clojure-spels/casting.html (if you didn't catch it) |
| 13:45 | rindolf | Of course, from my experience it's hard to install many third-party APIs for Java (a la Perl's CPAN) with maven being the beast that it is. |
| 13:45 | a_robbins | odyssomay: thanks, I read through that |
| 13:45 | a_robbins | odyssomay: I'll read through that* |
| 13:45 | ekoontz | rindolf: project.clj looks pretty nice |
| 13:45 | rindolf | ekoontz: what is it? |
| 13:46 | ekoontz | installs dependencies |
| 13:46 | ekoontz | a la maven |
| 13:46 | rindolf | ekoontz: ah. |
| 13:46 | rindolf | ekoontz: can they be Java ones too? Or only clojure ones? |
| 13:46 | ekoontz | yep, java too :) |
| 13:46 | odyssomay | Aren't they java only? |
| 13:46 | ztellman | rindolf: anything with a Maven repository |
| 13:46 | rindolf | ztellman: hmmm.... :-S |
| 13:46 | ztellman | clojars provides a maven repository for clojure projects |
| 13:47 | ztellman | trivial to set up |
| 13:47 | ekoontz | then do lein deps |
| 13:47 | ztellman | and most established java projects have their own |
| 13:47 | anthony__ | If I have "key1:value1;key2:value2;key3:value3" and want to convert it to {key1 value1 key2 value2 key3 value3}, what functions should I start looking at? |
| 13:47 | rindolf | Can it easily interface with RPM/Deb-dpkg/etc.? |
| 13:48 | ekoontz | i don't know about that; i use it on mac os x for now |
| 13:48 | ztellman | anthony__: split on ";", then (apply hash-map ...) on the resulting sequence |
| 13:48 | ztellman | sorry, split on ":" |
| 13:48 | anthony__ | ztellman: Thanks. hash-map was my missing function. :D |
| 13:56 | rindolf | What did I also want to ask? |
| 13:56 | rindolf | Let me see. |
| 13:59 | rindolf | http://www.perl.com/pub/2007/12/06/soto-11.html - if you didn't read that, you should. How does clojure feel about being a language for writing quick (and sometimes dirty) code? And for "catering to mere mortals"? |
| 14:05 | ztellman | rindolf: I don't think anyone's fundamentally opposed to quick and dirty code, but the general message from on high is that Clojure should be a powerful tool for knowledgable users |
| 14:05 | rindolf | ztellman: well, I don't see these as necessarily contradictory. |
| 14:06 | ztellman | no, but there's a fundamental lower bar in terms of knowledge to use Clojure effectively |
| 14:06 | ztellman | a novice can't easily use Clojure in a "quick and dirty" way |
| 14:07 | rindolf | ztellman: I mean, it's hard to write quick-and-dirty stuff in C and in Java, etc. but in Perl/Python/PHP/Ruby/etc. you can also write complex stuff , but also quick-and-dirty-stuff. |
| 14:07 | ztellman | hmm, maybe I'm just conflating the quick and dirty and "mere mortals" comments |
| 14:07 | rindolf | ztellman: would you accept a ClojureScript extension? |
| 14:08 | ztellman | rindolf: what would that be, exactly? |
| 14:08 | rindolf | ztellman: also see http://perl.plover.com/yak/12views/samples/notes.html#sl-39 |
| 14:09 | ztellman | brb |
| 14:09 | rindolf | ztellman: see ya. |
| 14:15 | ztellman | rindolf: maybe this just speaks to my particular biases, but I don't think designing a language around one-liners is a particularly great idea |
| 14:15 | ztellman | or rather, I don't think a language needs to be able to do both one-liners and large-scale programs |
| 14:16 | ztellman | there are plenty of good scripting tools out there, why would Clojure try to displace them? |
| 14:16 | rindolf | ztellman: well, I don't think we should make sure a language is usable only for one liners. |
| 14:16 | rindolf | and some of my perl -e programs are longer than 80 chars. |
| 14:16 | rindolf | ztellman: well, if people use clojure on the command line, they will eventually use it for more serious stuff. |
| 14:17 | rindolf | ztellman: some of them at least. |
| 14:17 | ztellman | rindolf: sure, that's one way to build a community |
| 14:17 | ztellman | it worked very well for perl |
| 14:17 | ztellman | but it's not the only way |
| 14:17 | ztellman | obviously the one-liner/big program distinction is a spectrum, not a dichtomy |
| 14:18 | rindolf | Right. |
| 14:18 | rindolf | Anyway, maybe I should try creating something like ClojureScript. |
| 14:18 | ztellman | I'd be interested to see that |
| 14:18 | rindolf | Yes. |
| 14:19 | rindolf | One of the problems I found with Scheme and to a lesser extent CL was that they tended to be very verbose/wordy by default. |
| 14:19 | rindolf | Long identifiers, etc. |
| 14:19 | rindolf | You could avoid it eventually by writing many abstractions, but that's hardly a solution. |
| 14:19 | odyssomay | rindolf: that's a good thing |
| 14:19 | ztellman | again, i think it's just what you're optimizing for |
| 14:20 | rindolf | Paul Graham talked about it. |
| 14:20 | rindolf | odyssomay: you mean verbosity? |
| 14:20 | odyssomay | rindolf: yes |
| 14:20 | rindolf | odyssomay: why? |
| 14:20 | ztellman | Paul Graham said that concision = expressiveness, which I'm wholly unconvinced of |
| 14:20 | rindolf | ztellman: http://www.paulgraham.com/power.html |
| 14:20 | odyssomay | rindolf: because when it's verbose, I can understand my programs |
| 14:20 | rindolf | Hmm... there's such a word as concision. |
| 14:21 | rindolf | odyssomay: well, if it's too verbose, you'll have a problem following it. |
| 14:21 | ztellman | ha, yeah, I didn't just make it up |
| 14:21 | odyssomay | rindolf: which is? |
| 14:21 | ztellman | unnecessary verbosity = lack of expressiveness, sure |
| 14:21 | ztellman | but that doesn't necessarily imply the converse |
| 14:21 | rindolf | odyssomay: I'm not a fan of using obscure identifiers, but I still think that conciseness is important. |
| 14:22 | odyssomay | I mean, of course I can see the problem of verbosity (ztellman got it), but for me verbosity always comes out on top |
| 14:23 | ztellman | I think the key is that if some boilerplate is getting in the way of you understanding your own code, you can abstract it away |
| 14:24 | rindolf | Yes, I think that preferably the language or the API-collection (CPAN/etc.) that you're using should make you avoid this boilerplate by default. |
| 14:25 | ztellman | rindolf: is that a language design issue, or a social convention issue? |
| 14:26 | rindolf | ztellman: well, if anyone has their own favourite and incompatible abstractions, then it creates fragmentation. |
| 14:26 | ztellman | rindolf: definitely true |
| 14:26 | ztellman | but one of the things that I think Clojure got very right was choosing what the language forces people to standardize on |
| 14:27 | ztellman | mutability is the big one |
| 14:27 | ztellman | because two libraries that deal with that differently would basically be incompatible |
| 14:28 | ztellman | not baking everything into the language will cause some growing pains due to people inventing their own conventions |
| 14:28 | ztellman | but I think the idea is that the community will adopt conventions over time, as various approaches are proved out |
| 14:29 | rindolf | ztellman: yes, if people share their abstractions and APIs online as FOSS, then eventually standards emerge. |
| 14:30 | ztellman | rindolf: which seems to be happening at a pretty good clip |
| 14:30 | ztellman | so I'm not personally very concerned by the fragmentation issue |
| 14:33 | a_robbins | I use django, a python web framework, and they are having a very similar ongoing discussion about what to bring into the contrib package, and what to leave out in the community. It seems like the basic dilemma is you can either 1) bless something and make it contrib, slowing down development on that problem since it is harder to modify than someone's personal project or 2)let everyone make their own solutions out in the community, whi |
| 14:33 | a_robbins | ch fragments and makes it hard for newer users to know what the available packages are. |
| 15:02 | rindolf | Hi all. |
| 15:03 | LauJensen | rindolf: yo yo |
| 15:03 | rindolf | LauJensen: I went to take a bath. |
| 15:04 | LauJensen | rindolf: thanks for sharing |
| 15:04 | rindolf | I see ztellman , and a_robbins have gone. |
| 15:04 | rindolf | LauJensen: sorry. :-(. |
| 15:04 | LauJensen | ? |
| 15:04 | rindolf | LauJensen: regarding the "thanks for sharing." |
| 15:04 | LauJensen | It was said with a smile |
| 15:04 | rindolf | LauJensen: ah, OK. |
| 15:05 | LauJensen | :) |
| 15:05 | rindolf | Well, maybe I'll try working on a ClojureScript something. |
| 15:05 | rindolf | Clojure has something like eval "string" right? |
| 15:05 | rindolf | Or only eval (SEXPR)? |
| 15:05 | LauJensen | &(read-string "(+ 2 2)") |
| 15:05 | sexpbot | ⟹ (+ 2 2) |
| 15:06 | LauJensen | &(-> "(+ 2 2)" read-string eval) |
| 15:06 | sexpbot | java.lang.SecurityException: You tripped the alarm! eval is bad! |
| 15:06 | rindolf | Wow. |
| 15:06 | rindolf | This -> looks cool. |
| 15:06 | rindolf | I had a similar idea. |
| 15:06 | rindolf | For Park->Spark I mean. |
| 15:15 | kumarshantanu | has anybody tried using fn names with dash/underscore in protocols and then using them in Java? does it work? |
| 15:17 | Raynes | kumarshantanu: Don't hold me to it, but I seem to remember Clojure converting the names to something Javable under the hood. |
| 15:41 | kumarshantanu | Raynes: that possibly means i need to know converted names pattern if i want to use them in Java |
| 16:07 | Raynes | defn: Ping |
| 16:09 | LauJensen | kumarshantanu: - becomes _, IIRC |
| 16:23 | phenom_ | hey guys, im having some trouble understanding the male/female example from Programming Clojure ... why does the sequence not cause a SOE but the direct call does ? |
| 16:27 | rindolf | phenom_: can you give a URL? |
| 16:27 | rindolf | phenom_: is Programming Clojure available online? |
| 16:27 | phenom_ | rindolf: no it's not ... ill do a pastie |
| 16:28 | rindolf | phenom_: thanks. |
| 16:28 | rindolf | phenom_: I'm not a clojure expert, though, but it's standard procedure. |
| 16:28 | kumarshantanu | LauJensen: i tested and found both dash and underscore work in Clojure..that leads me to suspect they have separate encoding pattern (certainly for the dash, because it) |
| 16:28 | kumarshantanu | ..it's not valid in Java.. |
| 16:30 | rindolf | Well, maybe Java symbols accept arbitrary strings internally. |
| 16:30 | rindolf | With some special API calls, not using code directly. |
| 16:31 | phenom_ | rindolf: http://pastie.org/1535093 |
| 16:32 | joshua__ | $findfn {:test "123"} "123" |
| 16:32 | sexpbot | [] |
| 16:32 | rindolf | phenom_: what is SOE? |
| 16:32 | phenom_ | stackoverflowexception |
| 16:33 | joshua__ | &(key {:test "123"}) |
| 16:33 | sexpbot | java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.util.Map$Entry |
| 16:33 | joshua__ | Is that what is suppose to happen? |
| 16:33 | joshua__ | &(doc key) |
| 16:33 | sexpbot | ⟹ "([e]); Returns the key of the map entry." |
| 16:34 | joshua__ | &(key (first {:test "123"})) |
| 16:34 | sexpbot | ⟹ :test |
| 16:35 | joshua__ | Ah, so the ArrapMap has map entries. I think I get it now. |
| 16:36 | joshua__ | $findfn (first {:test "123"}) "123" |
| 16:36 | sexpbot | [clojure.core/val clojure.core/second clojure.core/last clojure.core/peek clojure.core/fnext clojure.core/rand-nth] |
| 16:36 | joshua__ | &(doc val) |
| 16:36 | sexpbot | ⟹ "([e]); Returns the value in the map entry." |
| 16:37 | joshua__ | Yeay, found the function I was looking for. |
| 17:09 | __name__ | hello |
| 17:09 | brehaut | morning __name__ |
| 17:10 | rindolf | Hi __name__ |
| 17:10 | __name__ | how is it ensure that a transaction completes at some time? |
| 17:10 | __name__ | *ensured |
| 17:10 | __name__ | i mean, what if there's two concurrent threads that keep spawing transactions and one always wins? |
| 17:11 | brehaut | __name__: complicated heuristics ;) |
| 17:11 | __name__ | sounds fun :) |
| 17:11 | companion_cube | it's STM magic :) |
| 17:11 | brehaut | __name__: http://java.ociweb.com/mark/stm/article.html |
| 17:12 | brehaut | its probably a bit out of date now, but it'll give you more info than you want :P |
| 17:13 | __name__ | brehaut: thank you |
| 17:18 | __name__ | working on a laptop without having a proper table sucks |
| 17:18 | __name__ | :( |
| 17:32 | riddochc | A random idea to plant in someone's head: because of homoiconicity, one could make a clojure project to ease migrating a clojure project from clojure 1.2 to 1.3. |
| 17:33 | riddochc | It'd be a practical application of code-walking, anyway. |
| 18:16 | brehaut | is there a short hand for (let [r (exp...)] (when (seq r) (something r))) ? |
| 18:18 | riddochc | brehaut: Look for when-let? |
| 18:19 | brehaut | riddochc: an empty seq is truthy |
| 18:20 | riddochc | If that's the case, (when (seq r) ... ) might not be what you want? |
| 18:21 | brehaut | r is the result of a complex expression |
| 18:21 | brehaut | when doesnt bind |
| 18:21 | brehaut | hence i have a let wrapping a when with a seq test |
| 18:22 | riddochc | Hmm. http://clojuredocs.org/clojure_core/clojure.core/when-let |
| 18:22 | brehaut | i guess i can just move the expression round |
| 18:23 | riddochc | I suppose you could *make* a shorthand... (defn blah [exp something] (let [r (exp...)] (when (seq r) (something r)))) |
| 18:24 | brehaut | meh it'll do |
| 18:24 | brehaut | cheers |
| 18:24 | riddochc | I'm really not the best one to be giving advice on this, really. I'm sure someone else knows. |
| 18:25 | brehaut | no worries. i rejiggered thing saround so that when-let is a bit cleaner. |
| 19:22 | cheezey | so im trying to use lein with a library that uses jni. how would i do this => |
| 19:25 | ssideris | cheezey: there is a native-deps parameter to lein |
| 19:25 | ssideris | it goes in project.clj |
| 19:26 | ssideris | for example: |
| 19:26 | ssideris | :native-dependencies [[penumbra/lwjgl "2.4.2"]] |
| 19:26 | cheezey | oh |
| 19:27 | cheezey | is there a place that lists all the options? i guess i suck at searching |
| 19:27 | ssideris | lein's default repo is clojars |
| 19:27 | ssideris | http://clojars.org/ |
| 19:28 | ssideris | (there is a browse link in there) |
| 19:41 | cheezey | ssideris: thnx |
| 19:41 | joshua__ | $findfn "longstringwhichcontaintsanother" "contains" true |
| 19:41 | sexpbot | [clojure.core/not= clojure.core/distinct?] |
| 19:42 | joshua__ | <joshua__> $findfn "contains" "longstringwhichcontaintsanother" true |
| 19:42 | joshua__ | $findfn "contains" "longstringwhichcontaintsanother" true |
| 19:42 | sexpbot | [clojure.core/not= clojure.core/distinct?] |
| 19:43 | joshua__ | $findfn "contains" "longstringwhichcontainsanother" true |
| 19:43 | sexpbot | [clojure.core/not= clojure.core/distinct? clojure.contrib.string/substring?] |
| 19:44 | joshua__ | Love that function sooo much. |
| 20:02 | TimMc | whoa |
| 20:02 | TimMc | $findfn 2 2 4 |
| 20:02 | sexpbot | [clojure.core/unchecked-multiply clojure.core/+ clojure.core/* clojure.core/unchecked-add] |
| 20:02 | TimMc | That's superb. |
| 20:03 | TimMc | But what about exponentiation? |
| 20:04 | Chousuke | I don't think there's any exponentiation function in core or contrib |
| 20:16 | joshua__ | It only searches a few libraries for the sake of speed. |
| 20:17 | joshua__ | I don't think that math libraries that might have exponentiation are among the ones it searches. |
| 20:18 | joshua__ | $(src find-fn) |
| 20:18 | joshua__ | &(src find-fn) |
| 20:18 | sexpbot | java.lang.Exception: Unable to resolve symbol: src in this context |
| 20:23 | joshua__ | If you want to check out the function it is at: https://github.com/Raynes/sexpbot/blob/master/src/sexpbot/plugins/clojure.clj towards the bottom of the page |
| 20:29 | joshua__ | Where can I grab an sha-256 function for clojure? |
| 20:30 | joshua__ | Nevermind, think I found what I was looking for. |
| 20:31 | RazWelles | Anyone have examples of loading .net assemblies in clojureclr? |
| 20:37 | TimMc | joshua__: Where? |
| 20:37 | KirinDave | Why do I try to explain coding concepts on HackerNews? :( |
| 20:37 | KirinDave | It always goes wrong. |
| 20:37 | joshua__ | https://github.com/tebeka/clj-digest/blob/master/README.rst |
| 20:38 | joshua__ | How so KirinDave? |
| 20:38 | KirinDave | http://news.ycombinator.com/item?id=2185810 (and down) |
| 20:38 | KirinDave | Jerk makes statements about actor model |
| 20:38 | KirinDave | Some of which are not even wrong |
| 20:38 | KirinDave | (as in they're so bizarre to be nonsense) |
| 20:42 | RazWelles | is there any example code for clojureclr anywhere? |
| 20:44 | joshua__ | Honestly, I don't understand what you two are talking about well enough to agree or disagree, but more people to be supporting your statements than his. Maybe that Proverb about correcting fools leading to trouble applies? |
| 20:44 | joshua__ | Obviously I'm going to need to add a project that will force me to learn concurrency to my to-do list. ;/ |
| 20:47 | KirinDave | joshua__: He's just very full of passion for such an uninformed dude. |
| 20:48 | TimMc | Wait a tick... what's the difference between let and let*? |
| 20:49 | TimMc | This is isn't like Scheme... |
| 20:49 | Chousuke | let is a porcelain macro, let* is the actual "plumbing" :P |
| 20:50 | Chousuke | let basically adds destructuring on top of let*, there's no difference otherwise. |
| 20:50 | TimMc | Ah! So that's why there's no destructuring in let*... I should be using let anyway. |
| 20:50 | TimMc | Fascinating. |
| 20:50 | Chousuke | yeah |
| 20:50 | Chousuke | there's also fn* which is similar. |
| 20:51 | Chousuke | you'll see them in macroexpansions, but nowhere else really. |
| 20:52 | TimMc | Well, you'll see them in newbie code too. :-P |
| 20:52 | TimMc | (let* at least) |
| 20:53 | Chousuke | I wonder. Why would they use let*? / |
| 20:53 | Chousuke | it's not documented anywhere |
| 20:53 | Chousuke | you can get by without knowing it even exists |
| 20:53 | hiredman | let* in cl is like clojure's let |
| 20:54 | TimMc | Chousuke: In R5RS Scheme, let does not evaluate each init-expr in the scope of the preceding bindings. |
| 20:54 | TimMc | let* is the form to use for that. |
| 20:55 | TimMc | I had no reason to expect any difference. :-) |
| 21:01 | TimMc | Chousuke: Also, if they hadn't read http://clojure.org/lisps closely, like me. >_< |
| 21:06 | RazWelles | how do I access a method when it's like.. indrect by 2? aka object.object2.method() |
| 21:06 | RazWelles | (let [temp_instance object] (.object2.method args1 args2))? |
| 21:07 | brehaut | ,(doc ..) |
| 21:07 | clojurebot | "([x form] [x form & more]); form => fieldName-symbol or (instanceMethodName-symbol args*) Expands into a member access (.) of the first member on the first argument, followed by the next member on t... |
| 21:07 | RazWelles | ty |
| 21:11 | brehaut | RazWelles: if it might return nil, you may find -?>> in clojure.contrib.core useful too; |
| 21:11 | brehaut | -?>> is like -?>> but it will short circuit to nil if any of the intervening forms returns nil |
| 21:11 | RazWelles | ahh ok, ty :) |
| 21:12 | brehaut | s/ -\?>>/->>/ |
| 21:12 | sexpbot | <brehaut> -?>> is like->> but it will short circuit to nil if any of the intervening forms returns nil |
| 21:22 | Chousuke | I think you mean -> |
| 21:23 | brehaut | i dont |
| 21:24 | Chousuke | hmm, I'm not sure how ->> is any better than -> |
| 21:24 | Chousuke | at least for method calls. |
| 21:24 | brehaut | in this case it doesnt matter |
| 21:24 | brehaut | i meant -?> rather than -?>> i think |
| 21:25 | Chousuke | anyway, using -> with .foo symbols is IMO somewhat nicer than .., but use whichever you want. |
| 21:25 | brehaut | Chousuke: the advantage of .. is that it is explicity java object interop |
| 21:26 | Chousuke | well so are .foo symbols :) |
| 21:26 | Chousuke | it's more typing, but I prefer having the . for any java methods. |
| 21:26 | brehaut | fair enough |
| 21:26 | gfrlog | what are people using for sinatra-style http servers in clojure these days? |
| 21:28 | brehaut | gfrlog: what is 'sinatra-style' ? |
| 21:28 | gfrlog | welp |
| 21:29 | gfrlog | fairly minimal. if it parses the path and the query string and the post params and such that'd be nice |
| 21:29 | gfrlog | but don't need too much else I don't think |
| 21:29 | brehaut | then then answer is whatever server you like, and ring as the base layer |
| 21:30 | brehaut | add compojure or moustache for route dispatch |
| 21:30 | brehaut | most people stick with jetty for the server, but its basically one line in the whole thing |
| 21:30 | weavejester | Ring handles query and post params, so any Ring-based framework would do |
| 21:32 | brehaut | gfrlog: that approach is the default in clojure |
| 21:33 | gfrlog | yes but which library? |
| 21:33 | brehaut | gfrlog: it depends on taste. ring to start. |
| 21:33 | gfrlog | okay |
| 21:33 | gfrlog | I will look at that, thanks |
| 21:33 | brehaut | i have a preference for moustache for routing, and i suspect weavejester prefers compojure |
| 21:34 | weavejester | Haha - yes, you'd be correct ;) |
| 21:34 | brehaut | :) |
| 21:34 | gfrlog | and these are all mutually exclusive? |
| 21:34 | weavejester | I've actually been working on an example Compojure project: https://github.com/weavejester/compojure-example |
| 21:34 | gfrlog | no sane reason to combine them? |
| 21:34 | weavejester | Not really |
| 21:34 | brehaut | not really mutally exclusive |
| 21:34 | brehaut | they both generate ring handlers |
| 21:34 | weavejester | Compojure and Moustache handle routing. So, I mean, you could use them both |
| 21:34 | brehaut | but you probably wouldnt choose to use both as they cover 90% the same ground |
| 21:34 | weavejester | But they do the same thing, more or less |
| 21:35 | brehaut | my gut feeling is that if you are coming from ruby/rails, compojure's routing may feel more familiar |
| 21:35 | weavejester | Really? I'd have though Moustache was more like Rails, in that it has a static routing system. |
| 21:35 | gfrlog | I've actually done a lot with 2-year-old compojure |
| 21:35 | weavejester | Compojure is I guess more like Sinatra |
| 21:36 | brehaut | hah ok :) |
| 21:36 | gfrlog | but I gathered it changed a lot more recently |
| 21:36 | weavejester | gfrlog: which version? |
| 21:36 | brehaut | im from django land, so i dont really know rails other than what i looked at about 3 or 4 years ago |
| 21:36 | gfrlog | weavejester: was there a major change a year or two ago? |
| 21:36 | gfrlog | I don't have the source code on hand |
| 21:37 | brehaut | gfrlog: basicly ring came into existance and compojure no longer duplicates that affort |
| 21:37 | weavejester | The major change was probably the move to Ring. |
| 21:37 | gfrlog | okay |
| 21:37 | brehaut | weavejester: and seperation of hiccup into its own thing? |
| 21:37 | gfrlog | certainly some version prior to that |
| 21:37 | weavejester | Yeah. |
| 21:37 | gfrlog | hiccup was still part of it too |
| 21:37 | weavejester | I started off building Compojure as a monolithic framework |
| 21:37 | weavejester | Then Ring came along |
| 21:38 | weavejester | so I factored out all of Compojure's parameter, cookie, session etc. stuff to Ring |
| 21:38 | weavejester | Anything that wasn't framework-specific. |
| 21:38 | weavejester | the html generating I stuffed into ring |
| 21:38 | weavejester | Er, hiccup |
| 21:38 | weavejester | So all that's left is about 200 lines of routing code. |
| 21:38 | gfrlog | my coworker and I were actually just commisioned to rewrite the whole thing in rails |
| 21:39 | gfrlog | since I didn't write the original app, I consider it legacy clojure code |
| 21:39 | weavejester | Haha - to be honest, Rails is pretty nice, and more mature. I use it in my day job. |
| 21:39 | weavejester | I think Ring, Compojure, etc. have greater potential than Rails |
| 21:40 | weavejester | The design is better, I think. |
| 21:40 | brehaut | weavejester: seconded |
| 21:40 | weavejester | But Rails has so much stuff for it |
| 21:40 | brehaut | and thats rails etc ;) django is my day job |
| 21:40 | weavejester | Django has a lot of stuff too |
| 21:40 | brehaut | and i feel the same way about it |
| 21:40 | weavejester | they're far more mature, so if I wanted to get a web app out fast, I'd probably use Rails |
| 21:40 | weavejester | for now |
| 21:41 | weavejester | But when I'm programming for fun |
| 21:41 | weavejester | Clojure is better than Ruby :) |
| 21:41 | brehaut | the new clojureql is also a very replacement for an ORM too :) |
| 21:41 | weavejester | Yeah. Clojure web development libraries are coming along very quickly! |
| 21:42 | brehaut | yup! its exciting |
| 21:42 | gfrlog | I think I agree with just about everything that has been said |
| 21:42 | weavejester | I use Sinatra a lot at work for APIs and stuff, and I think Compojure has already overtaken it. |
| 21:42 | brehaut | im hoping to get a v1.1 of my xml-rpc library out along with a pingback implementation at 1.0 in the next month |
| 21:42 | weavejester | IMHO of course ;) |
| 21:43 | brehaut | heh |
| 21:43 | gfrlog | compojure was named after a more superior cultural icon |
| 21:43 | weavejester | Which cultural icon was that? |
| 21:44 | gfrlog | I hadn't planned on taking the joke this far |
| 21:45 | weavejester | haha - ok |
| 21:45 | gfrlog | my apologies. |
| 21:46 | weavejester | np |
| 21:47 | arbscht | weavejester: hi! btw, there is a #compojure channel too :) sometimes people ask questions there |
| 21:47 | brehaut | for the curious: i wrote a few words about getting started with fnparse http://brehaut.net/blog/2011/fnparse_introduction |
| 21:48 | weavejester | I really should keep on IRC |
| 21:49 | weavejester | Thus far I've tended to just use Google groups |
| 21:50 | gfrlog | so if I want to programmatically start/stop a ring server |
| 21:51 | gfrlog | then I should ask here if anybody knows how to do that |
| 21:51 | gfrlog | does anybody know how to do that? |
| 21:52 | gfrlog | I'd like to be able to start one in a separate thread and then stop it later |
| 21:55 | gfrlog | I assume the second part is the trick one |
| 21:56 | gfrlog | tricky* |
| 21:56 | brehaut | gfrlog: i think there might be an example snippet on the ring github somewhere? |
| 21:56 | brehaut | i just kill my whole jvm ;) |
| 21:57 | weavejester | There is lein-ring |
| 21:57 | weavejester | Which can start a ring server from the console |
| 21:57 | gfrlog | yeah, that's how I would normally do it. I'd like to run this from within a test though. |
| 21:57 | weavejester | lein ring server |
| 21:57 | weavejester | Ah, I see |
| 21:57 | gfrlog | I'm testing an HTTP client |
| 21:57 | weavejester | There's a test in the Ring repo that does that |
| 21:58 | gfrlog | I'll take a look, thanks |
| 21:58 | weavejester | https://github.com/mmcgrana/ring/blob/master/ring-jetty-adapter/test/ring/adapter/jetty_test.clj |
| 21:59 | weavejester | But you can also test Ring just by sending request maps directly to the handler |
| 21:59 | gfrlog | I think {:join? false} is the key there? |
| 22:00 | weavejester | Yeah, that causes it to run in a background thread |
| 22:00 | weavejester | Or rahter, not to block |
| 22:00 | gfrlog | weavejester: I'm not trying to test ring, I'm trying to test my client. I'm using ring to mock a rails project |
| 22:00 | weavejester | ah, I see |
| 22:00 | gfrlog | whereas in the rails project I use functional tests to mock the clojure client |
| 22:04 | brehaut | riddochc: excellent :) if you spot any errors or weirdness, flick me a message |
| 22:04 | riddochc | I've had some problems getting fnparse to work under clojure more recent than 1.2, because of some errors in its dependencies in c-contrib. I posted about it on the list a few weeks ago, didn't get a reply. |
| 22:06 | brehaut | i figured it might be the case so i specifically mentioned clj 1.2 and fnparse 2.2.7 |
| 22:06 | riddochc | I was going to try to use it to parse the git-fast-import format, as part of a project to convert between a mediawiki export dump and a file-based git repository of wiki pages. |
| 22:06 | riddochc | I'm not sure whether I'll actually be continuing that project, though. |
| 22:08 | riddochc | But it looks like the coffee shop is closing momentarily, so I should be going. I'll let you know how it reads, brehaut, once I finish reading it later. |
| 22:08 | brehaut | cheers |
| 22:21 | joshua__ | $findfn {:test "123"} :test {} |
| 22:21 | sexpbot | [clojure.core/dissoc] |
| 22:26 | gfrlog | $findfn partial (partial partial) |
| 22:26 | sexpbot | java.security.PrivilegedActionException: java.lang.IllegalArgumentException: Wrong number of args (1) passed to: core$partial (NO_SOURCE_FILE:0) |
| 22:41 | ttmrichter | OK, I'm seeing some oddity in the 1.2 REPL. Could anybody explain to me what's happening here? |
| 22:41 | ttmrichter | user=> (def six `六) |
| 22:41 | ttmrichter | #'user/six |
| 22:41 | ttmrichter | user=> six |
| 22:41 | ttmrichter | user/m |
| 22:42 | brehaut | ttmrichter: seems to be working sensible for me (other than an encoding problem) |
| 22:42 | brehaut | user=> six |
| 22:42 | brehaut | \? |
| 22:43 | ttmrichter | You think displaying "m" instead of 六 is sensible? |
| 22:43 | brehaut | i dont get m, i get \? |
| 22:44 | bdesham | I'm looking for a function to merge maps together, but which will merge arbitrarily deeply |
| 22:44 | bdesham | for example, (merge-deeply {:a {:b 1}} {:a {:c 5}}) should give {:a {:b 1, :c 5}} |
| 22:44 | brehaut | user=> (int six) |
| 22:44 | brehaut | 20845 |
| 22:44 | bdesham | does such a thing exist in core or clojure-contrib? |
| 22:44 | hiredman | ttmrichter: you are using jline? |
| 22:44 | ttmrichter | hiredman: Yes. |
| 22:44 | hiredman | jline doesn't do utf-8 properly |
| 22:44 | ttmrichter | brehaut: (int six) |
| 22:44 | ttmrichter | java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.Character (NO_SOURCE_FILE:0) |
| 22:45 | ttmrichter | hiredman: Ah. Is there an alternative I could use? |
| 22:45 | brehaut | ttmrichter: see hiredman's comment |
| 22:45 | hiredman | rlwrap |
| 22:46 | ttmrichter | Is there a quick pointer to using rlwrap for clojure's REPL somewhere? |
| 22:47 | hiredman | rlwrap java … |
| 22:48 | ekoontz | is there a function to return the hash-map minus a given element? |
| 22:48 | ekoontz | return a hash map i mean |
| 22:49 | bdesham | dissoc? |
| 22:49 | bdesham | (dissoc {:a 4, :b 5} :a) -> {:b 5} |
| 22:49 | ekoontz | cool, thanks bdesham, that works :) |
| 22:51 | bdesham | :-) |
| 22:53 | ekoontz | i tried google but no luck |
| 22:53 | ekoontz | actually i see it now: http://faustus.webatu.com/clj-quick-ref.html#map |
| 23:00 | bdesham | to answer my own question... it looks like (deep-merge-with (fn [_ b] b) map1 map2) will do what I wanted |
| 23:01 | ttmrichter | hiredman, brehaut: Thanks for the help. |
| 23:06 | sritchie_ | hey all - is there a good idiomatic way to check if an item exists in a collection? something like: |
| 23:06 | sritchie_ | ,((fn [x y coll] (some #(= [x y] %) coll)) 4 5 [[4 3][4 3]]) |
| 23:06 | clojurebot | nil |
| 23:06 | sritchie_ | ,((fn [x y coll] (some #(= [x y] %) coll)) 4 5 [[4 5][4 3]]) |
| 23:06 | clojurebot | true |
| 23:06 | brehaut | the idiom depends on the collection |
| 23:07 | sritchie_ | brehaut: I'm using the for macro to generate all combinations of these tiles: http://modis-land.gsfc.nasa.gov/MODLAND_grid.htm |
| 23:07 | sritchie_ | brehaut: but I need to ignore the tiles that don't touch the globe at all |
| 23:07 | anthony__ | What's the most elegant way to see if a string contains a substring out of a set of strings? ie "Does string a contain string b, c, or d?" It seems like I can maybe use some, but I'm not sure... |
| 23:08 | sritchie_ | anthony__: one second, one that one |
| 23:08 | brehaut | sritchie_: if existence is your requirement, then use a set |
| 23:09 | brehaut | ,(#{[4 5] [5 3]} [4 5]) |
| 23:09 | clojurebot | [4 5] |
| 23:09 | brehaut | ,(#{[4 5] [5 3]} [23 12]) |
| 23:09 | clojurebot | nil |
| 23:10 | brehaut | or, if you really care about a bool ##(contains? #{[4 5] [5 3]} [4 5]) |
| 23:10 | sexpbot | ⟹ true |
| 23:10 | sritchie_ | anthony__: (fn [str substrings] (some #(substring? % str) substrings)) |
| 23:10 | sritchie_ | brehaut: okay, that makes sense |
| 23:12 | anthony__ | sritchie: Awesome -- I knew there was a beautiful way to do it. Thanks a lot. |
| 23:13 | sritchie_ | no problem |
| 23:16 | sritchie_ | brehaut: I think you joked about this some other day -- what does sexpbot do if you ask it to realize an infinite sequence? |
| 23:17 | brehaut | sritchie_: it runs things in a timeout sandbox |
| 23:17 | brehaut | it shouldnt ever run forever |
| 23:17 | brehaut | there are some cases where it doesnt alert you to the timeout failure though |
| 23:18 | sritchie_ | brehaut: got it, I suppose there's no reason it should be expected to run longer than some sort time, given its environment |
| 23:18 | sritchie_ | s/sort/short |
| 23:18 | sexpbot | <sritchie_> brehaut: got it, I suppose there's no reason it should be expected to run longer than some short time, given its environment |
| 23:18 | brehaut | yup |
| 23:18 | brehaut | also its capped to never realize a large sequence to the channel |
| 23:19 | brehaut | $(range 10000000) |
| 23:19 | brehaut | ##(range 100000000) |
| 23:19 | sexpbot | java.lang.OutOfMemoryError: Java heap space |
| 23:19 | brehaut | that was surprising |
| 23:20 | sritchie_ | busted |
| 23:21 | brehaut | Raynes is probably going to give me some grief for that now :P |
| 23:21 | sritchie_ | it tried to go the extra mile for you, and look what happened |
| 23:21 | Raynes | brehaut: I have the heap setting fairly low. That isn't that uncommon. |
| 23:21 | Raynes | $kill |
| 23:21 | sexpbot | KILL IT WITH FIRE! |
| 23:21 | Raynes | You didn't break him yet. |
| 23:21 | brehaut | phew |
| 23:23 | brehaut | out of curiousity, why does it blow stack? holds onto head? |
| 23:26 | ekoontz | anyone tried redis or mongodb with clojure? |
| 23:26 | hiredman | not limiting the print level |
| 23:31 | sritchie_ | brehaut: if I'm building a set from multiple collections, is there a way to apply across all collections? |
| 23:31 | sritchie_ | let me give an example: |
| 23:31 | sritchie_ | ,(apply conj [] (for [x (range 2) y (range 2)] [x y])) |
| 23:31 | sritchie_ | |
| 23:31 | clojurebot | [[0 0] [0 1] [1 0] [1 1]] |
| 23:31 | sritchie_ | that works great |
| 23:32 | sritchie_ | ,(apply conj [] (for [x (range 2) y (range 2)] [x y]) (for [x (range 3 5) y (range 3 5)] [x y])) |
| 23:32 | clojurebot | [([0 0] [0 1] [1 0] [1 1]) [3 3] [3 4] [4 3] [4 4]] |
| 23:32 | sritchie_ | but here, conj gets applied to all elements of the first for, plus the entire second for |
| 23:33 | brehaut | first up |
| 23:34 | brehaut | (vec (for [x (range 2) y (range 2)] [x y])) |
| 23:35 | sritchie_ | brehaut: okay, internalized |
| 23:35 | brehaut | secondly, arent you wanting sets? |
| 23:35 | sritchie_ | yeah, I wanted to build up a collection to pass to set |
| 23:36 | brehaut | sets support fast unions |
| 23:36 | brehaut | (union (set (for [x (range 2) y (range 2)] [x y])) (set (for [x (range 3 5) y (range 3 5)] [x y]))) |
| 23:36 | brehaut | (union is in clojure.set) |
| 23:37 | sritchie_ | that's perfect, of course that's it |
| 23:37 | sritchie_ | brehaut: the proper function always exists |
| 23:37 | brehaut | it does |
| 23:38 | sritchie_ | brehaut: it's sort of odd, taking advantage of all of these recursive functions without having to write any of them |
| 23:38 | brehaut | yup |
| 23:39 | sritchie_ | brehaut: I've been working with scheme, too, and the worlds are very different. Though I did find something today that needed loop/recur, and a cond statement |
| 23:39 | brehaut | cond is not infrequent in clojure |
| 23:51 | cemerick | ~max |
| 23:51 | clojurebot | maxine is http://research.sun.com/projects/maxine/ |
| 23:51 | cemerick | oh well |
| 23:51 | cemerick | maxine is cool, though |
| 23:54 | Raynes | $max |
| 23:54 | sexpbot | The most users ever in #clojure is 317 |
| 23:54 | Raynes | cemerick: lrn2bot |