2010-04-22
| 00:16 | rfg | What's the easiest way to get an infinite sequence of [0 1 2 3 0 1 2 3 ...]? |
| 00:18 | hiredman | ,(doc cycle) |
| 00:18 | clojurebot | "([coll]); Returns a lazy (infinite!) sequence of repetitions of the items in coll." |
| 00:18 | rfg | Danke |
| 01:24 | johnmn3 | hi |
| 01:24 | herdrick | you know what'd be nice? to make memoized functions implement IPersistentMap |
| 01:24 | herdrick | that'd be super handy |
| 01:24 | herdrick | and would make symmetric the 'maps are functions' property |
| 01:26 | Chousuke | I think it might actually be confusing |
| 01:26 | herdrick | how? |
| 01:26 | clojurebot | with style and grace |
| 01:26 | herdrick | words of wisdom, clojurebot |
| 01:27 | Chousuke | "maps are functions" makes sense and is useful, but "functions are maps (only if memoized)" just isn't :/ |
| 01:28 | hoeck | herdrick: regardless wether its useful or not, with deftype, its only a few lines away :) |
| 01:29 | Chousuke | though I suppose it would facilitate a "lazy map" kind of thing |
| 01:29 | herdrick | it makes plenty of sense, and it's something i want right now |
| 01:29 | herdrick | hoeck: really? |
| 01:30 | herdrick | hmmm - i'll check out deftype |
| 01:30 | herdrick | thanks |
| 01:30 | herdrick | ! |
| 01:30 | hoeck | herdrick: yes, wait a little, I'm pasting sth in a few minutes |
| 01:30 | Chousuke | note that deftype is 1.2 |
| 01:33 | herdrick | Chousuke - thanks |
| 01:33 | herdrick | ouch |
| 01:33 | herdrick | i don't have 1.2 and my last clojure upgrade hurt |
| 01:34 | Chousuke | you can have two versions installed |
| 01:36 | johnmn3 | was reading the irc logs, seeing rhickey's comments about creating some kind of mechanism in clojure that can mimic some of OOP's modeling... could someone give an example of how that would look in code, using 'bank accounts' for example? |
| 01:37 | johnmn3 | like... would the clojure example require dereferencing of the fields or would that be taken care of by the object? |
| 01:42 | johnmn3 | if dereferencing was taken care of internally, would the clojure example look essentially like the java example (hiding the "where to put the value problem")? And what would be the limitations of the clojure version compared to the java one? |
| 01:48 | hoeck | herdrick: http://gist.github.com/374865 |
| 02:00 | herdrick | hoeck: thanks! |
| 02:01 | herdrick | can't try it until i get the newest clojure |
| 02:01 | herdrick | :( |
| 02:01 | herdrick | have been avoiding that |
| 02:03 | hoeck | herdrick: you can download clojure.jar from build.clojure.org, and just try it on the repl, without upgrading you other clojure environment |
| 02:03 | slyphon | so, is it possible to hand a function a var's name (like *foo*) and then have that function deref the var? kind of like what a macro would do in terms of delaying evaluation? |
| 02:03 | herdrick | hoeck: ok. |
| 02:03 | herdrick | or make a new swank-clojure-project using that jar, eh? |
| 02:03 | herdrick | that'd be a snap |
| 02:04 | herdrick | huh |
| 02:04 | hoeck | if it works for you, of course :) |
| 02:05 | herdrick | yeah |
| 02:27 | wooby | hoeck, that's sweet |
| 02:33 | hoeck | wooby: deftype is really nice, you can combine all the clojure interfaces to create new datastructures |
| 02:34 | wooby | hoeck, i've read a little on it but didn't realize the implications |
| 02:35 | hoeck | for example, if you implement seq and cons on your new datatype, you can map over and conj onto it as if it were a "native" clojure datatype |
| 02:37 | hoeck | you could do this all the time, maps and seqs were defined by interfaces all the time, but deftype makes it really succinct and efficient to implement them, in contrast to genclass or proxy |
| 02:39 | wooby | is defprotocol related to this capability somehow? |
| 02:45 | wooby | hm, i think ill try and write it myself :) |
| 03:15 | TheBusby | is there a simple way to check to see if something can be treated like a seq? I know (seq? [1 2]) is false... |
| 03:15 | Licenser_ | morning |
| 03:16 | Licenser_ | TheBusby: try coll? |
| 03:16 | Licenser_ | ,(coll? [1 2]) |
| 03:16 | clojurebot | true |
| 03:16 | Licenser_ | ,(coll? '(1 2)) |
| 03:16 | clojurebot | true |
| 03:16 | TheBusby | Licenser_: perfect, thank you! |
| 03:17 | _ato | ,(coll? "wheeeeeee") |
| 03:17 | clojurebot | false |
| 03:17 | _ato | ,(seq "wheeeeee") |
| 03:17 | clojurebot | (\w \h \e \e \e \e \e \e) |
| 03:17 | _ato | ,(seqable? "wheeee") |
| 03:17 | clojurebot | true |
| 03:17 | Licenser_ | and again _ato is smarter then me :P |
| 03:18 | _ato | though coll? maybe more appropriate if you |
| 03:18 | _ato | re really only interested in clojure collections |
| 03:18 | TheBusby | yep, '() [] and {} for the moment |
| 03:18 | Licenser_ | (coll? {1 2}) |
| 03:18 | Licenser_ | ,(coll? {1 2}) |
| 03:18 | clojurebot | true |
| 03:18 | TheBusby | strings are have their own special level of hell reserved for them |
| 03:19 | Licenser_ | ^^ |
| 03:20 | tomoj | just need a language where the words are integers |
| 03:20 | Licenser_ | 1 |
| 03:21 | _ato | hellish java string fact of the day: if you take a small subsequence of a large string and then release all references the large string so it can be garbage collected, prepare to be surprised by an OutOfMemoryError |
| 03:21 | Licenser_ | *g* |
| 03:22 | TheBusby | java strings have their fun, but everything after pure ASCII strings in C seems to have their own pain |
| 03:22 | _ato | I think it'd be interesting to try implementing strings using persistent vectors, it'd allow structure sharing but still avoid that problem |
| 03:22 | _ato | and would probably make manipulating them faster |
| 03:23 | TheBusby | I blame human language though, that's the difficult part |
| 03:23 | Chousuke | ICU is one of the few string libraries that is probably doing it right :P |
| 03:23 | _ato | or maybe they'd just be slower, dunno. Interesting to try |
| 03:23 | TheBusby | usually speed is the big problem |
| 03:23 | gregh | any problem in compute science can be solved with an other level of indirection |
| 03:23 | gregh | computer |
| 03:24 | Chousuke | gregh: including the problem of overabstraction? |
| 03:24 | TheBusby | haha |
| 03:24 | gregh | except that one, it creates other problems. :) |
| 03:31 | gregh | anyway, one could create a string class that broke up the backend representation when a substring was taken, so that freeing the large string would allow the majority to be garbage collected |
| 03:31 | gregh | you'd have to have a pretty good reason to go to all that work, though. |
| 03:32 | _ato | true that |
| 03:33 | _ato | I occasionally run into the problem when parsing lots of big data and tallying things up in hash tables, based on some smaller part of the larger text |
| 03:33 | _ato | just need to remember to explicitly copy the string before sticking it in your hash map |
| 03:58 | Licenser_ | meep meep |
| 04:02 | TheBusby | er, what's the trick where you can call a function before you define it? It's not bind... |
| 04:02 | _ato | declare |
| 04:02 | TheBusby | _ato: thank you! |
| 04:04 | esj | I do declare Mr. Beauregard... ! |
| 04:05 | esj | mercy, i need more coffee.... I'm turning into a ircbot |
| 04:21 | Licenser_ | _ato: do you still remember the bug in clj-sandbox that let you remap a function wiht var and such? |
| 04:22 | Licenser_ | you called .alterRootVar on some var and then got a eval with another name when I remember correctly |
| 04:22 | _ato | hmm |
| 04:24 | Licenser_ | i think clj-sandbox fixed the issue now but I'd like to make a test to be sure :P |
| 04:25 | _ato | Licenser_: see #clojure-casual |
| 04:53 | MadWombat | Hello all |
| 04:55 | MadWombat | If I have a defstruct with 3 keys and 3 lists of items, how can I make a bunch of structs picking values from each collections? |
| 04:57 | AWizzArd | Hi MadWombat. Could you please describe what you want in other words? I am not sure that I understand what you want. |
| 04:57 | bsteuber | MadWombat: you pick values with (:your-key your-struct) - not sure if this is what you need either :) |
| 04:58 | Chousuke | (map (partial struct yourstruct) list1 list2 list3) |
| 05:29 | AWizzArd | What do you use to parse .csv files? Does Contrib have something for that? |
| 05:31 | zmila | certainly, exists some java implementation of csv-parsers |
| 05:32 | esj | AWizzArd: I think there is such a thing in Incantre |
| 05:43 | stilkov | AWizzArd: check out http://github.com/davidsantiago/clojure-csv |
| 05:46 | AWizzArd | oki |
| 05:49 | stilkov | how does one submit bug reports for the clojure documentation? |
| 05:50 | Chousuke | normally through the ticket system I think |
| 05:50 | Chousuke | there's a support tab in assembla for non-members |
| 05:52 | stilkov | thanks |
| 06:26 | npoektop | what does mean :memory here (defmethod read-session :memory [repository id] ...)? |
| 06:27 | bsteuber | npoektop: depends on the definition of read-session |
| 06:28 | bsteuber | http://clojure.org/multimethods |
| 06:28 | npoektop | bsteuber, thank you |
| 07:03 | _exterm | Is the ASM used by the clojure compiler just a repackaged org.objectweb.asm? if so, which version is it based on? |
| 07:20 | eglyph | hello, I'm following the tutorial on enlive. scrape3 isn't working. it uses html/selector which is not in enlive-html. am I missing something? |
| 07:34 | _exterm | Hey people, I'm trying to do some modifications to the Compilre to target a different Bytecode format. Is the ASM used by the clojure compiler just a repackaged org.objectweb.asm? if so, which version is it based on? |
| 07:37 | hoeck | _exterm: yes, its org.objectweb.asm, but I don't know which version |
| 07:38 | hoeck | eglyph: which tutorial? |
| 07:39 | eglyph | hoeck: the one from here: http://github.com/swannodette/enlive-tutorial/ |
| 07:40 | eglyph | everything is fine until the moment i have to load scrape3.clj. i've browsed the source and couldn't find 'selector' function |
| 07:42 | hoeck | eglyph: and what about net.cgrand.enlive-html/selector ? |
| 07:43 | eglyph | is there such a function in enlive-html? |
| 07:44 | eglyph | enlive-html is :required as html, so the full name is html/selector. this is the exact thing the slime barks at. |
| 07:44 | hoeck | I don't know, I have never used enlive :P |
| 07:44 | eglyph | as i've already said there is no such function in enlive-html |
| 07:44 | hoeck | ah, okay, I first thought that there was a typo somewhere in scrape3 or so |
| 07:45 | eglyph | it seems the idea is to use partial application if i'm not mistaken |
| 07:59 | kzar | So I'm probably just being stupid here but I'm a bit confused by the clojure.http.client package. If I call the request function with the GET method and add some parameters the parameters seem to be given as post ones. (Even though the :method of the response is GET) . If I add the parameters manually to the URL they are sent as GET parameters though |
| 08:01 | AntonyBlakey | eglyph: in enlive_html.clj line 343 I see (defmacro selector ...) so it's definitely defined. This is enlive 1.0.0-SNAPSHOT |
| 08:04 | eglyph | AntonyBlakey: I'm looking into git version and there is no such string. the tutorial is installed with lein. so probably enlive evolved and the tutorial is not updated. |
| 08:04 | AntonyBlakey | Check your project.clj to see what version lein specifies. |
| 08:05 | AntonyBlakey | I did the tutorial with no problems. |
| 08:05 | eglyph | enlive "1.0.0-SNAPSHOT" |
| 08:06 | eglyph | i've just looked into enlive jar for the source. it's not there. wtf? |
| 08:06 | _ato | kzar: I think when you pass a map to it it always puts it in the request body, not the query string. If you want to put something on the query string add it to the URL (you can probably use url-encode on the map to format it) |
| 08:07 | AntonyBlakey | eglyph: It is in mine (along with many compiled files) |
| 08:08 | eglyph | AntonyBlakey: my jar consists two .clj files. this is weird. |
| 08:11 | AntonyBlakey | You have a later version than I do. |
| 08:13 | AntonyBlakey | Did you perchance checkout out the git head and build it? |
| 08:14 | Licenser_ | hmm has anyone worked with clojure to write gui applications? |
| 08:14 | AntonyBlakey | berlin brown has a blog post on it. |
| 08:15 | AntonyBlakey | http://berlinbrowndev.blogspot.com/2009/04/practical-clojure-with-swt-junit-and.html |
| 08:15 | sexpbot | "Berlin Brown and Software Development: Practical Clojure with SWT, JUnit and Spring" |
| 08:15 | eglyph | AntonyBlakey: no, I just cloned the tutorial repo and followed all the steps listed. lein deps && lein repl |
| 08:15 | AntonyBlakey | and this for swing: http://stuartsierra.com/2010/01/03/doto-swing-with-clojure |
| 08:15 | sexpbot | "doto Swing with Clojure - Digital Digressions by Stuart Sierra" |
| 08:15 | hoeck | eglyph: it looks like the selector macro was there for "compiling" selectors |
| 08:16 | hoeck | and now selectors are just plain functions, and you don't have to compile them |
| 08:16 | eglyph | hoeck: so the tutorial won't work until fixed, right? |
| 08:16 | hoeck | eglyph: can you try to just remove the html/selector calls from the scrape3 source? |
| 08:17 | AntonyBlakey | eglyph: try deleting the enlive jar from your lib directory and your ~/.m2/ repository |
| 08:17 | hoeck | eglyph: yes, but it looks like its a very small fix |
| 08:17 | AntonyBlakey | But I don't think that 1.0.0-SNAPSHOT matches git head. |
| 08:17 | hoeck | eglyph: but beware, I'm only doing a wild guess while looking at the commits |
| 08:18 | vu3rdd | _exterm: The clojure package in debian is built without the in-built asm library, as asm is already present as a deb package |
| 08:18 | vu3rdd | and it uses version 3.2 of libasm3 |
| 08:20 | Licenser_ | thanks fort the links |
| 08:20 | kzar | _ato: OK fair enough |
| 08:22 | eglyph | hoeck: right, selector has to be removed from the code |
| 08:22 | hoeck | eglyph: that was the commit I'm referring to: http://github.com/cgrand/enlive/commit/6d0919ef2be0f3ea1ca69335d8098ec9e3442f8f#L0R369 |
| 08:26 | eglyph | i wonder why it is not working |
| 08:55 | jfields | are there any conventions around naming in clojure? obviously dashes are preferred to camel case or underscores. Anything else? For example, Stu Halloway once mentioned to me that foo->bar was idiomatic for converting a foo to a bar. Are there other things like that? |
| 08:55 | kzar | _ato: Hey you're right the url-encode function works really well, I love how you can just give it a map. It was actually really easy to make a little web-request function that behaved like I expected. Thanks |
| 08:56 | Chousuke | jfields: ? for predicates |
| 08:57 | hoeck | jfields: also: http://www.assembla.com/wiki/show/clojure/Clojure_Library_Coding_Standards |
| 08:57 | sexpbot | "Clojure Library Coding Standards | Clojure | Assembla" |
| 08:57 | Chousuke | jfields: also parameter names: coll for collection, x, y, n, f, g for functions etc. |
| 08:57 | Chousuke | hm, that's unclear. obviously not x, y, n for functions :P |
| 08:58 | Chousuke | also shadowing core names is okay if the scope of shadowing is short-lived |
| 08:59 | jfields | Chousuke, hoeck: cool, thanks |
| 08:59 | Chousuke | eg. (defn reverse-map [map] (into {} (for [[k v] map] [v k]))) is okay |
| 09:01 | jfields | I've been using using name:age for maps (e.g. (def name:age {:jay 30 :bob 24}), but I was considering switching to name=>age and saving : for another option |
| 09:05 | hoeck | jfields: colons in symbols are not a good idea |
| 09:06 | jfields | hoeck: why's that? |
| 09:07 | hoeck | it looks bad, as they are usually reserved for keywords |
| 09:09 | hoeck | an idiomatic name would be name-age |
| 09:10 | jfields | hoeck: which looks good in that case, but when it's first-name-last-name you loose a bit of information. first-name=>last-name is more expressive, to me. |
| 09:10 | jfields | s/loose/lose/ |
| 09:10 | Chousuke | I think it's better to name the map to indicate its use |
| 09:11 | Chousuke | though if such a naming scheme is not applicable, name=>age is pretty good |
| 09:11 | Chousuke | or name->age |
| 09:11 | hoeck | right |
| 09:13 | jfields | chousuke: name->age, really? doesn't that collide with the idea that -> is usually used for converting from one data structure to another? |
| 09:13 | Chousuke | nah. |
| 09:13 | AWizzArd | Could be a map :) |
| 09:14 | jfields | cool. I'm just learning this stuff, so thanks for the ideas. |
| 09:14 | Chousuke | the type->another is mostly borrowed from scheme |
| 09:15 | Chousuke | but in clojure most things for now are simply maps and vectors and strings and other mundane data types. there isn't much need for conversion |
| 09:15 | jfields | chousuke: sadly, most of my clojure work is tied very closely to an existing java codebase. which has me doing ->'s all the time. |
| 09:16 | Chousuke | heh. |
| 09:16 | AWizzArd | “(->” does not look similar to “(something->” |
| 09:17 | Chousuke | AWizzArd: I don't think anyone said that. |
| 09:32 | dnolen | hmm, so is it possible to augment final Java classes now with extend ? |
| 09:36 | chouser | yes |
| 09:38 | kzar | Is there a way to use clojure.xml/parse with a string or a seq of strings instead of giving it a filename to open? |
| 09:40 | zmila | kzar - xml/parse can parse InputStream |
| 09:42 | chouser | ,(clojure.xml/parse (java.io.ByteArrayInputStream. (.getBytes "<foo>bar</foo>"))) |
| 09:42 | clojurebot | {:tag :foo, :attrs nil, :content ["bar"]} |
| 09:42 | chouser | dnolen: yeah, that's appropriate |
| 09:45 | kzar | zmila: chouser: sweet thanks |
| 09:45 | kzar | Which html parser would you recommend that can handle badly formed html? |
| 09:46 | chouser | tagsoup |
| 09:46 | chouser | works quite nicely with clojure.xml/parse |
| 09:46 | dnolen | ok, interesting so you can't extend a protocol right ? (that is, without having to specify a list of types) |
| 09:48 | chouser | "extend" is always about filling in an implementation at an intersection between a protocol and something else. |
| 09:48 | chouser | the something else can be a record, datatype, class (even a final one), or an interface. |
| 09:48 | dnolen | chouser: so that's a no. A protocol is a bit less of dynamic thing. I can't change the protocol for everyone (a bad idea I suppose anyway), but I can extend it for a type. |
| 09:49 | chouser | oh... you mean add a new method spec to an existing protocol? |
| 09:49 | dnolen | chouser: yes |
| 09:49 | chouser | I think you can redefine the entire protocol if you want. |
| 09:50 | dnolen | chouser: sure, I meant for users of a library which defines a protocol. They want to add some methods, they have to extend all types that use that protocol, they can't jsut add a method spec. |
| 09:54 | kzar | chouser: Dumb question but how do I know what to add to my use list to get clj-tagsoup working? Usually I just add the name but with hyphens changed to periods so [clj.tagsoup] but it's not working |
| 09:56 | _ato | kzar: if it's not documented then just look at the directory structure of the library source, or read the (ns ...) line: http://github.com/nathell/clj-tagsoup/blob/master/src/pl/danieljanus/tagsoup.clj |
| 09:57 | _ato | so in this case you'd use pl.danieljanus.tagsoup |
| 09:57 | dnolen | kzar: hyphens don't become periods. |
| 09:58 | chouser | it looks like http://github.com/nathell/clj-tagsoup produces different output than clojure.xml |
| 09:58 | chouser | if you want clojure.xml output, you don't need a clojure lib, just the tagsoup java .jar |
| 10:03 | dnolen | chouser: now that I think about it, I suppose it doesn't matter really, since protocols are composable :) |
| 10:04 | Licenser | aloa |
| 10:05 | kzar | Hmm so I did try pl.danieljanus.tagsoup earlier, but no luck. At least I was onto something. It's good to know how that stuff should work even if it's not all functioning atm. I tried unziping the tagsoup jar somewhere and the structure looks like org/ccil/cowan/tagsoup so I should add [org.ccil.cowan.tagsoup] to my use list right? Well that's not working either so I'm stumped now |
| 10:06 | vu3rdd | I see something very strange with (comment .. ) |
| 10:07 | vu3rdd | if I put some clojure code there, it is fine. But if I use a strange looking identifier (for example cut and paste code from dotrace), it does not compile |
| 10:07 | vu3rdd | ,(comment (defn x[] "true")) |
| 10:07 | clojurebot | nil |
| 10:08 | vu3rdd | ,(comment (defn x[] xyz:)) |
| 10:08 | clojurebot | Invalid token: xyz: |
| 10:08 | kzar | (I have copied all of the jars from tagsoup into my classpath and restarted Clojure) |
| 10:09 | Licenser | kzar: there is already a clojure lib for tagsoup that works |
| 10:10 | kzar | Licenser: Yea I think you joined us mid convo, I was having trouble getting that loaded and it was suggested I tried the tagsoup directly |
| 10:10 | lpetit | hello all |
| 10:11 | vu3rdd | Is this behaviour with (comment) a bug? |
| 10:13 | Licenser | ah okay, kzar I used it with the lib and it worked w/o any trouble - strange |
| 10:14 | kzar | Licenser: Heh it's very probably me doing something wrong to be fair on the library |
| 10:15 | Licenser | http://github.com/Licenser/lein-search/commit/7fc3030f8d5edb0099f93ea87717673d3f6fe56f#diff-7 |
| 10:16 | Licenser | actually http://github.com/Licenser/lein-search/blob/7fc3030f8d5edb0099f93ea87717673d3f6fe56f/src/leiningen/update.clj |
| 10:17 | kzar | OK I got it working, turns out killing Clojure wasn't enough to add the new jar files to the classpath. I needed to restart emacs |
| 10:17 | kzar | On the plus side I understand how things are laid out a lot better now |
| 10:22 | Licenser | :) |
| 10:28 | kzar | Oh sweet it's working really well with the inspect-tree gizmo, go to love that |
| 10:29 | kzar | Does anyone know of a good guide that explains the difference between map apply and reduce? I know it's dumb but the difference always eluded me |
| 10:38 | liebke | kzar: a one line summary of the difference is: (apply foo [1 2 3]) => (foo 1 2 3), where as (reduce foo [1 2 3]) => (foo (foo 1 2) 3). |
| 10:39 | bsteuber | and (map foo [1 2 3]) => [(foo 1) (foo 2) (foo 3)] |
| 11:07 | caljunior | so I was creating this ubercool gui. Sensibly designed it in Netbeans. :import into clojure. everything beautiful. now I want to (.add some-panel (JScrollPane. some-table)) but the ScrollPane is not showing up in the gui. Just an empty JPanel. |
| 11:09 | caljunior | all my (.addActionListnener ) code I added in clojure is working just fine in the same gui. |
| 11:09 | Chousuke | did you try forcing a repaint of the whole thing? |
| 11:10 | caljunior | no |
| 11:10 | Chousuke | or check if the scroll pane has any visibility flags |
| 11:10 | caljunior | ok |
| 11:10 | Chousuke | There's no reason code like that shouldn't work as far as I know so I'm guessing it's for some reason deciding it doesn't need to get drawn at all |
| 11:15 | caljunior | (.repaint some-panel) no effect. |
| 11:16 | caljunior | *checking visibility flags on scroll pane* |
| 11:23 | jfields | does anyone know if (append-spit) is thread safe? |
| 11:24 | Chousuke | ~def append-spit |
| 11:24 | clojurebot | It's greek to me. |
| 11:24 | jfields | it's in contrib |
| 11:25 | stuartsierra | define thread safe |
| 11:25 | Chousuke | you can always ensure it's thread safe by using an agent :P |
| 11:25 | jfields | I have two threads that want to write to the same file |
| 11:26 | stuartsierra | Since it's just calling java.io methods, I would guess it is not safe to use from 2 threads at once. |
| 11:26 | jfields | okay, thanks |
| 11:27 | Licenser | I really want to write a program with agents, then I'd call them all smith |
| 11:27 | stuartsierra | ha |
| 11:27 | Chousuke | (def agent smith) |
| 11:27 | Licenser | (def smith agent) |
| 11:27 | Chousuke | except hm, yeah |
| 11:28 | Licenser | then you could use smith instead of agent |
| 11:34 | cYmen | I wrote down how I set up vimclojure in case anybody wants to try it: https://simon.a-oben.org/pages/clojurestart.html |
| 11:36 | Licenser | I really start to dislike my typo blog :( is there any nice clojure one out there? (yes I know I could write my own) |
| 11:36 | Licenser | propably would be best but I hate to do the graphics part -.- |
| 11:38 | tomoj` | "typo" blog? |
| 11:38 | Licenser | for god's sake :( |
| 11:38 | Licenser | yes it's a blog in rails |
| 11:38 | tomoj` | oh, yeah |
| 11:38 | Licenser | and I start to hate it more and more |
| 11:38 | tomoj` | naturally |
| 11:39 | Licenser | it refuses to update properly and their new editor is hell - I am scared to share the link of my latest post since it is embarrasing ... |
| 11:40 | rfg | Link please. |
| 11:40 | rfg | :) |
| 11:41 | rfg | I've been writing a blog in CL. |
| 11:42 | rfg | I would've liked to write it in clojure, but it's cgi based and so the jvm start-up speed is problematic. |
| 11:42 | Licenser | rfg: it is broken |
| 11:42 | Licenser | I really want to cry now |
| 11:43 | Licenser | *sighs* |
| 11:47 | Chousuke | rfg: have you considered using a wholly jvm-based approach like compojure with Jetty serving the pages? |
| 11:48 | zaphar_ps | rfg: I went the static site generator route and wrote it in clojure |
| 11:49 | rfg | Chousuke: It's mainly because my host was only (until recently) allowing cgi. They've started a beta for using arbitrary technologies which should allow me to do it in clojure, but I need to look into how one goes about doing that. |
| 11:51 | ivenkys | afternoon gents - i am learning clojure (and loving it) , any suggestions for code to look at for getting the idioms right |
| 11:51 | rfg | zaphar_ps: Yeah, I've seen your site. |
| 11:52 | zaphar_ps | really? |
| 11:52 | zaphar_ps | heh |
| 11:52 | zaphar_ps | not used to people having been there :-) |
| 11:52 | zaphar_ps | it's pretty low traffic |
| 11:52 | ivenkys | a small library or so would be perfect - |
| 11:52 | rfg | Actually could people have a look at my site and tell me if it is rendering nicely. www.radiofreeganymede.com |
| 11:52 | sexpbot | "Radio Free Ganymede" |
| 11:53 | zaphar_ps | ooohhhh pretty picture :-) |
| 11:53 | zaphar_ps | looks ok to me chrome on ubuntu linux |
| 11:54 | slaxor | looks fine on firefox, windows 7 |
| 11:54 | rfg | I hope to have my first clojure related post up soon. |
| 11:55 | Licenser | rfg: looks good on safari http://grab.by/3VYX |
| 11:56 | dnolen | invenkys: you could look at cgrand's repo on GitHub tho his work tends to be ultra-dense. The clojure-contrib 1.2.0 libraries might also be educational. |
| 11:56 | dnolen | ivenkys: ^ |
| 11:56 | ivenkys | dnolen: tkx |
| 11:57 | ivenkys | rfg : looks good in Firefox on Arch |
| 11:57 | lrenn | can you pass wild cards clojure.lang.Compile? In other words, is there a way to write an ant task that doesn't list an argument for each namespace? |
| 11:58 | stuartsierra | with a lot of ant XML foolery, yes |
| 11:58 | chouser | if you compile a namespace the 'require' or 'use's other namespaces, all those will be compiled too |
| 11:58 | Licenser | for gods sake :( this is so sad |
| 11:59 | lrenn | grr, thanks folks. |
| 12:00 | cemerick | lrenn: if you're locked into ant, but not opposed to using the maven-ant-tasks lib there, the clojure-maven-plugin supports wildcards for choosing which namespaces to compile. |
| 12:03 | lrenn | cemerick: thanks but I'm just fooling around with reimplementing lein in ant + ivy :) It's backwards compatible other than having to specify all your namespace :( |
| 12:03 | cemerick | heh, ok |
| 12:29 | ad4m | I've got a Clojure app that calls for clojure-1.2.0-master-SNAPSHOT.jar, but I can't seem to find that specific version in any repositories. I have found repos with 1.2.0 snapshot jars with dates in the name, do I just grab one of those and rename it to remove the date? |
| 12:30 | Chousuke | ad4m: that name is what you get if you build from git, but renaming a maven snapshot will work as well |
| 12:32 | ad4m | Ah, so is the idea that I should have that already in my local repo by way of building it from source? |
| 12:33 | Chousuke | probably |
| 12:33 | Chousuke | though the clojure build process doesn't actually put it in a *maven* repo. it just produces a jar |
| 12:34 | ad4m | Ok, well I don't know much about Maven either, but I'd assume there's a way to publish things to your local repo or cache or whatever it is called |
| 12:34 | ad4m | Thanks |
| 12:44 | raek | how is clojure's = done for java arrays? identity? element-wise-=? |
| 12:45 | dakrone | raek: the doc is pretty clear about it |
| 12:45 | dakrone | ,(doc =) |
| 12:45 | clojurebot | "([x] [x y] [x y & more]); Equality. Returns true if x equals y, false if not. Same as Java x.equals(y) except it also works for nil, and compares numbers and collections in a type-independent manner. Clojure's immutable data structures define equals() (and thus =) as a value, not an identity, comparison." |
| 12:47 | dakrone | raek: does that make sense? so they are equal if the elements are equal |
| 12:49 | stuartsierra | ,(= (list 1 2 3) (seq [1 2 3])) |
| 12:49 | clojurebot | true |
| 12:50 | dakrone | ,(= '(1 2 3) [1 2 3]) |
| 12:50 | clojurebot | true |
| 12:50 | dakrone | even though one's a list and one's a vector |
| 12:50 | Chousuke | arrays have identity comparison. |
| 12:50 | stuartsierra | ,(= (list [:a 1] [:b 2]) {:a 1 :b 2}) |
| 12:50 | clojurebot | false |
| 12:51 | Chousuke | ,(seq {:a 1 :b 2}) |
| 12:51 | clojurebot | ([:a 1] [:b 2]) |
| 12:51 | Chousuke | ,(= (into-array [1 2 3]) (into-array [1 2 3])) |
| 12:51 | clojurebot | false |
| 12:52 | Chousuke | (this is not a bug :)) |
| 12:55 | slyphon | what's the deal with the "trailing attr-map" style? |
| 12:56 | Chousuke | what do you mean? |
| 12:57 | tchalvak | Hey, it worked! |
| 12:57 | slyphon | what does it look like? |
| 12:57 | slyphon | you can do (defn blah "docstr" {:private true} [] ) |
| 12:58 | slyphon | or even (defn #^{:private true} blah "docstr" [] (println "yay!")) |
| 12:58 | slyphon | there's a form where the metadata comes at the end, though |
| 12:59 | slyphon | no? |
| 12:59 | Chousuke | hm |
| 12:59 | tchalvak | So I'm trying to get started with clojure, and I'm running into problems including jars, can I do this, to test that I have the right paths, from within the repl? And if so, what's the actual syntax? |
| 12:59 | Chousuke | maybe with multiple arities? |
| 12:59 | Chousuke | (doc defn) |
| 12:59 | clojurebot | "([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + attr-map?]); Same as (def name (fn [params* ] exprs*)) or (def name (fn ([params* ] exprs*)+)) with any doc-string or attrs added to the var metadata" |
| 12:59 | slyphon | maybe |
| 12:59 | stuartsierra | (defn foo ([x] ...) {:meta ...}) |
| 13:00 | slyphon | ahhh |
| 13:00 | slyphon | ok, i couldn't figure out where the meta went in that form |
| 13:00 | slyphon | stuartsierra: thanks |
| 13:00 | stuartsierra | test that; I think it's right |
| 13:01 | Chousuke | tchalvak: do what? |
| 13:01 | slyphon | stuartsierra: yep, that's it, thanks! |
| 13:02 | stuartsierra | you're welcome |
| 13:02 | tchalvak | Get a jar library loaded, e.g. if I'm running the repl from a folder, and I have a blog/blog.jar file, can I include or require it from within the repl? |
| 13:02 | stuartsierra | nope |
| 13:05 | tchalvak | Ah. |
| 13:05 | raek | is there a simple way to make a hex string from a java byte array? |
| 13:06 | bsteuber | tchalvak: but you can check your existing classpath with (System/getProperty "java.class.path") |
| 13:08 | tchalvak | bsteuber: *nods* Ok, I guess that'll work for seeing whether the stuff that I'm trying to load is actually present, guess I'll have to load & reload the repl and test different configs. Thanks. |
| 13:08 | bsteuber | tchalvak: yes, I think so - or you can use something like leiningen or maven that sets up the right classpath for you |
| 13:09 | dakrone | raek: something like this perhaps: (map #(Integer/toHexString (int %)) [\a \b \c\ \d]) |
| 13:09 | dakrone | ,(map #(Integer/toHexString (int %)) [\a \b \c\ \d]) |
| 13:09 | clojurebot | ("61" "62" "63" "20" "64") |
| 13:09 | dakrone | you'll need to convert your byte array to a seq first |
| 13:10 | dakrone | ,(map #(Integer/toHexString (int %)) (.getBytes "asdf")) |
| 13:10 | clojurebot | ("61" "73" "64" "66") |
| 13:10 | dakrone | or not |
| 13:11 | bsteuber | tchalvak: but actually google gives some results for "java modify classpath runtime" - maybe you can experiment with this.. |
| 13:12 | bsteuber | would be nice to do a clojure wrapper around this |
| 13:12 | stuartsierra | Clojure has add-classpath, deprecated because it doesn't work in many environments |
| 13:12 | tchalvak | bsteuber: Not to dump lots of text, but: user=> (System/getProperty "java.class.path") |
| 13:12 | tchalvak | "/home/tchalvak/sites/threadhack/www/crow-blog:/home/tchalvak/sites/threadhack/ClojureX/lib/clojure.jar:/home/tchalvak/sites/threadhack/ClojureX/lib/clojure-contrib.jar:compojure/compojure.jar:rhino1_7R2/js.jar:blog/admin.clj:blog/config.clj:blog/db.clj:blog/layout.clj:blog/markdown.clj:blog/pages.clj:blog/rss.clj:blog/server.clj:blog/test.clj:blog/tokyocabinet.clj:blog/util.clj:::/home/tchalvak/sites/threadhack/ClojureX/lib/jlin |
| 13:12 | tchalvak | So I have all these files actually loaded, so that's good. |
| 13:12 | tchalvak | I'm using ClojureX, if y'all are familiar. |
| 13:13 | tchalvak | Which allows me to push some jar paths into a .clojure file on a project to project basis, and it's apparently working. |
| 13:13 | Chousuke | tchalvak: that's not right. |
| 13:13 | Chousuke | tchalvak: you should have the root of the blog dir in the classpath, not the blog files itself |
| 13:14 | tchalvak | Now I just have to figure out how to actually access the namespaces in the jars. |
| 13:14 | tchalvak | Right, I was kinda confused by that, I'll try that then. |
| 13:14 | Chousuke | so that you can have (ns blog.pages) etc. |
| 13:15 | hiredman | tchalvak: you have some clojure files (.clj) on the classpath, that is not going to work |
| 13:15 | hiredman | I should say in the classpath |
| 13:15 | hiredman | jars and directories go on the classpath |
| 13:16 | Chousuke | ie. if it's /foo/bar/blog/some.clj, add /foo/bar/ to the classpath |
| 13:16 | tchalvak | Chousuke: that applies to both .jar files and .clj files? |
| 13:16 | Chousuke | jar files are added directly |
| 13:16 | Chousuke | they represent a directory |
| 13:16 | tchalvak | Chousuke: Ok, I'll edit based on that then. |
| 13:17 | Chousuke | they contain a /foo/bar/whatever.clj hierarchy |
| 13:17 | Chousuke | the point is that in java, and in clojure, a namespace segment corresponds to a directory |
| 13:17 | Chousuke | except the last one, which is the file/class |
| 13:18 | Chousuke | so if you have some directory or jar in a classpath, the directories under it are going to represent namespaces |
| 13:18 | Chousuke | again, a jar is essentially just the dir hierarchy packaged into a zip file. you could extract it and it'd work just the same :) |
| 13:23 | bsteuber | stuartsierra: thx for the information |
| 13:24 | stuartsierra | np |
| 13:34 | tchalvak | Chousuke: 'lright, I guess I'm part of the way there, I'll have to go back to the book now and start at the beginning. |
| 13:34 | tchalvak | Chousuke: Thanks. |
| 13:42 | joshua-choi | I've been reading http://www.assembla.com/wiki/show/clojure/Clojure_Compiler_in_Clojure. |
| 13:42 | joshua-choi | What does "written in Clojure" mean? |
| 13:42 | joshua-choi | As in, clojure.core and other libraries that use no direct Java and no eval? |
| 13:42 | chouser | no, that page is just about the compiler |
| 13:43 | slyphon | wow, STM FTW |
| 13:43 | joshua-choi | chouser: So it doesn't have to be in "pure" Clojure then? |
| 13:43 | chouser | which is currently clojure/lang/Complier.java |
| 13:43 | slyphon | talk about "a good idea" |
| 13:43 | joshua-choi | Well, that's written in Java. |
| 13:43 | chouser | joshua-choi: oh, I see. yeah, I think it will strive to be pretty pure |
| 13:44 | cemerick | so, I wonder who's going to knock out a far shorter/simpler version of this... http://wiki.github.com/FaKod/Circuit-Breaker-for-Scala/ |
| 13:44 | joshua-choi | chouser: Does "pure" mean end-dependent on clojure.core and special forms only? |
| 13:44 | chouser | that is, the reader gives it clojure structures, and the compiler analysis phase will produce nested clojure records. |
| 13:45 | joshua-choi | Clojure records? |
| 13:45 | chouser | the step after that is to produce jvm bytecode, and of course that will use java and be java-specific. |
| 13:45 | chouser | yeah, defrecord instances. |
| 13:45 | joshua-choi | The reader would spit out raw lists, vectors, maps, and sets. What would need to be translated into records from those? |
| 13:46 | chouser | right, that's what the analysis phase of comiplation does now -- takes the raw lists, vectors, etc. and produces a tree of Java objects. |
| 13:46 | chouser | the new code would be in clojure instead, do roughly the same kind of analysis and produce a tree of records. |
| 13:46 | joshua-choi | What would need to turn into objects? Functions? |
| 13:47 | joshua-choi | Oh, I see |
| 13:47 | chouser | the analysis phase includes all macroexpansion, type inference, and the necessary gathering of data about primtives, local scopes, local-clearing (to prevent head-holding), etc. |
| 13:48 | joshua-choi | Would it matter if the reader was in pure Clojure too? Or could the current Java-implemented reader suffice for the compiler? |
| 13:49 | chouser | The reader can be ported to clojure independently. The interface between the reader and compiler is very well understood, so you should be able to mix-n-match implementations. |
| 13:49 | chouser | a couple people have written more or less complete Clojure readers in Clojure now. |
| 13:50 | joshua-choi | Really? I wrote one too, but I didn't know that there were others. |
| 13:50 | chouser | Chousuke and hiredman each wrote one |
| 13:51 | chouser | that's not including things very like clojure readers that the various syntax highlighters may have. |
| 13:51 | joshua-choi | Do you know if their sources are on GitHub? |
| 13:52 | chouser | I think one of the early steps for ccinc will be to make the interface between the compiler's analysis phase and emit phase as stable and accessible as the reader->compiler interface. That will allow compilers and emitters to be developed independently as well. |
| 13:54 | joshua-choi | The difference, I think, is that the reader-compiler phase uses standard Clojure data structures, while the compiler current emits weird Java objects that I don't get. :) |
| 13:55 | joshua-choi | I don't dare to figure them out. |
| 13:55 | chouser | right, that's why I want that to change early, into nice printable records |
| 13:55 | chouser | I'm actually kinda itching to get started on that, but I have this pesky book to finish first... |
| 13:55 | joshua-choi | It's not that urgent, though, anyway, right? |
| 13:55 | hiredman | joshua-choi: http://github.com/hiredman/clojure/blob/readerII/src/clj/clojure/reader.clj |
| 13:56 | chouser | hiredman: thanks. I was getting close... |
| 13:56 | chouser | oh, I'm in readerIII ...maybe not so close. |
| 13:56 | stuartsierra | I started sketching out plans for a reader that was entirely table-based. |
| 13:57 | joshua-choi | hiredman: Whoo, that is amazing, and dense. Why did you put your helper methods in a letfn? |
| 13:58 | hiredman | joshua-choi: to avoid var lookups in the generated bytecode |
| 13:59 | joshua-choi | hiredman: Does it make it that much slower? I've always wondered if I should use let instead of def for my parser libraries... |
| 14:00 | hiredman | http://groups.google.com/group/clojure-dev/browse_frm/thread/b20ce4b2c226ffcf/26860813d1c39ba1?lnk=gst&q=reader#26860813d1c39ba1 |
| 14:00 | hiredman | it's not a speed thing it is a bootstrapping thing |
| 14:00 | joshua-choi | Ah |
| 14:04 | Chousuke | my reader is out of date now though :P |
| 14:04 | hiredman | ditto(?) |
| 14:05 | chouser | what's changed in the reader?? |
| 14:05 | Chousuke | meta warnings? : |
| 14:05 | hiredman | ^ deprication at least |
| 14:06 | chouser | oh |
| 14:06 | Chousuke | I think I might still be missing some obscure features |
| 14:06 | Chousuke | and to be honest this thing has basically no design :P I wrote it as I thought it |
| 14:07 | Chousuke | http://github.com/Chousuke/clojure/blob/clojure-reader/src/clj/clojure/lang/reader.clj |
| 14:07 | hiredman | http://www.thelastcitadel.com/images/syntax.png |
| 14:08 | hiredman | trace of the method for reading syntax quote stuff |
| 14:08 | joshua-choi | Did you generate that? |
| 14:08 | Chousuke | I toyed with writing a restartable reader but after I had a restartable string reader I stopped; I wish Clojure had continuations |
| 14:09 | Chousuke | oh, and yeah, syntax-quote is horror |
| 14:09 | hiredman | joshua-choi: yes |
| 14:09 | Chousuke | I tried implementing it as a macro at first but gave up after a lot of frustration |
| 14:10 | joshua-choi | Chousuke: When I wrote mine, I cheated and just used `syntax-quote. |
| 14:10 | ad4m | Is there a way to add annotations to a class created with proxy? |
| 14:11 | hiredman | well, generated as in walked through the code trying to figure out what it did |
| 14:11 | joshua-choi | ad4m: I don't think so. It is unfortunate. |
| 14:11 | joshua-choi | hiredman: Ah, I meant if you used some program to do it for you. |
| 14:11 | ad4m | What about gen-class? |
| 14:12 | Chousuke | I don't think Clojure has any support for annotations |
| 14:12 | joshua-choi | It's a commonly requested feature. But comparatively low in priority, I think. |
| 14:13 | ad4m | Is there any sort of work around? |
| 14:13 | chouser | can you use the Java reflection API to adjust annotations? |
| 14:14 | ad4m | I don't know. I don't know that much about Java. |
| 14:14 | joshua-choi | Do you have a Java library that requires them? |
| 14:15 | joshua-choi | In any case, I found http://tutorials.jenkov.com/java-reflection/annotations.html from Google |
| 14:15 | sexpbot | "Java Reflection: Annotations" |
| 14:15 | ad4m | Yes, I'm using a library named Netty |
| 14:16 | technomancy | every time people ask about annotations, it's for netty. I wonder if you could write one Java wrapper around Netty that would let it be used without annotations and be done with it. |
| 14:16 | technomancy | would probably be less work than adding annotations to clojure |
| 14:17 | technomancy | pareto principle, etc, etc. |
| 14:17 | hiredman | ad4m: have you seen http://github.com/texodus/saturnine? |
| 14:18 | ad4m | hiredman: Nope, but the one line description makes it sound interesting. I'll check it out. |
| 14:19 | danlarkin | I love this: "clojure.contrib.logging integration (is this a feature?)" |
| 14:21 | ad4m | Thanks for the various ideas |
| 14:42 | zakwilson | I am frequently impressed by the well-reasoned explanations of design decisions posted to clojure.org. |
| 14:52 | zakwilson | Is fnparse the only game in town for a Clojure parser library? |
| 14:54 | replaca | zakwilson: the only one I know about, but some folks have also used antlr |
| 15:21 | jfields | how do I change {:a {:b 1}} to {:a {:b 2}} |
| 15:21 | chouser | ,(update-in {:a {:b 1}} [:a :b] inc) |
| 15:21 | clojurebot | {:a {:b 2}} |
| 15:21 | Licenser | jfields: |
| 15:21 | Licenser | what chouser sayd |
| 15:21 | jfields | cool, thanks all |
| 15:22 | jfields | ,(update-in {:a {:b 1} :c {:d 1} [:a :b] inc) |
| 15:22 | clojurebot | Unmatched delimiter: ) |
| 15:22 | jfields | ,(update-in {:a {:b 1} :c {:d 1}} [:a :b] inc) |
| 15:22 | clojurebot | {:a {:b 2}, :c {:d 1}} |
| 15:26 | Raynes | "If the main difference between Scala and Clojure is syntax then the main difference between an F-22 Raptor and Boeing 777 is paint color." - James Iry on Twitter. |
| 15:27 | chouser | Which demands an answer to the question, which is which? |
| 15:29 | LauJensen | Incredible that the discussion is still going. Remind me to be careful what I blog about if I'm ever Head of Development anywhere, people pay attention :) |
| 15:31 | slyphon | doh, does 'binding' create a recursion point? |
| 15:31 | chouser | nope |
| 15:31 | slyphon | hrm |
| 15:32 | slyphon | chouser: https://gist.github.com/f1044271c41c0880bee6 |
| 15:32 | slyphon | error: java.lang.IllegalArgumentException: Mismatched argument count to recur, expected: 0 args, got: 1 (jms_internal.clj:177) |
| 15:32 | slyphon | i thought that recur would re-enter from the top of the fn |
| 15:33 | chouser | hm, that's a reasonable assumption. :-) |
| 15:33 | slyphon | ok! :D |
| 15:33 | slyphon | hooray for not being crazy |
| 15:33 | slyphon | ohhhh |
| 15:33 | dnolen | "@jamesiry and Clojure is the nimble single-seat F-22, Scala the enterprise passenger-bearing beast, right? ;)" - David Nolen on Twitter |
| 15:33 | slyphon | jta/with-user-transaction is a macro |
| 15:34 | chouser | hm, binding acts funny in a recur loop. |
| 15:34 | slyphon | ah |
| 15:34 | slyphon | no TCO for you! |
| 15:35 | Raynes | I wish that MMEmail guy would do a full on JavaMail Clojure wrapper or similar. |
| 15:35 | chouser | slyphon: you're expecting *session* to retain it's newly-bound value when you recur there? |
| 15:35 | slyphon | chouser: yeah, that was the idea |
| 15:35 | chouser | I think it might actually behave that way currently, though I don't know that I'd rely on that. |
| 15:35 | slyphon | i don't *really* need to recur there |
| 15:36 | slyphon | i can just call myself again, it's not like it's a recursive algorigthm |
| 15:36 | slyphon | er |
| 15:36 | slyphon | algorithm |
| 15:37 | chouser | oh my. |
| 15:37 | slyphon_away | chouser: ? |
| 15:38 | chouser | binding acts really weird with recur |
| 15:38 | slyphon_away | that's good to know |
| 15:38 | chouser | like 'set!' almost |
| 15:38 | slyphon_away | ouch! |
| 15:39 | chouser | oh, maybe not. weird |
| 15:39 | hiredman | recur is gnarly, really tco would make things much simpler |
| 15:40 | chouser | ,(loop [a 1] (prn *print-level*) (when (< a 3) (binding [*print-level* 10] (recur (inc a))))) |
| 15:40 | clojurebot | 30 10 10 |
| 15:40 | chouser | ,*print-level* |
| 15:40 | clojurebot | 30 |
| 15:41 | chouser | actually ... that's exactly right. 'recur' inside binding acts like a recursive call, with the original value restored on final exit. |
| 15:41 | chouser | ,(loop [a 1] (prn *print-level*) (when (< a 5) (binding [*print-level* a] (recur (inc a))))) |
| 15:41 | clojurebot | 30 1 2 3 4 |
| 15:45 | Chousuke | chouser: I think that's a good demonstration of how dynamic scope is not "visually" intuitive like lexical scope :) |
| 15:46 | Chousuke | even though it often appears to be |
| 15:46 | stuartsierra | I've come to the conclusion that dynamic scope is a bug. |
| 15:47 | chouser | heh |
| 15:47 | Chousuke | kind of like goto is a bug |
| 15:48 | chouser | but there are so many clever tricks it can do |
| 15:50 | rfg | It makes some java interop stuff much more bearable but one can certainly feel dirty using it. |
| 15:51 | chouser | it's not really dirty until you start using 'set!' to return multiple values across multiple stack frames. |
| 15:55 | Chousuke | I did that in my implementation of read-time syntax-quote |
| 15:56 | chouser | clojure.lang.Compiler does it in several places. |
| 15:57 | Chousuke | I certainly hope the cinc compiler will avoid any dynamic binding |
| 15:57 | chouser | yeah, and mutable fields. |
| 15:58 | Chousuke | it's a bit difficult to make compiler information available to "outsiders" if it's all context-dependent and has dynamic scope :/ |
| 15:58 | chouser | well, outsiders don't need to see it until it's done mutating ...but, yeah. |
| 15:58 | chouser | it shouldn't do that. |
| 16:03 | slyphon | does the CLR do TCO? |
| 16:04 | slyphon | they just rolled out F# |
| 16:10 | slyphon | anyone know what handles the channel logging/publishing in here? |
| 16:10 | kotarak | slyphon: ask chouser |
| 16:14 | chouser | slyphon: my IRC client logs everything, and then I have a clj program that converts it to html and rsyncs to the web server. |
| 16:14 | slyphon | chouser: HA! |
| 16:14 | slyphon | awesome |
| 16:14 | slyphon | *way* more low-tech than i expected |
| 16:14 | cemerick | The channel logs have a bus factor of 1, though. :-P |
| 16:15 | hiredman | 59M #clojure.log |
| 16:16 | dcnstrct | word on the street is that Oracle will be charging for it's JRE very soon. =^o If this were to happen would it bother you folks ? |
| 16:16 | cemerick | dcnstrct: linky? |
| 16:16 | slyphon | dcnstrct: i highly suspect that's FUD |
| 16:16 | hiredman | is that the word on the street? |
| 16:17 | hiredman | I think thats the word on the "what's new" on reddit from a few days ago that didn't get enough votes to make the front page |
| 16:17 | cemerick | I doubt they're that stupid. |
| 16:17 | slyphon | anyway, isn't gcj like *nearly* there? |
| 16:17 | dcnstrct | http://www.sun.com/software/star/odf_plugin/ |
| 16:17 | sexpbot | "Sun ODF Plugin for Microsoft Office" |
| 16:17 | slyphon | dcnstrct: yes, that's totally different |
| 16:17 | hiredman | gcj is garbage |
| 16:18 | hiredman | well, it might be good for something |
| 16:18 | dcnstrct | according to someone @ oracle's tech support many of their previously free offerings are going to be behind a paywall |
| 16:18 | dcnstrct | including the jre |
| 16:18 | hiredman | but it is not a general purpose jvm |
| 16:18 | dcnstrct | but this is just second hand info |
| 16:19 | slyphon | hiredman: i was being "arch" |
| 16:19 | dcnstrct | my question though is would it matter much to you guys ? are you perfectly happy with OpenJDK ? |
| 16:20 | cemerick | dcnstrct: I think we'd have to actually see something concrete supporting the premise before thinking about much. |
| 16:20 | slyphon | i've used the mac version of openjdk, it did what i needed it to do |
| 16:20 | slyphon | not w/ clojure, but with jruby |
| 16:20 | dcnstrct | cemerick, it's just a conspiracy theory @ the moment, but it would explain why James Gosling resigned in protest. |
| 16:21 | slyphon | really? i think he might not have liked the culture @ oracle |
| 16:21 | slyphon | i mean, he'd been employed at Sun with *that* sr. team for like how many years? |
| 16:21 | hiredman | danlarkin says if you use the openjdk you'll run into bugs, but I have used it, and haven't to my knowledge run into such |
| 16:22 | Licenser | hmm ruby makes me sad this days :( |
| 16:23 | hiredman | pffft |
| 16:23 | hiredman | who cares, just release a jvm with tailcalls |
| 16:23 | hiredman | or fixnums |
| 16:23 | hiredman | well, I think I'd prefer tailcalls |
| 16:24 | Licenser | I want a jvm that just works |
| 16:24 | Licenser | apple should make one |
| 16:24 | Licenser | with a nice apple logo and a full metal frame |
| 16:24 | hiredman | Licenser: I have one of those |
| 16:24 | dcnstrct | yes and then they should mandate that users can only use it with the java programming language |
| 16:24 | Licenser | dcnstrct: nah I doubt it |
| 16:25 | Licenser | apple prefares objective C |
| 16:25 | dcnstrct | oh ya gp |
| 16:25 | Licenser | they'll kill java and make ojective C or ruby the main language on the jvm |
| 16:25 | hiredman | as it happens the compiler I am working on is source to source and generates java source code |
| 16:26 | Licenser | hmm I strongly doubt that oracle will make the jre payware |
| 16:26 | Licenser | it would kill it entirely |
| 16:26 | dcnstrct | unless their intention is to kill it |
| 16:26 | rfg | Anyone want to hazard a guess when dalvik will be "fast enough" for clojure? |
| 16:26 | rfg | *if/when |
| 16:26 | Licenser | dcnstrct: if I'm not mistaken their projects use java quite a lot right? At least the middleware sector |
| 16:27 | Licenser | what I fear more is that they go to neglect java |
| 16:27 | dakrone | rfg: I thought the concern was more in dalvik's garbage collector than its speed |
| 16:27 | cemerick | Their entire app business is JVM-based. Why talk about conspiracy theories? |
| 16:27 | hiredman | rfg: needs a good gc and jit, but as far as I know google's priority is battery life |
| 16:28 | stuartsierra | I thought the problem with dalvik was startup time for Clojure RT |
| 16:28 | dcnstrct | they could still run their app business while charging for manditory support for jvm downloads |
| 16:28 | Licenser | cemerick: yea but it does not mean that they will keep the 'wishes' of the comunity in mind anything like sun |
| 16:28 | Licenser | dcnstrct: but half the world would kill them for that :P |
| 16:28 | dcnstrct | hahaha |
| 16:28 | Licenser | and people would stop using the jvm as platform |
| 16:28 | Licenser | which would hurt the jvm |
| 16:29 | dcnstrct | well the openjdk stuff would just get stronger |
| 16:29 | dcnstrct | and oracle would have to spend less time thinking about the jvm |
| 16:29 | Licenser | or .net and the M thingy |
| 16:29 | dcnstrct | because it would be "pushed into the open source" more |
| 16:30 | dcnstrct | they did the same thing to solaris.. it's free but with a mandatory $90 support contract |
| 16:30 | dcnstrct | people still use solaris |
| 16:31 | slyphon | my whole shop is solaris |
| 16:31 | Licenser | wow they now charge for solaris? Since when |
| 16:32 | Licenser | downloaded it just like 2 weeks ago |
| 16:32 | slyphon | only if you're running it on non-sun hardware |
| 16:32 | slyphon | iirc |
| 16:32 | Licenser | ah okay I use it on a v440 |
| 16:32 | dcnstrct | see.. they're rolling out this new policy on all kinds of stuff that used to be free |
| 16:32 | dcnstrct | week after week |
| 16:33 | slyphon | dcnstrct: are you just trying to drive Oracle's stock price down? |
| 16:33 | dcnstrct | LOL |
| 16:33 | dcnstrct | busted |
| 16:33 | mfex | hi all, how do I map a function over each value in a hash-map? |
| 16:33 | dcnstrct | sell damn you all |
| 16:33 | dcnstrct | sell |
| 16:33 | hiredman | clojurebot: ticker ORCL |
| 16:34 | clojurebot | ORCL; -0.05 |
| 16:34 | dcnstrct | w00t! |
| 16:35 | cemerick | ,(map inc (map val {:a 0 :b 1})) |
| 16:35 | clojurebot | (1 2) |
| 16:35 | Licenser | dcnstrct: I loved sun as a company and I'm very sad they got bought too, and oracle isn#t the same ;( |
| 16:35 | cemerick | mfex: ^^ |
| 16:35 | cemerick | or... |
| 16:35 | cemerick | ,(map (comp inc val) {:a 0 :b 1}) |
| 16:35 | clojurebot | (1 2) |
| 16:36 | dcnstrct | licenser, care to speculate about what sun's big mistake was ? why did they end up selling ? |
| 16:36 | mfex | cemerick, I want to new values bound to the same keys in a map again |
| 16:36 | cemerick | ah |
| 16:36 | Licenser | dcnstrct: because oracle had way more money |
| 16:36 | cemerick | I think there might be a map-map fn to do just that in contrib somewhere. Otherwise, you can do... |
| 16:36 | dcnstrct | $_$ |
| 16:36 | sexpbot | Command not found. No entiendo lo que est?s diciendo. |
| 16:36 | mfex | cemerick, so (?? inc {:a 1 :b 2}) -> {:a 2 :b 3} |
| 16:36 | Licenser | also I think sun's buiggest mistake was that they were always briliant with new ideas but never got to an end. |
| 16:37 | Licenser | Also MySql was a big compeditor for oracle |
| 16:37 | cemerick | ,(into {} (for [[k v] {:a 0 :b 1}] [k (inc v)])) |
| 16:37 | clojurebot | {:a 1, :b 2} |
| 16:37 | cemerick | mfex: ^^ |
| 16:37 | hiredman | I find it hard to fathom how mysql competes with anything |
| 16:37 | mfex | cemerick, thanks |
| 16:38 | Licenser | hiredman: it might not be geniuse but it is widely used |
| 16:38 | cemerick | mfex: there is a map-map fn floating around somewhere though, that simplifies that a little |
| 16:38 | hiredman | ,fmap |
| 16:38 | clojurebot | #<MultiFn clojure.lang.MultiFn@3e6962> |
| 16:38 | dcnstrct | sqlite beats it for most of the use cases I care about |
| 16:39 | hiredman | ,`fmap |
| 16:39 | clojurebot | clojure.contrib.generic.functor/fmap |
| 16:39 | hiredman | ,(fmap inc {:a 1 :b 2}) |
| 16:39 | clojurebot | {:a 2, :b 3} |
| 16:39 | cemerick | yeah, there you go :-) |
| 16:39 | cemerick | hiredman: you know contrib well for someone that doesn't use it. ;-) |
| 16:40 | mfex | even better, thanks |
| 16:42 | hiredman | cemerick: well, you know, you keep an eye out, snag anything interesting that floats by |
| 16:43 | lancepantz | i saw a thread in the google group that mentioned flightcaster.com as the largest site with clojure in production |
| 16:43 | lancepantz | does anyone know otherwise? |
| 16:43 | cemerick | Sounds plausible. |
| 16:43 | cemerick | Do they publicize figures of any kind? |
| 16:43 | technomancy | probably depends on how you measure it |
| 16:43 | technomancy | LOC, cluster size, team size, etc. |
| 16:45 | slyphon | is there something in contrib that does bean but can set values too? |
| 16:45 | lancepantz | i'm not sure, but their alexa rank is 330,252 |
| 16:45 | cemerick | them's some hardcore metrics! ;-) |
| 16:45 | lancepantz | makes me nervous |
| 16:46 | slyphon | "How many spyware infected nop-heads can you attract to *your* site?" |
| 16:50 | dnolen | interesting JavaScript V8 looks like it's faster than Python 3 or Ruby 1.9. Good target for Clojure? |
| 16:52 | dcnstrct | it sure would be cool to have that be 100% clojure |
| 16:52 | dcnstrct | go ahead and get started on it would ja ? |
| 16:53 | hiredman | clojurebot: scriptjure? |
| 16:53 | clojurebot | Gabh mo leithscéal? |
| 16:53 | hiredman | clojurebot: google scriptjure |
| 16:53 | clojurebot | First, out of 57 results is: |
| 16:53 | clojurebot | arohner's scriptjure at master - GitHub |
| 16:53 | clojurebot | http://github.com/arohner/scriptjure |
| 16:54 | dcnstrct | if you called it scriptjure people who write frameworks on top of it would use a biblical naming scheme |
| 16:54 | dcnstrct | and that could get pretty ridiculous fast |
| 16:55 | hiredman | adam begat cain and cain begat seth(?) and ... |
| 16:55 | pjstadig | hehe |
| 16:55 | rfg | Ecclejiastes |
| 16:56 | pjstadig | pjalms |
| 16:56 | dcnstrct | jejus |
| 16:58 | dcnstrct | is it plain text search for in-memory arrays ? |
| 17:00 | dcnstrct | ahh it's that plus transactions and compression. |
| 17:03 | stuartsierra | Anybody here read the RSpec book from Pragmatic ? |
| 17:04 | Raynes | stuartsierra: No, but it's on my to-read list right after War and Peace and the Common Lisp spec. |
| 17:05 | stuartsierra | umm, not exactly a ringing endorsement |
| 17:06 | dcnstrct | I like test/spec a lot better |
| 17:07 | dcnstrct | it does all the main stuff you'd need and it's 1/50th the code size |
| 17:07 | technomancy | my thoughts on rspec: http://technomancy.us/118 |
| 17:07 | sexpbot | "in which a hypothetical death occurs in order that a real one may be avoided - Technomancy" |
| 17:08 | slyphon | technomancy: :D |
| 17:09 | slyphon | rspec is proof of what happens when "the void stares back into you" |
| 17:09 | chouser | 40KLOC of ruby!? |
| 17:09 | slyphon | chouser: it ain't pretty |
| 17:11 | nurv | well, i worked for a comp that had about 1.2MLOC of lisp |
| 17:11 | nurv | not CL |
| 17:11 | chouser | nurv: elisp? |
| 17:11 | chouser | ;-) |
| 17:12 | nurv | no no |
| 17:12 | nurv | an in-house dialect |
| 17:12 | chouser | ah |
| 17:12 | slyphon | yeeeeeeeeeeeeeeeeeeuuuuwwwww! |
| 17:12 | nurv | it "mostly" worked |
| 17:12 | chouser | heh |
| 17:12 | zakwilson | Was it the source code for the OS and all included software on a Lisp machine? |
| 17:12 | nurv | that is, until it didn't |
| 17:13 | nurv | nope, although that would be great |
| 17:13 | zakwilson | Did the people who wrote most of the code actually understand Lisp? |
| 17:13 | nurv | it ran on hp-ux and some ibm 390s machines |
| 17:13 | cemerick | technomancy: LOL @ bludgeon :-D |
| 17:14 | nurv | zakwilson, it depends on the project they were working |
| 17:14 | zakwilson | bludgeon is pretty funny. It needs more possible outputs though. |
| 17:14 | nurv | there were some great coders and some awful ones too |
| 17:14 | nurv | but at least it was challenging an fun |
| 17:15 | nurv | *and |
| 17:15 | zakwilson | Perhaps *what* you could bludgeon to death with a printout of the source code. (e.g. a fly, a mouse, a whale) |
| 17:15 | technomancy | =) |
| 17:15 | zakwilson | I'd enjoy working at a company that wrote lots of Lisp. |
| 17:15 | hiredman | lisp has been many things to many people |
| 17:16 | nurv | btw, rebooting...bbl |
| 17:16 | hiredman | ~google the evolution of lisp |
| 17:16 | clojurebot | First, out of 24500 results is: |
| 17:16 | clojurebot | The Evolution of Lisp |
| 17:16 | clojurebot | http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.85.8331&rep=rep1&type=pdf |
| 17:16 | hiredman | bleh |
| 17:16 | hiredman | there are free pdfs if you google |
| 17:22 | stuartsierra | technomancy: bludgeon install fails for me |
| 17:23 | technomancy | =( |
| 17:23 | technomancy | yeah, looks like there's some bitrot |
| 17:23 | stuartsierra | I like the concept though |
| 17:24 | technomancy | the code is mostly there to make the joke better |
| 17:24 | mmarczyk | BLUDGEON_PAGES = 500 # TODO: is this accurate? |
| 17:24 | mmarczyk | lol :-) |
| 17:24 | mmarczyk | um, hi |
| 17:25 | stuartsierra | 500 pages is only about 2.5 inches thick |
| 17:25 | dcnstrct | are we talking about text on both sides ? |
| 17:25 | technomancy | I was going for a standard ream like for a photocopier |
| 17:25 | technomancy | if you pack it tightly enough it could be deadly... maybe. further research is required. |
| 17:25 | stuartsierra | not sufficiently deadly, in my opinion |
| 17:26 | stuartsierra | 'cause I've tried bludgeoning the photocopier and never made a dent |
| 17:26 | technomancy | patches welcome =) |
| 17:28 | stuartsierra | well, I just bought the RSpec eBook, will report how it goes |
| 17:28 | technomancy | this is also assuming you have the advantage of surprise |
| 17:29 | stuartsierra | ah |
| 17:29 | mmarczyk | technomancy: I've read your last blog entry on submissions, very enlightening for me |
| 17:30 | mmarczyk | guess I'll be re-sending my clojure-mode patch |
| 17:30 | mmarczyk | so, just wanted to ask, would a git-prepared patch file be preferable to a pull request or does it not matter? |
| 17:31 | technomancy | mmarczyk: I have a slight preference for pull requests |
| 17:31 | mmarczyk | alright |
| 17:31 | mmarczyk | I'll make a fresh fork, put my stuff on a topic branch, then send one |
| 17:31 | technomancy | for the record, I like all kinds of submissions |
| 17:31 | technomancy | so don't stress over it. =) |
| 17:32 | mmarczyk | :-) |
| 17:32 | mmarczyk | that's about the coloured repl, btw |
| 17:32 | mmarczyk | there's also a swank bit to that |
| 17:32 | Licenser | if someone is interested I wrote togehter a little article about how to make libs nicely multy version compatible: http://blog.licenser.net/2010/04/22/on-clojure-libs-and-versions |
| 17:32 | sexpbot | "lice! : On clojure libs and versions." |
| 17:32 | technomancy | sweet |
| 17:32 | Licenser | also I fixed my blog after a day of work |
| 17:32 | Licenser | doh |
| 17:32 | mmarczyk | so... would a defadvice be ok inside swank |
| 17:33 | mmarczyk | or would that be better as an "extra recommendation" in the readme |
| 17:33 | mmarczyk | (or do I not make sense now...) |
| 17:33 | mmarczyk | hm... guess swank uses an advice on M-x slime anyway |
| 17:33 | MadWombat | hello |
| 17:34 | Licenser | hi MadWombat |
| 17:34 | MadWombat | How do you use nth-of-type or first-of-type in enlive? |
| 17:34 | technomancy | mmarczyk: sorry, don't have time to check the context on that. it's probably ok though. |
| 17:34 | mmarczyk | sure |
| 17:37 | slyphon | hrm |
| 17:48 | dnolen | MadWombat: you need an extra set of square brackets, [[:div (nth-of-type 2)]] |
| 17:52 | raek | Licenser: *bookmarked* |
| 17:53 | raek | honestly, hadn't thought about that stuff |
| 17:56 | kotarak | Licenser: *daumenhoch* for the version range tip. This should be promoted more! |
| 17:56 | Licenser | thanks :) I am glad if it helpes |
| 17:59 | Licenser | weöö bed time for me, night people! |
| 18:07 | livingston | so if I'm working with a swank project with lein and emacs... |
| 18:08 | livingston | if I want to work with a lot of source code, what's the preferred way to load it all in / manage that? |
| 18:10 | _ato | livingston: I use ido-mode for quickly switching between buffers, if that's what you mean |
| 18:11 | _ato | others use things like speedbar to show a tree of files |
| 18:11 | livingston | no i just mean loading all my source, when the project open although my classpath is set nothing is loaded |
| 18:11 | dnolen | livingston: I used desktop-save and desktop-read |
| 18:12 | dnolen | that saves all your open buffers to a file that can be read later |
| 18:12 | dnolen | no so hot for multi project setups but works well enough for me. |
| 18:12 | livingston | dnolen: oh that sounds useful (but that's another problem) |
| 18:13 | dnolen | oh, you mean loading all of your source and sending it to the repl? |
| 18:13 | _ato | livingston: if you mean loading into clojure not emacs, just have some main namespace which loads all the others? |
| 18:13 | livingston | yeah getting the code into clojure |
| 18:14 | livingston | in lisp there was a thing called asdf which managed the pacakage and file dependencies and would load and compile etc. |
| 18:14 | technomancy | livingston: in CL, you mean. |
| 18:14 | technomancy | sorry, pet peeve |
| 18:15 | livingston | i would think lein or something would help me with that too, but I haven't found examples of anything like it. |
| 18:15 | technomancy | if you (use 'top.level.ns.that.requires.all.others :reload-all) it would do it |
| 18:15 | technomancy | provided you have such a top-level ns |
| 18:15 | livingston | technomancy: prior to about 2 years ago lisp and common lisp were fairly interchangable (what else would you be using?), but yes I agree |
| 18:16 | technomancy | no love for MACLISP? come on guys... |
| 18:16 | technomancy | =) |
| 18:16 | livingston | oh, really? that's all I have to do? |
| 18:17 | _ato | does CL make things really hard or something? |
| 18:17 | livingston | that's pretty sweet, but wait how will it know what order to load all my files in? |
| 18:18 | livingston | _ato: no it doesn't, things like ASDF make managing CL pretty straightforward |
| 18:18 | nurv | MACLISP... there is an implementation for it to the JVM too. |
| 18:18 | nurv | Didn't play much with it though. |
| 18:19 | _ato | livingston: the order you specify... if namespace A use/requires B, which in turn use/requires C and then D then that's then they'll be loaded in the order C D B A |
| 18:19 | _ato | (assuming they all do so at the top of their code anyway) |
| 18:19 | livingston | that makes sense, although... what if I have the same ns in two different files? or is that really bad practice? |
| 18:20 | slyphon | gah |
| 18:20 | nurv | technomancy|away maybe you'll enjoy this: http://github.com/hz7k-nzw/lapin |
| 18:20 | _brian2_ | noob question, i am trying to use exception handler (from dnolen's enlive tutorial) http://clojure.pastebin.com/QMZeeZnq but I get "Don't know how to create ISeq from: java.lang.Boolean" when i run it |
| 18:20 | slyphon | https://gist.github.com/898a45ef78d87bc521ce |
| 18:21 | _ato | livingston: then it's only going to pick up one of them, the one that's named to match the namespace (yes it is bad practice) |
| 18:21 | slyphon | i'm trying to dynamically call a set method here, but i can't seem to get the escaping syntax correct |
| 18:22 | _ato | you can probably get around that by using load-file or some such (kind of like a C #include) but normally you should have namespaces correspond 1 to 1 to files. |
| 18:22 | livingston | oh, ok, well, I should stop that then...? but it just seems if I have a lot of code for a ns that naturally falls in a few big chucks I could split the files, but then you're saying they should then have their own subordinate ns each? |
| 18:23 | _ato | that's how I think it's intended to work, yes. |
| 18:23 | livingston | _ato: ok that makes sense. in CL we could spread it out, but then you specified each file in ASDF and their file level dependancies, so I was expecting to have to do something like that |
| 18:24 | livingston | and I guess I could roll my own equivalent of that but why bother if I get it for free with some ns disipline |
| 18:24 | dnolen | _brian2_ it just looks like your try/catch syntax is wrong right? true is outside the expr |
| 18:25 | _brian2_ | dnolen> ok thnks |
| 18:25 | _ato | yep, and in my opinion by having namespaces match files then it's easier to remember where stuff is defined |
| 18:26 | livingston | well that makes it more like java than CL but that's ok, I've conceeded that that's going to happen to me as I move forward with clojure ;) |
| 18:28 | mmarczyk | actually clojure.core is split into a couple of files |
| 18:28 | mmarczyk | and there's a bunch of (load "...") forms in core.clj |
| 18:28 | mmarczyk | so it's perfectly possible, if not necessarily great for readability |
| 18:29 | livingston | I guess there's no real difference from writing (load foo) vs (use foo) |
| 18:29 | livingston | and the net effect is basically the same |
| 18:29 | mmarczyk | well actually there are fairly significant differences |
| 18:30 | mmarczyk | a separate ns can be reloaded separately |
| 18:30 | technomancy | core is not always a good example to follow |
| 18:31 | mmarczyk | well that I'm entirely in agreement with :-) |
| 18:31 | livingston | you could just load one of the files though again independently, I think. but the separate ns is probably better... |
| 18:32 | livingston | although then you need a lot of "use" code everywhere to avoid having the qualify the heck out of everything |
| 18:34 | _brian2_ | dnolen> I'm not sure, I'm just substituting (html/html-resource (java.net.URL. url)) into this (try |
| 18:34 | _brian2_ | (Class/forName class-name) true |
| 18:34 | _brian2_ | (catch ClassNotFoundException _ false)) from the book |
| 18:34 | mmarczyk | livingston: maybe see http://onclojure.com/2010/02/17/managing-namespaces/ and http://code.google.com/p/clj-nstools/ |
| 18:34 | sexpbot | "Managing namespaces « On Clojure" |
| 18:36 | livingston | mmarczyk: cool thanks for the pointers |
| 18:37 | mmarczyk | sure |
| 18:37 | _ato | livingston: yep, for imports within a project I tend to just 'use all the symbols rather than listing just the ones I want explicitly as is usually recommended, since it's the one project if you introduce something that conflicts you'll know immediately when you try to run it, so it's easy to fix. It's too much hassle and repetition otherwise in my opinion. Listing symbols is definitely a good idea for between projects thoguh. |
| 18:57 | livingston | so regarding our previous discussion about namespace and files... if I have a ns foo and that breaks down into foo.bar and foo.baz but there is no actual foo code anymore, I could just create a foo ns that requires (or uses) both? |
| 18:58 | livingston | and I would put that foo ns defining code in just a foo.clj file and that's it? |
| 18:59 | livingston | there seems to be a naming convention for ".core" though, what's the deal there? |
| 19:00 | rfg | This is strange. I have some code where if it reads (first thing) it hangs the repl, but changing it to (take 1 thing) it works. |
| 19:01 | mmarczyk | I believe that a namespace foo.bar corresponds to a bar class in the foo package |
| 19:01 | mmarczyk | and with a "single-segment" namespace you're putting your class into the default package, or whatever that's called in Java |
| 19:02 | livingston | mmarczyk: makes sense I was just trying to figure out how to define/name the foo ns based on best practice |
| 19:03 | livingston | there seems to be a "core" naming convention that I was trying to understand |
| 19:03 | mmarczyk | well, anyway, if you want a foo.bar.baz namespace, but no foo.bar namespace |
| 19:03 | mmarczyk | you don't need a separate .clj file for foo.bar |
| 19:03 | Raynes | mmarczyk: Thanks for that correction earlier. |
| 19:05 | livingston | I know, I want to break up my code into more files though, and based on some previous advice I think I will give each file it's own ns... |
| 19:05 | mmarczyk | Raynes: which correction? you're welcome anyway, though :-) |
| 19:05 | livingston | but then I want to create a parent ns to kinda glom it all back together |
| 19:05 | Raynes | mmarczyk: I said "vars are immutable" when that isn't what I actually meant. You corrected me. |
| 19:06 | rfg | Ah, I see what my problem was. |
| 19:09 | mmarczyk | Raynes: ah, you mean in Clojure 101 |
| 19:09 | Raynes | Indeed. |
| 19:10 | mmarczyk | well, I do use the same mental picture |
| 19:11 | mmarczyk | of shadowing, I mean |
| 19:11 | mmarczyk | for locals, which I hope came across from my posting |
| 19:13 | mmarczyk | incidentally, I'm rather enjoying clj101 already :-) |
| 19:17 | mmarczyk | livingston: not sure why you'd want to do that |
| 19:18 | livingston | so that then I don't have to say :use bar baz etc.. I can just use the parent package/namespace |
| 19:18 | mmarczyk | that Google Code project of Konrad Hinsen's might help you with that |
| 19:20 | livingston | how do I get clojure to tell me what it thinks the classpath is? |
| 19:21 | livingston | mmarczyk: yeah I'll probably end up using konrad's ns+ |
| 19:21 | rfg | (System/getProperty "java.class.path") |
| 19:22 | Borkdude | I also saw this somewhere: (println (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader)))) |
| 19:22 | Borkdude | |
| 19:22 | mmarczyk | (filter #(.startsWith (name %) "foo.bar") (clojure.contrib.find-namespaces/find-namespaces-on-classpath)) |
| 19:23 | mmarczyk | though I suppose that's borderline ridiculous |
| 19:23 | Borkdude | what exactly is the difference? |
| 19:23 | mmarczyk | but you could map clojure.core/use over that |
| 19:25 | livingston | thanks. I just wanted to make sure it could see my class, turned out I had a typo somewhere else... |
| 19:28 | livingston | if I use a ns foo that itself uses a ns foo.bar don't I get all the symbols in foo and foo.bar? |
| 19:29 | arohner | does anyone have a function for elegantly handling functions with optional parameters in the middle |
| 19:29 | arohner | like defn |
| 19:29 | arohner | (defn-magic foo [a b? c]) |
| 19:29 | technomancy | livingston: that's what ns+ is for |
| 19:30 | livingston | arohner: why can't you put them at the end? |
| 19:30 | technomancy | but no, nothing like that is in clojure yet. I have hopes that template namespaces will get included some day. |
| 19:30 | arohner | livingston: cause I want it this way :-) |
| 19:30 | livingston | technomancy: oh ok, I though I got it all for some reason since the subordinate symbols do all exist in the parent ns |
| 19:31 | livingston | arohner: then you have to just use a & rest and pull off the end ones OR |
| 19:31 | technomancy | there's not really any such thing as a parent ns. the hierarchy is an illusion. |
| 19:32 | livingston | (defn foo [a c] (foo ([a default-for-b c]) ([a b c] ....)) |
| 19:33 | livingston | technomancy: right, right of course, but I was referring to foo as the parent in the context of (ns foo (use bar)) ... I thought maybe if I used foo I should get all of foo and bar |
| 19:33 | livingston | because I though the use brought bar's symbols into the foo ns. |
| 19:34 | mmarczyk | arohner: how about (defn foo ([a c] (foo a default-b c)) ([a b c] ...))? |
| 19:34 | mmarczyk | livingston: use isn't transitive |
| 19:35 | arohner | livingston mmarczyk: yeah, I guess that'll work. thanks |
| 19:35 | mmarczyk | in fact, it most definitely shouldn't be |
| 19:36 | livingston | i wouldn't really think you would want it to be, but I thought I read it as actually creating the symbols and adding them to the "parent" ns |
| 19:37 | mmarczyk | not really |
| 19:37 | mmarczyk | see the refer function and the refer method on ns objects |
| 19:37 | livingston | well this certainly makes package organization more of a pain.. I think I'll definately get Konrad's ns+ now |
| 19:50 | rfg | Is anyone using 1.2 with lein? |
| 19:51 | livingston | rfg: i was, but I just broke it, I think.. |
| 19:51 | rfg | I tried changing to 1.2 in project.clj but running lein deps gives errors. |
| 19:51 | livingston | what errors are you seeing? |
| 19:52 | livingston | I was running that just fine but now tried to add in ns+ from here: http://code.google.com/p/clj-nstools/ |
| 19:52 | sexpbot | " clj-nstools - Project Hosting on Google Code" |
| 19:52 | livingston | but it's telling me it's missing 1) org.apache.maven:super-pom:jar:2.0 |
| 19:53 | technomancy | super-pom is maven's way of saying "the current project" |
| 19:53 | technomancy | so it's missing one of your project's deps; read up higher in the output |
| 19:54 | livingston | Konrad's nstools needs 1.2 master and clojure contrib master , but I'm not quite sure how to figure out what to tell lein to make sure I have what he requires |
| 19:56 | rfg | livingston: http://paste.lisp.org/display/98174 |
| 19:57 | livingston | rfg: that's very much like what i'm seeing, if not exactly |
| 19:58 | livingston | so if i'm staring at a github page, how can i figure out exactly what string I need to pass lein to get a given version? |
| 20:03 | _ato | rfg: 1.2 hasn't been released; try "1.2.0-master-SNAPSHOT" instead of "1.2.0" |
| 20:04 | rfg | Cheers, will give that a go. |
| 20:04 | livingston | _ato: what contrib library goes with that? |
| 20:04 | _ato | "1.2.0-SNAPSHOT" i think |
| 20:06 | livingston | that seems to work... |
| 20:07 | livingston | (except it doesn't for konrad's code I'll email him: UnsupportedOperationException: nth not supported on this type: PersistentArrayMap) |
| 20:07 | livingston | _ato: so how am I supposed to know what tags like "1.2.0-SNAPSHOT" are available for download? / figure that out? |
| 20:08 | _ato | the way I do it is look here: http://build.clojure.org/snapshots/org/clojure/ and here http://build.clojure.org/releases/org/clojure/ |
| 20:08 | sexpbot | "Index of /snapshots/org/clojure/" |
| 20:09 | livingston | OH, huh |
| 20:10 | livingston | so does lein talk directly to github? or does it go there? because I was looking at tags on github, and there's one called "par" for better support of the parallelization code |
| 20:12 | _ato | lein goes there and http://clojars.org/repo/ |
| 20:12 | sexpbot | "Index of /repo/" |
| 20:12 | _ato | not github |
| 20:14 | livingston | that makes sense. |
| 20:23 | livingston | well, that's unfortunate... |
| 20:23 | MadWombat | this is weird, I have an HTML page whith table based layout, there is a single table under body, that contains all the other nested tables. Yet (select page [:body :> :table]) returns 6 separate tables. Am I misunderstanding the way :> works in enlive? |
| 20:23 | livingston | I emailed Konrad about nstools, but his autoresponder told me he's out for the week |
| 20:24 | livingston | anyone have ns+ working? |
| 20:37 | dcnstrct | http://www.lisperati.com/clojure-spels/casting.html |
| 20:37 | sexpbot | "Casting SPELs with Clojure - Home -" |
| 20:39 | dcnstrct | this is not quite as psychedellic as Ruby's beginner book.. but it looks just as useful and is perhaps even easier to read. |
| 20:40 | lancepantz | referring to why's poignant guide? |
| 20:40 | dcnstrct | absolutely |
| 20:41 | dcnstrct | back in the day it was the cartoon foxes or the half-japanese docs, or the prag book |
| 20:42 | dcnstrct | I like this wizard book a little better than why_'s stuff |
| 20:42 | lancepantz | naa, i like the foxes |
| 20:42 | dcnstrct | well I don't dine on swine so maybe that's why_ I'm a little bias |
| 20:42 | dcnstrct | the chunky bacon meme got a little out of control and I never quite got it. |
| 20:43 | dcnstrct | this lisp wizard is a boozer |
| 20:44 | dcnstrct | admittedly that's probably worse for the community than chunky bacon.. |
| 20:47 | dnolen | not sure if somebody's already mentioned this here, but KirinDave's podcast is pretty cool: http://www.redmonk.com/cote/2010/04/22/makeall002/ |
| 20:48 | danlarkin | pretty glorious headshot there |
| 20:58 | joshua-choi | It's a shame that Why disappeared from the Internet. |
| 21:01 | lancepantz | yeah, pretty strange |
| 21:10 | livingston | what's the best way to file a bug report on the 1.2.0-master-SNAPSHOT build? |
| 21:10 | dnolen | livingston: is this something you built from source? |
| 21:11 | hiredman | 1.2.0-master-SNAPSHOT is being constantly rebuilt on hudson |
| 21:11 | livingston | there's a bug in the ns macro |
| 21:11 | livingston | no |
| 21:11 | hiredman | that is what SNAPSHOT means |
| 21:11 | livingston | oh that makes sense |
| 21:11 | dnolen | what I meant was, where did you get that from? clojars? |
| 21:12 | livingston | um, whatever lein just gave me |
| 21:12 | hiredman | that comes from hudson |
| 21:12 | hiredman | build.clojure.org |
| 21:12 | dnolen | hiredman: interesting, I did not know lein pulled from hudson. |
| 21:13 | hiredman | build.clojure.org keeps a maven repo |
| 21:13 | livingston | so where do I report the bug? assembla? |
| 21:14 | hiredman | what makes you think you have a bug? |
| 21:16 | dnolen | livingston: I think it's best to bring it up on the ML or here, have people reproduce. You may need a CA to file a bug (I forget) |
| 21:16 | livingston | this generates an exception: (ns foo "doc" {:author "livingston"}) |
| 21:17 | hiredman | why wouldn't that? |
| 21:17 | mmarczyk | um, why wouldn't it? |
| 21:17 | mmarczyk | :-) |
| 21:17 | livingston | which is odd, because you would expect code like that everywhere |
| 21:17 | hiredman | have you read the docs for ns? |
| 21:17 | livingston | the docs on ns say the args are {:arglists '([name docstring? attr-map? references*])} |
| 21:18 | mmarczyk | (ns #^{:author "livingston" :doc "a cool ns to do foo efficiently"} foo) |
| 21:19 | livingston | it's not my code, it used to work that way... the ns for KonradHinsen's nstools is defined that way |
| 21:20 | hiredman | livingston: are you sure you are on the latest SNAPSHOT build? |
| 21:20 | hiredman | (works for me) |
| 21:20 | dnolen | ditto |
| 21:20 | livingston | yes. is there anyway to make the repl tell me? |
| 21:20 | hiredman | *clojure-version* |
| 21:20 | hiredman | ,*clojure-version* |
| 21:20 | clojurebot | {:interim true, :major 1, :minor 1, :incremental 0, :qualifier "master"} |
| 21:21 | livingston | shoot - it says 1.1.0 |
| 21:21 | hiredman | are you using lein repl? |
| 21:21 | livingston | damn |
| 21:21 | livingston | I'm using lein |
| 21:21 | livingston | but starting it from swank-clojure-project in emacs |
| 21:22 | dnolen | livingston: that should work, in your lib directory do you have multiple clojure jars ? |
| 21:22 | livingston | I thought that was supposed to be a safe way to avoid the fact that lein prefers 1.1.0 |
| 21:23 | livingston | yes there are multiple there |
| 21:23 | dnolen | remove the 1.1.0 one |
| 21:23 | dnolen | lein doesn't really do anything in the way of cleanup |
| 21:23 | livingston | i just ran lein clean and lein deps and it's gone... |
| 21:24 | dnolen | great, yet another thing I did not know about. |
| 21:25 | mmarczyk | livingston: which exception are you seeing? |
| 21:25 | livingston | damn - ok it's all good now |
| 21:25 | livingston | it was saying it couldn't call nth on a persistent map |
| 21:29 | livingston | this is the really bad thing about the bleeding edge - every once in a while you get really cut (that was a few hours I'd like to have back) |
| 21:30 | mmarczyk | well, I'm using the very latest checkout from GitHub right now |
| 21:30 | mmarczyk | nothing seems broken |
| 21:31 | dnolen | livingston: luckily 1.2.0 is really close, lein is converging on it as well as clojure-contrib. |
| 21:31 | livingston | no it's all fine now - it was the 1.1.0 jar that was left laying around by lein |
| 21:31 | mmarczyk | ah, ok |
| 21:31 | livingston | why are you going from github? |
| 21:31 | mmarczyk | oh, by the way |
| 21:31 | mmarczyk | I was going to ask |
| 21:32 | livingston | and when will the good parallelization stuff get mainlined? |
| 21:32 | mmarczyk | does the current lein HEAD pull in two versions each of ant and ant-launcher |
| 21:32 | dnolen | livingston: ? |
| 21:32 | livingston | mmarczyk: ask me? , yeah, shoot... |
| 21:32 | mmarczyk | for other people, or is it just me |
| 21:33 | mmarczyk | livingston: I use my own jars for a play-around REPL |
| 21:33 | livingston | dnolen: ? what ? |
| 21:34 | livingston | mmarczyk: what do you mean, like your own modified one? |
| 21:35 | mmarczyk | not necessarily, just ones which I built here myself |
| 21:35 | mmarczyk | for no particular reason |
| 21:35 | livingston | oh, well, why bother? unless you like to give bug reports back |
| 21:35 | mmarczyk | I already have the sources, I build them to see if anything breaks, then it's more convenient to just use those jars |
| 21:35 | mmarczyk | then do a separate download |
| 21:35 | mmarczyk | I like to file bug reports when I encounter bugs :-) |
| 21:36 | mmarczyk | that happened once so far with c.c build process |
| 21:36 | mmarczyk | anyway, that's just something I like to do |
| 21:37 | livingston | I don't have multiple ant anythings that I can see,... but lein grabs a ton of stuff I don't ask for, I only ask for clojure, clojure-contrib and swank... maybe if I asked for ant specifically i'd get doubles on things or smethign |
| 21:37 | mmarczyk | um, no, I mean the leiningen project itself |
| 21:37 | livingston | oh - |
| 21:38 | mmarczyk | nvm, I'll bring this up when technomancy appears |
| 21:39 | livingston | I can look .. to tell you the truth, I don't even know where lein puts all it's stuff? |
| 21:43 | mmarczyk | are you using the stable version or a snapshot from GH? |
| 21:44 | mmarczyk | if the former, then I guess you need a launcher script and the rest sits in a jar in your local maven repo |
| 21:45 | livingston | me, for lein? it is the stable one there's the script to download and then it seems to like to manage itself, yeah |
| 21:45 | livingston | oh, it just runs itself right out of the maven repo? |
| 21:46 | mmarczyk | see vim $(which lein) if you're on *nix |
| 21:48 | livingston | huh, wouldn't have thought to do it that way myself, but hey less copies of stuff - which is surprising, given the lein general take on that otherwise |
| 21:48 | mmarczyk | some irony in that I suppose ;-) |
| 21:49 | mmarczyk | btw, how's your unifier coming along? |
| 21:50 | livingston | it's good the unifier is just an extremely tiny piece of what I'm ramping up to |
| 21:51 | livingston | I was hoping to be further along with a minimalist RDF interface by now |
| 21:53 | livingston | thanks for your comments |
| 21:53 | mmarczyk | not at all, that was lots of fun |
| 21:54 | livingston | it's all going to end up open source so there will be a chunk of code come out regularly, probably |
| 21:56 | mmarczyk | cool |
| 21:56 | mmarczyk | and what kind of project is it? |
| 21:56 | livingston | I do natural language understanding |
| 21:57 | livingston | actually my real interest is memory, but the NLP is in there too, since I'm interested in how memory can facilitate nlp |
| 21:58 | uberjar | I thought NLP is a way to hypontize girls into comming back to your apartment. |
| 21:58 | uberjar | Neuro-linguistic programming |
| 21:59 | livingston | yeah it's odd, they can both share a lot of the same concepts too, like memory, etc. makes googling a pain |
| 22:00 | mmarczyk | livingston: in this case I'll definitely be reading your code |
| 22:00 | mmarczyk | should be of interest to me |
| 22:01 | livingston | what do you do? |
| 22:01 | uberjar | livingston, how do you do parts of speech tagging ? |
| 22:01 | mmarczyk | I'm a logician, mostly |
| 22:01 | uberjar | do you have a big dictionary of words and their parts of speech ? |
| 22:02 | livingston | uberjar: no and yes... |
| 22:02 | livingston | so bottom up approachs to NLP take things through pipelines that almost always start with POS tagging |
| 22:04 | livingston | I use a top-down approach to language (because I believe NLP isn't bottom up) and can leverage other things like memory and context which is important to understanding everything |
| 22:04 | livingston | the approach I use is called DMAP (Direct Memory Access Parsing) |
| 22:05 | livingston | where patterns of text and memory references are mapped to other memory references -- basically. |
| 22:05 | livingston | so if the patterns use POS information we look it up and try to leverage it, but there's nothing about the approach that requires it |
| 22:06 | uberjar | interesting |
| 22:06 | lancepantz | uberjar: most words have more than one sense that have multiple possible parts of speech |
| 22:06 | uberjar | where do you get your lexicon file for when you do look it up ? |
| 22:06 | uberjar | is that right word for it ? |
| 22:06 | livingston | (also I'm punting a little because I'm rewriting it from scratch so I don't have all the details for the new one yet - this is my second DMAP) |
| 22:07 | lancepantz | the "best" way to solve the problem is using an iterative rule based tagger, look up the brill tagger |
| 22:07 | lancepantz | the most complete lexicon is wordnet |
| 22:07 | livingston | lancepantz: yes there is a lot of ambiguity in language - it's everywhere |
| 22:08 | lancepantz | word sense disambiguation :) |
| 22:08 | livingston | which is why we focus on meaning and integrating with the underlying memory right away, since that's what it's all about anyway |
| 22:08 | livingston | if we get information from a POS tagger or whatever along the way, great |
| 22:09 | livingston | uberjar: there will be some form of lexicon you have to know what things mean |
| 22:09 | livingston | but that's kind of what the patterns are too - "if you see this input it means this" |
| 22:10 | lancepantz | i don't thinkg meaning doesn't really has any implications in nlp, what is important is quantifying conceptual similarity |
| 22:10 | lancepantz | that's all that meaning really is |
| 22:10 | lancepantz | i worked alot on measuring word similarity at a previous job |
| 22:11 | livingston | talk to the biologists I work with ... things mean things to them ;) |
| 22:11 | uberjar | the only NLP problem I've ever been up against was back in my spamming daze when I needed to build an autoresponder that could try to extract first names out of incomming messages. I ended up just trying to match every captialized word against a first name wordlist. |
| 22:11 | livingston | it's not just about words though - it's the whole utterance in context that meaning can be derrived from |
| 22:11 | livingston | even who's saying it can change the meaning |
| 22:11 | uberjar | then I would try 3 different POS taggin libraries to rule out words.. when too many made the cut |
| 22:12 | uberjar | the problem was the larger my first name wordlist the more false positives |
| 22:13 | hamza | gents, is there a func anywhere in contrib that can tell me if a val is with in a given range? |
| 22:14 | mistra | hi |
| 22:14 | mistra | Clojure and Java |
| 22:14 | qbg | ,(<= 2 5 7) |
| 22:14 | clojurebot | true |
| 22:14 | livingston | aren't < and > n-ary? |
| 22:14 | lancepantz | livingston: in my case it was always trying to measure the similarity of one collection of words to another |
| 22:14 | lancepantz | granted, i was working on search though, so the problem may be different from yours |
| 22:14 | livingston | yeah ok, that's what I thought (re: < and >) |
| 22:15 | livingston | lancepantz: I'm actually trying to understand the text - extract information from it |
| 22:15 | slyphon | argh |
| 22:15 | lancepantz | can you share an example? |
| 22:15 | mistra | it compiles to jvm bytecode |
| 22:15 | slyphon | who here is good at macroexpansion? |
| 22:16 | uberjar | ,(println "I am") |
| 22:16 | clojurebot | I am |
| 22:16 | slyphon | uberjar: :) |
| 22:16 | mistra | it compiles to jvm bytecode |
| 22:16 | livingston | lancepantz: biologist publish 2,000 journal-level quality articles a *day* they can't keep up |
| 22:16 | mistra | watchign the videos on youtube |
| 22:16 | mistra | search clojure |
| 22:17 | livingston | lancepantz: we are trying to say extract what proteins interact with what other proteins, or partisipate in a given funcational pathway, or... |
| 22:17 | lancepantz | interesting |
| 22:18 | mistra | no want...statement |
| 22:18 | mistra | have coffee and have video on subject.... = me happay |
| 22:18 | uberjar | mistra, yes.. think of java as a turtle.. clojure is what happens afer the turtle had mutagen for breakfast. It is still a turtle underneath but now it can do more. |
| 22:18 | livingston | slyphon: the best thing to do is start with an example of what you want to produce and then write code that cons it up like data |
| 22:19 | slyphon | livingston: well |
| 22:20 | slyphon | sorry, one sec |
| 22:20 | mistra | ok uberjar |
| 22:20 | livingston | by the way clojurebot should have answered your question, that he is good at macroexpansion - better than all of us ;) |
| 22:20 | uberjar | he did! |
| 22:21 | mistra | uberjar you mean 100 times as slow as C? |
| 22:22 | uberjar | it's pretty fast |
| 22:22 | uberjar | for something that takes out it's own trash |
| 22:22 | livingston | lol i totally missed that, very cute |
| 22:23 | uberjar | ;) |
| 22:23 | mistra | and processors seem to have moved along quite smartly in the last fifty years uberjar |
| 22:26 | slyphon | https://gist.github.com/29aaebed045617f5d595 |
| 22:27 | uberjar | mistra, processors were getting smarter, but some programming technologies were getting dumber.. at least for a while |
| 22:27 | slyphon | i can't understand how to escape things properly so that at line 11, it treats the value in setter# as the sym |
| 22:28 | mistra | which ones however are smart? uberjar |
| 22:28 | slyphon | instead of taking the autogenerated symbol name literally |
| 22:28 | livingston | so you should always have an example of the input and the code you expect to be produced... |
| 22:29 | slyphon | i'm looking at the expansion |
| 22:29 | mistra | which ones however are smart? to go with modern quad, octal and other processors uberjar |
| 22:29 | uberjar | mistra, the ones with Lots of Irritating Superfluous Parentheses |
| 22:29 | uberjar | mistra, functional languages.. ones that avoid mutable state |
| 22:30 | mistra | okay |
| 22:30 | mistra | so AmigaE is out |
| 22:30 | livingston | what you probably want ... |
| 22:30 | slyphon | livingston: i just updated it with the macroexpand |
| 22:30 | uberjar | mistra, you can do it in C.. it's just painful |
| 22:31 | livingston | is setter currently contains a string of the name and you acttually want the symbol, call symbol on that |
| 22:31 | slyphon | hmm |
| 22:32 | livingston | the macro expand is helpful, but you really want an example of just the plain code you expect your macro to produce |
| 22:32 | slyphon | No matching method found: symbol for class mbox.harpo.errors.BogusSetter |
| 22:32 | slyphon | i think '.' is doing something evil |
| 22:32 | mistra | uberjar How old are you anyway? |
| 22:32 | livingston | then you start building a macro up that generates that exact code |
| 22:32 | uberjar | mistra, you want one that makes meta-programming easily |
| 22:33 | uberjar | mistra, my first CPU was a 486 |
| 22:33 | mistra | but is too smart not to know ars technica jeremy reimer..... amiga info |
| 22:33 | mistra | yes |
| 22:33 | mistra | language, irc bot that is realistic leading to one that is useful |
| 22:33 | mistra | I like blot |
| 22:33 | mistra | I like hEx |
| 22:34 | livingston | presuming the map is fixed set of stuff, i would have the macro write it out not produce the doseq bit - if the map isn't fixed, but set at runtime then there is very little reason for you to do that with a macro, just use a function |
| 22:35 | mistra | who's te other one....Z? |
| 22:36 | livingston | if you are going the macro route I would expect the output of your macro to be simply (do (. obj set-foo 8) (. obj set-bar 9)) so make your macro produce that list of stuff |
| 22:36 | uberjar | mistra, ask the wizard http://www.lisperati.com/clojure-spels/casting.html |
| 22:36 | sexpbot | "Casting SPELs with Clojure - Home -" |
| 22:37 | livingston | slyphon: I'd normally gladly stay and keep helping but I'm so hungry I'm shaking I have to go... good luck. if i'm on later, I'll check in |
| 22:38 | slyphon | cool, thanks anyway |
| 22:38 | slyphon | good suggestions |
| 22:38 | livingston | later everyone and thanks for all the fish, I mean, help. |
| 22:44 | mmarczyk | slyphon: why not just make it a function? |
| 22:44 | slyphon | mmarczyk: i'm workin on it |
| 22:51 | mmarczyk | slyphon: actually I just realised why this perhaps should be a macro, d'oh |
| 22:51 | mmarczyk | anyway |
| 22:51 | mmarczyk | http://gist.github.com/376105 |
| 22:51 | mmarczyk | would this work? |
| 22:51 | slyphon | yeah, . is a special form |
| 22:52 | slyphon | i could try that :) |
| 22:52 | mmarczyk | please do :-) |
| 22:52 | slyphon | yeah it's the ~@(map ) bit that i don't really know |
| 22:54 | slyphon | doh |
| 22:54 | slyphon | brb, baby just woke up |
| 22:54 | mmarczyk | :-) |
| 22:55 | slyphon | oh, cool |
| 22:56 | slyphon | I Did Not Know That |
| 22:56 | slyphon | hrm |
| 22:56 | mmarczyk | :-) |
| 22:56 | mmarczyk | ~@ splices whatever comes next into the sequence it occurs in |
| 22:56 | clojurebot | @ is splicing unquote |
| 22:57 | mmarczyk | thanks, clojurebot :-) |
| 22:58 | slyphon | yeah, it's kind of like, it makes sense when you use it to splat a bunch of forms that are handed to the macro, but it kind of confuses me when you're generating it *inside* the macro |
| 22:58 | slyphon | hmm |
| 22:58 | slyphon | Wrong number of args passed to: core$map |
| 22:58 | mmarczyk | argh |
| 22:58 | slyphon | yeah, i see it |
| 22:58 | mmarczyk | right, of course |
| 22:58 | mmarczyk | I'll fix the gist too |
| 22:58 | slyphon | so you zip that? |
| 22:58 | mmarczyk | (done) |
| 22:59 | slyphon | :) |
| 22:59 | slyphon | oh, right |
| 22:59 | slyphon | map takes multiple args |
| 22:59 | slyphon | (duh) |
| 22:59 | slyphon | oof |
| 22:59 | slyphon | Malformed member expression |
| 22:59 | mmarczyk | btw, where are the camelize and upcase functions coming from? |
| 22:59 | slyphon | oh |
| 22:59 | slyphon | one sec |
| 22:59 | slyphon | i ported them from rails, basically |
| 23:00 | mmarczyk | oh, ok |
| 23:00 | mmarczyk | ok, I see one more thing to fix |
| 23:01 | mmarczyk | just a sec |
| 23:01 | slyphon | http://gist.github.com/376119 |
| 23:01 | slyphon | that's the other bits |
| 23:02 | slyphon | mmarczyk: ^^ |
| 23:02 | slyphon | oh |
| 23:02 | slyphon | gah |
| 23:02 | mmarczyk | make that two things |
| 23:03 | mmarczyk | done now, updated the gist |
| 23:03 | mmarczyk | should work |
| 23:03 | mmarczyk | (macroexpand-1 '(update-bean *bs*{:foo-bar 7 :byte-property 8})) |
| 23:03 | mmarczyk | (clojure.core/doto *bs* (. setfoo-bar 7) (. setbyte-property 8)) |
| 23:03 | mmarczyk | |
| 23:03 | mmarczyk | (with my stand-ins for as-str, camelize, upcase) |
| 23:03 | slyphon | :) |
| 23:03 | slyphon | http://gist.github.com/376119 |
| 23:04 | mmarczyk | cool, thanks! :-) |
| 23:04 | slyphon | sure |
| 23:04 | slyphon | now i just have to put *your* code at the bottom |
| 23:06 | slyphon | mmarczyk: it works! |
| 23:06 | slyphon | hooray! |
| 23:08 | mmarczyk | :-))) |
| 23:13 | slyphon | mmarczyk: ok, now to figure out what the hell this is doing :) |
| 23:15 | mmarczyk | yup, that would be the next step ;-) |
| 23:16 | mmarczyk | oh, only I might mean it in a different way, since this has just reminded me how I don't really get the Java beans stuff |
| 23:16 | slyphon | hah |
| 23:17 | slyphon | yeah, i just wanna learn why this works and the thing i did didn't |
| 23:17 | slyphon | brb |
| 23:29 | mmarczyk | (added a slightly different version to the gist, moving the map outside of ~@; doesn't matter much) |