2012-01-30
| 00:00 | aphyr | Yeah, insertion or arbitrary order. |
| 00:00 | aphyr | Do you suppose I could re-jigger a list or vector to implement that interface? |
| 00:01 | aphyr | https://github.com/cgrand/parsley/blob/master/src/net/cgrand/parsley/lrplus.clj#L67 |
| 00:01 | aphyr | that, specifically, is what I'm trying to force to evaluate a set in a certain order. |
| 00:03 | jeremyheiler | Could use sorted-set-by with a custom comparator that preserves insertion order by always returining 1. |
| 00:03 | amalloy | jeremyheiler: that would be a disaster and not work |
| 00:04 | amalloy | (a) it's gross that parsley requires you to give it sets, but (b) just write a (set-in-this-order 'a 'b 'c) function, that creates a custom comparator when you give it the items |
| 00:04 | aphyr | Where the comparator... attaches ordered metadata to the objects? |
| 00:04 | aphyr | Or can I presume that (fn [] 1) will be stable? |
| 00:05 | amalloy | huh? just create a new comparator that keeps a copy of the original order |
| 00:06 | aphyr | Hmm. Feels inefficient... really all this thing needs is a type that's APersistentSet and Seqable, if I understand correctly. |
| 00:06 | amalloy | (defn my-set [& args] (let [order (zipmap args (range))] (apply sorted-set-by (fn [a b] (- (order a) (order b))) args))) or something |
| 00:06 | jeremyheiler | sets are seqable |
| 00:06 | aphyr | Can I extend List to be APersistentSet? |
| 00:07 | aphyr | Or I guess I could just patch Parsley to accept some core type like lists for alternation. |
| 00:13 | jeremyheiler | amalloy: what exactly is wrong with this? ##(sorted-set-by (fn [x y] 1) :b :a :d :c :f) |
| 00:13 | lazybot | ⇒ #{:b :a :d :c :f} |
| 00:14 | amalloy | &(let [elts [:b :a :d :c :f], s (apply sorted-set-by (fn [x y] 1) elts))] (map s elts)) |
| 00:14 | lazybot | java.lang.RuntimeException: Unmatched delimiter: ) |
| 00:14 | amalloy | &(let [elts [:b :a :d :c :f], s (apply sorted-set-by (fn [x y] 1) elts)] (map s elts)) |
| 00:14 | lazybot | ⇒ (nil nil nil nil nil) |
| 00:15 | amalloy | jeremyheiler: if your comparator lies, you can seq over the list, but you can't look things up by key |
| 00:16 | jeremyheiler | amalloy: ah yes, forgot sets were just maps underneath. |
| 00:16 | Raynes | amalloy: What is spark plug? What is car? |
| 00:16 | jeremyheiler | never really thought of pulling things out of a set by a key |
| 00:16 | amalloy | it doesn't matter if they're maps underneath |
| 00:16 | amalloy | you can't call contains? either |
| 00:16 | amalloy | (or rather, it won't work) |
| 00:17 | nrichards | Does anyone know the the timeout for 4clojure solutions? I have a problem that finishes in < 30ms on my machine but gets "An Error occured: timeout" on the site |
| 00:18 | Raynes | amalloy: Why don't you write up something about this for an FAQ or something on 4clojure? |
| 00:18 | Raynes | amalloy: It has to be kind of frustrating. |
| 00:19 | aphyr | Oh, amalloy, you *wrote* an ordered-set! |
| 00:20 | amalloy | i did. and you're welcome to use it, but if you only have static fixed-size sets, the defn i put in earlier will surely be more lightweight and less complicated |
| 00:23 | aphyr | They're being destroyed immediately after parser generation... doesn't really matter to me. |
| 00:23 | aphyr | I'll just use the library, make my packaging easier. |
| 00:25 | jeremyheiler | amalloy: sorry, didn't mean to sound rude. was just looking for further explanation. |
| 00:25 | amalloy | nor i. just further clarifying/explaining |
| 00:26 | Raynes | jeremyheiler: He is lying. Look at his poker face. |
| 00:27 | amalloy | he can't read my poker face |
| 00:27 | jeremyheiler | I can buffer it though |
| 00:32 | muhoo | p p p p p p poker face |
| 00:32 | aphyr | (satisfies? clojure.lang.APersistentSet #{}) |
| 00:32 | Raynes | muhoo: You forgot a 'po' there. |
| 00:32 | aphyr | java.lang.NullPointerException |
| 00:32 | aphyr | :/ |
| 00:33 | amalloy | &(doc instance?) |
| 00:33 | lazybot | ⇒ ------------------------- clojure.core/instance? ([c x]) Evaluates x and tests if it is an instance of the class c. Returns true or false nil |
| 00:33 | aphyr | (instance? clojure.lang.APersistentSet (ordered-set 1 6 )) |
| 00:33 | aphyr | false |
| 00:33 | aphyr | hmmm |
| 00:34 | aphyr | So I guess I do need to implement a custom comparator then |
| 00:34 | amalloy | IPersistentSet |
| 00:34 | aphyr | or write my own damn parser generator |
| 00:34 | amalloy | if it checks for APersistentSet that's frankly retarded, whereas checking for IPersistentSet is just distasteful to me |
| 00:35 | aphyr | https://github.com/cgrand/parsley/blob/master/src/net/cgrand/parsley/lrplus.clj#L67 |
| 00:35 | aphyr | I don't exactly understand how protocols interact here |
| 00:36 | aphyr | But it looks like that ... class? Is being extended with a function for the TokenMatcher protocol? |
| 00:36 | amalloy | ah. so it's not doing any silly checking |
| 00:38 | aphyr | Ah, A suggests that it's an abstract class? |
| 00:38 | amalloy | just extend that protocol to whatever type you want, with a behavior that's similar to do what you want. say, to ISeq |
| 00:38 | aphyr | Is it possible to extend only a single object with a protocol? |
| 00:38 | amalloy | no |
| 00:39 | aphyr | So I need to define a new type |
| 00:41 | aphyr | Goddamnit, I'll just write the damn thing as a PEG |
| 00:42 | muhoo | wow, the docstring for deftype is like 3 pages lonng |
| 00:54 | amalloy | jeremyheiler: wish granted, conditional upon your being on the west coast |
| 00:55 | jeremyheiler | will be in march -- but not today :-/ |
| 00:55 | muhoo | it's sunday here. it's probably been monday for like a day already in australia |
| 00:55 | muhoo | this joy of clojure book is really good. |
| 00:55 | jeremyheiler | although it's summer there, dam |
| 00:56 | jeremyheiler | muhoo: i concur |
| 00:56 | muhoo | beats the hell out of trying to learn from just reading the language reference and random stuff from the internets. |
| 01:02 | talios | muhoo: 7pm Monday evening in Auckland, New Zealand here. |
| 01:03 | amalloy | was monday any good, or should i just stay in bed? |
| 01:03 | talios | amalloy: public holiday ( Auckland aniversary day ) so I spent it in the sun with bro and his 1yr old daughter ( and his wife ). so good. |
| 01:03 | talios | and then coded my pet project to all green tests. so double good. |
| 01:05 | talios | now contemplated dinner, or the gym - then dinner. |
| 01:05 | talios | s/ed/ing/ |
| 01:11 | muhoo | trying to decide if i should blow $500 on attending clojure/west |
| 01:11 | muhoo | bummer it's in san jose. if it were in san francsico i could just bart it there. |
| 01:12 | talios | if you think going would be "blowing" away $500 then yes. sounds like you think it's not worth it. I'd love to go. |
| 01:12 | muhoo | i don't know if it'd be worth it. $500 is a lot of money to me. |
| 01:12 | jeremyheiler | I'm flying out form New York. I wouldn't mind switching costs with you, muhoo |
| 01:12 | jeremyheiler | lol |
| 01:13 | talios | Mmm, I suppose - thats $500US, jeremyheiler - hey, if I went I'd be paying upward of $4000NZ in flights alone! |
| 01:13 | talios | i think. |
| 01:13 | jeremyheiler | talios: yikes! |
| 01:13 | muhoo | jeremyheiler: 1am there? |
| 01:14 | jeremyheiler | I imagine it's a lot -- it's already a pretty penny to fly to cali from ny. |
| 01:14 | talios | Mmm, no direct flights from Auckland to San Jose, what would be the closest international? |
| 01:14 | muhoo | hmm, then maybe i should take advantage of the opportunity to not have to fly then :-) |
| 01:14 | amalloy | sfo probly |
| 01:14 | muhoo | talios: SFO |
| 01:15 | muhoo | san jose is a relatively small airport |
| 01:16 | talios | $2,209.34 NZ return to San Francisco, then I'd just have to get from there to San Jose. Plus accom. FOR TWO DAYS. :) |
| 01:16 | muhoo | damn. |
| 01:16 | talios | If I went I'd make a week or so of it. But still, thats A LOT of coin. |
| 01:16 | muhoo | yep, i have a friend in australia, haven't been to visit him yet, in 10 years, just can't afford it. |
| 01:16 | muhoo | cross-pacific flights are crazy expensive. |
| 01:17 | jeremyheiler | muhoo: yep, it's 1am |
| 01:18 | muhoo | well i think i'm going to do it then, and see how it goes. |
| 01:24 | muhoo | ack, the early registration deadline was yesterday |
| 01:24 | muhoo | damn, coulda saved myself US$75. oh well. |
| 01:25 | jeremyheiler | muhoo: i can get you $25 due to this special thing they're doing. |
| 01:25 | jeremyheiler | $25 off* |
| 01:28 | muhoo | that'd be cool, thanks |
| 01:28 | jeremyheiler | pm me your email, i'll forward you the email they sent |
| 01:28 | muhoo | cool, thanks! |
| 01:33 | jeremyheiler | ^ wanted that to say pokemon |
| 02:51 | yawNO | hello :D |
| 02:51 | yawNO | just started learning clj |
| 02:56 | jeremyheiler | yawNO: nice! |
| 02:57 | yawNO | i never thought i would have said that |
| 02:58 | yawNO | coming from ruby and js |
| 02:58 | yawNO | but i like it |
| 02:58 | yawNO | :D |
| 02:58 | jeremyheiler | Are you playing with ClojureScript, too? |
| 02:59 | yawNO | i started learning clj because of it |
| 02:59 | yawNO | i am mainly a nodejs developer |
| 03:01 | jeremyheiler | nice! there's a lot going on with cljs at the moment. |
| 03:03 | yawNO | jeremyheiler: is there a irc chan for cljs? |
| 03:03 | jeremyheiler | this is it |
| 03:03 | yawNO | ah |
| 03:03 | yawNO | lol |
| 03:05 | jeremyheiler | anywho, i need to get some shut-eye. hope to see your around yawNO! |
| 03:14 | clj_newb | can I capture the state of a graphics 2d in a BufferedImage? I currently want to have an optimization where I render graphics2D to a BufferedImage, then unless stuff changes, just repaint the bufferedImage instead of rerenderinb everything; the only question is: does this intermediate step reduce quality of rendering? |
| 03:22 | Licenser | clj_newb I don't think it will reduce the quality, AFAIK it is a common practice |
| 03:26 | Blkt | good morning everyone |
| 03:31 | Licenser | hi Blkt |
| 03:32 | Blkt | :D |
| 03:32 | clj_newb | Licenser: cool; any known drawbacks with this? |
| 03:33 | Licenser | more memory usage usually :) |
| 03:33 | clj_newb | I have something like 16GB of RAM |
| 03:34 | Licenser | some image containers even allow a double buffered mode wich allow you to draw in the background and just swap the buffers when done |
| 03:34 | clj_newb | is switching atomic? |
| 03:34 | Licenser | not sure, it has been a long time since I played with that kind of stuff |
| 03:34 | clj_newb | at the moment; Im creating new images and sending it to agents |
| 03:35 | Licenser | also it was back in Delphi with Borlands canvase objects |
| 03:36 | Licenser | also that does not sound too bad what you do |
| 03:36 | Licenser | what kind of place you use to draw them? |
| 03:36 | clj_newb | i'm writing a wygiwyg editor |
| 03:36 | clj_newb | rendering pages is expensive |
| 03:36 | Licenser | ah I see, and yes I understand that :) |
| 03:36 | clj_newb | which only needs to render when the document changes; not when I'm scorlling around, etc ... |
| 03:37 | Licenser | a wysiwyg or really wygiwyg? |
| 03:37 | clj_newb | these images I create on the fly on created, live shortly, and then die fast |
| 03:37 | clj_newb | so I think the java gc handles them well |
| 03:37 | clj_newb | lol |
| 03:37 | clj_newb | wygiwyg editor encaptures all editors I think |
| 03:37 | clj_newb | including LaTeX and MS Word |
| 03:37 | Licenser | ^^ |
| 03:38 | Licenser | Word is more a What I want is What You Get editor |
| 03:38 | clj_newb | s/I want/Clippy thinks is best/ |
| 03:39 | Licenser | that is what I ment with I :P |
| 04:09 | clj_newb | do element sent to agents ever get released? |
| 04:09 | clj_newb | if so, when? |
| 04:15 | AWizzArd | clj_newb: what “elements” do you mean? |
| 04:18 | jondot | hi guys. i'm reading Storm clojure code on and off, i found this https://refheap.com/paste/492 |
| 04:19 | jondot | since storm-cluster-state isn't used, can we replace the whole thing with just (when-let (:conf nimbus) .. ? |
| 04:21 | scottj | jondot: I don't think so, because (:conf nimbus) is not the same as ((:conf numbus) NIMBUS-REASSIGN) |
| 04:22 | scottj | you could probably do (when ((:conf nimbus) NIMBUS-REASSIGN)) (mk-assign..) though |
| 04:22 | jondot | let me rewrite that |
| 04:22 | scottj | removing the let entirely |
| 04:23 | IceD^ | https://gist.github.com/1703536 |
| 04:24 | IceD^ | and when I'm trying to do get-messages on empty queue, exception is thrown, but I can't catch it |
| 04:24 | IceD^ | https://gist.github.com/1703540 |
| 04:24 | IceD^ | any ideas? |
| 04:25 | jondot | how about this https://refheap.com/paste/493 |
| 04:29 | scottj | jondot: no, you can't call (conf NIMBUS-REASSIGN) bc conf isn't bound ot anything |
| 04:29 | scottj | (when ((:conf nimbus) NIMBUS-REASSIGN) is what you want |
| 04:30 | scottj | make sure you always have a :conf though on your nimbus otherwise you'll get a nullpointerexception |
| 04:33 | IceD^ | weird |
| 04:35 | jondot | scottj, right. well i don't work on Storm, but just reading for educational purposes. any idea why that code was left that way? https://github.com/nathanmarz/storm/blob/master/src/clj/backtype/storm/daemon/nimbus.clj#L504 |
| 04:37 | scottj | jondot: he probably used storm-cluster-state in an old version of the function and clojure doesn't have a "you're not using this variable" IDE helper so it's easy to miss |
| 04:37 | jondot | i see, ok |
| 04:53 | amro | I'm having trouble setting up clojurescript repl with chromium- I can see in the inspector that it's connecting, but the repl just hangs when I type in a form |
| 04:53 | jondot | im wondering about the benefits of clojurescript.. |
| 04:54 | amro | not writing code in javascript |
| 05:11 | IceD^ | ok guys, my lib is ready |
| 05:11 | IceD^ | how do I distribute it ;] |
| 05:12 | Fossi | github? :) |
| 05:12 | foodoo | what about clojars? |
| 05:13 | Fossi | yeah, that too |
| 05:13 | jondot | amro, how about coffeescript? |
| 05:14 | raek | IceD^: https://github.com/ato/clojars-web/wiki/tutorial |
| 05:14 | IceD^ | yes, project will be on github in a min |
| 05:14 | IceD^ | writing README |
| 05:15 | raek | you also have to register on Clojars http://clojars.org/register |
| 05:15 | scottj | README driven distribution. |
| 05:15 | IceD^ | raek, that's what I need, thanks |
| 05:16 | raek | use semantic versioning |
| 05:16 | raek | and if your library is ready for use, realease it by making a non-SNAPSHOT version available |
| 05:16 | raek | for example 1.0.0 |
| 05:16 | IceD^ | raek, is is ;] |
| 05:16 | raek | great! |
| 05:16 | IceD^ | tested it - everything works perfectly |
| 05:17 | IceD^ | it's client for ironmq (http://iron.io) |
| 05:17 | raek | (you see a lot of 0.0.1-SNAPSHOT, even in production, these days) |
| 05:17 | IceD^ | yeah, I know |
| 05:17 | IceD^ | makes me angry |
| 05:17 | IceD^ | btw - small code review 'd be nice |
| 05:18 | IceD^ | https://gist.github.com/1703725 |
| 05:18 | IceD^ | I'm seasoned lisp dev, but used clojure only for fast internal things |
| 05:18 | IceD^ | so it's possible my code isn't idiomatic |
| 05:19 | foodoo | IceD^: Please write proper documentation metadata |
| 05:19 | IceD^ | foodoo, ofc |
| 05:19 | IceD^ | FIXME will not let me forget this |
| 05:20 | IceD^ | better yet, I'll make our doc guy do it ;) |
| 05:20 | foodoo | IceD^: I'm still not sure what this module does |
| 05:20 | scottj | IceD^: :use is not recommended unless you use :only |
| 05:20 | IceD^ | it's api for ironmq ;] |
| 05:20 | raek | IceD^: namespace names have hyphens in them when the files have underscores in them |
| 05:21 | scottj | IceD^: also I think you can do & {:as options} and then not have to do (apply hash-map options) |
| 05:21 | raek | so (ns iron-mq-clojure.client ...) in the file src/iron_mq_clojure/client.clj |
| 05:21 | IceD^ | hyphen - fixed |
| 05:21 | IceD^ | what to use instead of :use |
| 05:22 | IceD^ | I'm using only two funcs from there |
| 05:22 | scottj | IceD^: (:use chesire.core :only [list of functions you use]) |
| 05:22 | yawnt | hai |
| 05:22 | raek | (:use [chesire.core :only [list of functions you use]]) |
| 05:22 | yawnt | no prior experience w/ lisp |
| 05:22 | raek | the []s are needed for options |
| 05:22 | yawnt | which book should i begin w/? |
| 05:23 | yawnt | joy of clojure? clojure in action? |
| 05:23 | scottj | raek: thanks |
| 05:23 | foodoo | "programming clojure" is a good introductory book. But won't go deep into the language in my opinion |
| 05:23 | scottj | yawnt: I think JoC is ocnsidered more advanced. |
| 05:24 | yawnt | so foodoo .. what would your advice be? |
| 05:24 | yawnt | scottj: okay so not that one |
| 05:24 | CmdrDats | yawnt: I agree with foodoo - Programming Clojure is a good book to start |
| 05:24 | foodoo | probably "programming clojure" + "The joy of clojure" is a good combo? |
| 05:24 | yawnt | thx :D |
| 05:24 | CmdrDats | joy of clojure is amazing, but the pace is fast |
| 05:25 | yawnt | cause i heard a lot of people speaking about clojure in action too |
| 05:25 | raek | I would write (map (fn [m] (if (string? m) (create-message m) m)) messages) |
| 05:25 | raek | like this: (->> message (filter string?) (map create-message)) |
| 05:25 | CmdrDats | i can't speak for clojure in action - haven't read it yet |
| 05:25 | CmdrDats | (i certainly intend to though! :P ) |
| 05:25 | scottj | programming clojure has a new version coming out (not sure date) since the existing is slightly outdated |
| 05:26 | yawnt | existing is 2009 |
| 05:26 | yawnt | afaik 1.2 brought major changes |
| 05:26 | yawnt | or was it 1.3? |
| 05:26 | raek | ...or perhaps as (for [m messages :when (string? m)] (create-message m)) |
| 05:26 | foodoo | sidenote: "programming clojure" was written with Clojure 1.2 in mind. The current version is Clojure 1.3 |
| 05:26 | yawnt | foodoo: really? |
| 05:26 | yawnt | good to know |
| 05:27 | foodoo | But I think it's still very current. |
| 05:27 | foodoo | But there will be a new version somewhere in March I think |
| 05:28 | foodoo | (Amazon says 6th of April ) |
| 05:28 | scottj | foodoo: I don't think so. I thought they released 1.0 FOR programming clojure. don't think it mentions deftype/protocol/record |
| 05:28 | raek | IIRC, programming clojure was written at the time of Clojure 1.1 |
| 05:28 | IceD^ | more advanced question |
| 05:29 | raek | I still think it's a good book, though |
| 05:29 | IceD^ | I have multi-deps (for 1.2.1) in my project.clj |
| 05:29 | IceD^ | how to test against them without pushing lib |
| 05:29 | raek | especially if you come from java or another oo language |
| 05:30 | foodoo | scottj: true, these topics aren't in the book |
| 05:30 | scottj | IceD^: in request fn, you could use destructuring to not repeat (:key client). you don't need do inside let. you could use doto to not repeat conn. |
| 05:34 | IceD^ | removed do, used doto |
| 05:34 | IceD^ | destructuring - how |
| 05:38 | scottj | IceD^: https://refheap.com/paste/494 |
| 05:38 | scottj | IceD^: opps, you don't need two lets. move the contents of first into second. |
| 05:39 | scottj | IceD^: it's a debateable change since it no longer shows exactly where the data comes from at the point of use. |
| 05:42 | IceD^ | scottj, ahh, considered that |
| 05:42 | IceD^ | doesn't improve code from my poc |
| 05:42 | IceD^ | pov* |
| 05:42 | scottj | yeah I probably agree |
| 05:49 | amro | jondot: I don't like it |
| 05:50 | amro | anyway I figured it out, I was missing <meta charset="UTF-8"> |
| 05:50 | scottj | amro: that should be a FAQ |
| 05:51 | amro | indeed- or perhaps the js part should spit out an error |
| 06:20 | IceD^ | https://github.com/iron-io/iron_mq_clojure - here we go |
| 06:21 | IceD^ | thanks for your help guys |
| 06:42 | jbiesnecker | If anyone's interested, I'm putting together a number theory/other math library, available at: https://github.com/biesnecker/clj-numbers |
| 06:42 | jbiesnecker | Mostly Project Euler inspired now (and rough, because it's serving as my "let's learn Clojure" project), but I'm happy with the functionality it's starting to provide. |
| 06:46 | clgv | jbiesnecker: seeing 'digits and 'binary-digits why dont you just add a base for the digit representation? ;) |
| 06:48 | jbiesnecker | clgv: that's a good point (the answer is that digits came way before binary-digits, and I didn't think about it :)), I'll make that happen in the next release. |
| 06:50 | clgv | jbiesnecker:: I would also rewrite 'integers-larger-than and its friend with usage of 'iterate |
| 06:51 | jbiesnecker | clgv: Is there a particular reason for that? It would certainly be cleaner, but is there a performance difference between the two (or other reason/s)? |
| 06:52 | clgv | jbiesnecker: yes it's cleaner since it's just weird to use a double constant of infinity there. that might cause unforseen trouble whereas the other one is easy to check that its working ;) |
| 06:53 | jbiesnecker | clgv: good reasons all :) |
| 06:59 | jbiesnecker | clgv: (though actually the Double infinity constant is how range itself is implemented -- originally I wanted to do a negative range with a start and no end, didn't think of iterate, and looked up the source to range to figure out how they do it) |
| 07:00 | clgv | jbiesnecker: oh, thats bad programming then... |
| 07:01 | clgv | jbiesnecker: reading the source, that is due to the function organization. they have to have some end-value. |
| 07:01 | clgv | jbiesnecker: but the two function of yours do not need such an end value^^ |
| 07:02 | jbiesnecker | clgv: right… iterate is clearly the better choice here |
| 07:23 | echo-area | Does anyone read /The Joy of Clojure/? The example using ThreadPoolExecutor via dothreads! won't work as 11.2.1 tells, as without shutdown'ing the executor the process will be hanged out there, right? |
| 07:29 | clgv | echo-area: well if you stay in a repl it should work like told. if you build a jar that might not exit without shutdown |
| 07:33 | echo-area | clgv: Okay thanks |
| 07:34 | echo-area | clgv: I'd like to write those examples in a file named some.clj then execute that file, as I think that's easier to be experimented with :) |
| 07:34 | clgv | echo-area: in the box you are told that it was written for demonstration purposes only |
| 07:35 | clgv | echo-area: what do you use as development environment? |
| 07:35 | echo-area | clgv: I see that. But I still want to change it a bit and see how things go |
| 07:35 | echo-area | clgv: Emacs + SLIME |
| 07:35 | clgv | echo-area: ah well then you should use REPL and file for experimenting ;) |
| 07:36 | clgv | echo-are: copy the function definitions in the file, reload and try them on the REPL |
| 07:36 | echo-area | clgv: Yes, I tried C-x C-e yesterday, but it seemed to hang too. I was confused. Maybe I did it wrong, nevermind |
| 07:37 | clgv | echo-area: cant help you with the emacs setup since I am member of the non-emacs minority ;) |
| 07:38 | echo-area | clgv: Okay. BTW, the diff between (board-map #(dosync (deref %)) board) and (board-map deref board) is that the former wait until all threads done but the latter just read an intermediate value, right? |
| 07:39 | clgv | echo-area: I dont remember the details of the board-map example and cant re-read them right now |
| 07:40 | clgv | echo-area: dosync is a transaction that you need to access the refs |
| 07:41 | echo-area | clgv: The board-map form is evaluated right after the threads get started. I don't understand the dosync form around deref |
| 07:42 | echo-area | To me, it seems there's no difference with or without the dosync form |
| 07:45 | clgv | echo-area: well the second will only work if it is somehow enclosed in a dosync directly or indirectly |
| 07:47 | echo-area | clgv: But I tried one without dosync, and it worked |
| 07:48 | echo-area | clgv: And the doc of `deref' says "Within a transaction, returns the in-transaction-value of ref, else returns the most-recently-committed value of ref." |
| 07:50 | clgv | ah ok. mixed it up then. |
| 07:50 | echo-area | What does that mean? Is there any difference between the two, for Ref's? |
| 07:51 | echo-area | Thanks |
| 08:01 | CmdrDats | hey guys, I'm busy building a small library for defining schema's in mysql, with auto-updating columns, indices and foreign keys. |
| 08:01 | CmdrDats | does that sound vaguely useful, or am I duplicating someone else's work? |
| 08:23 | clgv | CmdrDrats: you could search github and clojars for the related keywords and see what you find |
| 08:35 | CmdrDats | clgv: thanks - i can't find anything though.. this is how I define the entities currently : https://gist.github.com/1704412 |
| 08:36 | CmdrDats | i'm staying away from trying to abstract SQL itself, too many libraries already doing that |
| 08:37 | CmdrDats | but defentity macro itself defines a defrecord and a couple of helper crud functions |
| 08:38 | clgv | CmdrDats: did you have a look if ClojureQL has something for what you do? |
| 08:40 | CmdrDats | clgv: i've looked, but everything is against an existing database - what I want is something to describe a database and then it must make sure the database is up to date and correct |
| 08:40 | clgv | CmdrDats: "database life cycle management" to express it in "manager speak"? :P |
| 08:41 | CmdrDats | hehe, i guess so :P |
| 08:44 | clgv | CmdrDats: what about that one? http://budu.github.com/lobos/ |
| 08:44 | CmdrDats | looks promising |
| 08:45 | CmdrDats | except, ugh, it needs to express entities in their final state - not just a wrapper to SQL :P |
| 08:45 | CmdrDats | but i might actually incorporate lobos to gain a bit of abstraction from specifically mysql |
| 08:46 | CmdrDats | I've done quite a bit of work on this thing here at work, but I'm interested in pulling that out into a standalone library so I can open source it |
| 08:59 | RickInGA | I keep reading articles about using GPUs. Anyone know if Clojure can take advantage of heterogenius systemS? |
| 09:07 | clgv | RickInGA: si there a java for GPUs? |
| 09:08 | RickInGA | I don't know |
| 09:08 | clgv | afair I doubt that, since GPU computing is quite special |
| 09:08 | llasram | http://code.google.com/p/javacl/ |
| 09:08 | clgv | only dialect for a compiler? |
| 09:08 | clgv | ah wrapper to opencl right. |
| 09:09 | RickInGA | Microsoft is pushing AMP as a way to write C++ for gpu's, and they are saying that right now most code using gpus is in C |
| 09:09 | clgv | I saw some CUDA stuff last year. |
| 09:09 | RickInGA | so the fact that a methodology for C++ is just being developed, or has just been developed, makes me think probably nothing else does it yet. |
| 09:09 | clgv | It was C++ as far as I remember |
| 09:10 | lucian | there was an example of compiling a small subset of clojure to shaders |
| 09:10 | lucian | theoretically it should be possible to write an OpenCL DSL |
| 09:11 | clgv | CLJ-GPU? ;) |
| 09:11 | RickInGA | is OpenCL just drawing stuff? |
| 09:11 | clgv | no that OpenGL ;) |
| 09:11 | lucian | RickInGA: OpenCL is just computing stuff |
| 09:12 | RickInGA | ah, wow |
| 09:13 | RickInGA | hehe, now that I see that it is possible, I am confronted with admitting I haven't the slightest idea what I will do with it :) |
| 09:14 | clgv | RickInGA: then let me tell you that you might be surprise how few that actually is ;) |
| 09:16 | RickInGA | It is a fun question... just what sort of software could possibly use a 100 core system? |
| 09:16 | RickInGA | we are going to have the hardware soon, but what are people going to do with it. |
| 09:17 | RickInGA | right now I am trying to learn HOW to do it. I will figure out the WHY somewhere along the way :) |
| 09:23 | clgv | RickInGA: the problem with GPU programming is that you dont have just 100 normal cores. they are very specialized and thus limited compared with normal CPUs |
| 09:24 | lucian | there certainly are things we could do if we could easily run a nice language on our GPUs |
| 09:24 | lucian | mostly numerical, though |
| 09:24 | RickInGA | Yeah, I know the C++ libraries put a lot of restrictions on what can be done |
| 09:24 | clgv | I guessed that ;) |
| 09:25 | RickInGA | I was jus thinking that one of Clojure's big selling points is the way it handles concurrency |
| 09:25 | lucian | RickInGA: so would a Clojure library, i would be a small incompatible subset of clojure |
| 09:25 | lucian | RickInGA: this would be possible because of homoiconicity, not STM |
| 09:26 | RickInGA | ok, how about this sort of setup. a clojure app that runs on the cpu, and when it can benifit from it, it dispatches work to a librarry running on the gpu |
| 09:27 | RickInGA | it is kind of foggy in my mind, but I think i am starting to get it :) |
| 09:27 | lucian | have you ever used vectorization libs, for things like SSE? |
| 09:28 | RickInGA | no, I haven't. Think that would be a good place for me to learn more? |
| 09:28 | lucian | you'd say something like (with-gpu (add 2 [1, 2, 3])) and you'd get [3, 4, 5] |
| 09:28 | lucian | pretty much all operators would be on matrices |
| 09:29 | RickInGA | It is such a cool time to be a developer |
| 09:33 | clgv | hm yeah I guess 1700 would have sucked to be software developer ;) |
| 09:33 | RickInGA | haha |
| 09:38 | foodoo | RickInGA: [on what to do with 100 cores:] solving differential equations |
| 09:42 | RickInGA | the 7 languages in 7 weeks book has a Sudoku solver in Prolog. In 4 lines of code you specify that 1: Only digits 1-9 are acceptable values, 2: values across have to be unique, 3: values down have to be unique and 4 each of the 9 3 by 3 squares have to have unique values. |
| 09:42 | RickInGA | It is up to the prolog 'compiler' to find the answer. |
| 09:42 | lucian | RickInGA: sure, but that's a special, limited case |
| 09:42 | RickInGA | I believe it does a depth first search on all possible solutions until a match is found |
| 09:42 | lucian | often it turns out that explaining the problem in that much detail is similar effort to solving it by other methods |
| 09:43 | lucian | but yeah, prolog is cool |
| 09:43 | RickInGA | that is something that could work on a heterogeneious (how do you spell that!) system |
| 09:43 | lucian | s/ei// |
| 09:44 | RickInGA | like you say, very limited application, but cool none the less |
| 09:45 | RickInGA | I want to check out core.logic. I think the sudoku app would be a fun one to play with. |
| 09:53 | gtrak | have there been any newer overtone videos lately? |
| 09:54 | RickInGA | I saw that someone ported Overtone to F# and called it Undertone :) |
| 09:54 | gtrak | ha |
| 09:54 | samaaron | RickInGA: haha, really? |
| 09:54 | samaaron | do you have a link? |
| 09:54 | RickInGA | yeah, one sec |
| 09:54 | samaaron | gtrak: no, there haven't been any newer overtone demo vids - just the interview i did with FLOSS |
| 09:55 | gtrak | ah ok |
| 09:55 | gtrak | hopefully confreaks gets their act together with the conj one :-) |
| 09:55 | samaaron | gtrak: unfortunately, I'm still dealing with my step-father's suicide |
| 09:55 | samaaron | gtrak: it's rough times for me atm |
| 09:55 | samaaron | gtrak: yeah, totally - it's been ages since the conj |
| 09:55 | samaaron | gtrak: it would be nice to have the presentation out there |
| 09:55 | RickInGA | http://strangelights.com/blog/archive/2012/01/27/undertone-ndash-programmable-music-in-f.aspx |
| 09:55 | gtrak | samaaron: ah, I'm sorry to hear that, but I really enjoyed your talk :-) |
| 09:57 | samaaron | RickInGA: awesome - thanks! |
| 09:57 | RickInGA | samaaron: sorry to hear about your loss |
| 09:57 | fdaoud | samaaron: sorry to hear that, my sympathies to you. |
| 09:57 | samaaron | RickInGA: yeah, i am too. It's just the suddenness of it which is the hardest to deal with. |
| 09:58 | samaaron | it's totally affected my productivity |
| 09:58 | samaaron | life is very fragile - and we should enjoy it to the very best of our abilities! |
| 09:59 | samaaron | fdaoud: thanks :-) |
| 09:59 | samaaron | still, people's continuing enthusiasm with Overtone is really helping me along |
| 10:00 | samaaron | you should read http://twitter.com/overtone for some of the wonderfully positive things people have been saying |
| 10:01 | RickInGA | I haven't checked it out yet. I heard your interview on mostly lazy a couple of weeks ago, I do want to try it out |
| 10:02 | samaaron | RickInGA: have you seen the FLOSS interview? |
| 10:02 | samaaron | http://twit.tv/show/floss-weekly/197?page=1 |
| 10:02 | RickInGA | The f# article made it sound like using overtone was a help to learning clojure |
| 10:02 | samaaron | RickInGA: yeah, i think Overtone is a great way of learning Clojure - learning through doing |
| 10:03 | RickInGA | so to use overtone I will write clojure expressions? |
| 10:03 | samaaron | RickInGA: of course :-) *everything* is in Clojure |
| 10:03 | clojurebot | Roger. |
| 10:03 | RickInGA | Awesome, this is one developer who needs his own theme music!! |
| 10:06 | samaaron | haha |
| 10:08 | samaaron | RickInGA: so the top-level overview is that you design synths using Clojure macros. These then compile down to special binary form which the sound synthesis engine SuperCollider understands. SuperCollider then reifies these designs meaning that they can be triggered and controlled. This triggering and controlling is done via normal Clojure fns. |
| 10:09 | RickInGA | I am just starting to watch the video now, I will be downloading soon |
| 10:09 | RickInGA | probably have a barrage of questions for you tomorrow :) |
| 10:10 | samaaron | RickInGA: you're welcome. You're free to pester me on freenode. I also hang out in #overtone. Also, the Overtone mailing list is a great place for longer questions |
| 10:11 | RickInGA | Since I have started playing with Clojure, I keep finding more and more fun ways to not get any work done. |
| 10:12 | clgv | RickInGA: lol, I hoe you'll also find the complement ;) |
| 10:12 | samaaron | RickInGA: just redefine your notion of 'work' |
| 10:14 | RickInGA | speaking of complement... I was on 4clojure yesterday... trying to omit every nth occurrence. I did filter(complement (= 0 (rem ndx n))) (ok, the vars are tough to follow).. but anyway, compliment didn't work and not did. |
| 10:14 | RickInGA | how are complement and not different? |
| 10:15 | RickInGA | samaaron: yes, I am not playing or wasting time I am "learning"... its an investment, right? |
| 10:15 | samaaron | RickInGA: always :-) |
| 10:15 | samaaron | never close your mind |
| 10:16 | samaaron | play is very important too though |
| 10:17 | RickInGA | speaking of "play" does anyone know anything about less conf? I saw the Relevence guys said they were goign to be there, so I wondered what it was. |
| 10:17 | RickInGA | And if you go to the less conf site, they wont tell you |
| 10:18 | RickInGA | their videos are pretty good though :) |
| 10:19 | RickInGA | I am thinking about going, just because it is in Atlanta, which means I don't have to pay for lodging, but I really have no idea what it is |
| 10:19 | RickInGA | http://lessconf.lesseverything.com/ |
| 10:21 | RickInGA | ah, there is an emacs plugin too |
| 10:22 | noidi | RickInGA, complement returns a function that's the opposite of the given predicate |
| 10:22 | noidi | ,((complement =) 2 2) |
| 10:22 | clojurebot | false |
| 10:23 | RickInGA | noidi: I was trying to filter a sequence. I wrote the code that would only take every third item (= 0 (rem ndx 3)). |
| 10:24 | RickInGA | I thought wrapping that in complement would exclude every third item, but instead I got the whole sequence. wrapping it in not gave me what I expected |
| 10:25 | noidi | not operates on boolean values, returning their negation, while complement works on functions returning boolean values, returning new functions which call the original function and negate the return value |
| 10:26 | clgv | how about not= ;) |
| 10:26 | RickInGA | hah, didn't look for not= that would work too |
| 10:27 | fdaoud | cemerick: I know it's not on you but-- has your book really been delayed again, this time until end of April? Now it's not funny anymore. :( |
| 10:27 | fdaoud | www.amazon.com/Clojure-Programming-Chas-Emerick/dp/1449394701#productDetails |
| 10:27 | cemerick | holy shit! |
| 10:28 | cemerick | ahem. Sorry. |
| 10:28 | cemerick | fdaoud: No, I hadn't seen that. |
| 10:28 | fdaoud | cemerick: no don't apologize, I'm glad you're as "wtf?" as I am.. |
| 10:31 | TimMc | RickInGA: Wow, reading the blog on lesseverything makes me want to punch a kitten. |
| 10:32 | RickInGA | hah, I didn't look at the blog |
| 10:32 | TimMc | Don't, it's terrible. |
| 10:32 | RickInGA | I liked the video about who is speaking |
| 10:32 | RickInGA | I haven't decided if it is a really cool conference, or a way to get people to fork out a bunch of money to hang out and eat pizza for 2 days |
| 10:33 | clgv | there is a blog? |
| 10:34 | TimMc | Yeah, apparently written by two angry, illiterate rhinoceri. |
| 10:34 | RickInGA | noidi: I don't know why I am having so much difference grasping why complement didn't work for me, but not did. Is this the right way to think about it, complement works on a function and not works on an expression? |
| 10:35 | clgv | TimMc: hmm guess I found it as well |
| 10:35 | TimMc | clgv: I read the grammar post and skimmed the REST post. |
| 10:36 | TimMc | RickInGA: Right. |
| 10:36 | RickInGA | thx |
| 10:37 | TimMc | RickInGA: You might say that 'complement is the HOF version of 'not |
| 10:37 | noidi | RickInGA, if you want the opposite of a boolean *value*, use not. if you want the opposite of a predicate *function*, use complement. |
| 10:37 | RickInGA | HOF = higher order function? |
| 10:37 | TimMc | yeah |
| 10:37 | TimMc | noidi: That's a great way of putting it. |
| 10:38 | wiseen | is there a clojure reader/writer library that will serilaize to clojure data, for clojure and clojurescript ? |
| 10:38 | TimMc | wiseen: pr-str |
| 10:38 | TimMc | That's a function, not a library. |
| 10:39 | RickInGA | noidi: thanks, I will try to remember it that way. |
| 10:39 | TimMc | wiseen: and read-string to get it back (look up *read-eval* before using it) |
| 10:39 | RickInGA | (though, repl makes memory less critical, hey that didnt work try the other one) |
| 10:40 | wiseen | TimMc, is it consistent across clojure and clojurescript ? |
| 10:41 | wiseen | eg. if I send "#user.Foo{:x 1}" to clojurescript - does it have the same reader syntax ? |
| 10:42 | RickInGA | "overtone wants to make electronic music a performable art" -- WOW |
| 10:43 | samaaron | RickInGA: yep, that's the goal |
| 10:43 | samaaron | RickInGA: so everything needs to be achievable live and in real time |
| 10:44 | raek | wiseen: for all "normal" data (vectors, sequences, maps, strings, numbers, keywords, etc) it is definitely consistent |
| 10:44 | samaaron | RickInGA: where did you find taht quote? |
| 10:44 | raek | I'm not sure about records |
| 10:44 | wiseen | raek, and defrecord ? |
| 10:44 | RickInGA | you are blowing my mind. I can think of non-programming friends, barely programming friends, and only know visual foxpro friends, that I am going to have to show this to |
| 10:44 | samaaron | RickInGA: haha, excellent. Mind-blowing is a hobby of mine |
| 10:44 | raek | records are a bit special in that they are data + type |
| 10:45 | RickInGA | samarron: Probably not an exact quote, but you said it in the twit.tv link you provided. About 12 minutes in. |
| 10:45 | RickInGA | go to 11:45, and you may have to watch for 30 second |
| 10:45 | samaaron | RickInGA: ah cool. It's definitely the kind of thing I would say :-) |
| 10:46 | RickInGA | are you going to clojure west? |
| 10:46 | RickInGA | nm |
| 10:46 | RickInGA | I remembered, you are one of the presenters |
| 10:47 | RickInGA | hah, the host of the interview is pretty good "I like the idea of using emacs to do all that. I like to think that Jimi Hendrix would have been a wizard on emacs" |
| 10:47 | TimMc | You can't spell "juxt" without "Jimi Hendrix", and also some other letters. |
| 10:49 | RickInGA | samaaron: I hope I am not skipping ahead, you have this thing called a monome that has lots of buttons on it. Does each of the buttons fire an event.... kind of like joystics with macro buttons for gaming? |
| 10:50 | metajack1 | RickInGA: The monome speaks OSC protocol, so you essentially get a udp packet for every button press and release, etc. |
| 10:51 | samaaron | RickInGA: that's exactly the way my monome lib presents to Clojure - you write handlers which are called on trigger (on/off) events |
| 10:51 | metajack1 | you can also send light up messages to rows, buttons, columns, or various squares of grid |
| 10:51 | samaaron | metajack1: actually, the monome only speaks serial |
| 10:51 | samaaron | metajack1: however, you can run a separate process which will talk serial and present OSC |
| 10:51 | metajack1 | samaaron: but everything runs off of the OSC udp side. nothing talks directly to the serial part except monomecontrol right? |
| 10:51 | samaaron | metajack1: or you can use my monome lib which talks directly to the serial protocol |
| 10:51 | metajack1 | (i have a monome) |
| 10:51 | metajack1 | ah. |
| 10:52 | RickInGA | but a button could be a note, or a chord or a melody... and if buttons are notes, then you can press a few at once for a chord |
| 10:52 | metajack1 | i ahve previously only used it from Reaktor and Max |
| 10:52 | samaaron | metajack1: cool. so the separate process thing was called MonomeSerial if I recall correctly |
| 10:52 | metajack1 | samaaron: yeah, that's right. |
| 10:52 | samaaron | metajack1: so with my monome lib, you don't need MonomeSerial |
| 10:52 | metajack1 | i also have the launchpad which is similar but speaks midi. not as responsive as the monome if you have a lot going on |
| 10:53 | samaaron | metajack1: Phil Potter is working on making my monome stuff work with the launchpad |
| 10:53 | metajack1 | is there a technical reason to skip the monomeserial thing? |
| 10:53 | metajack1 | or does that only exist because Max doesn't speak serial? |
| 10:53 | RickInGA | can you have a button that represents a tempo, so if I press button one, it is a melody at 80 bpm, but have another button that multiplies any tempo by 1.5, so both keys give the same melody played at 120bpm? |
| 10:53 | samaaron | metajack1: no technical reason other than i wanted to remove deps |
| 10:54 | samaaron | RickInGA: yep, all doable :-) |
| 10:54 | RickInGA | If I had a job and musical ability, I think I would quit my job and play with overtone all day! |
| 10:54 | samaaron | RickInGA: that's exactly what i did for a year :-) |
| 10:55 | TimMc | RickInGA: You're half-way there already! |
| 10:55 | RickInGA | haha, true! |
| 10:55 | samaaron | RickInGA: and i didn't have any musical ability |
| 10:55 | samaaron | so i think you're all the way there ;-) |
| 11:01 | samaaron | does anyone know how i might discover the escape sequence for specific key combinations? |
| 11:01 | TimMc | samaaron: Context? |
| 11:01 | samaaron | TimMc: so in emacs, when I hit C-M-l emacs doesn't register it |
| 11:02 | samaaron | yet when I do C-M-SHIFT-l, emacs registers it as C-M-l |
| 11:02 | TimMc | haha, what |
| 11:02 | samaaron | which makes me wonder if my terminal is doing the right thing... |
| 11:02 | samaaron | so, my terminal (iTerm2) allows me to register escape sequences for key combos |
| 11:03 | TimMc | samaaron: Try using ESC for meta, see what happens: Esc, C-l |
| 11:04 | samaaron | TimMc: that works fine |
| 11:05 | gtrak | programming and music feel like the same mental process to me, reasoning about structure, trying to maximize aesthetics, doing one well helps the other |
| 11:07 | gtrak | I think overtone makes the connection more obvious :-) |
| 11:08 | samaaron | gtrak: that's exactly how i feel too :-) |
| 11:10 | gtrak | it's interesting stuff |
| 11:11 | samaaron | gtrak: thanks :-) |
| 11:12 | RickInGA | I need to head out. Thanks all for the good answers. ANd thanks samaaron for the new toy :) |
| 11:12 | TimMc | samaaron: So Emacs is not at fault. |
| 11:14 | samaaron | TimMc: yeah, i didn't think it was Emacs' fault |
| 11:27 | TimMc | amalloy_: While grepping my logs for something else, I noticed you said "i just wish people would stop going map->seq->map, which gets you the worst of both worlds performance-wise" -- were you talking about the general case of mapping over the keys and values of maps, or was this likely taken out of context? |
| 11:42 | axle_512_ | (+ 2 2) |
| 11:42 | clojurebot | 4 |
| 11:43 | clgv | (* 2 2) |
| 11:43 | clojurebot | 4 |
| 11:44 | axle_512_ | (pow 2 2) |
| 11:44 | dgrnbrg | ,(pow 2 2) |
| 11:44 | clgv | yeah that one is missing^^ |
| 11:44 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: pow in this context, compiling:(NO_SOURCE_PATH:0)> |
| 11:44 | axle_512_ | dang |
| 11:48 | TimMc | (+ 1 5) ; axle_512_ |
| 11:48 | clojurebot | *suffusion of yellow* |
| 11:48 | clgv | hmm the next operation fits as well 2!!2=2^2 :D |
| 11:48 | TimMc | You have to use the eval trigger, \, |
| 11:49 | clgv | ,(pow 2 2) |
| 11:49 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: pow in this context, compiling:(NO_SOURCE_PATH:0)> |
| 11:49 | clgv | ;) |
| 11:49 | axle_512_ | Why does the arithmetic operator not require the veal trigger, but pow does? |
| 11:49 | TimMc | amalloy_: It's a factoid Clojurebot has stored, that happens to be correct. |
| 11:49 | axle_512_ | veal trigger, that is. |
| 11:49 | TimMc | ugh, sorry ^ axle_512_ |
| 11:50 | axle_512_ | ah, ok |
| 11:50 | axle_512_ | ,(+ 1 5) |
| 11:50 | clojurebot | 6 |
| 11:50 | TimMc | clojurebot: (+ 2 3) is 42 |
| 11:50 | clojurebot | 'Sea, mhuise. |
| 11:50 | TimMc | ~(+ 2 3) |
| 11:50 | clojurebot | (+ 2 3) is 42 |
| 11:50 | axle_512_ | got it, thanks Tim |
| 11:52 | TimMc | clojurebot: forget (+ 2 3) |is| 42 |
| 11:52 | clojurebot | I forgot that (+ 2 3) is 42 |
| 11:52 | TimMc | Actually, that might not be part of the factoids module. It's a pretty weird bot. |
| 11:52 | axle_512_ | haha |
| 11:54 | TimMc | lazybot is faster, but doesn't allow certain constructs, such as 'binding and 'resolve (for security reasons) |
| 11:54 | bleakgadfly | ,(/ 1 998001) |
| 11:54 | clojurebot | 1/998001 |
| 11:54 | bleakgadfly | ,(/ 1 998001.0) |
| 11:54 | clojurebot | 1.002003004005006E-6 |
| 11:55 | axle_512_ | TimMc: how do you interface with lazybot? |
| 11:56 | TimMc | axle_512_: &(+ 2 2) at the beginning of a line, ##(+ 2 2) in the middle (although that only triggers for parenthesized forms) |
| 11:56 | lazybot | ⇒ 4 |
| 11:56 | cemerick | ,(with-precision 500 (/ 1 998001.0M)) |
| 11:56 | clojurebot | 0.00000100200300400500600700800901001101201301401501601701801902002102202302402502602702802903003103203303403503603703803904004104204304404504604704804905005105205305405505605705805906006106206306406506606706806907007107207307407507607707807908008108208308408508608708808909009109209309409509609709809910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113... |
| 11:56 | cemerick | bleakgadfly: ^^ |
| 11:56 | axle_512_ | &(pow 2 2) |
| 11:56 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: pow in this context |
| 11:57 | axle_512_ | TimMc: ok, thanks |
| 11:57 | TimMc | axle_512_: And there are some $commands too: |
| 11:57 | TimMc | $findfn 2 3 8 |
| 11:57 | lazybot | [] |
| 11:57 | TimMc | ^ no pow, you'll have to use Math/pow |
| 11:58 | clgv | &(Math/pow 2 2) |
| 11:58 | lazybot | ⇒ 4.0 |
| 11:58 | axle_512_ | TimMc: Can you defn to create your own functions? |
| 11:59 | TimMc | Not in a sandbox. |
| 11:59 | TimMc | You can use 'let and 'letfn, though. |
| 11:59 | axle_512_ | can you use lamdas? |
| 11:59 | TimMc | absolutely |
| 12:00 | TimMc | The problem with 'defn is the 'def bit. |
| 12:01 | axle_512_ | &(filter (fn [x] (> x 0)) [-1 0 1 2 3]) |
| 12:01 | lazybot | ⇒ (1 2 3) |
| 12:01 | axle_512_ | cool |
| 12:03 | TimMc | &(map #(* 5 %) (range -1 4)) |
| 12:03 | lazybot | ⇒ (-5 0 5 10 15) |
| 12:12 | bleakgadfly | If I want to create a library to work both on Clojure for JRE and Clojure for CLR, AND use native bindings in the same library: Is it possible to figure out, in Clojure, if the library is being run on JRE or CLR and choose to execute the part of the code which is written for the platform the library is being run for? Or would I have to create an own library for CLR and one for JRE? I'm thinking |
| 12:12 | bleakgadfly | sort of like the #ifdef you can find in some C headers that are platform-dependent. |
| 12:13 | bleakgadfly | s/the library is being run for/the library is being run on/ |
| 12:19 | TimMc | bleakgadfly: With on-the-fly compilation, you can have macros check the current runtime and set up the environment as appropriate. |
| 12:28 | jeremyheiler1 | bleakgadfly: I haven't thought about this too much, but I imagine having three projects: one of them pure clojure code, and then depend it from a java version, and a clr version, and add the platform specific stuff. you can hoose your poison for how you want to abstract it, though. In either case, it would be interesting to see how you make out with whatever solution that ends up working for you. |
| 12:33 | Bronsa | is there a funciton that returns [(take-while pred coll) (drop-while pred coll)]? |
| 12:35 | Vinzent | Bronsa, split-with? |
| 12:35 | Bronsa | thanks. |
| 12:49 | jsabeaudry | You can use defn- for functions that should not be exported. Is there something similar for constants and macros? |
| 12:51 | Vinzent | jsabeaudry, use :private metadata |
| 12:52 | jsabeaudry | Vinzent, alrighty, was curious to see if there was something less verbose that already existed, thanks! |
| 12:53 | Vinzent | jsabeaudry, defmacro- and def- was somewhere in contrib, but it looks like they won't be included in core (maybe even defn- will get deprecated someday) |
| 12:55 | JohnnyL | what's the sense of having [] over ()? |
| 12:56 | Vinzent | JohnnyL, [] is an empty vector, () is an empty list |
| 12:57 | TimMc | and you usually want vectors |
| 12:57 | jeremyheiler1 | JohnnyL: Can you provide more context, unless Vinzent answered your question. |
| 13:04 | edw | Anyone here deploying to Heroku? Is there a way to speed up deploys? 'lein deps' is making incremental development deeply painful. |
| 13:07 | TimMc | edw: I think I saw some kind of cure for that... |
| 13:12 | technomancy | edw: I'm working on a way to get dynos to support swank/nrepl connections so you can do development more interactively |
| 13:12 | technomancy | doesn't help when you need to add/remove deps of course |
| 13:12 | technomancy | though your ~/.m2 should be cached in between deploys |
| 13:21 | jcrossley3 | technomancy: is it not possible to run (swank.swank/start-server) on an app deployed to heroku? |
| 13:22 | cemerick | technomancy: BTW, waiting on Meikel for a patch containing his bencode impl at the moment. nrepl-over-http was a snap, though some thought will need to go into the correspondence (or not) of HTTP sessions to nrepl sessions. |
| 13:23 | bartj | I would like to parse HTML DOM to compare HTML nodes |
| 13:23 | technomancy | jcrossley3: it is possible, but right now the routing mesh only routes HTTP requests, not raw sockets. we are working on a raw TCP router, but it's not ready yet. |
| 13:23 | bartj | on the looks of it, Enlive does not like like the right library |
| 13:23 | bartj | can someone please suggest an option ? |
| 13:24 | technomancy | jcrossley3: even with the TCP router, each process can only listen on a single port, so your swank server process couldn't also respond to HTTP requests. |
| 13:24 | jcrossley3 | technomancy: i was *JUST* about to ask that. :) |
| 13:24 | TimMc | bartj: Enlive scrapes HTML into a pretty regular data structure, what's wrong with it? |
| 13:24 | technomancy | jcrossley3: my plan is to get it to make an outbound SSH connection to a proxy server that can reverse-tunnel |
| 13:25 | Vinzent | bartj, standard clojure xml tools + some java html parser lib |
| 13:25 | technomancy | cemerick: yeah, really looking forward to trying that out. |
| 13:25 | JohnnyL | jeremyheiler: what makes [a b] in use rather than (a b) <--clojure newb |
| 13:25 | bartj | scraping assumes you *know* the structure of the HTML page before hand |
| 13:26 | bartj | but, what if you want to parse it, get the first child, sibling, descendants, etc. |
| 13:26 | bartj | which led me to conclude that it might not be what I need |
| 13:26 | jcrossley3 | technomancy: so with the proxy server, that preserves the HTTP port for the process, right? so i could do both? |
| 13:27 | jeremyheiler1 | a vector is constant time look up and you append things at the end. a list is linear lookup, and appends things at the beginning. |
| 13:27 | jeremyheiler1 | JohnnyL: ^ |
| 13:27 | technomancy | jcrossley3: yup |
| 13:27 | jcrossley3 | cool |
| 13:28 | cemerick | technomancy: right now, I just have a ring-suitable handler fn that does what seems like a sane transformation from HTTP req -> nrepl req -> HTTP response. Some thought will need to go into figuring out the best HTTP representation and maybe "standard" routes so non-Clojure tools can have a shot at using the endpoint sanely. |
| 13:29 | JohnnyL | jeremyheiler: ok |
| 13:29 | technomancy | cemerick: is this public anywhere? |
| 13:29 | JohnnyL | jeremyheiler: are vectors hashes? |
| 13:30 | jeremyheiler1 | JohnnyL: Also, vectors are generally preferred because by default lists will be invoked as a function call unless quoted. |
| 13:30 | bereal | Hi. what is fn*, please ? |
| 13:30 | jeremyheiler1 | JohnnyL: vectors are more like indexed arrays (at face value) |
| 13:30 | bereal | as in the output of (macroexpand '(fn [] 1)) |
| 13:31 | cemerick | technomancy: not yet; blocking on a patch to get https://bitbucket.org/kotarak/wire into nREPL w/ some fixes (can't have outside deps in contrib). Shouldn't be long, last I heard. |
| 13:31 | jeremyheiler1 | bereal: it's an internal function used by clojure as it's bootstrapping itself, i believe. |
| 13:32 | technomancy | cemerick: cool; let me know once it's ready |
| 13:32 | bereal | jeremyheiler1: aha, so it's not useful for a regular coder |
| 13:34 | bartj | TimMc, do you concur ? |
| 13:37 | TimMc | sorry, working atm |
| 13:40 | TimMc | bartj: OK, caught up. No, Enlive parses the whole page and hands it to you as a DOM tree. |
| 13:40 | TimMc | You can run selectors on it. |
| 13:41 | jeremyheiler1 | bereal: Actually, looking at the code, I think fn* is the function that internally represents fn, which is a special form. |
| 13:44 | bartj | I am unable to do any searches on Google for enlive related stuff. eg: [clojure enlive dom tree] |
| 13:45 | bartj | the only stuff Google returns is clojurescript related. Bah! |
| 13:45 | bartj | and even "-clojurescript" doesn't lead anywhere |
| 13:47 | TimMc | You may want to use verbatim search, which is their new option to replace + |
| 13:47 | JohnnyL | thanks jeremyheiler. |
| 13:48 | bartj | TimMc, do you have any references/code samples ? |
| 13:48 | TimMc | bartj: Sort of -- it doesn't use Enlive for what you want to do, probably. https://github.com/timmc/seqs-and-colls/blob/master/src/seqs/core.clj |
| 14:09 | gfredericks | I'm trying to learn enlive...what select would I use for "all p tags that come after h2 tags"? |
| 14:10 | gfredericks | s/select/selector |
| 14:14 | amalloy | TimMc: i'm mostly echoing hiredman's objection, that if you are treating a map as just a sequence of k/v pairs, you're spending cpu time and cluttering up your source code by converting it to a sequence, then back to a map, over and over as each step of your application says it "needs" a map but actually treats it as a seq |
| 14:15 | amalloy | better to do as much transformation as you can on the k/v pairs, and slam it back into a map only when code you don't own finally needs a map |
| 14:15 | dnolen | gfredericks: not sure if you can get just the p tags, but you can definitely get a range h2 p |
| 14:17 | TimMc | gfredericks: In CSS, that would be something like h2 + p or h2 ~ p |
| 14:18 | gfredericks | hmm |
| 14:18 | gfredericks | I was trying things like [:p :> :h2] |
| 14:18 | gfredericks | based on browsing the source code |
| 14:19 | gfredericks | the function called "left" sounds related based on its docstring |
| 14:22 | TimMc | gfredericks: > is the child selector |
| 14:43 | technomancy | trying to track down a leiningen bug; does anyone know of a :type "pom" dependency I could use to test? |
| 14:49 | fliebel | Hey awesome community, long time no see |
| 14:50 | mrb_bk | leiningen question: i'm trying to use the edge checkout of overtone in my project. i symlink to the project directory from /checkouts, and leave overtone in the project.clj |
| 14:50 | mrb_bk | but it's forcing me to use a version number -- what do i use? |
| 14:51 | mrb_bk | or do i not have to put overtone in the project.clj? |
| 14:51 | samaaron | mrb_bk: putting overtone in project.clj shouldn't make a difference |
| 14:51 | technomancy | whatever the newest published version of overtone is |
| 14:51 | samaaron | yoru checkout dir should take precidence |
| 14:52 | technomancy | no, you need it in project.clj; otherwise you won't get deps |
| 14:52 | technomancy | checkout dependencies aren't transitive |
| 14:52 | mrb_bk | technomancy: whatever the most recent version # on clojars is? |
| 14:52 | technomancy | should be |
| 14:52 | samaaron | technomancy: i still haven't switched from cake, so i'm still unsure of the process of doing this with lein |
| 14:53 | mrb_bk | okay i'll try that again, before it seemed like it wasn't actually taking precedence |
| 14:53 | technomancy | mrb_bk: whoever checks out your project should be able to make it work with the version in project.clj; checkout deps are only there for your convenience |
| 14:53 | samaaron | but in cake you can specify the dep in project.clj but that is overridden if you put a project dir in the classpath |
| 14:53 | technomancy | mrb_bk: if you need to check which is taking precedence, you can inspect "lein classpath" |
| 14:53 | mrb_bk | technomancy: that's interesting, but doesn't it make sense to be able to specify edge code? |
| 14:53 | mrb_bk | for example if certain examples won't work in the published version |
| 14:54 | technomancy | mrb_bk: then you'd want a snapshot |
| 14:55 | samaaron | technomancy: so when i'm hacking overtone I use a scratchpad project which never gets shared with others |
| 14:55 | mrb_bk | technomancy: sure, that makes sense |
| 14:55 | technomancy | if the project isn't publishing snapshots frequently enough you can always locally do "lein install" from your checkout dir, but that is a breakdown of the normal process; it's not the usual case |
| 14:56 | samaaron | the aim being to be able to hack on a dep of the scratchpad project (overtone) without having to worry about teaching the scratchpad project about the exact specifics of the version of overtone i'm working with |
| 14:57 | technomancy | samaaron: so you want the dependencies of the checkout dep to apply transitively? |
| 14:57 | mrb_bk | technomancy: thanks a lot! it seems like the classpath has the dir of my checked out version, but the published jar is also there |
| 14:57 | samaaron | technomancy: i'm unsure of what you specifically mean by "transitively" in this context |
| 14:58 | technomancy | samaaron: if "scratchpad" has overtone in its project.clj, overtone's dependencies come in via overtone's pom. you have overtone as a checkout dependency in addition to a regular dependency, and that should give you both overtone's dependencies as well as its source straight on the classpath. |
| 14:59 | technomancy | but having it as a checkout deps *without* putting it in project.clj won't work because overtone's deps won't be visible to scratchpad |
| 14:59 | samaaron | technomancy: does that give me the source as a git checkout? |
| 14:59 | technomancy | right |
| 14:59 | samaaron | ok cool |
| 15:00 | samaaron | so a checkout dependency is a git uri? |
| 15:00 | technomancy | no, it's a checkout |
| 15:00 | amalloy | it's just a directory |
| 15:00 | amalloy | you point it at your existing git checkout (usually with a symlink) |
| 15:00 | technomancy | cd scratchpad; mkdir checkouts; cd checkouts; git clone git@github.com/overtone/overtone.git |
| 15:00 | technomancy | (or symlink) |
| 15:00 | samaaron | ok, and i choose how to populate that directory |
| 15:00 | mrb_bk | technomancy: should the other jar not be in that classpath? or should it |
| 15:01 | technomancy | mrb_bk: fewer pronouns please? =) |
| 15:01 | mrb_bk | technomancy: haha sorry |
| 15:01 | mrb_bk | technomancy: the overtone 0.6.0 jar is showing in the classpath, along with the directory i symlinked to in checkouts |
| 15:01 | mrb_bk | technomancy: lein classpath that is |
| 15:01 | samaaron | mrb_bk: which appears first? |
| 15:02 | mrb_bk | samaaron: checkouts |
| 15:02 | technomancy | mrb_bk: yeah, as long as the checkout is first, it should "win" |
| 15:03 | samaaron | sounds like a RACE! |
| 15:03 | ckirkendall | acagle: ping |
| 15:03 | mrb_bk | technomancy: yay |
| 15:03 | samaaron | go checkout! |
| 15:05 | mrb_bk | samaaron: okay now i'm getting an error FileNotFoundException Could not locate seesaw/core__init.class or seesaw/core.clj on classpath: clojure.lang.RT.load (RT.java:430) |
| 15:07 | samaaron | mrb_bk: sounds like a dep issue - I'm assuming the deps in the checkout of overtone edge don't match overtone 0.6 |
| 15:07 | mrb_bk | yeah :/ |
| 15:07 | mrb_bk | technomancy: any thoughts? or is this a lib issue? |
| 15:08 | samaaron | technomancy: what's the lein-idiomatic solution for dealing with a checkout dep with different deps to the released jar? |
| 15:09 | technomancy | samaaron: I'd recommend pushing a new snapshot whenever your deps change |
| 15:09 | technomancy | snapshots are cheap |
| 15:09 | jondot2 | hi guys. trying to make an HTTP get, should i go with whats in contrib or there is the way to stay in core for this? |
| 15:09 | samaaron | mrb_bk: i usually circumnavigate that problem by just hacking in the different deps to my scratch project's project.clj |
| 15:09 | samaaron | technomancy: sounds sensible |
| 15:09 | mrb_bk | ah, it works after 'lein install' |
| 15:09 | brehaut | jondo2: ideally you want clj-http, otherwise you can just stick with java.net.URL (which is crappy) |
| 15:09 | mrb_bk | oh wait no it doesn't |
| 15:09 | mrb_bk | haha |
| 15:10 | edw | technomancy: You mentioned 'my' ~/.m2; does my Heroku account have one of those? |
| 15:10 | mrb_bk | samaaron: can haz snapshot? |
| 15:11 | samaaron | mrb_bk: working on it right this moment - had to shake the cat of my chest |
| 15:11 | samaaron | s/of/off/ |
| 15:11 | technomancy | edw: yeah, it's cached in between builds, but I'm a bit fuzzy on when the cache gets cleared. |
| 15:11 | mrb_bk | hahah thanks |
| 15:11 | mrb_bk | the cat of your chest? |
| 15:11 | samaaron | yep, my cat |
| 15:11 | mrb_bk | i hope the dog of your head isn't scaring her too much |
| 15:11 | samaaron | luckily the dog is away for a week |
| 15:11 | technomancy | edw: I have seen a few cases where the cache isn't being respected; if you have a repeatable case of this I could take a look. |
| 15:12 | johncourtland | has anyone had (proxy) throw ClassCastException: clojure.asm.Type cannot be cast to clojure.lang.IFn in clj 1.3? |
| 15:12 | jondot2 | so lein is using maven to handle the heavy lifting? |
| 15:12 | edw | Hmm. I'm inquiring over on #heroku. |
| 15:12 | johncourtland | i have no idea how it gets in that state |
| 15:13 | technomancy | edw: don't bother; that channel is a wasteland. =( |
| 15:14 | technomancy | half the traffic is that stupid broken bot announcing itself over and over and the other half is rails questions |
| 15:14 | edw | Hey, I'm actually getting a human who works there checking with their Java dudes. A first time for everything! |
| 15:15 | muhoo | i wouldn't be surprised if 90% of heroku apps are rails |
| 15:15 | edw | Given that up until 3-6 mo ago, 100% were RoR... |
| 15:16 | technomancy | edw: I need to grab lunch in a few, but give me a ping later if you haven't resolved the caching issue. |
| 15:16 | jsabeaudry | Is keep-indexed the most idiomatic way to keep every second value of a sequence? (keep-indexed #(if (odd? %1) true nil)) [1 2 3 4]) |
| 15:17 | edw | technomancy: Thank you. Will do. |
| 15:18 | brehaut | jsabeaudry: take-nth |
| 15:18 | brehaut | ,(take-nth 2 (range 10)) |
| 15:18 | clojurebot | (0 2 4 6 8) |
| 15:18 | brehaut | ,(take-nth 2 (rest (range 10))) |
| 15:18 | clojurebot | (1 3 5 7 9) |
| 15:19 | jsabeaudry | brehaut, Ah nice, thanks! That long keed-indexed line was suspicious :) |
| 15:20 | johncourtland | is anything wrong with this (as a test)?: (proxy [java.lang.Object] [] (toString [] "proxy's toString")) |
| 15:20 | amalloy | johncourtland: no, though i'd prefer reify |
| 15:21 | johncourtland | i thought you could only implement interfaces/protocols via reify |
| 15:21 | brehaut | johncourtland: object is the exception |
| 15:22 | johncourtland | ok, good to know |
| 15:22 | johncourtland | i'm actually having issues compiling clojure.logging from within a grails runtime |
| 15:22 | johncourtland | it has a proxy to ByteArrayOutputStream in there |
| 15:23 | johncourtland | and using clojure 1.3, i get that exception i asked about (ClassCastException: clojure.asm.Type cannot be cast to clojure.lang.IFn) |
| 15:23 | samaaron | technomancy: what's the situation with lein 2.0? Is it on the immediate horizon? |
| 15:23 | johncourtland | in 1.2 it works fine |
| 15:23 | johncourtland | i have tried tracing code for days and i'm not seeing any reason that it should be trying to apply clojure.asm.Type |
| 15:24 | johncourtland | so i tried that simple proxy and i get the same issue |
| 15:26 | johncourtland | the only thing i can think of is that the grails runtime is causing proxy to behave poorly, because it obviously works fine outside of grails itself |
| 15:27 | cwardell | Help needed. I am trying to load a .clj file from within a java jar. I am getting an error: Could not locate Clojure resource on classpath. My call is just a RT.loadResourceScript(cljPath) - The cljPath is a string holding the path to a hello-world.clj relative to the jar file. Any ideas? |
| 15:29 | hiredman | is the resource on the classpath? |
| 15:30 | danlarkin | ohhhhhhh burnnnnnnnnnnnn |
| 15:30 | hiredman | ~burn |
| 15:30 | clojurebot | Pardon? |
| 15:31 | cwardell | yes |
| 15:31 | muhoo | &(def burn "ouuuch!") |
| 15:31 | lazybot | java.lang.SecurityException: You tripped the alarm! def is bad! |
| 15:31 | hiredman | ~burn |
| 15:31 | clojurebot | what |
| 15:32 | cwardell | the resource is place on the class path with the other jar. |
| 15:32 | muhoo | so does that error mean it can't locate Clojure (i.e. clojure.jar is not on cp), or that it can't locate the foo.clj file? |
| 15:33 | muhoo | also, wait a minute. clojure is compiled. why would it need a foo.clj file to run a clojure program from java? |
| 15:33 | muhoo | wouldn't you just compile the clojure source, make a jar of the classes, and then use them like any other java classes (also including any deps in the cp too)? |
| 15:34 | cwardell | I believe it finds the clojure jar ok. That was assembled into my jar. It's the *.clj that I am trying to pull in at runtime |
| 15:34 | jondot2 | whats an idiomatic way to update a single key of a hash within a hash ? |
| 15:34 | muhoo | cwardell: and i have to wonder: why? |
| 15:35 | jeremyheiler1 | jondot2: update-in |
| 15:35 | cwardell | I have a java app that I would like to extend with clojure. |
| 15:35 | jondot2 | jeremyheiler, thanks - how would that relate to assoc? |
| 15:35 | cwardell | Having end-users writing code in clojure and have my java app execute the functionality. |
| 15:36 | muhoo | oh, ok |
| 15:36 | jeremyheiler1 | &(update-in {:a {:b 1}} [:a :b] #(inc %)) |
| 15:36 | lazybot | ⇒ {:a {:b 2}} |
| 15:36 | jeremyheiler1 | There's also assoc-in |
| 15:36 | jondot2 | jeremyheiler i see. i would need assoc-in imho |
| 15:38 | jeremyheiler1 | jondot2: This assumes that you know the path to the value, though. |
| 15:38 | jondot2 | yes, i know it |
| 15:38 | jeremyheiler1 | cool, just being explicit :-) |
| 15:38 | muhoo | cwardell: i dunno. i'd guess treat it like it was a repl, use the regular (require ) stuff? |
| 15:38 | jondot2 | yup, thanks! |
| 15:40 | amalloy | you probably don't want assoc-in to do dissocs; update-in is more general and useful for this |
| 15:41 | jondot2 | there are so many ways to shape the braces, i wonder if any LISP convention is valid for clojure ? |
| 15:41 | amalloy | &(let [m {:a 1 {:b 2 :c 3}]] (update-in m [:a] dissoc :c)) |
| 15:41 | lazybot | java.lang.RuntimeException: Unmatched delimiter: ] |
| 15:41 | amalloy | &(let [m {:a 1 {:b 2 :c 3}}] (update-in m [:a] dissoc :c)) |
| 15:41 | lazybot | java.lang.RuntimeException: Map literal must contain an even number of forms |
| 15:41 | amalloy | &(let [m {:a {:b 2 :c 3}}] (update-in m [:a] dissoc :c)) |
| 15:41 | lazybot | ⇒ {:a {:b 2}} |
| 15:41 | jkdufair | i'm having a problem with clojure-jack-in. "couldn't find project.clj". I'm in a dired buffer with a project.clj. Also lein swank seems to start up just fine |
| 15:41 | cwardell | ok thanks muhoo |
| 15:41 | edw | jkdufair: Did you M-x cd to the dir? |
| 15:42 | amalloy | jondot2: you mean where to put the parens? that's more or less a solved problem |
| 15:42 | jkdufair | lemme try that |
| 15:42 | edw | Or M-x shell and cd there. |
| 15:42 | jondot2 | i'm trying to mimick what other people do, so far i'm learning from nathanmarz' storm. he likes to leave the closing brace in case of let vertical to the indent. |
| 15:42 | jondot2 | amalloy, yes |
| 15:43 | jondot2 | my code looks like a wacky closing paren case. |
| 15:43 | amalloy | mostly the answer is "let emacs do all the indenting; don't put trailing parens on their own line" |
| 15:43 | jondot2 | in my case - i'm using vim |
| 15:43 | edw | "Now you have two problems." |
| 15:43 | jondot2 | haha |
| 15:43 | jeremyheiler1 | jondot2: Are you using vimclojure? |
| 15:43 | jkdufair | edw: alas, neither seems to have helped |
| 15:43 | jondot2 | yes its starting to come to me that when i did scheme i never worried about this (was using emacs at the time). yes, vimclojure |
| 15:44 | jkdufair | any other ideas? |
| 15:44 | amalloy | my understanding is there are paredit-like features for vim that make this not-too-onerous |
| 15:44 | TimMc | amalloy: The one thing tha makes me want trailing parens on their own line is the cleanliness of the resulting diffs. :-P |
| 15:44 | amalloy | ugh i know |
| 15:44 | jeremyheiler1 | with you on that one TimMc... and just general code refactoring |
| 15:44 | amalloy | how does refactoring enter the discussion at all? |
| 15:45 | jondot2 | TimMc, i thought it is typically done for do like forms, where it is probably that people can add statements (side effects) vertically. |
| 15:45 | Raynes | There is nothing in the world that would ever make me want to put closing parens on their own line. |
| 15:45 | jeremyheiler1 | amalloy: eh, yank and put by lines (same reason as for diff) |
| 15:45 | amalloy | solution: never do that? use paredit to kill/yank balanced forms |
| 15:46 | amalloy | or one of vim's balanced-pair equivalents |
| 15:46 | jondot2 | look here: https://github.com/nathanmarz/storm/blob/master/src/clj/backtype/storm/cluster.clj |
| 15:47 | jondot2 | nathan typically leaves a trailing paren so that it will be convenient to add lines (without finding an splicing the correct paren) |
| 15:47 | amalloy | that style is not at all common. nathan can do what he wants, i guess, but most newbies doing that get taken to task |
| 15:47 | jkdufair | i also see that my emacs has no slime whatsoever. does that matter? |
| 15:47 | jkdufair | i just installed clojure-mode from marmalade and swank-clojure plugin for lein |
| 15:47 | jkdufair | i'm on cygwin |
| 15:48 | jkdufair | other pc with cygwin is ok as is my mac. looking thru buffers for more detail but nothing yet |
| 15:48 | edw | TimMc: wouldn't it be nice if we had a symbolic, not lexical, 'diff'? |
| 15:48 | amalloy | jkdufair: clojure-mode bundles its own version of slime these days |
| 15:48 | amalloy | so i don't think you need it, assuming you use clojure-jack-in |
| 15:49 | ordnungswidrig | edw: there is https://github.com/brentonashworth/clj-diff |
| 15:49 | jkdufair | ok that's what i thought. any idea where else to look? |
| 15:50 | amalloy | huh? look for what? |
| 15:50 | jondot2 | is there any historical reason as to why parens should never be left on their own line? |
| 15:51 | Raynes | My reason is simple: it is hideous. |
| 15:52 | amalloy | it's a line of vertical space wasted for no reason, and encourages bad habits like trying to visually match opening and closing parens |
| 15:52 | jondot2 | to my fresh (read: newbie) eyes it looks practical and less error prone |
| 15:52 | jkdufair | ok, strangely when i run emacs -nw, i get the following: no such file or directory, /cygdrive/e/dev/clojurecraft/c:/users/jase/.emacs.d/swank/slime-dbd975fa.el |
| 15:52 | jkdufair | wtf? |
| 15:52 | jkdufair | this is as a result of clojure-jack-in |
| 15:53 | mrb_bk | technomancy: that worked a treat, thank you! |
| 15:53 | TimMc | edw: Absolutely, I'd love structural diff. |
| 15:53 | brehaut | jondot2: your text editor should support paren management for you. you shouldnt be counting them yourself. |
| 15:54 | jondot2 | i see. |
| 15:54 | brehaut | jondot2: once you learn the basics of structural editing (aka paredit) you dont want to go back to editing lisp as text |
| 15:54 | jondot2 | i'll give it a try. is paredit a vim specific thing? |
| 15:55 | emezeske | jondot2: paredit is an emacs thing, but somebody created a vim plugin that does pretty much the same thing |
| 15:57 | brehaut | theres also support for it in CCW, the eclipse clojure support stuff |
| 15:57 | jondot2 | ah. i see. |
| 16:04 | jondot2 | how bad is it if i'm naming things with snake_case (and not hypen-case)? |
| 16:04 | jondot2 | specifically, let variables |
| 16:04 | brehaut | its pretty bad |
| 16:04 | amalloy | jondot2: someone will murder you in your sleep |
| 16:04 | jondot2 | ah damn. |
| 16:04 | brehaut | best case: you're code will be treated like a leper |
| 16:05 | jondot2 | well, is that true for hash keys as well? |
| 16:05 | pjstadig | jondot2: it's so ugly...why? |
| 16:05 | amalloy | yes, unless you're getting those hashes from some other language |
| 16:05 | TimMc | also, extra shift key |
| 16:05 | jondot2 | yea.. i'm replacing.. |
| 16:05 | pjstadig | TimMc: yes, it's very annoying to type |
| 16:05 | amalloy | (eg, when you convert a java object to a hash and back, it's okay to use camelCase keys) |
| 16:06 | TimMc | so is Java |
| 16:06 | TimMc | BAZINGA |
| 16:06 | pjstadig | i think you mean clabango |
| 16:06 | brehaut | thanks sheldon |
| 16:06 | pjstadig | ~suddenly |
| 16:06 | clojurebot | BOT FIGHT!!!!!111 |
| 16:06 | pjstadig | ~suddenly |
| 16:06 | clojurebot | BOT FIGHT!!!!!111 |
| 16:06 | ordnungswidrig | jkdufair: I got a similiar glitch with emacs and clojure-jack-in on windows. I do not use cygwin but emacs and leiningen jack-in disagree on my home directory. |
| 16:06 | amalloy | one thing that lisp has going for it is that there's actually a global style that people mostly agree on |
| 16:07 | ordnungswidrig | thus having c:/documents and settings/USER/.emacs as well as c:/documents and settings/USER/Local Settings/.emacs |
| 16:07 | amalloy | compared to the C-like languages, where every language has five prevalent styles, each with minor variations, that people fight over within the same team |
| 16:07 | hiredman | I wrote this sweet function at work the other day called mirror, that given an object return an object that implemented ILookup and would get the values of all fields (even private ones) from the original object |
| 16:07 | amalloy | oh god, reflection pun? |
| 16:08 | brehaut | hiredman: how dies that differ from bean? |
| 16:08 | hiredman | so then you could (let [{x :somePrivateField} (mirror something)] ...) |
| 16:08 | brehaut | jondot2: http://mumble.net/~campbell/scheme/style.txt |
| 16:08 | hiredman | brehaut: as far as I know bean doesn't access private fields, does it? |
| 16:08 | brehaut | hiredman: oh right. of course |
| 16:08 | jondot2 | brehaut, thanks i was actually looking for that, my memory fails me. |
| 16:08 | pjstadig | hiredman: should have been called refraction instead |
| 16:09 | amalloy | magic-mirror |
| 16:09 | hiredman | and actually I needed a bunch of private fields |
| 16:10 | hiredman | (let [{x :somePrivateField y :someOther z :andAnother} (mirror something)] ...) |
| 16:14 | TimMc | amalloy: No, just a joke about how terrible Java's so-called type system is. |
| 16:14 | amalloy | TimMc: i was referring to hiredman's name "mirror" |
| 16:15 | TimMc | ah |
| 16:23 | technomancy | samaaron: the plan is to release a preview of lein2 for ClojureWest |
| 16:23 | technomancy | although it's starting to look like it might be ready earlier |
| 16:24 | samaaron | technomancy: perfect - my plan was to not spend the time switching until lein2 was out |
| 16:24 | technomancy | samaaron: the main things blocking the preview is integration of the new repl and native-deps. |
| 16:24 | samaaron | so I only had to update all the Overtone docs once :-) |
| 16:24 | technomancy | once Raynes lands native-deps you might be ready to roll |
| 16:25 | samaaron | technomancy: great - I can also test the native-deps stuff with my monome lib |
| 16:25 | technomancy | right now all that stuff is commented out; Raynes volunteered to bring it back in line with 2.0 since I threatened to release the preview without it. =) |
| 16:27 | technomancy | we're also missing shell-wrappers, javac, and trampoline; those won't land till after the preview. |
| 16:30 | samaaron | technomancy: what's the difference between compile and javac? |
| 16:31 | technomancy | samaaron: compile does Clojure AOT |
| 16:31 | TimMc | compile does AOT compilation on Clojure, right? |
| 16:31 | technomancy | in 1.x it implicitly called javac, in 2.x it's a bit different |
| 16:31 | samaaron | ah ok :-) |
| 16:32 | technomancy | javac can probably be addressed by just updating the plugin; it doesn't necessarily need to be fixed in lein itself |
| 16:33 | samaaron | technomancy: does Leiningen's moustaches improve in 2.0? |
| 16:33 | samaaron | so/does/do/ |
| 16:33 | amalloy | technomancy: did lein ever solve the problem of co-dependency between java and clojure? eg, if you have some java code that depends on a clojure deftype you need to AOT-compile the deftype, then compile java, then do whatever else is left |
| 16:34 | technomancy | samaaron: actually the image on the new stickers are done from scratch since the old ones weren't high-res; I would say that they have a more regal shape to the nose. |
| 16:34 | technomancy | moustache remains about the same though. =) |
| 16:34 | samaaron | :-) |
| 16:34 | samaaron | it would be fun to see it grow as the tool matures ;-) |
| 16:35 | technomancy | amalloy: I told nathanmarz to go ahead implement that in a plugin, but he never did =) |
| 16:36 | samaaron | technomancy: so what was it about the new stickers that you weren't quite happy with? |
| 16:36 | technomancy | I don't imagine it would be too tricky to just accept sequential :source-path/:java-source-path alterations |
| 16:37 | technomancy | samaaron: they have a transparent background |
| 16:37 | samaaron | didn't you expect that? |
| 16:37 | technomancy | looks fine on a white or metal laptop; not so hot on a black one |
| 16:38 | samaaron | ah, so Leiningen fades into the black background |
| 16:38 | technomancy | I think I just didn't read through the printing order form or something |
| 16:38 | samaaron | did you want a white background? |
| 16:39 | technomancy | yeah, that's what the first run had |
| 16:39 | technomancy | and also what successive runs will probably have |
| 16:39 | technomancy | since I personally have a black laptop =) |
| 16:39 | samaaron | i definitely need to get my mitts on a few transparent ones then ;-) |
| 16:39 | samaaron | limited edition! |
| 16:39 | jsabeaudry | Is it possible for a macro to expand to 2 sexps instead of 1? |
| 16:40 | technomancy | hehe |
| 16:40 | ordnungswidrig | jsabeaudry: wrap it in progn |
| 16:40 | amalloy | jsabeaudry: no |
| 16:40 | technomancy | it'll look fine on black if you put the sticker on a white mailing label or something |
| 16:41 | jsabeaudry | ordnungswidrig, Doesn't really apply here, and you probably mean in do (i think prog is in common lisp |
| 16:41 | jsabeaudry | amalloy, alrighty, too bad thanks for the info |
| 16:41 | amalloy | i'm sure there's a simple way to do what you want to do, though |
| 16:42 | amalloy | (ie, you're attempting to solve an impossible subproblem isntead of a tractable real-problem) |
| 16:43 | ordnungswidrig | jsabeaudry: yes, it was common lisp. |
| 16:45 | jsabeaudry | amalloy, Yes, well two short macros are not much long to write than one short macro I guess :) |
| 16:45 | jsabeaudry | amalloy, I'm not really providing abstraction I'm DRYing |
| 16:48 | ordnungswidrig | is there a smart way to check a reader for more to come? |
| 16:49 | ordnungswidrig | is it safe for a pushbackreader to read and unread a single byte for this? |
| 16:54 | technomancy | anyone know of a dependency of :type "pom" I could test against for a Leiningen bug? |
| 16:58 | TimMc | technomancy: That was discussed last week, I think. Let me check my logs. |
| 17:01 | Raynes | yaml.load(open(os.path.expanduser('~/.refh.yml')).read())['token'] |
| 17:01 | Raynes | Clojure has too many parentheses. |
| 17:02 | gtrak | wtf is that ruby? |
| 17:02 | Raynes | No. Python. |
| 17:02 | gtrak | ha, I actually know python |
| 17:02 | TimMc | technomancy: [org.kohsuke/pom "2" :type "pom"] [javax.media/jai_core "1.1.3" :type "pom"] I think |
| 17:02 | technomancy | TimMc: thanks! |
| 17:02 | TimMc | Don't take my word for it. |
| 17:05 | technomancy | apparently eclipse freaks out if you have pom files in lib =( |
| 17:05 | mabes | does 1.3 world have something like re-gsub (http://clojuredocs.org/clojure_contrib/clojure.contrib.str-utils/re-gsub) ? |
| 17:06 | amalloy | &(doc clojure.string/replace) |
| 17:07 | amalloy | (there wasn't really any reason to use re-gsub in 1.2 either; it's a holdover from 1.1 i think) |
| 17:08 | diginet | so, I've heard clojure is the most "pure" lisp |
| 17:08 | diginet | or |
| 17:09 | diginet | the most purely functional |
| 17:09 | TimMc | Who told you that? |
| 17:09 | diginet | (LispKit, and other notwithstanding) |
| 17:09 | diginet | people in #lisp |
| 17:09 | mabes | amalloy: thanks |
| 17:09 | TimMc | diginet: Well, it does have that focus on immutability, so that's a + |
| 17:09 | Raynes | &(doc clojure.string/replace) |
| 17:09 | lazybot | ⇒ "([s match replacement]); Replaces all instance of match with replacement in s. match/replacement can be: string / string char / char pattern / (string or function of match). See also replace-first." |
| 17:10 | technomancy | so... leiningen will place directories in lib/ on the classpath right now, sort of by accident |
| 17:10 | diginet | so, is it possible to write clojure code without side effects? |
| 17:10 | technomancy | would it be horrible to be stricter and only use files in lib/? if you need dirs on the classpath you should use :extra-classpath-dirs anyway |
| 17:11 | TimMc | diginet: Sure. (+ 2 2) is probably simpler than you wanted, though. |
| 17:11 | diginet | err, what I mean is write anything non-trivial without side effects |
| 17:11 | TimMc | If you start asking about I/O monads I'll have to refer you to a Haskeller. |
| 17:12 | diginet | no I know, I tried Haskell, but I found the syntax not to likable |
| 17:12 | diginet | *too |
| 17:12 | technomancy | diginet: it's customary and idiomatic to avoid side-effects in as much code as possible, but the compiler will not catch you if you accidentally sneak one in. |
| 17:13 | TimMc | Anything interesting involves side effects, or is a lib for something that does. The designers of Clojure put a lot of work into increasing the safety and reasonableness of how those side effects are coordinated. |
| 17:13 | diginet | well, that sounds what I'm looking fo |
| 17:13 | diginet | t |
| 17:13 | diginet | *for |
| 17:13 | diginet | obviously, at the end of the day, without side effects we just have a hot CPU, but minimizing them is preferable IMO |
| 17:14 | mintsoup | you can write code like that in any language though |
| 17:14 | TimMc | mintsoup: I dunno, is it even possible in Java? |
| 17:14 | diginet | sure you /could/ |
| 17:14 | diginet | I wouldn't want to necesarily |
| 17:15 | TimMc | I have definitely written Cons.java once or twice. It was natural for the task, but did not fit the language one bit. |
| 17:20 | tjgillies | just started seriously looking at clojure the other day. Now I think its the best language I've ever seen |
| 17:21 | tjgillies | how are "lines of code" counted in lisps? or do you just say how many s-exp there are? |
| 17:21 | TimMc | Source lines. *shrug* |
| 17:22 | TimMc | I'd like to see a comparison of that with source forms, but I assume it's proportional. |
| 17:22 | technomancy | gaming LOC can be done in any language |
| 17:22 | tjgillies | whats a source line? |
| 17:23 | TimMc | LIne with sourc eon it. |
| 17:23 | technomancy | I guess the main problem with counting source lines in Clojure is that all the existing tools penalize you for docstrings. |
| 17:23 | TimMc | Not blank or only containing a comment. |
| 17:23 | TimMc | technomancy: penalize? |
| 17:23 | tjgillies | TimMc: thnx |
| 17:26 | amalloy | TimMc: they count as source lines. technomancy is minimizing, not maximizing |
| 17:26 | Somelauw | I think clojure is actually nice to read. When I see some common lisp, I really need to think for a while what it is saying. |
| 17:26 | TimMc | ah |
| 17:26 | technomancy | I'm assuming they know how to skip docstrings in CL/Scheme |
| 17:27 | technomancy | sloccount and friends |
| 17:27 | TimMc | amalloy: As opposed to the GitHub situation. |
| 17:31 | lucian | same happens in othe rlanguages with docstrings |
| 17:32 | lucian | i tend to find that loc in a sanely-written program is directly proportional to the effort to read it |
| 18:17 | dgrnbrg | How does slingshot interact with map's laziness? If I map a function that throw+s an object over a collection, is there a good way to ensure I can catch the error at the site that I declare write the map short of using doall? |
| 18:20 | technomancy | dgrnbrg: slingshot doesn't really factor into it; any exception will be thrown when the seq is realized, not when it's created |
| 18:20 | technomancy | you either need to perform the catch inside the function you're mapping or force it to be realized with a doall inside the appropriate try/catch |
| 18:21 | dgrnbrg | Thanks, that's what I thought would be the case |
| 18:21 | dgrnbrg | I just wasn't sure if slingshot had other features to assist |
| 19:11 | mabes | is there a with-out-writer macro alternative in clojure 1.3? |
| 19:12 | amalloy | &(doc with-out-str) |
| 19:12 | lazybot | ⇒ "Macro ([& body]); Evaluates exprs in a context in which *out* is bound to a fresh StringWriter. Returns the string created by any nested printing calls." |
| 19:12 | amalloy | or did you just want (binding [*out* (writer f)] ...)? |
| 19:15 | mabes | (binding [*out* (writer f)] ...) |
| 19:15 | mabes | well, and it uses with-open to make sure the writer is closed |
| 19:18 | phil___ | is there a way to let a defrecord implement IAssociative in clojure or is this cljs only? |
| 19:21 | dnolen | phil___: not necessary, Java has interface inheritance, defrecord implement IPersistentMap which extends Associative |
| 19:23 | phil___ | dnolen: so should i just implement clojure.lang.Associative or must I do it for all classes like PersistentMap/Vector/Set etc? |
| 19:23 | unlink | What is the Ring equivalent to SCRIPT_NAME/PATH_INFO? |
| 19:23 | dnolen | phil___: you can't implement it, it's been implemented for you. |
| 19:23 | TimMc | phil___: Aren't records already associative? |
| 19:25 | phil___ | dnolen, TimMc: oh yes, indeed - ok, is there a way to overload assoc for a specific... idk entity (whatever that might be)? |
| 19:26 | phil___ | i thought defrecords might be a good fit, but they are already maps |
| 19:26 | dnolen | phil___: you cannot change assoc for records |
| 19:27 | phil___ | so either change it globally or dont change it at all? |
| 19:27 | TimMc | phil___: What's the bigger picture? |
| 19:29 | phil___ | TimMc: i want to be able to store the "mutation history" of an object, i.e. if i do (def a (assoc b :key 5)) then a would be {:actions [[:assoc :key 5]] :entity b} |
| 19:31 | TimMc | Hmm, I think storing it inside the object is a bad idea. |
| 19:31 | TimMc | I've implemented an undo/redo feature in a GUI program using two stacks of state, stored in refs. |
| 19:32 | TimMc | If that's what you're up to, I can get you a GitHub link to that. |
| 19:34 | _phil | TimMc: yes id like to take a look! what im after is having purely functional event handlers - i.e. if a handler is called it receives some old state, doest something to it in terms of assoc etc and returns a new state, which is then "run" by behind the scenes |
| 19:35 | _phil | -by |
| 19:35 | TimMc | Yeah, store everything in a state map in a ref, then swap it in a transaction. |
| 19:36 | _phil | yea, thats what id do, but id also like to know what the event handler changed... and short of diffing the old and the new state storing the "assoc history" is the only thing i can think of right now |
| 19:37 | TimMc | You can assoc a key-value pair indicating what produced the new state. |
| 19:38 | TimMc | I'm a little reluctant to show you this code, since it was written when I was just learning Clojure, so it contains some fairly non-idiomatic code, like overuse of records instead of maps, and var naming... |
| 19:38 | _phil | yes, but then the event handlers would need to use some custom assoc function and if they used the regular one then the changed state wouldnt be detected |
| 19:38 | TimMc | https://github.com/timmc/CS4300-HW3/blob/master/src/timmcHW3/core.clj |
| 19:39 | _phil | TimMc: doesnt matter, im after the bigger picture right now, not code style :) |
| 19:39 | _phil | thx! |
| 19:39 | pandeiro | _phil: use an atom watcher? |
| 19:39 | TimMc | I should clean that code up some day. |
| 19:40 | TimMc | pandeiro: That's a thought. Might need some finagling. |
| 19:40 | _phil | pandeiro: but then every bit of data would need to be wrapped in an atom :/ |
| 19:40 | TimMc | _phil: or a ref or var |
| 19:40 | TimMc | They all support watchers. |
| 19:40 | pandeiro | _phil: or just have one mega-state-atom? |
| 19:41 | TimMc | pandeiro: That's the ticket. |
| 19:41 | _phil | TimMc: yea some mutable state thingie |
| 19:41 | aphyr | rea |
| 19:41 | pandeiro | i just implemented undo/redo with ClojureScript (right before reading that the Google Closure Editor already has an undo/rego plugin) |
| 19:41 | _phil | pandeiro: but the problem is that i dont wanna have (swaps! ...) in the event handler because that would effectively make them impure |
| 19:42 | _phil | i wanna have smth like event-handler :: Input -> Output and everything is pure inside |
| 19:43 | _phil | then the "main loop" or whatever you wanna call it "runs" the changes made in the event handlers and (swaps!) them into the mega-atom |
| 19:56 | alexyk | anything shorter than: (Integer/parseInt "12") ? |
| 19:56 | amalloy | 12 |
| 19:57 | amalloy | ~rimshot |
| 19:57 | clojurebot | Badum, *tish* |
| 19:59 | seanm | read-string maybe? |
| 20:00 | seanm | though that's likely overkill |
| 20:00 | technomancy | ,(Integer. "12") |
| 20:00 | clojurebot | 12 |
| 20:00 | alexyk | seriously, no str2int in std lib? |
| 20:02 | jeremyheiler | all it would do is what was already mentioned |
| 20:03 | emezeske | jeremyheiler: and possibly be portable across e.g. Clojure, ClojureScript, and whatever the CLR one is called |
| 20:03 | technomancy | doesn't JS's integer constructor expect a string? |
| 20:04 | technomancy | oh wait... JS doesn't have integers |
| 20:04 | emezeske | rofl |
| 20:04 | seanm | womp womp |
| 20:04 | emezeske | well, there's that... |
| 20:05 | jeremyheiler | emezeske: undestandable. not sure how much of a priority that is for Core, though. |
| 20:05 | emezeske | jeremyheiler: yeah |
| 20:07 | alexyk | why not (int "12")? |
| 20:08 | TimMc | &(doc int) |
| 20:08 | lazybot | ⇒ "([x]); Coerce to int" |
| 20:08 | TimMc | 'int is intended for casting and coercion of other numerics |
| 20:09 | jeremyheiler | dunno.. https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L1068 |
| 20:11 | jeremyheiler | ah (missed what TimMc said) |
| 20:12 | alexyk | so coerce doesn't say "numeric" |
| 20:12 | seanm | ,(int "12) |
| 20:12 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading string> |
| 20:12 | seanm | ,(int "12") |
| 20:12 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Character> |
| 20:12 | TimMc | Character is apparently the last thing it tries. |
| 20:12 | alexyk | true, the question is that this semantics may be too limiting |
| 20:13 | TimMc | You could (defn int-by-hook-or-by-crook ...) |
| 20:14 | jeremyheiler | heh, when doesn't an open source project need better/clearer docs |
| 20:17 | alexyk | where do I get uniq now from? |
| 20:18 | alexyk | for sort | uniq kind of thing |
| 20:18 | alexyk | or via a set? |
| 20:18 | technomancy | yeah, just call set on your collection |
| 20:19 | hiredman | (doc distinct) |
| 20:19 | clojurebot | "([coll]); Returns a lazy sequence of the elements of coll with duplicates removed" |
| 20:19 | technomancy | or sorted-set I guess |
| 20:19 | TimMc | _phil: Event handlers *are* impure, they're responding to events! |
| 20:20 | unlink | Does anyone deploy Ring applications under a context root? Or is it assumed that Ring has the whole web server to itself? |
| 20:20 | _phil | TimMc: its possible the "outside world" is impure, but why should event handlers be impure by definition? |
| 20:21 | TimMc | Their job is to mutate something. |
| 20:21 | _phil | TimMc: their job is to return a new state derived from an old state... this doesnt necessarily imply mutation |
| 20:21 | TimMc | I mean, if you turn the universe inside out, sure, you can make them pure. |
| 20:23 | _phil | TimMc: well, idk, but if i already ditch java for clojure, dont see why i should be programming like i did in java with the additional benefit of first class functions and macros |
| 20:23 | _phil | but still with mutable state all around the place |
| 20:23 | TimMc | If you can make them transformers instead of mutators, then go for it -- but I wouldn't try to restructure too much of the rest of the program to accomodate that. |
| 20:24 | TimMc | At some point you have to frob a ref. |
| 20:25 | _phil | TimMc: its a new project so i can architect it any way i want... thats why right now im trying to get as many points of view as possible |
| 20:25 | TimMc | Ah, OK. |
| 20:26 | _phil | TimMc: and yes, sure, at some point you gotta mutate some ref / atom / etc, but this is gonna be at *one* place only and well tested |
| 20:26 | _phil | and the rest of the program consists of pure functions that can be easily composed and tested |
| 20:26 | TimMc | True, the more you can localize your side effects, the better. |
| 20:26 | devn | DCI in Clojure... Anyone know anything about that? |
| 20:27 | TimMc | DCI? |
| 20:27 | TimMc | Digital Chicken Interleaving? |
| 20:27 | jeremyheiler | Dependency Companion Indicators? |
| 20:28 | alex001 | data, context, interraction ? |
| 20:28 | _phil | TimMc: do you see any obvious disadvantages to any of this? or would you rather say clojure's philosophy is "minimize mutation but dont try too hard" and i should do it the old fashioned way? |
| 20:29 | jeremyheiler | unlink: im not sure, but doing that has always been a pain unless you programatically create URLs, or hard code them :-/ |
| 20:30 | jeremyheiler | unlink: I suppose you can have somethign re-write them *shrug* |
| 20:32 | jeremyheiler | devn: Seriously, what is DCI? |
| 20:33 | TimMc | _phil: It's not as discouraged as it is in some languages -- because the STM is so awesome. |
| 20:34 | TimMc | But the general philosophy is to avoid mutation when practical. |
| 20:35 | jeremyheiler | I hate articles that claim to talk about something, and after the first two paragraphs don't really say what it is they really are talking about (trying to figure out what DCI is...) |
| 20:35 | technomancy | you mean like every article on dependency injection out there? |
| 20:36 | technomancy | or OSGi? |
| 20:37 | jeremyheiler | yes, exactly. (except for martin fowlers article on dependency injection.) |
| 20:38 | _phil | is implementing clojure.lang.Associative (i.e. overwrting assoc) in a deftype a bad idea? |
| 20:38 | brehaut | is your type associative? |
| 20:39 | _phil | brehaut: as much as any random type is associative, i.e. it is a container that could hold any type, also associative types |
| 20:43 | unlink | jeremyheiler: It's trivial for typical servlets, however. |
| 20:45 | brehaut | unlink: i presume you are talking about deploying a ring app via the ring servlet adapter |
| 20:45 | unlink | brehaut: yes. The line that troubles me is: :uri (.getRequestURI request) |
| 20:45 | brehaut | unlink: why? |
| 20:45 | brehaut | unlink: because it gets an absolute url? |
| 20:45 | brehaut | err uri |
| 20:46 | unlink | brehaut: Servlet applications should have no knowledge what context root they are deployed under. |
| 20:51 | unlink | brehaut: I see that this was discussed (inconclusively) on the ring-clojure google group. http://bit.ly/AiCYIt |
| 21:09 | brehaut | unlink: both compojure and moustache use :path-info (ie, context aware :uri) where available. it seems the talked about wrap-context middleware hasnt made it into ring though |
| 21:09 | brehaut | (both compojure and moustache allowed for nested handlers which is the same usecase as context roots for servlets) |
| 21:12 | brehaut | unlink: you should be able to use :servlet-context to generate :path-info in a middleware as needed |
| 21:13 | aaelony | I have a macbook pro that absolutely refuses to give a repl for Clojure 1.3.0. It accepts Clojure 1.2.1 though just fine. It drives me crazy though and would love to get this fixed. Any ideas? http://pastie.org/3286336 |
| 21:16 | brehaut | aaelony: what version of lein are you running? |
| 21:16 | aaelony | Leiningen 1.6.2 on Java 1.6.0_29 Java HotSpot(TM) 64-Bit Server VM |
| 21:17 | brehaut | lion ? |
| 21:17 | aaelony | not Lion, 10.6.8 |
| 21:17 | aaelony | somewhere there must be something 1.2.1 that conflicts |
| 21:18 | aaelony | i have no clue as to where |
| 21:18 | brehaut | i cant really help much, but i have the same lein and jvm on lion and im not having trouble, but i cant easily go test on snowleopard sorry |
| 21:20 | aaelony | brehaut: well thanks for trying at least. |
| 21:20 | aaelony | I have another machine that doesn't have this problem as well. I know there is something that got funky on this machine but looking to correct that somehow |
| 21:26 | muhoo | aaelony: try a different jvm? |
| 21:27 | aaelony | muhoo: how can I try that? |
| 21:28 | muhoo | uninstall the one you have, and install a different one |
| 21:28 | aaelony | ok, will look into that |
| 21:28 | muhoo | http://www.oracle.com/technetwork/java/javase/downloads/index.html |
| 21:28 | aaelony | thanks |
| 21:28 | yazirian | on OS X you can check the 'Java Preferences' control panel (spotlight it) |
| 21:28 | yazirian | and choose between whichever jvms you have |
| 21:29 | yazirian | i have 3 i think, a 7 and 2 different 6's |
| 21:29 | muhoo | my guess is hotspot is optimizing away something that clojure needs |
| 21:30 | apwalk | fwiw: i am using those exact versions of lein, jvm, and clojure. |
| 21:30 | aaelony | ok |
| 21:30 | yazirian | i have used those together as well on both OS X 10.6.8 and 10.7 |
| 21:31 | yazirian | what happens if you try to run the repl directly? i.e. java -cp /path/to/clojure-1.3.jar etc etc |
| 21:31 | aaelony | In the General tab of 'Java Preferences' I see Java SE 6, both 64-bit and 32-bit are checked |
| 21:34 | aaelony | yazirian: what other options do i need to include to try running the repl directly? I have java -cp lib/clojure-1.3.jar |
| 21:35 | aaelony | I don't have much of a java background |
| 21:35 | yazirian | java -cp lib/clojure-1.3.jar clojure.main |
| 21:35 | aaelony | java -cp lib/clojure-1.3.jar clojure.main |
| 21:35 | aaelony | Clojure 1.2.0-master-SNAPSHOT |
| 21:35 | aaelony | user=> |
| 21:36 | aaelony | weird |
| 21:36 | yazirian | yeah that is clearly wrong heh |
| 21:36 | aaelony | I wonder where it is coming from |
| 21:38 | aaelony | running a find on that ... |
| 21:39 | xeqi | aaelony: try running `echo $CLASSPATH` |
| 21:40 | aaelony | $CLASSPATH is not set |
| 21:40 | xeqi | thats good |
| 21:41 | yazirian | even the name clojure-1.3.jar is wrong, it should be clojure-1.3.0.jar |
| 21:42 | aaelony | find found 2 files named clojure-1.2.0-master-SNAPSHOT.jar |
| 21:43 | yazirian | where? |
| 21:43 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack> |
| 21:43 | aaelony | yazirian: that is my typo |
| 21:43 | aaelony | java -cp lib/clojure-1.3.0.jar clojure.main still gives the 1.2.0-master-SNAPSHOT |
| 21:43 | yazirian | where are the weird 1.2.0-master-SNAPSHOT files located? |
| 21:44 | aaelony | yazirian: ~/clojure/clojure-1.2.0-master-SNAPSHOT.jar and ~/tmp/clojure/clojure-1.2.0-master-SNAPSHOT.jar I'm perfectly willing to rm them both |
| 21:44 | ltmitch49 | ? |
| 21:47 | yazirian | was wondering if one got stuck into the JAVA_HOME area someplace |
| 21:49 | yazirian | like how rt.jar doesn't need to be in CLASSPATH to be found |
| 21:49 | tjgillies | in clojure speak does synchronous == blocking? |
| 21:49 | aaelony | in 'Java Preferences' in the Network tab there is a cache. I wonder if there is something there? |
| 21:49 | aaelony | deleting the cache files to see if that helps |
| 21:56 | aaelony | when I do "java -cp lib/clojure-1.3.0.jar clojure.main" where does the resulting answer message "Clojure 1.2.0-master-SNAPSHOT" come from ? |
| 21:59 | jeremyheiler | aaelony: Looks like it comes from the pom.xml |
| 21:59 | aaelony | looking for a pom.xml |
| 22:00 | jeremyheiler | Which gets torn apart into the *clojure-version* var |
| 22:00 | jeremyheiler | in core.clj |
| 22:00 | aaelony | ]: java -cp lib/clojure-1.3.0.jar clojure.main |
| 22:00 | aaelony | Clojure 1.2.0-master-SNAPSHOT |
| 22:00 | aaelony | user=> *clojure-version* |
| 22:00 | aaelony | {:interim true, :major 1, :minor 2, :incremental 0, :qualifier "master"} |
| 22:00 | jeremyheiler | yes. |
| 22:00 | jeremyheiler | here: https://github.com/clojure/clojure/blob/master/pom.xml#L8 |
| 22:02 | jeremyheiler | actually.... it comes from a version.properties file as well |
| 22:02 | jeremyheiler | https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L6199 |
| 22:02 | xeqi | aaelony: what happens if you run `java clojure.main` |
| 22:03 | aaelony | if I do "lein pom" it generates a pom.xml file, but without reference to 1.2.0. Otherwise there is no pom.xml file in my dir |
| 22:03 | aaelony | : java clojure.main |
| 22:03 | aaelony | Clojure 1.2.0-master-SNAPSHOT |
| 22:03 | jeremyheiler | Did you download the source for clojure? |
| 22:03 | aaelony | user=> |
| 22:03 | aaelony | I might have, perhaps ages ago. If I did, how would I clean it out? |
| 22:04 | jeremyheiler | clone it from github |
| 22:04 | jeremyheiler | https://github.com/clojure/clojure |
| 22:04 | aaelony | I guess it can't make it worse... ;) |
| 22:05 | aaelony | cloning now |
| 22:05 | jeremyheiler | What is your motive behind knowing were the version string comes from? |
| 22:05 | aaelony | http://pastie.org/3286336 |
| 22:07 | xeqi | aaelony: `ls /System/Library/Java/Extensions` |
| 22:07 | xeqi | I think thats the mac directory |
| 22:07 | aaelony | ls /System/Library/Java/Extensions/ |
| 22:07 | aaelony | AppleScriptEngine.jar j3daudio.jar jai_core.jar libJ3DUtils.jnilib* mlibwrapper_jai.jar |
| 22:07 | aaelony | MRJToolkit.jar j3dcore.jar libAppleScriptEngine.jnilib* libQTJNative.jnilib* vecmath.jar |
| 22:07 | aaelony | QTJava.zip j3dutils.jar libJ3D.jnilib* libShark.jnilib* |
| 22:07 | aaelony | dns_sd.jar jai_codec.jar libJ3DAudio.jnilib* libmlib_jai.jnilib* |
| 22:08 | xeqi | k, not in there, and you mentioned classpath was not set |
| 22:08 | xeqi | theres gotta be a 1.2.0-master jar somewhere for the `java clojure.main` to have made a repl |
| 22:08 | aaelony | easier to peruse here: http://pastie.org/3286519 |
| 22:09 | aaelony | yes, $CLASSPATH is empty |
| 22:12 | aaelony | xeqi: I agree, but where the devil is it? |
| 22:13 | aaelony | running this: sudo find / -name "*1.2.0-master*" |
| 22:13 | xeqi | that was my next suggestion |
| 22:13 | tjgillies | state mutation would be a cool band name |
| 22:15 | aaelony | found it |
| 22:16 | aaelony | http://pastie.org/3286544 |
| 22:17 | aaelony | I guess I can just rm that |
| 22:17 | xeqi | yeah |
| 22:18 | yazirian | the case of the haunted extensions dir |
| 22:18 | aaelony | ok, removed that. Now eerily I get: ]: java clojure.main |
| 22:18 | aaelony | Clojure |
| 22:18 | aaelony | user=> |
| 22:18 | muhoo | good to know. |
| 22:18 | tjgillies | is there a way to see a history of state for a structure? |
| 22:19 | muhoo | i remember reading that variables keep a history of the last 5 states, like bash history, but i don't remember reading how you can actually LOOK at those |
| 22:19 | muhoo | or maybe i misread it entirely. |
| 22:20 | brehaut | muhoo: what do you mean by variables? i think most clojure programmers would think you mean on of lexical variables defined by lets and params etc, or perhaps Vars |
| 22:20 | aaelony | interestingly, removing the clojure-1.2.0-master broke leiningen! Lein version even bombs now |
| 22:21 | aaelony | doing lein upgrade |
| 22:21 | muhoo | brehaut: then i misremembered it with incorrect terms as well :-) |
| 22:22 | brehaut | muhoo: do you mean an STM Ref ? |
| 22:22 | muhoo | probably, an agent or ref perhaps |
| 22:25 | brehaut | muhoo: i suspect you are confusing some of the ref machinary (but i dont know for sure). Agents dont appear to have any history storying mechanism |
| 22:26 | brehaut | muhoo: refs have a history, but i dont know if its intended for use outside the transactional machinary |
| 22:26 | muhoo | i should wait until i finish this joy of clojure book then. most of my knowlege so far of clojure is like free-associational dream-logic fragments, culled from reading language refs, various tutorials, videos, and my own experimentation. |
| 22:26 | muhoo | it's like a soup of terms and concepts. but the book is organized, so i'm starting to get some structure now. |
| 22:26 | brehaut | muhoo: sounds a lot like mine then ;) |
| 22:27 | muhoo | so much of the mental pictue i have of clojure right now is "not even wrong" |
| 22:29 | muhoo | i read sentences like this 8 times and still have NFI what they mean: "Destructuring allows us to positionally bind locals based on an expected form for a composite data structure." |
| 22:29 | muhoo | totally! |
| 22:29 | muhoo | but after i finish this chapter, i'd damn well better understand that sentence :-) |
| 22:30 | xeqi | aaelony: any luck? |
| 22:30 | brehaut | muhoo: a "composite data structure" is something like a list, vector map etc ie its made up of other smaller parts (in contrast with scalars like numbers or characters) |
| 22:31 | muhoo | brehaut: that helps, thanks |
| 22:31 | brehaut | muhoo: "positionally bind locals" means that the local variables are bound to the items in the data structure based on their position in the destructuring expression |
| 22:31 | aaelony | removing the 1.2.0 jar broke leiningen. Now re-installing lein. |
| 22:31 | brehaut | muhoo: eg, if you have a vector [:first :second :third] then |
| 22:31 | aaelony | java clojure.main yields "Clojure" and gives me a repl too |
| 22:32 | brehaut | you can bind local variables a b and c with let like (let [[a b c] [:first :second :third]] …) |
| 22:32 | aaelony | *clojure-version* is unbound |
| 22:33 | JanxSpirit | ' |
| 22:34 | xeqi | heh, can you (+ 1 2)? |
| 22:34 | aaelony | hmmm... lein is quite unhappy now. |
| 22:34 | muhoo | aaelony: lein requires clojure 1.2 iirc |
| 22:34 | aaelony | haha, looks like it!! |
| 22:35 | muhoo | lein does some magic i don't understand to run in its OWN clojure, 1.2, separate from whtaever clojure you may be actually running (1.3, git HEAD, whatever) |
| 22:35 | muhoo | this is done, IIRC, to keep the build environment separate from the run environment |
| 22:36 | aaelony | lein is now missing the 1.2.0 jar it needs and I think that that must have been the earlier problem as well... that something needed a missing jar and was thus unhappy. |
| 22:36 | muhoo | aaelony: CLOJURE_JAR="$HOME/.m2/repository/org/clojure/clojure/1.2.1/clojure-1.2.1.jar" |
| 22:37 | muhoo | (clojure, i'm still lost in the woods, but bash, i understand :-) |
| 22:37 | aaelony | muhoo: indeed... Now the question is how to start over fresh... |
| 22:38 | muhoo | aaelony: i'm kind of brutal with this stuff, i'd blow away ~/.m2, blow away all clojure, start over |
| 22:38 | xeqi | aaelony: was there anything else in the "/Library/Java/Extensions/" directory? |
| 22:38 | muhoo | blow away ~/.lein too |
| 22:38 | aaelony | oh, there is no ~/.m2. I'm trying to get it back, but https://raw.github.com/technomancy/leiningen/stable/bin/lein throws an exception now |
| 22:39 | muhoo | aaelony: what's in ~/.lein ? |
| 22:39 | yazirian | just clear out ~/.lein and let it re-bootstrap itself? |
| 22:39 | aaelony | just nuked ~/.lein |
| 22:39 | muhoo | aaelony: yazirian <--- what he said |
| 22:39 | aaelony | that seemed to help |
| 22:40 | aaelony | lein tries to re-install and now eventually throws an exception |
| 22:41 | aaelony | Caused by: java.io.FileNotFoundException: Could not locate leiningen/core__init.class or leiningen/core.clj on classpath: |
| 22:41 | clojurebot | I don't understand. |
| 22:41 | aaelony | perhaps I'll move this to the leiningen area then... |
| 22:43 | muhoo | brehaut: thanks, that was the stuff that i needed to unpack. makes sense now. |
| 22:45 | brehaut | muhoo: no problem |
| 22:54 | nuclearsandwich | technomancy: I'm trying to run a standalone swank-clojure server (for Slimv) and I've noticed that ~/.lein/bin/swank-clojure has `/home/phil` hard coded in it. |
| 22:54 | nuclearsandwich | technomancy: where's the best place for me to follow up with it/find and submit a fix? |
| 23:00 | tjgillies | anyone know how i can fix this?: |
| 23:00 | tjgillies | /Users/tyler/penumbra> lein native-deps |
| 23:00 | tjgillies | That's not a task. Use "lein help" to list all tasks. |
| 23:03 | tjgillies | (i installed leiningen with mac homebrew if that matters) |
| 23:03 | brehaut | tjgillies: lein version |
| 23:05 | tjgillies | /Users/tyler/penumbra> lein version |
| 23:05 | tjgillies | Leiningen 1.6.2 on Java 1.6.0_29 Java HotSpot(TM) 64-Bit Server VM |
| 23:09 | brehaut | tjgillies: you have the apropriiate plugin installed? |
| 23:12 | tjgillies | brehaut: lein plugin install native-deps? |
| 23:12 | brehaut | tjgillies: no idea |
| 23:13 | tjgillies | ok |
| 23:13 | brehaut | but it lookjs like a good guess |
| 23:34 | devn | just showed overtone to someone who has been trying to do generative music in javascript |
| 23:34 | jeremyheiler | devn: did you have to fix their jaw? |
| 23:34 | devn | i have a feeling he's not going to go to work tomorrow |
| 23:34 | devn | lol |
| 23:35 | jeremyheiler | nice |
| 23:35 | devn | yeah, basically had to help him off the floor |
| 23:36 | devn | The whole repl-driven music generation thing was making him crazy, plus the concurrency story and timing stuff |
| 23:36 | devn | I've worked with other languages and generative music -- clojure is a dream in so many ways |
| 23:38 | devn | jeremyheiler: sorry for bailing earlier. figure out what DCI is? |
| 23:39 | jeremyheiler | eh, i found the wikipedia article and kind of gave up lol |
| 23:43 | nuclearsandwich | DCI? Drum Core International? |