2011-04-04
| 00:00 | amalloy | MiggyX: raek has a blog post somewhere that does this |
| 00:00 | amalloy | $google executors in clojure raek |
| 00:00 | sexpbot | First out of 33 results is: Executors in Clojure - raek's blog |
| 00:00 | sexpbot | http://blog.raek.se/2011/01/24/executors-in-clojure/ |
| 00:42 | bettsp | Hi guys, I'm working my way through The Joy of Clojure and I'm having trouble with an example |
| 00:43 | bettsp | http://pastie.org/1753072 |
| 00:43 | bettsp | This reports "No implementation of method: :cat of protocol: #'user/Concatenatable found for class: java.lang.String" |
| 00:47 | amalloy | bettsp: works for me. maybe you're on the wrong clojure version |
| 00:47 | brehaut | bettsp: can you run *clojure-version* |
| 00:48 | brehaut | (in your repl) |
| 00:48 | bettsp | brehaut: Well I'm going through vimclojure (nailgun), my lein file depends on 1.2.0 |
| 00:49 | amalloy | brehaut: this should work on 1.2.0 - try doing what brehaut asked to see if you're *actually* on 1.2.0 |
| 00:49 | bettsp | amalloy: Yep, 1.2.0 |
| 00:49 | amalloy | hm |
| 00:50 | bettsp | Maybe it's a weird Nailgun / vimclojure quirk |
| 00:50 | bettsp | Let me try using clj directly |
| 00:50 | amalloy | you may need to restart your repl |
| 00:50 | amalloy | some things have a sort of "once-only" semantics |
| 00:51 | bettsp | amalloy: Yeah, I think that was it. Thanks |
| 00:53 | amalloy | when all else fails, try rebooting |
| 00:57 | ataggart | amalloy: do you have permissions on jira? |
| 00:57 | amalloy | no |
| 00:57 | ataggart | k |
| 00:57 | amalloy | what for, ooc? |
| 00:58 | ataggart | I can submit tickets, add/delete attachments, etc., but I can't change any of the field values, e.g., "waiting on". I was just wondering if that was expected, or I'm missing some obvious button somewhere. |
| 00:59 | ataggart | I'd rather not pester Stu every time I update something. |
| 01:27 | ataggart | &(Integer/toBinaryString -2) |
| 01:27 | sexpbot | ⟹ "11111111111111111111111111111110" |
| 01:27 | ataggart | &2r11110 |
| 01:27 | sexpbot | ⟹ 30 |
| 01:42 | marko_ | can I create this task in leiningen on intelliJ: clean, deps, jar and move .jar to other destination folder with one combined command? |
| 03:54 | marko_ | is it possible to get current file path with File. on clojure? say im on ns projects.core and want to get whole system path to the same file? |
| 03:57 | marko_ | im trying (.getPath (File. "")) |
| 04:19 | TobiasRaeder | Morning |
| 06:42 | markskilbeck | Hi, all. |
| 06:42 | markskilbeck | Is it possible to open a jar from the repl? |
| 06:51 | zmyrgel | I have a list of vectors like ([1 a] [2 b] [3 c] ...). What would be a idiomatic way to return the vector with highest number from it? |
| 06:52 | alfborge | Is it sorted? |
| 06:52 | zmyrgel | no |
| 06:52 | zmyrgel | making changes to my code and previous version had just a list of numbers so I had (apply max my-list) |
| 06:53 | alfborge | Will you use the list to retrieve other vectors later? |
| 06:53 | opqdonut_ | zmyrgel: reduce with a (fn [x y] (if (<= (first x) (first y)) y x)) |
| 06:53 | zmyrgel | no, I just need the highest vector from it |
| 06:56 | zmyrgel | opqdonut_: seems to work just fine |
| 07:01 | yason | zmyrgel: (last (sort yourlist)) but efficiency-wise the right solution really depends on how you use the list of vectors |
| 07:02 | raek_ | ,(apply max-key first '([1 a] [2 b] [3 c])) |
| 07:02 | clojurebot | [3 c] |
| 07:02 | zmyrgel | raek_: seems nice solution, no need for extra code |
| 07:03 | raek_ | markskilbeck: what do you mean by "open a jar"? use libraries from it? |
| 07:03 | zmyrgel | yason: It's part of my chess game tree evaluation |
| 07:03 | markskilbeck | I apologise for my poor terminology. I just want to use the gtk.jar, without having to quit and restart the repl. |
| 07:03 | markskilbeck | Is that possible? |
| 07:03 | zmyrgel | The max value goes to new list where I choose the minimum value and that again to new list |
| 07:04 | raek_ | markskilbeck: you can use (add-classpath "file:///absolute/path/to/file.jar"), but add-classpath has been deprecated |
| 07:04 | zmyrgel | though my minimax seems to have slight error in it :) |
| 07:05 | zmyrgel | seems to return the game state of the cutoff point and not the next state |
| 07:05 | markskilbeck | raek_: I noticed that. Still, I get an error when doing (import 'org.gnome.gdk Event) |
| 07:05 | markskilbeck | Class doesn't exist. |
| 07:06 | raek_ | markskilbeck: there's an error in you syntax: (import '(org.gnome.gdk Event)) |
| 07:07 | raek_ | either that or simply (import 'org.gnome.gdk.Event) |
| 07:07 | markskilbeck | Oh I see. |
| 07:08 | markskilbeck | Thanks raek_ |
| 07:14 | raek_ | anyone know where I can read about the details why add-classpath was deprecated? |
| 07:14 | yason | zmyrgel: if you do this operation constantly, then you could either keep the list sorted, keep track of the biggest item before hand, or use a reduction as described above to run through the list quickly. But if this isn't in the inner loop and especially if the list is quite short, it's probably cleanest to just sort+pick last |
| 07:14 | raek_ | all I know is that it turned out to not work consistently |
| 07:33 | marko | im running clojure.contrib.shell-out to execute a shell script, but the problem is, that output of shell script is printed after execution, not realtime, can this be solved somehow? |
| 07:53 | waxrose | ,(instance? Integer 10) |
| 07:53 | clojurebot | true |
| 07:53 | waxrose | weird |
| 07:56 | markskilbeck | waxrose: why is that weird? |
| 07:56 | waxrose | markskilbeck, My REPL is outputting that as false. |
| 07:56 | waxrose | Which I know it shouldn't. |
| 07:56 | markskilbeck | I get true. |
| 07:57 | waxrose | hmm, maybe my repl is out of wack |
| 07:57 | clojurebot | c'est bon! |
| 08:00 | raek | in 1.3, boxed integer numbers are always of type Long |
| 08:01 | waxrose | oh, thanks |
| 08:02 | waxrose | I thought I was going crazy. :3 |
| 09:17 | TimMc | hey wax |
| 09:57 | fliebel | &(let [kv (clojure.lang.MapEntry. :a 1)] (identical? kv (first (into {} [kv])))) |
| 09:57 | sexpbot | ⟹ false |
| 09:57 | TimMc | Not terribly surprising. |
| 09:58 | fliebel | TimMc: I guess, not, but why does it tear apart these entries? |
| 09:58 | TimMc | Maps can be implemented as trees, hash tables, etc. |
| 09:59 | TimMc | I suspect the entries *have* to be torn apart for those. |
| 10:00 | fliebel | TimMc: And then? In the end you need to get the key and the value back together, right? |
| 10:00 | TimMc | For iteration, sure. |
| 10:02 | fliebel | I guess I don't understand enough of maps then… |
| 10:04 | fliebel | Okay, say you have a binary tree, which you go down in left or right with hash < node or whatever. Now, dos it really matter if you store the value down there or the MapEntry? Hm, I guess it's just efficiency then? |
| 10:05 | fliebel | Anyway, I made a type that implements IMapEntry, and when iterating over it, I naively expected to get back my objects, rather than vanilla objects. |
| 10:09 | kumarshantanu | hi, anybody deeply familiar with Leiningen plugins here? (eval-in-leiningen and eval-in-project) |
| 10:10 | TimMc | Not I, but ask your question anyway. |
| 10:11 | alfborge` | This is probably a stupid question, but are the people behind leiningen and cake enemies? |
| 10:11 | alfborge` | Or friends? |
| 10:13 | TimMc | Friendly competitors, I think. |
| 10:13 | TimMc | I don't actually know who the maintainer of cake is. |
| 10:13 | alfborge` | I suspect he's from ruby... cake => rake ... hmmm... |
| 10:14 | TimMc | Ah, yeah. And it is written in Ruby. |
| 10:14 | TimMc | The two tools maintain basic config compatibility, which is nice. |
| 10:15 | fliebel | … Don't reifies have a type? |
| 10:15 | fliebel | TimMc: It's wrapped in some Ruby souse I think. The meat of it is Clojure. |
| 10:21 | kumarshantanu | my Leiningen question is here: http://groups.google.com/group/leiningen/browse_thread/thread/fbec0e9ef37a9111/3296ec2ccd087913#3296ec2ccd087913 |
| 10:22 | kumarshantanu | TimMc: if you'd like to answer the question (link above) |
| 10:32 | fliebel | How much faster are types than multimethods? |
| 10:34 | raek | Justin Balthrop (ninjudd) is the maintainer of cake. Interview where he mentions why cake was made: http://blog.fogus.me/2010/11/30/take-6-justin-balthrop/ |
| 11:02 | mattmitchell | i need a function like filter, but to only return the first matching item. is there one that exists? |
| 11:03 | ogonzalez | mattmitchell, some |
| 11:03 | zmyrgel | some? |
| 11:05 | ogonzalez | hmm I think it's quite not the same |
| 11:06 | ogonzalez | http://richhickey.github.com/clojure-contrib/seq-utils-api.html#clojure.contrib.seq-utils/find-first |
| 11:07 | mattmitchell | perfect thanks! |
| 11:07 | ejackson | mattmitchell: does (comp first filter) work for you |
| 11:08 | Raynes | mattmitchell: (comp first filter) is a good solution. Since filter is lazy, you aren't really doing any unnecessary computation. |
| 11:08 | mattmitchell | ejackson: I think so: |
| 11:08 | mattmitchell | (comp first filter) |
| 11:08 | mattmitchell | #<core$comp$fn__3642 clojure.core$comp$fn__3642@368bca43> |
| 11:08 | mattmitchell | how does that work? |
| 11:09 | mattmitchell | oh i think i see |
| 11:09 | mattmitchell | oh nice :) |
| 11:09 | Raynes | &((comp first filter) (partial = 3) [1 2 3 4 3 5]) |
| 11:09 | sexpbot | ⟹ 3 |
| 11:10 | ejackson | &((comp first filter) (partial >= 3) [1 2 3 4 3 5]) |
| 11:10 | sexpbot | ⟹ 1 |
| 11:10 | mattmitchell | ... brain working hard ... |
| 11:10 | ejackson | hmmm.... that was unexpected |
| 11:11 | ejackson | &((comp first filter) even? [1 2 3 4 3 5]) |
| 11:11 | sexpbot | ⟹ 2 |
| 11:11 | mattmitchell | interesting |
| 11:11 | mattmitchell | that's really cool! |
| 11:13 | raek | ((partial >= 3) 1) is (>= 3 1) |
| 11:13 | Raynes | (some even? [1 2 3 4 3 5]) |
| 11:13 | Raynes | &(some even? [1 2 3 4 3 5]) |
| 11:13 | sexpbot | ⟹ true |
| 11:13 | Raynes | &(some #(and (even? %) %) [1 2 3 4 3 5]) ; I do this more often than I'd like to admit. |
| 11:13 | sexpbot | ⟹ 2 |
| 11:14 | ejackson | eep |
| 11:15 | mattmitchell | Raynes: yeah that's what i was doing before |
| 11:15 | ejackson | raek: thanks, I always get that backwards. |
| 11:16 | raek | &(letfn [(pick [p?] (fn [x] (when (p? x) x)))] (some (pick even?) [1 2 3 4 5])) |
| 11:16 | sexpbot | ⟹ 2 |
| 11:16 | raek | some is a bit weird to use, since it excpects a kind of funtion that you usually don't have |
| 11:16 | mattmitchell | raek: and the word |
| 11:16 | mattmitchell | oops |
| 11:16 | Raynes | raek: I'm so ashamed. ;> |
| 11:17 | mattmitchell | and the word "some" seems very much plural |
| 11:17 | raek | (except for maps and sets) |
| 11:17 | Raynes | raek: I bet there are a few of those in sexpbot and clojail. I'm not even sure that amalloy thinks to change them during his tidy sessions. |
| 11:18 | ejackson | mattmitchell: if you prefer the threading style: |
| 11:18 | ejackson | &(->> [1 3 5 6 8 10] (filter even?) first) |
| 11:18 | sexpbot | ⟹ 6 |
| 11:18 | raek | hadn't thought of using and there... |
| 11:18 | raek | neat |
| 11:19 | raek | Raynes: ashamed of what? |
| 11:19 | mattmitchell | ejackson: so is that actually different from (first (filter even? [1 2 3 4])) ? |
| 11:19 | raek | &(macroexpand-1 '(->> [1 3 5 6 8 10] (filter even?) first)) |
| 11:19 | sexpbot | ⟹ (clojure.core/->> (clojure.core/->> [1 3 5 6 8 10] (filter even?)) first) |
| 11:19 | Raynes | raek: Using some where I should be using (comp first filter). |
| 11:19 | ejackson | no, its just sometimes easier to read as the order of functions appears in the code in the order in which they are execute |
| 11:19 | ejackson | rather than inside-out as with the standard syntax |
| 11:20 | mattmitchell | ejackson: i see, yeah |
| 11:25 | msilverman2 | hi guys, what's the easiest way to append something to a list? it looks like conj in lists prepends your data |
| 11:26 | Raynes | &(cons 0 '(1 2 3 4)) |
| 11:26 | sexpbot | ⟹ (0 1 2 3 4) |
| 11:26 | msilverman2 | that's prepending |
| 11:26 | ejackson | &(concat '(0 1 2 3) (4)) |
| 11:26 | sexpbot | java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn |
| 11:26 | Raynes | That was unrelated to your question. Sorry. |
| 11:26 | msilverman2 | ahh, sorry |
| 11:26 | ejackson | &(concat '(0 1 2 3) 4) |
| 11:26 | sexpbot | java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer |
| 11:27 | Raynes | &(concat '(0 1 2 3) '(4)) |
| 11:27 | sexpbot | ⟹ (0 1 2 3 4) |
| 11:27 | ejackson | dammit Raynes ! |
| 11:27 | ejackson | :P |
| 11:27 | Raynes | There isn't really a good way to do that though. You really shouldn't. |
| 11:27 | ejackson | agreed, its a bit nasty |
| 11:27 | Raynes | If you need to prepend data, you probably should be using vectors. |
| 11:27 | Raynes | append* |
| 11:27 | Raynes | Forgive me, I didn't sleep much last night. :( |
| 11:28 | ejackson | i dunno about that, your trigger finger is pretty Clint Eastwood today :) |
| 11:28 | Raynes | :p |
| 11:29 | ejackson | or is that all the caffeine ? |
| 11:29 | Raynes | I am caffeine free. |
| 11:30 | Raynes | I've been caffeine free since last September. |
| 11:30 | Raynes | I binged on coke at the Conj and slept about 2 hours the night before the conference started. |
| 11:30 | ejackson | oooooooh |
| 11:31 | Raynes | Since ninjudd and friends took me to a bar and I was too young to drink, I drank coke so I could still get the teenage rebellion out of my system. |
| 11:31 | ejackson | i never manage to go very long w/o, although I'm strictly drip fed on the stuff now, after a similarly binge filled youth |
| 11:31 | Raynes | I miss caffeine, but I missed getting sleep at night more. |
| 11:32 | dnolen | ,(conj [1 2 3 4] 0) |
| 11:32 | clojurebot | [1 2 3 4 0] |
| 11:32 | dnolen | msilverman2: ^ |
| 11:32 | ejackson | but that's a vector, he wanted lists, no ? |
| 11:32 | msilverman2 | it's all good |
| 11:32 | msilverman2 | we're just using concat |
| 11:32 | msilverman2 | but is there a better way with lists? |
| 11:32 | dnolen | msilverman2: just not that concat is slow - linear in the length of the list. |
| 11:33 | dnolen | s/not/know |
| 11:33 | sexpbot | <dnolen> msilverman2: just know that concat is slow - linear in the length of the list. |
| 11:33 | Raynes | Not really. Lists are not designed for that. |
| 11:33 | msilverman2 | figured |
| 11:33 | dnolen | msilverman2: lists are useful, but is there any reason to not use a vector? |
| 11:33 | ejackson | Raynes: an interesting fact for you is that the drinking age in the UK is 18, you should arrange that the conj happens here at the appropriate time :) |
| 11:33 | msilverman2 | no :) good point |
| 11:33 | Raynes | ejackson: Heh. Good to know. |
| 11:34 | ejackson | not that I wish to involve myself in corruption, you understand. |
| 11:34 | Raynes | I don't have much of an indulging personality. |
| 11:34 | ejackson | god, this is an IRC channel, I've probably just got myself on all sorts of FBI lists now. |
| 11:34 | thorwil | there's no clojure-contrib 1.2.1 ... using contrib 1.2.0 with clojure 1.2.1 doesn't pose any problems? |
| 11:35 | fliebel | Doe anyone happens to have written a 'memoizing' macro? That would bind a vec of functions to memoized versions during the body of the macro. |
| 11:35 | Raynes | ejackson: It'll be fine. Maybe a cavity search and the airport or two, but you'll make it. |
| 11:35 | Raynes | s/and/at/ |
| 11:35 | sexpbot | <Raynes> ejackson: It'll be fine. Maybe a cavity search at the airport or two, but you'll make it. |
| 11:36 | ejackson | i thought that was standard practice these days ? |
| 11:36 | raek | thorwil: yes. tje new stuff in clojure 1.2.1 is just some bug fixes |
| 11:36 | Raynes | ejackson: Touché. |
| 12:01 | pyr | is it me or are all the clojure/cassandra projects outdated and/or unmaintained ? |
| 12:13 | kumarshantanu | fliebel: do you want those functions to be dynamically re-bound? |
| 12:15 | fliebel | kumarshantanu: I just need a macro that does (binding [foo (memoize foo) bar (memoize bar)] ~@body) |
| 12:15 | kumarshantanu | fliebel: if the functions are known beforehand, then writing one should be straightforward I guess |
| 12:15 | fliebel | kumarshantanu: No, they should be passed in. |
| 12:16 | fliebel | Still rather straightforward, but I just wanted to know if anyone had one lying around. |
| 12:16 | kumarshantanu | fliebel: so you want to pass a vector (variable size) of functions? |
| 12:16 | kumarshantanu | oh okay |
| 12:16 | fliebel | yea |
| 12:17 | fliebel | so it'll involve some looping and concatenating maybe... |
| 12:22 | mec | Is there a better way to implement nested-for? https://gist.github.com/901895 |
| 12:22 | malkomalko | what's the best idiomatic way to filter a seq based on multiple criteria? |
| 12:24 | mec | (for [s someseq :when (test1 s) :when (test2 s)] s) |
| 12:24 | Raynes | malkomalko: Combinations of and and or. |
| 12:25 | Raynes | &(filter #(and (> % 10) (< % 20)) [7 8 9 10 11 12 13 14 15 21 30 45]) |
| 12:25 | sexpbot | ⟹ (11 12 13 14 15) |
| 12:25 | malkomalko | yah, that's what I figured, I'm trying to pass in a map to dynamically build up my and list |
| 12:25 | malkomalko | just trying to figure out how to do that |
| 12:26 | malkomalko | that will be a good start, thanks |
| 12:29 | fliebel | Is a sorted map more expensive to insert and delete from, or doesn't it matter because they are both trees anyway? |
| 12:32 | raek | fliebel: it probably has log_2 instead of log_32, or something |
| 12:33 | fliebel | raek: That would make sense. |
| 12:34 | raek | so, 2^n entries would make a tree of depth n |
| 12:49 | mattmitchell | is there a fn like select-keys, but instead where you specify the keys you *don't* want? |
| 12:53 | mec | mattmitchell: you could do something like (select-keys m (seq (clojure.set/difference (set keys-you-want) (set (keys m))))) |
| 12:53 | mec | but i'd think theres a better way |
| 12:54 | mattmitchell | mec: ok excellent |
| 12:54 | mec | oh flip those around (clojure.set/difference (set (keys m)) (set keys-dont-want)) |
| 12:56 | mattmitchell | ,(clojure.set/difference #{:id :one :two} #{:two}) |
| 12:56 | clojurebot | #{:one :id} |
| 12:56 | mattmitchell | ,(seq (clojure.set/difference #{:id :one :two} #{:two})) |
| 12:56 | clojurebot | (:one :id) |
| 12:57 | malkomalko | is something like this possible? it seems like % loses context |
| 12:57 | malkomalko | https://gist.github.com/15106a3022c4c28d03b6 |
| 12:57 | mattmitchell | ,(select-keys {:id => 1 :one => "1" :two => "skip this"} (seq (clojure.set/difference #{:id :one :two} #{:two}))) |
| 12:57 | clojurebot | 9 |
| 12:57 | mattmitchell | hmm |
| 12:57 | mattmitchell | ,(doc select-keys) |
| 12:57 | clojurebot | "([map keyseq]); Returns a map containing only those entries in map whose key is in keys" |
| 12:58 | mattmitchell | ,(select-keys {:id => 1 :one => "1" :two => "skip this"} [:id :one]) |
| 12:58 | clojurebot | 9 |
| 12:58 | mec | ,{:id => 1} |
| 12:58 | clojurebot | java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: 3 |
| 12:59 | mattmitchell | why is that? |
| 12:59 | mec | ,(select-keys {:id 1 :one "1" :two "skip this"} [:id :one]) |
| 12:59 | clojurebot | {:one "1", :id 1} |
| 12:59 | mattmitchell | omg no! sorry, i'm mixing in my ruby :( |
| 12:59 | mattmitchell | i switch back and forth all day eh eh |
| 13:00 | mattmitchell | ,(select-keys {:id 1 :one "1" :two "skip this"} (seq (clojure.set/difference #{:id :one :two} #{:two}))) |
| 13:00 | clojurebot | {:id 1, :one "1"} |
| 13:00 | mattmitchell | there we go! |
| 13:00 | mec | instead of difference i would do (apply disj (set (keys m)) keys-you-dont-want) or if you konw the keys just (disj (set (keys m)) key1 key2) |
| 13:01 | mattmitchell | ,(doc disj) |
| 13:01 | clojurebot | "([set] [set key] [set key & ks]); disj[oin]. Returns a new set of the same (hashed/sorted) type, that does not contain key(s)." |
| 13:07 | mec | malkomalko: im not sure what you're trying exactly but doseq always returns nil, i think you want for. Also #(and (for ...)) wouldnt work you need something like #(every? identity (for ...)) |
| 13:07 | malkomalko | I'm trying to build in a list to of statements to filter on based off a map |
| 13:08 | malkomalko | wow, awesome grammar... |
| 13:08 | mec | lol |
| 13:08 | mec | can you give me an example of the result? |
| 13:12 | Raynes | mattmitchell: Sounds like you lead a very complicated existence. |
| 13:12 | mattmitchell | Raynes: why do you say that? |
| 13:13 | Raynes | You switch between Clojure and Ruby all day long and get the two mixed up. Sounds like a confusing lifestyle. :p |
| 13:14 | mec | I dont think its too hard ;p i cought myself writing lua style maps once |
| 13:14 | mattmitchell | Raynes: seriously, tell me about it. we just started using clojure a few months ago. |
| 13:14 | mattmitchell | and now half of our stuff is in clojure, half in ruby |
| 13:16 | ejackson | yeah, its the same for me. I now get annoyed with python etc when I can't do things like make lists keys in maps. |
| 13:19 | mattmitchell | eh eh. sometimes when i switch back to ruby and see "if(xxx)", i just stare at it ??? it takes me a minute to remember that it's ruby and there is no prefix notation |
| 13:21 | malkomalko | hey mec... what's the diff between (filter #(every? identity (for...)..) vs (filter #(every? (for ..)..) |
| 13:22 | fliebel | malkomalko: unified diff? |
| 13:22 | fliebel | ANyway, I don;t think the later is valid |
| 13:22 | pdk | (doc identity) |
| 13:22 | clojurebot | "([x]); Returns its argument." |
| 13:23 | technomancy | if you're using for anyway, you should use the :when clause rather than having a sepraate filter call |
| 13:23 | pdk | i think there's something wrong with the formatting in both though |
| 13:23 | malkomalko | this worked |
| 13:23 | malkomalko | https://gist.github.com/15106a3022c4c28d03b6 |
| 13:23 | amalloy | Raynes: i did write raek's "pick" in amalloy/utils, though i called it verify. i haven't ported any of that to sexpbot yet though |
| 13:24 | malkomalko | but i just feel like I'm not doing it the best way |
| 13:25 | amalloy | mattmitchell: i disagree about the word "some". i agree the function "should" act like (comp first filter), but i remember using "some" in the same context as "there exists" back in school. "some positive x", etc |
| 13:25 | pdk | there's no function some that uses it in that sense though |
| 13:31 | mattmitchell | amalloy: i see what you mean. This example... returns true, which is what I would expect: (some even? [2 3 4 5 6]) |
| 13:32 | amalloy | mattmitchell: right. i kinda wish it returned 2: "find some even number from this list" |
| 13:32 | amalloy | as do you |
| 13:33 | kephale00 | yeah perhaps some as is should actually be named some? |
| 13:33 | mattmitchell | amalloy: yeah 2 makes sense too. i originally was looking for something like ruby's "detect" -> http://www.ruby-doc.org/core/classes/Enumerable.html#M001485 |
| 13:33 | mattmitchell | detect returns the first item in the collection when the "predicate" is true |
| 13:34 | kephale00 | , (some #(if (even? %) %) [2 3 4]) |
| 13:35 | clojurebot | 2 |
| 13:35 | kephale00 | i retract my statement about renaming some, its just how you use it |
| 13:36 | amalloy | kephale00: just a sketch, i know, but it's generally bad form to use a single-branch if. prefer when (in this case, "and" would work as well) |
| 13:36 | kephale00 | amalloy: noted and appreciated |
| 13:36 | pdk | and standing in for when is kinda hackish |
| 13:39 | amalloy | pdk: meh. and is designed for short-circuiting on purpose. in languages lacking a when construct, you might well write "divisible = y != 0 && x % y == 0" |
| 13:40 | kephale00 | i've run into and being used in such situations in common lisp a number of times |
| 13:40 | kephale00 | wow.. its confusing to read that without denoting AND in some way |
| 13:41 | mec | malkomalko: this may be better, but I think it can be simplified further, im just not sure how https://gist.github.com/gists/fd02f373dd819b5e4536/edit |
| 13:41 | amalloy | kephale00: yes, not a well-written example :P |
| 13:42 | amalloy | haha github's 500 page is adorable |
| 13:43 | mec | malkomalko: sorry this one https://gist.github.com/fd02f373dd819b5e4536 |
| 13:45 | amalloy | mec: i missed the start of that discussion, i guess. what is this code trying to do? |
| 13:49 | mec | amalloy: no idea |
| 13:49 | amalloy | haha |
| 13:49 | mec | malkomalko: ok this is deffinitly the one https://gist.github.com/fd02f373dd819b5e4536 |
| 13:53 | fliebel1 | What is this supposed to mean? RetryEx clojure.lang.LockingTransaction http://pastebin.com/11xTUfKn |
| 13:54 | hiredman_ | fliebel1: means your code is trying to dos the stm |
| 13:54 | hiredman_ | "pleases stop" |
| 13:59 | fliebel1 | hiredman_: Haha, sure… I know what is the problem idk. |
| 14:05 | fliebel1 | More weird errors, this is what I get upon closing my Swing window: http://pastebin.com/UjdhDhcX |
| 14:06 | ieure | Is there a decent XML/HTML parser for Clojure similar to lxml for Python? |
| 14:06 | fliebel1 | Note that there is none of my nses in there, and a few mentions of Leiningen. |
| 14:07 | fliebel1 | ieure: I think there is a lot of XML stuff in Java, and some in clojure.contrib as well. |
| 14:07 | kumarshantanu | hi, can anybody here tell me how does leiningen set the classpath (to include project sources)? e.g. for "lein test" or "lein repl" |
| 14:07 | amalloy | kumarshantanu: less `which lein` - it's fairly straightforward iirc |
| 14:08 | ieure | fliebel1, Yeah, what I’m really after is a single lib that lets me use the same code to parse HTML and XML. |
| 14:08 | fliebel1 | ieure: Oh, like tagsoup? |
| 14:08 | amalloy | ieure: tagsoup |
| 14:08 | technomancy | kumarshantanu: see the leiningen.classpath namespace |
| 14:09 | ieure | fliebel1 / amalloy, Looks like exactly what I want. |
| 14:09 | ieure | Thanks. |
| 14:09 | ieure | amalloy, BeautifulSoup is a Python library. |
| 14:09 | amalloy | yeah, i looked it up |
| 14:09 | amalloy | again :) |
| 14:09 | ieure | It’s crazy handy. |
| 14:10 | amalloy | ieure: i think tagsoup was first |
| 14:13 | fliebel1 | Grr, does anyone know why I might possibly get IndexOutOfBoundsException when closing a Swing window? |
| 14:14 | fliebel1 | amalloy: I have the same. |
| 14:14 | kumarshantanu | amalloy: thanks, yes the script includes both "src" and "test" folders in classpath |
| 14:14 | fliebel1 | But worse, I forget about one completely and end up on the wrong page, not remembering the other one. |
| 14:16 | kumarshantanu | technomancy: yes, I can see the classpath using leiningen.classpath/classpath -- but surprisingly, any attempt to (require (symbol "foo.valid-ns")) and (resolve (symbol "foo.valid-ns/bar")) fails - returns nil |
| 14:17 | kumarshantanu | I am trying to do this inside a leiningen plugin (that a host project uses) |
| 14:17 | technomancy | that is the classpath that eval-in-project will use to run any code that needs access to the project's dependencies and/or source |
| 14:18 | technomancy | kumarshantanu: HACKING.md may be helpful here |
| 14:18 | kumarshantanu | technomancy: I am doing this inside eval-in-project -- is that a right thing to do? |
| 14:19 | technomancy | yeah, if you need access to the project source, you need to run inside eval-in-project |
| 14:22 | kumarshantanu | technomancy: ah, seems I found a clue -- actually i am declaring `:eval-in-leiningen true` in the host project, because unless I do that leiningen.compile isn't available to the plugin |
| 14:23 | kumarshantanu | and HACKING.md seems to say that if I set `:eval-in-leiningen true` then that will be an exception and therefore (I guess) sources will not be included in the classpath (!!) |
| 14:28 | technomancy | kumarshantanu: you can't have code eval both in leiningen's process and the project's. you have to pick one. |
| 14:32 | kumarshantanu | technomancy: not sure if I followed that - I want to have the host project's deps+sources on the classpath (like test, repl) and want to eval-in-project from the plugin at the same time. That seems to require that I declare `:eval-in-leiningen true` (because unless I do that, leiningen.compile namespace isn't available to the plugin) |
| 14:34 | kumarshantanu | I guess I am missing something obvious, but not sure what |
| 14:52 | fliebel1 | What is the `~@ trickery for turning a supplied symbol into a qualified one? `(foo ~bar) -> (some.ns/foo some.other.ns/bar) It works without it, but I suppose it's cleaner to have them qualified? |
| 14:54 | pdk | ,`x |
| 14:54 | clojurebot | sandbox/x |
| 14:54 | amalloy | fliebel1: ##(let [supplied bar] `(foo `~supplied)) |
| 14:54 | sexpbot | java.lang.Exception: Unable to resolve symbol: bar in this context |
| 14:54 | amalloy | &(let [supplied 'bar] `(foo `~supplied)) |
| 14:54 | sexpbot | ⟹ (clojure.core/foo clojure.core/supplied) |
| 14:54 | amalloy | dangit. maybe not |
| 14:55 | fliebel1 | amalloy: Yea, I want to get whatever 'bar points to |
| 14:56 | fliebel1 | &(let [x 'y y 1] `(~(resolve x))) |
| 14:56 | sexpbot | java.lang.SecurityException: You tripped the alarm! resolve is bad! |
| 14:56 | fliebel1 | ,(let [x 'y y 1] `(~(resolve x))) |
| 14:56 | clojurebot | (nil) |
| 14:56 | fliebel1 | oh |
| 14:59 | amalloy | fliebel1: resolve doesn't get access to locals (nothing does) |
| 15:01 | amalloy | incidentally, trying to manually namespace-resolve symbols supplied by the user sounds like a bad idea. why do you want it? |
| 15:07 | msilverman2 | is there anyway to run a single deftest with lein? |
| 15:08 | technomancy | msilverman2: you can use test selectors; see the tutorial |
| 15:09 | technomancy | kumarshantanu: I see. you can't change the classpath of leiningen itself, and a plugin runs inside the leiningen process. |
| 15:09 | msilverman2 | thanks |
| 15:13 | fliebel1 | amalloy: If it's a bad idea, I don't wan it. I just thought using unqualified symbols was bad practice most of the time. But thinking about it, symbols supplied by the user should be 'clean' |
| 15:13 | msilverman2 | technomancy: I got this after following the tutorial: Could not locate robert/hooke__init.class or robert/hooke.clj on classpath: |
| 15:14 | kumarshantanu | technomancy: sorry for the repeated ping! I located the problem (of not resolve'ing a symbol) was in my own code -- it works for me now. Thanks so much! |
| 15:14 | amalloy | fliebel1: right. symbols supplied by the user should be left alone unless your intent is to transform them. they don't need to be qualified, because in the user's scope they already resolve to something |
| 15:15 | technomancy | msilverman2: oy, I need to update the tutorial about that. you need to add [robert/hooke "1.1.0"] to your :dependencies in project.clj for that to work. |
| 15:15 | technomancy | kumarshantanu: aha; great. |
| 15:15 | msilverman2 | thanks |
| 15:15 | msilverman2 | what does that package do? |
| 15:16 | technomancy | msilverman2: all manner of wonderful hackery |
| 15:16 | msilverman2 | lovin it... |
| 15:16 | technomancy | basically an extension mechanism for functions you don't have controll over |
| 15:16 | technomancy | https://github.com/technomancy/robert-hooke |
| 15:17 | technomancy | sorta like monkeypatching, but a little safer |
| 15:20 | fliebel1 | Can I use Java methods like one can use methods in Python? I mean, (someclass/method otherclass arg arg) |
| 15:21 | fliebel1 | I am having trouble shaping a piece of api in a easy and extensible manner. |
| 15:24 | fliebel1 | In Python, you have explicit this/self, which allows you to apply methods of one class to another. Since methods in deftypes and such also have the self, I was wondering if I could reuse them that way. |
| 15:30 | amalloy | no |
| 15:30 | fliebel1 | okay |
| 15:31 | amalloy | but i think extend-type allows you to specify a map protocol-functions to implementations |
| 15:31 | amalloy | so you can reuse the clojure *functions* |
| 15:31 | fliebel1 | yea… Thinking about it… |
| 15:31 | amalloy | ah, i guess you have to use the raw extend function |
| 15:32 | fliebel1 | okay |
| 16:31 | thorwil | (type body) tells me that body is a com.google.appengine.api.datastore.Text |
| 16:31 | thorwil | but (isa? body com.google.appengine.api.datastore.Text) doesn't seem to be true |
| 16:34 | technomancy | thorwil: yeah, that's confusing. you want instance? instead. |
| 16:35 | technomancy | isa? isn't really about isa? |
| 16:35 | thorwil | what's the right way to test for class membership, then? |
| 16:37 | thorwil | oh. not clear evena fter reading the doc |
| 16:37 | dnolen | ,(doc isa?) |
| 16:37 | clojurebot | "([child parent] [h child parent]); Returns true if (= child parent), or child is directly or indirectly derived from parent, either via a Java type inheritance relationship or a relationship established via derive. h must be a hierarchy obtained from make-hierarchy, if not supplied defaults to the global hierarchy" |
| 16:38 | technomancy | ,(doc instance?) |
| 16:38 | clojurebot | "([c x]); Evaluates x and tests if it is an instance of the class c. Returns true or false" |
| 16:39 | thorwil | yeah, now in contrast it's very clear :) |
| 16:40 | thorwil | i'm testing with a java.lang.String |
| 16:40 | thorwil | trying instance? gives me java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Class (NO_SOURCE_FILE:0) |
| 16:40 | dnolen | thorwil: reverse arg order. |
| 16:41 | thorwil | thanks |
| 16:41 | thorwil | looks like it's getting time for me to log off soon ;) |
| 17:04 | kephale00 | I'm not sure what this stems from. I am using lein to make an uberjar within a function that is called from -main I do an EVAL on a list representation of a function call (J 3 4) which is a function defined inside my core.clj. This fails when I call it from the uberjar. When I run it in swank I don't get the issue. |
| 17:04 | kephale00 | I resolved this by calling (use 'myns.core) at the start of my -main, but really weird. |
| 17:06 | kephale00 | errr… not calling lein from a function |
| 17:07 | kephale00 | there should be a period after uberjar |
| 17:11 | amalloy | kephale00: a lot of the calling environment's context doesn't get passed on to eval. i know eval doesn't have access to lexical bindings, for example. i thought it got the benefit of your use/require forms, but i wouldn't be astonished to find out it didn't |
| 17:13 | kephale00 | amalloy: aha. the thing that caught me off guard was the difference between the uberjar and swank, but maybe that is because when calling the function in swank I am already in the namespace or something along those lines. The thing is that everything that caused the issue was contained within the core.clj |
| 17:13 | kephale00 | but all is well… until i find something else to break |
| 17:14 | amalloy | *generic warning about eval being evil* |
| 17:14 | kephale00 | heh |
| 18:29 | Somelauw | Okay, I am install cake |
| 18:29 | Somelauw | I did sudo ln -s bin/cake /bin/cake |
| 18:29 | Somelauw | And tried typing cake but nothing happened. |
| 18:32 | sritchie | ,(not (not-any? #{:jobtracker :namenode} [:jobtracker :slavenode])) |
| 18:33 | clojurebot | true |
| 18:33 | sritchie | is there a version of this with contains? that will return a bool? |
| 18:33 | amalloy | Somelauw: you installed a relative symlink in the wrong place |
| 18:34 | amalloy | now /bin/cake is a file saying "look in ./bin/cake", that is /bin/bin/cake |
| 18:34 | sritchie | or! is it idiomatic to wrap this in a predicate like (defn master? [roles] ... and trust that the user will use it as a predicate? |
| 18:35 | amalloy | sritchie: huh? |
| 18:35 | sritchie | I'm writing a predicate that will check if any item in the supplied collection can be found in that set |
| 18:35 | amalloy | are you looking for ##(some #{:a :b} [:c :a])? |
| 18:36 | sexpbot | ⟹ :a |
| 18:36 | sritchie | amalloy: yup, that's great. my other question was, is there a function like some that returns an explicit boolean |
| 18:36 | Somelauw | So, I should give an absolute path? |
| 18:36 | amalloy | if you really-really want the user to only get out a boolean instead of a truthy-thing, you can cast to boolean |
| 18:37 | amalloy | Somelauw: if you're going to install it in an absolute place, yeah |
| 18:37 | amalloy | i just put cake in ~/bin, though |
| 18:37 | sritchie | okay, but it's idiomatic to trust that a function called "master?" is going to return a truthy value, not necessarily a bool |
| 18:37 | amalloy | eg ##(boolean (some #{:a :b} [:c :a])) |
| 18:37 | sexpbot | ⟹ true |
| 18:38 | amalloy | (def master? (comp boolean (partial some #{:namenode :jobtracker}))) for some amusing point-free nonsense |
| 18:39 | sritchie | point free or bust |
| 18:40 | amalloy | brehaut: in haskell that would be something like... master = boolean . some #{:foo :bar}, yes? (imagining that haskell has clojure's functions, anyway) |
| 18:40 | brehaut | yup |
| 18:40 | amalloy | woo |
| 18:41 | brehaut | plus maybe a type hint to dodge the monomorphism restriction (sigh) |
| 18:41 | amalloy | @$#@? |
| 18:41 | Somelauw | Okay, I put it in my bin as well. |
| 18:42 | brehaut | amalloy: cat trouble? |
| 18:42 | amalloy | brehaut: no, just you |
| 18:42 | amalloy | as in, "what is this monomorphism nonsense" |
| 18:42 | Somelauw | I tried running "cake repl" and now it is downloading something. |
| 18:42 | amalloy | Somelauw: sounds good |
| 18:44 | brehaut | amalloy: oh right. its a think in the haskell type system that was added to simplify some type errors early on and that is now regretted; some instances of generic types are only allowed to have a single morphism or specific type unless you go out of you way to ok it with the compiler. its dumb. |
| 18:44 | brehaut | amalloy: in particular you hit it a lot with point free stuff in the repl |
| 18:45 | Somelauw | And now it is printing a lot of resource not found messages. |
| 18:45 | amalloy | brehaut: that sounds well beyond my superficial knowledge of haskell |
| 18:45 | brehaut | amalloy: heres a fun quote from the haskell wiki "The monomorphism restriction is probably the most annoying and controversial feature of Haskell's type system. All seem to agree that it is evil, but whether or not it is considered a necessary evil depends on who you ask." |
| 18:45 | brehaut | http://www.haskell.org/haskellwiki/Monomorphism_restriction |
| 18:47 | Somelauw | But the repl is working now |
| 18:48 | amalloy | confirmed: reading that page causes my brain to bubble, but no information is imparted |
| 18:49 | brehaut | amalloy: that summarises it pretty well ;) |
| 19:10 | ieure | Hm, was #^{…} the old reader macro for metadata? |
| 19:10 | amalloy | yes |
| 19:10 | amalloy | it still works (more or less) but don't use it in new code |
| 19:10 | amalloy | ieure: ^ |
| 19:10 | ieure | Yeah. I just saw it in clj-http and wasn’t sure if that was the case or not. |
| 19:11 | ieure | Wanted to make sure I understood what was going on, since there’s no mention of it on http://clojure.org/reader |
| 19:11 | gigamonkey | This may be silly but can the dispatch function in a multi-method itself be a multi-method? |
| 19:12 | ieure | Multimethods all the way down. |
| 19:12 | gigamonkey | Great. |
| 19:12 | amalloy | gigamonkey: yes. sounds silly but i'm sure there's some reason for it somewhere |
| 19:12 | ieure | gigamonkey, I have no idea, really. |
| 19:12 | ieure | Try it and find out! |
| 19:12 | gigamonkey | ieure: heh. I haven't even got Clojure installed yet. |
| 19:12 | gigamonkey | Lame, I know. |
| 19:13 | ieure | gigamonkey, Gotta start somewhere. |
| 19:14 | gigamonkey | Bah, this is where I hate that Clojure is built on top of Java. Maven, Ant, blech. |
| 19:14 | brehaut | gigamonkey: are you trying to install from source? |
| 19:15 | ieure | gigamonkey, It is one of the best and undoubtedly the worst thing about it. |
| 19:15 | gigamonkey | brehaut: I think I'm going to skip that for the reasons just mentioned. ;-) |
| 19:15 | ieure | gigamonkey, I recommend that you start by installing Leiningen, rather than Clojure. |
| 19:15 | ieure | https://github.com/technomancy/leiningen |
| 19:15 | brehaut | gigamonkey: the reasons you mentioned are exactly the reasons you never have to install from source ;) |
| 19:16 | gigamonkey | I would not have guessed that "a build tool for X" can be installed "rather than" X |
| 19:17 | ieure | gigamonkey, Yes, well. Lisp & JVM make for strange bedfellows. |
| 19:18 | ieure | The nature of Clojure (JVM-based, young, relatively active development) mean that you really want to stick the appropriate JAR files into your workspace per-project rather than dicking around with installing stuff on the system. |
| 19:18 | ieure | And Leiningen is the tool which makes that not suck. |
| 19:18 | Oabl | It's even more fun with other dialects (i.e. building SISC is a pita). |
| 19:21 | Somelauw | I think that because clojure being build on top of java makes it practical. |
| 19:21 | gigamonkey | Somelauw: no doubt. However I don't actually care about that. ;-) |
| 19:21 | gigamonkey | Do I need a special version of SLIME for use with Clojure or is stock SLIME okay? |
| 19:21 | cemerick | Indeed; it being on the JVM means it'll be deployed far wider than probably any other lisp (if it isn't already). |
| 19:22 | amalloy | gigamonkey: get clojure-mode.el |
| 19:22 | ieure | gigamonkey, I have the latest installed from ELPA, works fine. |
| 19:22 | ieure | And yeah, clojure-mode. |
| 19:22 | gigamonkey | ELPA? |
| 19:22 | technomancy | gigamonkey: newer slimes break with Clojure; the version that worsk can be got via package.el or at https://github.com/technomancy/slime |
| 19:22 | amalloy | i think stock slime is probably okay, but clojure-mode.el has some nice stuff in it |
| 19:22 | ieure | gigamonkey, JFGI |
| 19:23 | amalloy | $google elpa |
| 19:23 | sexpbot | First out of 83900 results is: Welcome to ELPA |
| 19:23 | sexpbot | http://tromey.com/elpa/ |
| 19:23 | technomancy | gigamonkey: but if a sufficiently-motivated CL-head could bring swank-clojure up to date with the latest slime developments I'd be happy =) |
| 19:23 | amalloy | wonder if that's right |
| 19:23 | amalloy | $google elpa emacs |
| 19:23 | sexpbot | First out of 930 results is: Welcome to ELPA |
| 19:23 | sexpbot | http://tromey.com/elpa/ |
| 19:23 | amalloy | whew |
| 19:23 | gigamonkey | technomancy: how well understood are the issues that need fixing? |
| 19:24 | technomancy | gigamonkey: not very, unfortunately. the author of swank-clojure went MIA a couple years ago, and I took over in maintenance mode, but it's kind in a "don't poke it to hard" state. |
| 19:24 | technomancy | my knowledge is pretty cursory |
| 19:24 | technomancy | *too hard |
| 19:25 | gigamonkey | ieure: of course the "latest" SLIME in ELPA doesn't seem, in fact, to be the latest SLIME. |
| 19:26 | kephale00 | gigamonkey: i think we're supposed to use marmalade now |
| 19:27 | technomancy | gigamonkey: the problem is the slime devs don't seem to value stable releases, so publishing via package.el was my way of saying "this version here; we're calling that a release" and getting off the cvs treadmill |
| 19:30 | Somelauw | What is the best way to return multiple values? |
| 19:30 | ieure | Somelauw, Depends on what you need to do with them. |
| 19:30 | brehaut | technomancy: OT: did see that clj-time got a non-snapshot the other day? |
| 19:30 | ieure | Somelauw: A list, vector, or map are fine. Just use whatever’s appropriate for the conventions in the callers. |
| 19:30 | Somelauw | Okay, I have a list and I would like to remove and return a random element from that list. |
| 19:30 | technomancy | brehaut: whew; finally |
| 19:31 | brehaut | technomancy: weevejester and mmcgrana to the rescue. |
| 19:31 | Somelauw | It would be convenient to have syntax like (def [a b c] [1 2 3]) or something to easily return multiple values. |
| 19:31 | gigamonkey | kephale00: marmalade instead of what? |
| 19:32 | amalloy | gigamonkey: i'm worried it might have been a pun on the word slime |
| 19:32 | kephale00 | gigamonkey: oh, you mentioned elpa, i figured you were using that instead of marmalade |
| 19:32 | amalloy | Somelauw: that syntax exists for let. you don't often want to def a zillion things wholesale |
| 19:32 | Somelauw | Since lists are immutable, I thought I should return both the removed element and the list with that element removed. |
| 19:33 | amalloy | &(let [[a b c] (range)] b) |
| 19:33 | sexpbot | ⟹ 1 |
| 19:33 | Oabl | Somelauw, how about... (defn foo [] [(do something) (another thing)]) (let [[a b] (foo)] (...)) |
| 19:34 | ieure | Somelauw, I’d make sure that you _need_ to return both first. "I thought this would be a good idea" is a great way to write a bunch of code you don’t really need. |
| 19:34 | ieure | That said, you’re going to find some nice features of Clojure if you do. |
| 19:34 | Somelauw | lets are fine too, but it is also usefull to be able to do the same with def, probably. |
| 19:34 | amalloy | haha probably |
| 19:35 | amalloy | Somelauw: you might find https://github.com/amalloy/amalloy-utils/blob/master/src/amalloy/utils/seq.clj#L74 handy if you want to take random elements out of a list |
| 19:35 | gigamonkey | technomancy: do you know if there was ever any attempt to get clojure-swank included in the main SLIME? |
| 19:36 | technomancy | gigamonkey: there was a long time ago. they might be more open to it now that Clojure has matured a bit. I don't have the cycles to push for that myself though; I'm just keeping up the status quo. |
| 19:36 | amalloy | Somelauw: in practice it really isn't useful. if you want to do something like that you'll want to do some processing on the elements anyway; and then you end up using a macro that expands into (do (def x (some-function-of 1)) (def y (some-function-of 10))) |
| 19:36 | technomancy | plus I'm too old to have the patience for CVS =) |
| 19:37 | ieure | technomancy, Slime is in CVS? Savages. |
| 19:37 | technomancy | ieure: it's true. |
| 19:38 | Somelauw | amalloy: lazily shuffling a list of elements is also a cool idea, thanks. |
| 19:39 | gigamonkey | technomancy: yeah, that's kind of astounding to me. |
| 19:40 | amalloy | someone get out the chloroform, and run cvs2git while the slime devs are out of commission |
| 19:46 | technomancy | gigamonkey: essentially every time someone mentions swank-clojure, I make thinly-veiled attempts to pass off maintainership. no luck so far. =) |
| 19:46 | amalloy | technomancy: i cloned swank-clojure! sadly by the time i got around to looking at it i forgot what i wanted to fix |
| 19:47 | technomancy | amalloy: this does not disqualify you from potential maintainership, just so you know. |
| 19:48 | amalloy | technomancy: yeah, i'm keeping my teflon coat on just in case you try to stick me with it |
| 20:31 | gigamonkey | technomancy: well, I was a long-ago hacker on SLIME and do grok Common Lisp. So maybe if I get into Clojure I'll take a look. But doubtful. |
| 20:32 | technomancy | gigamonkey: I know, I've read the book. no worries though; I'm not really expecting anyone to take me up on it =) |
| 20:33 | technomancy | it's really only an issue for people who want to hack CL and Clojure simultaneously, which is a pretty small minority. stumpwm users mostly, I figgure. |
| 20:37 | gigamonkey | Yes, if/when that population is larger, it'll probably get sorted. |
| 23:13 | hboon | Can someone help take a look at a 12 line macro using try-catch, would like some help with it - https://gist.github.com/902956 |
| 23:16 | ataggart | the ~name emits a namespaced symbol, which isn't allowed on the lefthand side of the let bindings |
| 23:16 | ataggart | wait, no |
| 23:16 | ataggart | how are you calling it? |
| 23:16 | hboon | the syntax itself is right (and taken from redis-clojure) |
| 23:17 | hboon | it's called from another macro |
| 23:17 | hboon | i would like to make it not call the second release-connection (the one in finally) if there's an exception (i.e. if the catch is triggered) |
| 23:18 | hboon | ie. in procedural languages, you set a flag in catch and check for it in finally |
| 23:18 | ataggart | move the one in finally to immediately after ~@body |
| 23:19 | ataggart | that'll work so long as it doesn't also throw an exception |
| 23:19 | hboon | this macro will be used in a different ns, in case that matters (because I was having problem trying to use (def *flag* true), etc |
| 23:20 | hboon | ok. sounds like that ought to work. Excellent! |
| 23:20 | hboon | well, just for curiosity sake.. how would I do it if it does throw an exception and catch wasn't catching Exception, but a subclass? |
| 23:21 | hboon | what's the functional equivalent of doing it instead of a global flag? (heck I can't even figure out to use a global flag since it's in a macro) |