2011-09-28
| 00:00 | technomancy | hahaha http://wondermark.com/302/ |
| 00:00 | technomancy | speaking of confusing the crap out |
| 00:02 | j941 | ( |
| 00:02 | j941 | (juxt #((map count ) )) |
| 00:02 | j941 | is returning nothing (i.e. its not executing ) |
| 00:03 | j941 | (its in a larger context, of course. |
| 00:03 | brehaut | &((juxt #(map count %)) [1 2 3]) |
| 00:03 | lazybot | java.lang.UnsupportedOperationException: count not supported on this type: Integer |
| 00:03 | brehaut | err |
| 00:03 | brehaut | &((juxt #(map count %)) [[1 2 3] [2 3]]) |
| 00:03 | lazybot | ⇒ [(3 2)] |
| 00:04 | brehaut | thats the closest i can work out that you might have meant |
| 00:04 | brehaut | and juxt on a single functions is perhaps not the most useful thing ever |
| 00:04 | technomancy | wow and this one is like basically a metaphor for emacs: http://wondermark.com/664/ |
| 00:04 | j941 | well.. im planning on adding more |
| 00:04 | j941 | :) |
| 00:05 | zerokarmaleft | heh |
| 00:05 | dnolen | technomancy: haha |
| 00:05 | brehaut | ahaha |
| 00:06 | j941 | ok here |
| 00:06 | j941 | http://pastebin.com/SA184uLy |
| 00:06 | j941 | its odd, returning one of those cryptic #(ss_sss11_->cl_2_Z looking things. |
| 00:06 | brehaut | j941: (require '[clojure.string :as str]) is quite nice too btw; eg str/join str/split |
| 00:07 | j941 | oh yeah i gotta do that |
| 00:07 | Apage43 | j941: juxt returns a closure |
| 00:07 | j941 | im tired of importing methods |
| 00:07 | Apage43 | more parens. |
| 00:07 | j941 | whats wrong with a closure? |
| 00:07 | brehaut | j941: you're a fan of C family languages? |
| 00:07 | Apage43 | nothing |
| 00:07 | Apage43 | you just have to actually call it |
| 00:07 | zerokarmaleft | technomancy: dammit, this is a rabbit hole i don't need right now |
| 00:07 | Apage43 | ((juxt fn1 fn2) val) |
| 00:07 | j941 | yeah especially when debuggin |
| 00:08 | j941 | o ok |
| 00:08 | technomancy | zerokarmaleft: what, you haven't discovered wondermark? I must say I envy you; so much to look forward to! |
| 00:08 | technomancy | clojurebot: piranhamoose? |
| 00:08 | clojurebot | piranhamoose is unadulterated awesome: http://blog.howfastareyou.net/wp-content/uploads/2009/08/piranhamoose.jpg |
| 00:09 | technomancy | clojurebot: absolut botsnack |
| 00:09 | clojurebot | forget botsnack is Thanks! Can I have chocolate next time |
| 00:09 | cark | mhh is it possible to "override" protected methods or not with proxy ? |
| 00:09 | j941 | beautiful ! it worx! |
| 00:09 | technomancy | clojurebot: forget forget botsnack |is| Thanks! Can I have chocolate next time |
| 00:09 | clojurebot | I forgot that forget botsnack is Thanks! Can I have chocolate next time |
| 00:10 | technomancy | you're going to blow your stack one of these days, I'm telling you |
| 00:10 | brehaut | hes already pretty garbled since i did some apparently nafarious (use … earlier |
| 00:10 | brehaut | ,(inc 1) |
| 00:10 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalStateException: replace already refers to: #'clojure.string/replace in namespace: sandbox> |
| 00:11 | technomancy | heh |
| 00:12 | brehaut | im going to blame arrows again |
| 00:14 | j941 | so we can map a list into a map ? |
| 00:14 | j941 | btw im gonna thank you guys on my thesis. this is the last table for my phd thesis ! |
| 00:15 | j941 | tryin to go [1 2 3] -> {:a 1 :b 2 :c 3) |
| 00:15 | brehaut | j941: how do you mean? |
| 00:15 | amalloy | &(zipmap [:a :b :c] [1 2 3])? |
| 00:15 | lazybot | ⇒ {:c 3, :b 2, :a 1} |
| 00:15 | brehaut | ,(zipmap [:a :b :c] [1 2 3]) |
| 00:15 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalStateException: replace already refers to: #'clojure.string/replace in namespace: sandbox> |
| 00:15 | j941 | oh awesome |
| 00:15 | amalloy | brehaut: irc.freenode.WrongBotException |
| 00:16 | brehaut | (dec brehaut) |
| 00:16 | lazybot | You can't adjust your own karma. |
| 00:16 | amalloy | (dec clojurebot) |
| 00:16 | lazybot | ⟹ 1 |
| 00:16 | brehaut | lol |
| 00:17 | amalloy | brehaut: did i tell you, when i was writing http://4clojure.com/problem/107 i got jealous of haskell again? just write a function of two args, don't worry about this manual currying nonsense |
| 00:17 | brehaut | its easy to get jealous of haskell |
| 00:17 | brehaut | (from a distance anyway) |
| 00:17 | amalloy | *nod* that's why i never use is |
| 00:18 | j941 | so... from a distance... what do the haskell tempations lead to? |
| 00:18 | brehaut | j941: jenga towers of monads |
| 00:18 | napping | what's hard about a curried function of two arguments? |
| 00:18 | j941 | monads ? |
| 00:19 | j941 | i thought those were okay |
| 00:19 | amalloy | napping: nothing is, really |
| 00:19 | brehaut | they are powerful and useful |
| 00:19 | j941 | everyone talks about em like they are gods gift to programers |
| 00:19 | j941 | ok ... but... |
| 00:19 | napping | everyone talks like people talk like they are god's gift to programmers |
| 00:19 | brehaut | but, if you have to stack them high, things get unwiedly |
| 00:20 | amalloy | it's just (fn foo [a b] ...) instead of (fn foo [a] (fn [b] ...)) |
| 00:20 | amalloy | simpler |
| 00:20 | j941 | like objects in java |
| 00:20 | napping | aren't there macros for that? |
| 00:20 | amalloy | *shrug* you can write them |
| 00:20 | j941 | does zipmap destructure for you ? |
| 00:20 | amalloy | but it doesn't actually simplify the code much since you have to specify # args |
| 00:21 | brehaut | i need to find time do some 4clojure stuff |
| 00:22 | napping | you've seen the Racket syntax? |
| 00:22 | alandipert | once you're hooked, the time will find you |
| 00:22 | j941 | brehaut sounds like u do plenty of clojure |
| 00:22 | brehaut | j941: not really, i dabble in my spare time |
| 00:22 | j941 | really how u know it so well. |
| 00:23 | j941 | oh oops i saw 4clojure, not clojure. |
| 00:23 | brehaut | theres a bunch of people in this channel who would probably laugh at that assessment |
| 00:23 | j941 | not me |
| 00:23 | napping | http://docs.racket-lang.org/guide/define.html |
| 00:24 | napping | (defn [[f x] y] body), basically |
| 00:24 | j941 | (->> (map #(clojure.string/split % #"_"))) (->> zipmap [:a :b] ) |
| 00:24 | napping | doesn't work so nicely with (defn name [params*] ...) |
| 00:25 | j941 | ClassCastException |
| 00:25 | j941 | was hoping the list would get destructured into the first two keys |
| 00:31 | brehaut | &(let [lines (map #(clojure.string/split % #"_") ["1_2" "b_c" "3_4"])] (map (partial zipmap [:a :b]) lines)) |
| 00:31 | lazybot | ⇒ ({:b "2", :a "1"} {:b "c", :a "b"} {:b "4", :a "3"}) |
| 00:32 | brehaut | no need to go threading macro happy ;) |
| 00:32 | j941 | o ok |
| 00:33 | j941 | i am threading obsessesd |
| 00:33 | brehaut | if you did, it would be ##((->> ["1_2" "b_c" "3_4"] (map #(clojure.string/split % #"_")) (map (partial zipmap [:a :b]))) |
| 00:33 | brehaut | blast |
| 00:33 | brehaut | &(->> ["1_2" "b_c" "3_4"] (map #(clojure.string/split % #"_")) (map (partial zipmap [:a :b]))) |
| 00:33 | lazybot | ⇒ ({:b "2", :a "1"} {:b "c", :a "b"} {:b "4", :a "3"}) |
| 00:33 | brehaut | amalloy: whats lazybots inline eval symbol? |
| 00:34 | j941 | threading is like pipes. and i like the feeling of "history | grep 'ls' |
| 00:34 | amalloy | ## |
| 00:34 | amalloy | but you have to have a well-formed sexp :P |
| 00:34 | napping | is it safe to do (for [x @my-ref] body) in a dosync? |
| 00:34 | j941 | so can i persist a list by just doing (def a ll) if ll is a function? |
| 00:35 | brehaut | amalloy: oh haha :) |
| 00:35 | j941 | nope |
| 00:35 | clojurebot | I don't understand. |
| 00:35 | j941 | (def a (ll)) |
| 00:35 | dnolen | nappy: laziness in a dosync is probably not a good idea |
| 00:35 | j941 | that does it. wanted to store my list in memory |
| 00:35 | dnolen | napping: oops, sorry mistyped. |
| 00:36 | napping | Laziness is what I was worried about |
| 00:37 | amalloy | well, everything is "safe" depending on what behavior you want |
| 00:38 | napping | I want the ref lookup to happen in the transaction, and then filtering to happen sometime |
| 00:40 | Apage43 | i suspect that form will work |
| 00:40 | amalloy | probably, but it's easier to try it than to speculate |
| 00:41 | napping | I don't know how to test whether it's delayed too long |
| 00:41 | amalloy | &(let [r (ref [])] (dosync (let [result (for [x @r] x)] (alter r conj 1) result)) |
| 00:41 | lazybot | ⇒ () ; Adjusted to (let [r (ref [])] (dosync (let [result (for [x (clojure.core/deref r)] x)] (alter r conj 1) result))) |
| 00:41 | napping | hmm, maybe a ref-set later in the same transaction |
| 00:43 | napping | (def x (ref '(1 2 3))) (dosync (let [z (for [v @x] v)] (ref-set x '(4 5 6)) z)) |
| 00:43 | napping | produces (1 2 3) |
| 00:44 | amalloy | napping: i just did that for you, up above |
| 00:45 | technomancy | I wonder if we could get a security audit done on clojars. |
| 00:45 | technomancy | (after we switch from sha1 to bcrypt for password hashes, of course) |
| 00:55 | brehaut | question time. xml-rpc has an 'array' notation, necessary-evil currently deserializes it to a vector and only serializes vectors back to 'arrays'; It seems fairly obvious that i should also make PersistentList serialize to arrays, but should LazySeq also be included there? |
| 00:56 | brehaut | Ive explicitly avoided having lazyseq serialisation to avoid realizing infinite seqs and forcing the user of the library to make a decision about how those lazy values are handled. |
| 00:56 | brehaut | im not sure if thats the right decision tough |
| 00:56 | brehaut | though* |
| 01:00 | amalloy | brehaut: it seems kinda rude not to handle lazy seqs |
| 01:00 | brehaut | its a bit annoying yeah |
| 01:00 | alandipert | brehaut: i vote all things seq-able... hopefully users understand there's no such thing as infinite xml |
| 01:00 | alandipert | (thank goodness!) |
| 01:01 | brehaut | the thought of an endless stream of xmlrpc xml is horrifying |
| 01:01 | amalloy | (repeatedly #(vomit xml)) |
| 01:02 | brehaut | lol |
| 01:02 | brehaut | thanks for the feedback. i shall fix that in the next release |
| 01:02 | brehaut | (not that anyone in their right mind is using xmlrpc) |
| 01:07 | j941 | how can i make a pre condition that asserts that the "type" of something is list |
| 01:07 | j941 | :pre isList(l) |
| 01:07 | ibdknox | ,(doc list?) |
| 01:07 | j941 | i mean "pre isList(l) |
| 01:07 | clojurebot | "([x]); Returns true if x implements IPersistentList" |
| 01:07 | brehaut | :pre (list? l) |
| 01:08 | j941 | wow thats cool |
| 01:08 | brehaut | (apropos '?) |
| 01:08 | brehaut | &(apropos '?) |
| 01:08 | ibdknox | lol |
| 01:08 | lazybot | java.lang.Exception: Unable to resolve symbol: apropos in this context |
| 01:08 | brehaut | &(clojure.repl/apropos '?) |
| 01:08 | lazybot | java.lang.ClassNotFoundException: clojure.repl |
| 01:08 | brehaut | fine |
| 01:08 | brehaut | j941: there are lots of useful predicates like that |
| 01:10 | brehaut | im sure theres some good joke code to me made with the rational? predicate |
| 01:10 | brehaut | &(rational? 'brehaut) |
| 01:10 | lazybot | ⇒ false |
| 01:11 | amalloy | j941: you almost certainly don't want to assert that it's a list |
| 01:11 | j941 | why |
| 01:12 | amalloy | because you want to treat vectors and seqs the same, probably |
| 01:12 | j941 | in any case ([a]) throws an exception |
| 01:12 | j941 | &([a]) |
| 01:12 | lazybot | java.lang.Exception: Unable to resolve symbol: a in this context |
| 01:12 | napping | &(list? (filter (constantly true) '(1 2 3))) |
| 01:12 | lazybot | ⇒ false |
| 01:12 | j941 | &([1 2]) |
| 01:12 | lazybot | java.lang.IllegalArgumentException: Wrong number of args (0) passed to: PersistentVector |
| 01:12 | j941 | oh ok |
| 01:13 | j941 | how can i assert its an iSeq |
| 01:13 | j941 | :pre ..... |
| 01:13 | clojurebot | Gabh mo leithscéal? |
| 01:13 | brehaut | &(seq? (list 1 2 3)) |
| 01:13 | lazybot | ⇒ true |
| 01:13 | j941 | o ok |
| 01:13 | amalloy | brehaut: boooooo |
| 01:13 | amalloy | &(seq? [1 2 3]) |
| 01:13 | lazybot | ⇒ false |
| 01:14 | brehaut | boo? |
| 01:14 | clojurebot | book is http://www.pragprog.com/titles/shcloj/programming-clojure |
| 01:14 | amalloy | j941: you could write java instead? encumbering every list-handling function with "hey, first check that this is a list" is not a productive way to spend your time in a loosely-typed language |
| 01:14 | brehaut | thanks bot |
| 01:14 | j941 | hahah |
| 01:14 | j941 | yeah your write |
| 01:14 | j941 | right |
| 01:15 | j941 | java just iterator pattern :) |
| 01:15 | j941 | for (a : mySeq) {...} |
| 01:15 | j941 | works on everything |
| 01:15 | amalloy | brehaut: well. aside from the dangers of telling people what they ask for instead of what they need to know, i think someone who wants to check whether something is "a list" probably is willing to accept vectors |
| 01:15 | napping | not a good way to spend time in any decent statictly-typed language either. That's what type inference is for. |
| 01:16 | j941 | im starting to like clojure. |
| 01:16 | j941 | too bad they dont have jobs for it. i guess it will always be a guilty pleasure . |
| 01:16 | brehaut | j941: make your own job |
| 01:17 | brehaut | amalloy: sure, point taken |
| 01:17 | brehaut | its clearly time for me to go be productive elsewhere |
| 01:17 | j941 | yup. |
| 01:17 | amalloy | j941: who is "they"? |
| 01:17 | j941 | the man lol |
| 01:18 | amalloy | at least three people you've talked to in the last half hour make a living working on clojure |
| 01:18 | j941 | thats true. |
| 01:18 | j941 | its actually pretty popular esp in bigger cities. im in CT though. |
| 01:19 | j941 | i think the supply is prob less than demand so in that sense, its prob better then python. |
| 01:23 | brehaut | why on earth have i written (String. …) in some code. fail. |
| 01:24 | j941 | im conflicted about functions. too many functions -> boilerplate |
| 01:24 | j941 | i like bigger methods in clojure. big, domain specific blocks of code. |
| 01:25 | j941 | the idea of needing a name for every method is a remnant of OO over modelling, |
| 01:29 | j941 | ( map (partial zipmap [_ :p _ :c _ _ :f]) |
| 01:29 | j941 | doesnt like the _'s |
| 01:30 | j941 | ( map (partial zipmap [_ :b _ :c _ _ :f]) |
| 01:30 | j941 | seems good 2 me :( |
| 01:30 | j941 | &( map (partial zipmap [_ :p _ :c _ _ :f]) |
| 01:30 | lazybot | java.lang.Exception: Unable to resolve symbol: _ in this context |
| 01:46 | j941 | how can i create a submap from a map ? |
| 01:46 | j941 | {:a 1 :b 2 :c 3} -> {:a 1} |
| 01:47 | j941 | seems like "filter" would do the trick. but not sure how. |
| 01:50 | napping | maybe |
| 01:50 | napping | it can probably be done more efficiently |
| 01:50 | j941 | remove |
| 01:50 | j941 | (remove #(= (:name %) "eric") mylist) |
| 01:51 | ibdknox | ,(doc select-keys) |
| 01:51 | clojurebot | "([map keyseq]); Returns a map containing only those entries in map whose key is in keys" |
| 01:51 | napping | but you could filter by a set of the names you want to keep |
| 01:51 | j941 | (remove #(= (:name %) "eric") mylist) |
| 01:51 | j941 | oh ok |
| 01:52 | ibdknox | ,(select-keys {:a 1 :b 2 :c 3} [:a]) |
| 01:52 | clojurebot | {:a 1} |
| 01:53 | aamar | Any recent opinions on profiling code? clojure.contrib.profile vs. jvisualvm vs. other? |
| 01:53 | j941 | duh just found it |
| 01:53 | j941 | ! |
| 01:53 | j941 | thanx |
| 01:59 | scottj | aamar: yourkit is the best I've seen |
| 02:01 | aamar | scottj: ah, a commercial option... $500. interesting. |
| 02:02 | aamar | I'll try it out; thanks for the tip. |
| 02:02 | scottj | yeah use the evaluation version |
| 02:03 | scottj | I think they have a free version somewhere for open source projects |
| 02:39 | pyr | ibdknox: great news! |
| 02:52 | pyr | ibdknox: still doesn't work for me |
| 02:53 | ibdknox | pyr: forgot to push to clojars |
| 02:53 | ibdknox | just pushed it up |
| 02:54 | pyr | nope i had lein i nstalled it |
| 02:54 | ibdknox | hm |
| 02:54 | pyr | i use (pe/on (dom/query "a.something") :click ...) |
| 02:54 | ibdknox | and that does what? |
| 02:54 | pyr | nothing |
| 02:55 | ibdknox | hm |
| 02:55 | pyr | if i only (pjs/log "foo") in the event handler, nothing happens |
| 02:55 | ibdknox | do the a.something's exist already? |
| 02:55 | pyr | yes |
| 02:55 | ibdknox | if they don't it won't work |
| 02:55 | ibdknox | hm |
| 02:56 | pyr | hmm lemme check though |
| 02:56 | ibdknox | it works in the todo example if I change it to (dom/query "li") |
| 02:56 | pyr | erf |
| 02:57 | ibdknox | but only for the ones that already exist, since it doesn't try to run that query over and over again |
| 02:57 | ibdknox | for every possible hit target |
| 02:58 | pyr | is there the equivalent of $() ? |
| 02:58 | pyr | so i can start my handlers when i'm sure everything is ready ? |
| 02:58 | ibdknox | (dom/query) is more or less equivalent |
| 02:58 | ibdknox | oh |
| 02:59 | ibdknox | you mean $(document).ready? |
| 02:59 | pyr | yeah |
| 02:59 | ibdknox | no, but if you order your handlers after the append call it should be fine |
| 02:59 | ibdknox | pyr: google closure intentionally doesn't have a document.ready solution |
| 03:01 | pyr | ah, alright |
| 03:01 | pyr | still no luck, must be doing something wrong |
| 03:03 | ibdknox | this is exactly what I'm using: https://gist.github.com/7a5b6722ccbaf7645525 |
| 03:03 | pyr | indeed i was :) |
| 03:04 | pyr | alright, great, having events on queries again is really nice |
| 03:05 | pyr | i don't think i'm missing anything now |
| 03:07 | ibdknox | sweet :) |
| 03:09 | pyr | ibdknox: it fixes a pain, since to have events i had to have a bunch of partials |
| 03:09 | pyr | and including partials in partials is cumbersome |
| 03:09 | ibdknox | mm |
| 03:09 | ibdknox | ideally there would be named elements in a partial |
| 03:09 | ibdknox | and you could bind events to those |
| 03:09 | ibdknox | that's the goal |
| 03:09 | ibdknox | not sure how to do that yet though |
| 03:11 | ibdknox | but that's it for me for tonight :) Good luck! |
| 03:12 | pyr | thanks :) |
| 03:35 | rata_ | hi |
| 03:37 | iAmerikan | I'm checking out clojure, and was wondering if anyone could point out my issue here? http://snips.tk/nyd3/ |
| 03:38 | napping | &(let [num 3] (if (= (rem num 5) 0) "buzz" num)) |
| 03:38 | lazybot | ⇒ 3 |
| 03:38 | hiredman | iAmerikan: think it through |
| 03:38 | napping | function returns value of last expression |
| 03:38 | raek | iAmerikan: in functional programming languages, the expression is the building block rather than the statement |
| 03:39 | rata_ | what do you think about allowing nested #(...) fns and using %%, %%1, %%2, and so on, as in (update-in m [k1] #(for [e %] (update-in e [k2] #(map f %%))))? |
| 03:39 | raek | but clojure does provide an "imperative" construct that allows you to evaluate two expression in the place of one |
| 03:39 | hiredman | raek: horrible |
| 03:39 | opqdonut | rata_: horrible |
| 03:40 | napping | tasty deBruijn indices |
| 03:40 | rata_ | why? |
| 03:40 | raek | namely 'do'. it evaluates all expressions and returns the value of the last one |
| 03:40 | clojurebot | why not? |
| 03:40 | raek | defn has an "implicit do", which means that your example is thr same as (defn fizz-buzz [num] (do (if ...) (if ...))) |
| 03:41 | iAmerikan | oooh |
| 03:41 | opqdonut | napping: except those are not deBruijn indexes, right? |
| 03:41 | napping | could be deBruijn levels, I guess |
| 03:41 | raek | i.e. the value of the first conditional expression is evaluated and discarded. then the second is evaluated and returned |
| 03:41 | napping | but the number of % is how many binders out to go |
| 03:41 | opqdonut | deB would be: %1 referring to the first argument of the innermost #(), %%1 to the next #() etc |
| 03:41 | napping | was that not the proposal? |
| 03:41 | opqdonut | maybe I misread |
| 03:42 | opqdonut | or -understood |
| 03:42 | raek | iAmerikan: you can use 'cond' if you want something prettier than nesting a bunch of ifs |
| 03:42 | napping | anways, deBruijn levels are the ones that count the other way, and are maybe not much better |
| 03:42 | napping | raek: that's probably the wrong way to go |
| 03:43 | iAmerikan | I'll look into it, thank you, I'm extremely new to functional programming, and still a novice w/ OOP/procedural |
| 03:43 | napping | iAmerikan: try the "str" function |
| 03:43 | raek | (cond (zero? (rem num 3)) "fizz", (zero? (rem num 5)) "buzz", :else num) |
| 03:43 | napping | call it with a few argumnets, and nills thrown in |
| 03:45 | iAmerikan | can I save to .clj then run clj foo.clj to run it? |
| 03:45 | iAmerikan | while I'm here can anyone suggest a clojure resource for beginners? |
| 03:45 | rata_ | napping, opqdonut: it could be both ways (not at the same time obviously) |
| 03:46 | raek | iAmerikan: I recommend taking a look at leiningen. |
| 03:46 | iAmerikan | Thank you |
| 03:46 | napping | rata_: http://www.e-pig.org/epilogue/?p=773 |
| 03:47 | napping | "M’colleague Bob Atkey once memorably described the capacity to put up with de Bruijn indices as a Cylon detector, the kind of reverse Turing Test that the humans in Battlestar Galactica invent, the better to recognize one another by their common inadequacies. He had a point." |
| 03:47 | opqdonut | :) |
| 03:48 | raek | lein new fizzbuzz, put stuff in fizzbuzz/src/fizzbuzz/core.clj, put (ns fizzbuzz.core) at the top of that file, make a function called (defn -main [] ...) that contains code you want to test, run with "lein run fizzbuzz.main" |
| 03:49 | raek | iAmerikan: but it is often more rewarding to develop in a repl. use "lein repl" in the project to get one, (require 'fizzbuzz.core) to load you file and (in-ns 'fizzbuzz.core) to move the repl into it |
| 03:53 | raek | iAmerikan: clojure does not come with a standard 'clj' script (unlike python and ruby, for example). there are tools that make it simpler to do "one-off scripts", but the project approach is simpler to use when you need to split up your code into more than one source file. |
| 03:54 | raek | so IMHO it's good to get acquainted with it as soon as possible |
| 03:54 | iAmerikan | Thank you again :D |
| 03:59 | hiredman | clojurebot should load a fresh clojure runtime for the sandbox every 10 minutes now, I think I figured out all the security problems I had with with reloading RT with a security manager in place |
| 04:01 | Zolrath | I'm looking for a postgresql library for clojure, is ClojureQL a good choice? Hasn't been updated in a while. |
| 04:01 | rata_ | is there anyone from congomongo here? |
| 04:02 | hiredman | Zolrath: clojureql is not a postgresql library |
| 04:02 | hiredman | you'll want the postgres jdbc driver |
| 04:03 | Zolrath | no? the site says it compiles to SQL92 so its compatable with MySQL and PostgreSQL |
| 04:03 | hiredman | right, it generates sql statements, which you have to ship off to an sql server |
| 04:03 | hiredman | so nothing to do with postgres |
| 04:04 | Zolrath | ahhhh okay |
| 04:04 | hiredman | I recommend you just use clojure.java.jdbc together with the postgres jdbc driver |
| 04:04 | Zolrath | Realistically if theres a better option for another db I'd be open to that too |
| 04:05 | hiredman | nah |
| 04:05 | hiredman | postgres is great |
| 04:05 | Zolrath | I was using congomongo but I realize for this project a normal relational database would be better |
| 04:08 | Blkt | good morning everyone |
| 04:13 | Zolrath | hiredman: Thanks for your help! |
| 04:15 | rata_ | Zolrath: why did you realize a relational database would be better? did you need the expressive power of SQL? |
| 04:17 | Zolrath | rata_: Well maybe it's just my lack of knowledge of mongodb but I'm trying to make a project that loads entries via AJAX |
| 04:17 | rata_ | ok |
| 04:18 | Zolrath | and the ids of mongodb dont really lend themselves to incrementing an id to get the next entry |
| 04:20 | rata_ | I think there's a way to have "normal" autoincrementing ids in mongodb |
| 04:20 | Zolrath | I actually have the logic and data in mongodb already so that would be awesome if so |
| 04:21 | Zolrath | The only thing I saw seemed like it was something you'd have to run on the data every time there was a new entry, but I could have been interpreting it wrong |
| 04:22 | cark | it would take a lot for me to consider a nosql solution |
| 04:22 | cark | there's so much you cannot do with those |
| 04:23 | cark | and so little benefit |
| 04:23 | rata_ | cark: speed is not a benefit for you? |
| 04:23 | rata_ | Zolrath: http://shiflett.org/blog/2010/jul/auto-increment-with-mongodb <- this is the first google hit, but haven't read it enterily yet |
| 04:24 | cark | sur speed is good, but sql databases are already fast enough for me =P |
| 04:24 | cark | sure* |
| 04:24 | cark | what's your project ? |
| 04:25 | rata_ | my project or Zolrath's? |
| 04:25 | cark | yours, what project do you need a nosql database's speed for ? |
| 04:26 | napping | is there a fancier version of cond? |
| 04:26 | rata_ | napping: even fancier? |
| 04:27 | napping | letting you bind the true result, for one |
| 04:27 | cark | i have a project in production with several hundreds page views per second, postgres seems to be faring pretty good |
| 04:27 | cark | and that's only the gui side of things |
| 04:29 | rata_ | cark: I'm working on a project for which I don't know how much page views per second I'll have, but I think that the faster the db goes, the cheaper the server on which you have to run it |
| 04:29 | raek | napping: only if-let. (but that's for only one clause, of course) I think I once wrote a macro that looked like cond but expanded into nested if-let forms instead of if forms |
| 04:29 | napping | I might also have a use for one that makes if-not forms |
| 04:29 | cark | rata_: and you're ready to loose referencial integrity, and do the bookkeeping manually for this ? |
| 04:30 | cark | it all depends on how you value your time |
| 04:30 | Zolrath | Am I correct in thinking that ids are the way to go for this auto-pagination type project? I was trying to think of a way to do it using the mongodb I already have but couldnt think of anything that made sense |
| 04:31 | cark | what do you mean by auto-pagination ? |
| 04:31 | rata_ | cark: until now, it's a "query-only" db with weekly updates or so |
| 04:32 | cark | ah i guess for simple use cases it fits the bill |
| 04:32 | rata_ | yes |
| 04:33 | Zolrath | I want to make it so when you go to the page it loads the most current entry and as you scroll down it loads the earlier entries |
| 04:33 | cark | tho project have a tendency to grow in complexity over time... then you're stuck with a nosql database |
| 04:33 | Zolrath | but if you go to a url with the direct link to a specific entry it would load that entry |
| 04:33 | Zolrath | and allow you to scroll up for newer entries |
| 04:33 | Zolrath | and down for older |
| 04:34 | cark | Zolrath: to me, autoincrement fields are only for identity |
| 04:34 | cark | you need to have a date inserted field, then sort on that |
| 04:34 | Zolrath | I have a date field, hm |
| 04:34 | cark | and then the usual select * from x limit offset thing |
| 04:35 | cark | or whatever the mongodb equivalent is |
| 04:35 | Zolrath | I've actually never done any ajax loading before so this whole thing is an adventure |
| 04:35 | cark | are you using jquery or maybe clojurescript ? |
| 04:36 | Zolrath | I'm trying this with clojurescript |
| 04:37 | cark | ahwell didn't give it a test run yet =/ |
| 04:37 | Zolrath | I was going to attempt using pinot/goog.dom but I imagine it would be easier if I go with jquery and its horde of plugins? |
| 04:37 | rata_ | Zolrath: in mongo it'd be db.collection.find().sort({date: 1}) or something like this |
| 04:38 | cark | no idea, i'm pretty sure clojurescript is up to the task |
| 04:38 | cark | i always went the jquery route until now, next new project will probably be clojurescript |
| 04:38 | rata_ | cark: if the project grows, I can leave this part as mongodb and use a relational database for the users part... this part is just public information I web-scrapped |
| 04:39 | Zolrath | I was trying to find an article out there that broke down how systems like this work so I could go at this with some knowledge |
| 04:39 | cark | rata_: ok =) |
| 04:39 | Zolrath | Right now I just have functions that will fetch an entry based on a fields value, or just all of them sorted by date |
| 04:40 | Zolrath | But I'm not really sure how to call that information from the clojurescript in reference to the data already loaded |
| 04:40 | cark | Zolrath: i recently converted an application to use a service based architecture in the spirit of wxhat you're doing |
| 04:40 | cark | i have the web server producing json on different http requests |
| 04:41 | cark | always encapsulated in the same message structure |
| 04:41 | cark | then a single web page on the client side |
| 04:41 | cark | which requests information from the correct url depending on what it needs |
| 04:42 | Zolrath | Hm, since I'm going Clojure/Clojurescript can I do the same idea via passing clojure maps between them? |
| 04:42 | cark | that's a full application with maybe 50 "pages" all collapsed in a single javascript file |
| 04:42 | cark | that's what i would do |
| 04:43 | Zolrath | Right now I have all entries pass a normalized map with the same fields |
| 04:43 | cark | you may want to have something around that |
| 04:43 | cark | so that you can pass errors etc |
| 04:44 | cark | or go the rest way, and just rely on http status ... i didn't go that route |
| 04:44 | Zolrath | I hope to have it allow you to go to |
| 04:45 | Zolrath | localhost:8080/entry/09/23/2011 and have it load that entry |
| 04:45 | cark | hum a date is a single piece of data |
| 04:45 | Zolrath | then allow you to scroll up/down from there depending on if there are entries either way |
| 04:45 | cark | i would do localhost:8080/entry/09-23-2011 |
| 04:45 | Zolrath | ah okay, that works |
| 04:46 | cark | woah the scroll up thing might prove difficult |
| 04:46 | cark | but it would be neat if you make it =P |
| 04:46 | Zolrath | yeah I was trying to figure out how to get the previous/next entry in the db without ids |
| 04:47 | Zolrath | I can sort it by date, but how do I match that with where I am/what the next entry is |
| 04:47 | cark | well i don't know about mongodb |
| 04:50 | Zolrath | Thats why I was thinking about using an id field as I could go Hey Im on entry 32 try loading 31 |
| 04:52 | Zolrath | I can't really reason a way to Say Hey I'm at 9-28-2011, lets sort by date, find all entries earlier than that entry, return the oldest? |
| 04:52 | Zolrath | Though I guess that way might work.. |
| 04:58 | clgv | Zolrath: a timestamp can be a good id as well if your problem environment assures its uniqueness |
| 04:58 | cark | if you do not plan to delete much from the database i guess the id thing could work |
| 04:59 | cark | but that's forcing one database request per item |
| 04:59 | Zolrath | yeah each entry will have a unique timestamp |
| 04:59 | cark | maybe more than one, if there are some deleted items |
| 05:01 | Zolrath | cark: Hm, would something like finding the first 5 entries with dates later than the current one be a better option then? |
| 05:01 | cark | would be so easy with sql : item = select from table where date = x, page before = where date < item order by date desc, page after : where date > item order by date |
| 05:02 | Zolrath | To be honest I still have research to do as how the actual ajax calls happen |
| 05:02 | cark | Zolrath: sure you want to batch as much as possible, from the database, through your application, via ajax |
| 05:03 | Zolrath | how it actually passes what the oldest/newest entries loaded so far are to the query |
| 05:03 | cark | you don't want to get too chatty when coping with internet latencies |
| 05:04 | cark | Zolrath: well you can start by passing test data, see how the ajax stuff works |
| 05:04 | cark | my first ajax call was requesting a string that said "hello" |
| 05:05 | cark | on this last project i was talking about =) |
| 05:08 | Zolrath | haha yeah I so far had it pull the title from the first entry |
| 05:08 | Zolrath | in the database |
| 05:08 | Zolrath | and that works |
| 05:08 | cark | =) |
| 05:09 | Zolrath | But I have no idea how to bind calling more entries to screen position or anything like that |
| 05:10 | Zolrath | especially based on information contained within the entry pulled |
| 05:14 | Zolrath | I'll make trying to get something based on the last entry the next challenge, before really figuring out how to tie that into the screen position |
| 05:21 | Zolrath | cark: Thanks for all your input! I'll hopefully be able to show you something "working" soon! |
| 05:22 | cark | hehe great =) |
| 06:11 | shtutgart | Clojurescript newbie: I've created the script as described here (https://github.com/clojure/clojurescript/wiki/Emacs-%26-inferior-lisp-mode) and started it. I can see the prompt, but after sending some input repl hangs forever: http://dpaste.org/1nY07/ |
| 06:20 | robermann | hello, maybe I'm missing something: this (http://pastebin.com/PVZqGLdb) is my partial resolution of a 4clojure problem (http://4clojure.com/problem/118). My problem is that it seems I'm not able to write a lazy recur/loop, not even using lazy-seq. Am I missing any fundamental concept? |
| 06:21 | robermann | my resolution works for the first two problems, but the third goes on and on in timeout |
| 06:21 | clgv | robermann: loop-rcur is not lazy |
| 06:21 | robermann | ah ok |
| 06:22 | clgv | robermann: you might use lazy-seq as standalone |
| 06:25 | clgv | robermann: http://pastebin.com/KSbXE48c |
| 06:26 | robermann | thanks, but before check it I'll try to resolve it by my own. I was checking http://clojure.org/special_forms#recur , but I cannot find where it say itsn't lazy. How could I infer that a form is not "lazy-able"? |
| 06:27 | clgv | robermann: "(almost) only lazy-seq is lazy" |
| 06:28 | robermann | I thought that (recur (next col) (lazy-seq (conj res (f cur)))))))) would recur in a lazy loop |
| 06:28 | clgv | loop-recur: is just a form to enable tail-recursion |
| 06:28 | clgv | clojure's function calls are not lazy evaluated |
| 06:28 | clgv | only lazy sequences are |
| 06:28 | robermann | mmm correct |
| 06:29 | robermann | now makes more sense :) |
| 06:29 | robermann | thank you |
| 06:29 | clgv | let me rephrase: loop-recur is a form to enable optimized tail-recursion |
| 06:30 | robermann | and works as a function call, evaluating immediately |
| 06:30 | clgv | yes. it does |
| 06:30 | robermann | ok |
| 06:31 | Chousuke | you need to use regular recursion when you create lazy seqs, not recur |
| 06:32 | Chousuke | then just wrap the recursive function call in a lazy-seq form |
| 06:32 | Chousuke | you can't do that with recur because it's not the tail position, but due to the laziness there is no stack growth issue |
| 06:32 | clgv | does the 4clojure problem list grow over time? |
| 06:33 | Chousuke | by the time the thunk gets evaluated, the original function call has returned. |
| 06:35 | robermann | Chousuke: are you referring to clgv's solution right? |
| 06:35 | Blafasel | Trying to put a clojure environment on most of my machines here: How do you suggest doing that? For example, my fedora here packages 1.2.1. Would you use that or go with the .jar? Is there something like rvm or a tool of sorts to keep my environment current? |
| 06:36 | clgv | robermann: I guess he didnt read it, since he describes it ;) |
| 06:36 | Chousuke | robermann: yes. |
| 06:36 | clgv | ok, my error |
| 06:37 | Chousuke | I think you can actually do (cons (f (first coll)) (lazy-seq (my-sad-map (rest coll)))) too |
| 06:39 | clgv | you forgot an f^^ otherwise you have to have another (possible anonymous) closure with f |
| 06:40 | Chousuke | right |
| 06:40 | Chousuke | I think that implementation of map will always force the evaluation of the first element of the seq though :/ because (when (seq coll) ...) is outside the lazy-seq form |
| 06:42 | clgv | Chousuke: yeah I thought about moving it into lazy-seq. but to demonstrate lazy-seq it also works^^ |
| 07:00 | robermann | clgv or Chousuke: could I use "next" instead of "rest"? |
| 07:00 | clgv | why? |
| 07:00 | clojurebot | http://clojure.org/rationale |
| 07:01 | robermann | ah ok, I found "rest versus next" on your book :) |
| 07:02 | robermann | (to be honest I read it, but just I forgot all those useful informations) |
| 08:04 | chrido | hi, does anybody know how to get syntax-highlightning with *.cljs files in LaClojure/IntelliJ? |
| 08:31 | fdaoud | ,(let [teams (range 1 9)] (map list (take 4 teams) (reverse (drop 4 teams)))) |
| 08:31 | clojurebot | ((1 8) (2 7) (3 6) (4 5)) |
| 08:31 | fdaoud | better way to do that? |
| 08:35 | nachtalp | fdaoud: you don't need to use drop |
| 08:35 | fdaoud | ,(let [teams (range 1 9)] (map list (take 4 teams) (reverse teams))) |
| 08:35 | clojurebot | ((1 8) (2 7) (3 6) (4 5)) |
| 08:36 | fdaoud | nachtalp: like that? |
| 08:36 | nachtalp | ,(let [teams (range 1 9)] (take 4 (map list teams (reverse teams)))) |
| 08:36 | clojurebot | ((1 8) (2 7) (3 6) (4 5)) |
| 08:36 | nachtalp | or like that |
| 08:37 | fdaoud | ah, I like yours better |
| 08:37 | nachtalp | fdaoud: reverse is not lazy, however... |
| 08:38 | fdaoud | nachtalp: yeah I was wondering about that.. |
| 08:39 | fdaoud | nachtalp: thanks |
| 08:39 | nachtalp | fdaoud: glad to help :) |
| 08:40 | fdaoud | nachtalp: appreciate it.. one more question? |
| 08:40 | nachtalp | fdaoud: sure |
| 08:40 | fdaoud | how do you flatten by one level only? |
| 08:41 | fdaoud | have [ [ [1 8] [2 7] [3 6] [4 5] ] [ [9 16] [10 15] [11 14] [12 13] ] ] |
| 08:41 | fdaoud | want [ [1 8] [2 7] [3 6] [4 5] ] [ [9 16] [10 15] [11 14] [12 13] ] |
| 08:41 | fdaoud | sorry |
| 08:41 | fdaoud | want [ [1 8] [2 7] [3 6] [4 5] [9 16] [10 15] [11 14] [12 13] ] |
| 08:42 | clgv | fdaoud: apply concat |
| 08:42 | nachtalp | ,(reduce concat [ [ [1 8] [2 7] [3 6] [4 5] ] [ [9 16] [10 15] [11 14] [12 13] ] ]) |
| 08:42 | clojurebot | ([1 8] [2 7] [3 6] [4 5] [9 16] ...) |
| 08:43 | clgv | or you use mapcat when generating those two lists via map |
| 08:43 | nachtalp | apply makes more sense |
| 08:46 | fdaoud | clgv: mapcat does the trick :) |
| 08:46 | fdaoud | thank you both! |
| 08:47 | fdaoud | so much nicer than a ton of Java code.. |
| 08:52 | clgv | fdoud: I guess you can skip the reverse by a clever use of partition and map |
| 08:56 | fdaoud | clgv: ? |
| 08:57 | clgv | fdaoud: with the following you get pairs of the ranges you want to combine: ##(->> (range 16) (map inc) (partition 4) (partition 2)) |
| 08:57 | lazybot | ⇒ (((1 2 3 4) (5 6 7 8)) ((9 10 11 12) (13 14 15 16))) |
| 08:58 | clgv | it shouldnt be that hard to continue from that to your goal |
| 09:01 | fdaoud | clgv: ok but I don't see how that skips the reverse? |
| 09:02 | clgv | fdaoud: right, I expressed that wrong - you only have to reverse what you actually use |
| 09:02 | fdaoud | clgv: ah, I understand |
| 09:04 | jonasen | Anyone know what's going on here: http://build.clojure.org/job/data.csv/org.clojure$data.csv/lastBuild/console ? |
| 09:04 | jonasen | I don't know why it fails. Running 'mvn clojure:test' locally works fine but fails on build.clojure.org |
| 09:05 | fdaoud | clgv: great thanks |
| 09:20 | dnolen | jonasen: clearly this commit broke things, https://github.com/clojure/data.csv/commit/8608a2c62aac58eb2deab5801e55323a75d2e06c |
| 09:20 | cemerick | jonasen: .setLength is only in JDK 6, IIRC |
| 09:21 | jonasen | cemerick: ok, I didn't know that. Thanks |
| 09:25 | cark | is there a problem in 1.3 where recompiling a defmulti has no effect ? |
| 09:25 | cemerick | jonasen: sorry, no, that's not right; that sort of error is something I hit before on Clojure 1.1, but it should be fine in 1.2 |
| 09:26 | cark | i mean without restarting the repl |
| 09:26 | jonasen | cemerick: this is on 1.3.0-beta1 |
| 09:28 | jonasen | I found this on the mailing list https://groups.google.com/forum/#!msg/clojure/rp7vMFYqzTM/ZSF0DfK8z2AJ |
| 09:28 | jonasen | might be related? |
| 09:29 | cemerick | ,(.setLength (StringBuilder.) 0) |
| 09:29 | clojurebot | nil |
| 09:30 | jonasen | I have not been able to reproduce the exception locally |
| 09:33 | cemerick | jonasen: I've hit this before, but now I can't seem to reproduce it on Clojure 1.1 either: https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl.clj#L166 |
| 09:33 | clgv | ,(clojure-version) |
| 09:33 | clojurebot | "1.3.0-master-SNAPSHOT" |
| 09:33 | clgv | &(clojure-version) |
| 09:33 | lazybot | ⇒ "1.2.0" |
| 09:33 | cemerick | cark: The dispatch fn is cached; you need to ns-unmap the var, and then reload the definition. |
| 09:34 | cark | allright i thought it was something like that |
| 09:34 | cark | thanks ! |
| 09:36 | jonasen | cemerick: i found this http://www.davidflanagan.com/2004/10/abstractstringbuilder.html |
| 09:37 | jonasen | setLength is in AbstractStringBuilder, which is a private class. Maybe that is the reason it fails? |
| 09:39 | cark | grrr not being able to access protected methods from a proxy is a real pain |
| 09:40 | cark | there is no way to keep a repl and effectively work with swing components |
| 09:40 | cark | no way to derive = loose |
| 09:40 | cark | paint me frustrated |
| 09:40 | cark | lose* |
| 09:47 | cemerick | jonasen: In any case, since it works locally, but fails in hudson, you "just" need to find the difference in environment. I'd certainly like to know what the real cause is. |
| 10:02 | robermann | does anyone installed the Emcs's starter-kit? I followed these instructions, all went well but now Emacs's toolbar and icons are disappeared |
| 10:03 | robermann | http://technomancy.us/153 |
| 10:04 | Zolrath | I'm pretty sure thats part of the starter kit |
| 10:04 | Zolrath | Removing the toolbar and icons |
| 10:04 | robermann | mmm :) |
| 10:04 | Zolrath | Force you to drop the mouse hah |
| 10:06 | robermann | well, here I'm on Windows, I have some mouse and not ASCII icons :D |
| 10:07 | robermann | plenty of "antifeature", maybe |
| 10:10 | joegallo | i think it's a polite suggestion from the author that you'll prefer it that way, eventually. |
| 10:11 | joegallo | if you disagree, you can put it in your emacs config that you want those back, and they shalt appear |
| 10:11 | joegallo | he's attempting to provide what he considers to be sane defaults |
| 10:11 | joegallo | if you disagree, feel free to change them back |
| 10:11 | cark | you just need to learn about navigating the config screens... i think the fastest would be to learn going without the toolbar |
| 10:20 | robermann | yes, you all are right, but I was trying to understand if this starter-kit would be an easier setup than Clojurebox |
| 10:23 | robermann | every "raw" installation of Emacs on Windows does not work properly; I thought this version (http://code.google.com/p/emacs-for-windows/updates/list) had included all binary dependencies (like "sh") |
| 10:23 | robermann | but, instead of it, I also loose the toobars :D |
| 10:25 | robermann | by now I'll keep with Clojurebox on Windows. I don't regret command line setups, just searching for a ready-to-go Clojure-environment setup |
| 10:28 | clgv | robermann: you could try eclipse with ccw under windows |
| 10:31 | robermann | last time I checked it was lacking something like indentation; it seemed to me a beta version |
| 10:33 | duck1123 | Why not just add (tool-bar-mode 1) to the bottom of your ini file? |
| 10:33 | duck1123 | If you're using the starter kit,create <username>.el and put it there |
| 10:33 | clgv | ah well beta would be an insult. but the feature set has a lot growth potential, indeed ;) |
| 10:38 | robermann | yes clgv :) Maybe I checked it time ago; it surely has a lot of growth potential :) |
| 11:08 | kzar | Is there a function that takes a map, key and function and returns a new map which just changed the given key by running the function on it's value? |
| 11:10 | clgv | kzar: update-in |
| 11:11 | kzar | clgv: Aha, had a hunch there was something that did that. Thanks |
| 11:35 | kzar | Does noir work OK if you use Clojure 1.3 in your project? |
| 11:35 | Zolrath | Yeah just use noir "1.1.1-SNAPSHOT" |
| 11:36 | kzar | Zolrath: Great OK |
| 11:36 | Zolrath | When working with the DOM in ClojureScript/Pinot if I add a click handler to images and use that to add new images, the new images don't have the click event. |
| 11:37 | Zolrath | Is there any way to make the click handler that is generating the images reinitialize itself I suppose? |
| 11:47 | Blkt | could anyone help me understanding why I get this kind of error? |
| 11:47 | Blkt | #<CompilerException java.lang.RuntimeException: java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IPersistentVector (NO_SOURCE_FILE:0)> |
| 11:50 | kzar | Blkt: I guess you're doing something that expects a vector but it doesn't get one. Something like this: |
| 11:50 | kzar | ,(subvec (seq [1 2 3]) 1) |
| 11:50 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector$ChunkedSeq cannot be cast to clojure.lang.IPersistentVector> |
| 11:50 | Blkt | mmm |
| 11:50 | Blkt | let me see |
| 11:50 | kzar | ,(subvec [1 2 3] 1) |
| 11:50 | clojurebot | [2 3] |
| 11:51 | Blkt | thanks kzar!!! |
| 11:51 | Blkt | I just found the freaking erro! |
| 11:51 | Blkt | error* |
| 11:52 | kzar | sweet good work |
| 11:52 | Blkt | I've been digging the code for hours... |
| 11:53 | kzar | Blkt: What're you making, anything cool? |
| 11:53 | zippy314 | Has anybody used clojurescript and a goog.ui.Dialog to hold components, i.e. form elements? I figure out how to load up the content with anything but straight html, when I want to fill it with dynamically constructed elements. |
| 11:54 | Blkt | kzar: I'm using Clojure to handle some neural network stuff in Java |
| 11:54 | Blkt | using neuroph |
| 11:54 | Blkt | pretty good library |
| 11:55 | kzar | Blkt: oo cool |
| 11:55 | Blkt | yes, I'm pretty happy about it |
| 11:55 | Blkt | it's not common in Italy to work with AI |
| 11:59 | kzar | Gotta run anyway, ciao |
| 11:59 | Blkt | ciao |
| 12:01 | Bronsa | italiano Blkt? |
| 12:03 | Zolrath | Is there any way around events not working with event created elements or am I out of luck? |
| 12:04 | dnolen | Zolrath: what are you referring to? |
| 12:04 | Blkt | Bronsa: si :D |
| 12:05 | Bronsa | yeah |
| 12:05 | Blkt | Bronsa: you too? |
| 12:05 | Bronsa | yep |
| 12:05 | Blkt | :) |
| 12:05 | Zolrath | dnolen: Oh I guess that was incredibly non-specific. ClojureScript/Pinot click event handling |
| 12:06 | fdaoud | it's not common in Italy to work |
| 12:06 | fdaoud | :( |
| 12:06 | dnolen | Zolrath: events work fine. I haven't played around much Pinot yet. |
| 12:06 | pyr | Zolrath: you just have to make sure event handlers are setup after your elements are created |
| 12:07 | pyr | Zolrath: or alternately, use a partial as reference |
| 12:08 | Zolrath | The issue here being if I made a <li> that generates more <li>s when clicked, the generated items don't have the click event |
| 12:08 | Zolrath | Trying to figure out if theres a way to make the event function wrap the new elements |
| 12:11 | dnolen | Zolrath: are you add click events to the newly adding li elements? |
| 12:12 | dnolen | erg I meant - are you adding click events to the new added li elements ? |
| 12:12 | duck1123 | Does the Closure library have something equivalent to JQuery's live? |
| 12:15 | Zolrath | I'm not adding it to the newly added elements specifically, I was reallllly hoping adding the event to a dom type would propigate to newly created ones or I'd be able to have the function that wraps the elements run again automatically |
| 12:15 | Zolrath | jQuery.live looks exactly like what I was thinking |
| 12:15 | ibdknox | Zolrath: events on partials are delegated like that |
| 12:17 | Zolrath | Yeah? hm |
| 12:18 | ibdknox | https://github.com/ibdknox/pinot/blob/master/examples/todo.cljs#L43 |
| 12:18 | ibdknox | that line essentially says for anything created by that partial function ever, bind this event |
| 12:20 | Zolrath | is there any way to select an element of a partial for the click handler in the query or would I need to make the section of the partial I want to put the handler on into its own partial? |
| 12:25 | Zolrath | ibdknox: While I have a direct line to the man himself, am I incorrect in thinking that Noir can't handle %20 in the address bar? |
| 12:25 | Zolrath | ibdknox: I have images with spaces in their names and if I try to go to them I just get a white screen, but if I remove the spaces they work. |
| 12:26 | ibdknox | Zolrath: huh, I haven't tried. It should do whatever compojure does in that instance, as resource routes are handled purely with compojure |
| 12:27 | clgv | short question: I want to use a classic SQL database like postgresql - is there already a clojure frontend? |
| 12:28 | hiredman | ~google jdbc |
| 12:28 | clojurebot | First, out of 1780000 results is: |
| 12:28 | clojurebot | JDBC - Oracle |
| 12:28 | clojurebot | http://www.oracle.com/technetwork/java/javase/jdbc/index.html |
| 12:28 | hiredman | ~google jdbc postgres |
| 12:28 | clojurebot | First, out of 42300 results is: |
| 12:28 | clojurebot | PostgreSQL JDBC Driver |
| 12:28 | clojurebot | http://jdbc.postgresql.org/ |
| 12:28 | clgv | hmok. I thought that there is plenty in the java world ;) |
| 12:28 | clgv | but there was also a chance that a comfortable clojure layer already exists ... |
| 12:28 | ibdknox | Zolrath: it appears you are correct that it doesn't url parse them |
| 12:29 | ibdknox | clgv: clojureql |
| 12:29 | clgv | ibdknox: oh right^^ |
| 12:29 | Zolrath | ibdknox: Yeah it doesnt seem to be able to handle any %__ characters |
| 12:30 | ibdknox | interestingly, it will pick up hey%20how as a route |
| 12:30 | ibdknox | Zolrath: I'll see what can be done about that |
| 12:31 | Zolrath | ibdknox: You're my hero, thanks! |
| 12:31 | seancorfield | clgv: clojure.java.jdbc is a reasonable wrapper for SQL / jdbc - depends what you want |
| 12:32 | clgv | seancorfield: yep. I have to find out what I want. right now I am performing $joins and $rollups on incanter datasets ;) |
| 12:32 | clgv | that might not scale with my bigger datasets |
| 12:33 | seancorfield | for raw performance you're going to want to stay "close to the metal" so c.j.jdbc will let you do that |
| 12:34 | ibdknox | Zolrath: I'm actually confused, ring *does* decode the url... |
| 12:35 | Zolrath | ibdknox: Hm so at some mysterious undefined point from there to here it goes awry. That's less fun. |
| 12:36 | ibdknox | yeah lol |
| 12:39 | ibdknox | Zolrath: ok, it only decodes the body for form params, but never sets the URI to a decoded state. The fix is a very simple piece of middleware. I'll add it tonight, or maybe earlier if I get some free time |
| 12:41 | jriddy | quick question: is there a builtin function f : (f [[k1 v1] [k2 v2] ... ]) -> {k1 v1, k2 v2, ... } |
| 12:41 | Zolrath | ibdknox: Aweeeeeesome. Thanks for looking into it! |
| 12:41 | jriddy | ? |
| 12:41 | ibdknox | jriddy: (into {} ...) |
| 12:42 | jriddy | (partial reduce (fn [m [k v]] (assoc m k v)) {}) works |
| 12:42 | jriddy | oh |
| 12:42 | jriddy | thanks |
| 12:42 | ibdknox | ,(into {} [[:a 1] [:b 2]]) |
| 12:42 | clojurebot | {:a 1, :b 2} |
| 12:57 | bendlas` | I want to use clojure.java.data, but it's not released yet |
| 12:57 | bendlas` | which repository should I use for snapshots? |
| 12:58 | bendlas` | My guess is https://oss.sonatype.org/content/repositories/snapshots/, but it's not documented anywhere |
| 13:26 | justicefries | so I'm getting more and more into clojure...I'm using homebrew to install leiningen, when I enter lein repl it's version 1.2.1 |
| 13:26 | justicefries | should I be on 1.3? if so...possible with lein? |
| 13:27 | bhenry | try lein upgrade |
| 13:27 | gtrak | justicefries, make your project.clj point to 1.3 |
| 13:27 | bhenry | oh yeah |
| 13:27 | bhenry | derr |
| 13:27 | justicefries | ah |
| 13:27 | justicefries | perfect |
| 13:27 | justicefries | thank you |
| 13:28 | justicefries | gtrak: is there a global one? I'm not in the context of a project at the moment...but I suppose that's the idea behind lein is to be in that context. |
| 13:28 | gtrak | not sure.. simply do lein new and you'll be in one |
| 13:29 | gtrak | any pure repl work probably shouldn't care about 1.3 vs 1.2 |
| 13:29 | justicefries | ah okay sure. |
| 13:30 | justicefries | i'm coming over from the world of RVM/ruby/bundler, so. :) |
| 13:31 | Blafasel | Hmm.. vimclojure seems to be quite nice and good enough for all my needs. Let's steal some .vimrc ideas from the net.. :) |
| 13:31 | gtrak | justicefries, I wouldn't know about that stuff, but welcome! |
| 13:31 | justicefries | thanks! |
| 13:32 | justicefries | Blafasel: I'm of the same mind but emacs/swank/slime seems so nice. |
| 13:32 | hiredman | imagine if bundler had been around from the start and people looked at you crazy if you tried to do it differently |
| 13:32 | justicefries | makes sense. |
| 13:32 | justicefries | kind of like npm with node js |
| 13:32 | hiredman | "wait, you want to install thingks globally? whatever for?" |
| 13:33 | Blafasel | justicefries: I'm used to vi/vim - and don't want to get started with emacs as an ide only. So - not for me, not right now :) |
| 13:40 | technomancy | I think there's a plugin for a "global lein project", but I think it's silly to have a special case like that; just make a new project since they are cheap. |
| 13:43 | Raynes | technomancy: It's useful to be able to configure dependencies and such for a 'default' repl outside of any other project. I don't know how that global lein project plugin does it, but the way cake does it results in cljr-like functionality. |
| 13:44 | technomancy | must be solving problems I don't have |
| 13:45 | Raynes | Must be. |
| 13:46 | technomancy | question is if it's a problem others have or a problem they think they have |
| 13:46 | robermann | I add my "default" jar/source foders in the lein script file, hard coded |
| 13:46 | Raynes | I'm not sure it's a problem in general. |
| 13:46 | technomancy | I get so many requests to solve the latter |
| 13:47 | Raynes | It's just handy. |
| 13:47 | duck1123 | robermann: but wouldn't your build fail if someone else checked out your project? |
| 13:47 | gtrak | just make a project and a default-repl bash script... |
| 13:48 | robermann | yes of course, they are local dependencies |
| 13:48 | Raynes | Or just use the global project. |
| 13:48 | gtrak | but what do you guys do in a repl like that except toy things? |
| 13:49 | gtrak | it has to be attached to swank or something to be useful, imo |
| 13:50 | Raynes | Meh, I don't even use swank these days. |
| 13:50 | robermann | I use Emacs's REPL |
| 13:50 | gtrak | the inferior-lisp? |
| 13:50 | Raynes | Just cake's repl is fine for me. |
| 13:50 | robermann | no, now i'm on Windows + Clojurebox |
| 13:51 | robermann | very cool |
| 13:51 | gtrak | I like the navigation and compilation stuff in slime |
| 13:51 | gtrak | esp if you're looking at other people's code... what do you do? |
| 13:52 | robermann | ultimately I added to my clojurebox setup the tabber and rainbow stuff, now I'm an happy man |
| 13:52 | Raynes | Must be solving problems I don't have. |
| 13:52 | Raynes | ;) |
| 13:52 | robermann | :) |
| 13:53 | technomancy | heh |
| 13:53 | robermann | gtrak: I added to my emacs load-path this file (a revisioned version of): http://pastebin.com/dVivdqpB |
| 13:53 | robermann | [ the original was here: http://www.learningclojure.com/2010/03/conditioning-repl.html ] |
| 13:54 | robermann | it contains useful function to inspect other people's code, |
| 13:54 | robermann | or just to study the core funcitons |
| 13:54 | gtrak | pretty useful, yea |
| 13:56 | robermann | this is a part of .emacs http://pastebin.com/gLq0zrDt |
| 13:56 | robermann | my .emacs |
| 13:56 | gtrak | I just type something and use M-. |
| 13:56 | gtrak | and find-doc or source is available from the repl |
| 13:56 | robermann | but you have to remember to require its namespace before |
| 13:56 | gtrak | or compile it from emacs |
| 13:57 | justicefries | gah emacs is hard. |
| 13:57 | justicefries | do people use aquamacs or base emacs? |
| 13:57 | gtrak | true |
| 13:57 | justicefries | i'm trying to figure it out. ;) |
| 13:57 | robermann | I use aquamacs too |
| 13:57 | justicefries | i can't even figure out how to switch between my SLIME window and a regular buffer |
| 13:58 | robermann | but I was not able to do a clojure-jack-in mode |
| 13:58 | gtrak | M-x describe-bindings |
| 13:58 | gtrak | C-x b is buffer switch |
| 13:58 | gtrak | I suggest printing out the cheat sheets |
| 13:58 | technomancy | aquamacs is unsupported and nonportable |
| 13:59 | justicefries | i'm coming from vim so I feel helpless |
| 13:59 | robermann | in order to work with aquamacs, I had to disable autodoc |
| 13:59 | robermann | and now with M-x slime-connect I can do something |
| 14:00 | gtrak | ooo, technomancy v2 starter kit |
| 14:01 | robermann | on windows i'm still using clojurebox http://clojure.bighugh.com/ |
| 14:02 | robermann | the best IMHO :) (congrats technomancy) |
| 14:02 | technomancy | it's been out for a while; just formally announced last night. |
| 14:03 | robermann | I have to run away - no wife no party |
| 14:03 | robermann | bye |
| 14:27 | shep-home | Hmm, I parsed "technomancy v2 starter kit" as "technomancy is having a child" |
| 14:27 | scgilardi | :) |
| 14:33 | justicefries | aaah emacs is just frustrating. |
| 14:33 | amalloy | justicefries: what are you used to using? |
| 14:33 | justicefries | vim. |
| 14:34 | justicefries | i'm actually trying to go throught he tutorial right now. |
| 14:34 | justicefries | and figure out what's going on. |
| 14:36 | justicefries | and install emacs 24 in osx. |
| 14:36 | justicefries | i'm about to roll with slimv and vimclojure. :D |
| 14:43 | justicefries | or I could just slug it out. |
| 14:44 | gtrak | justicefries, emacs is easy peasy |
| 14:44 | gtrak | after about 2 days I was able to get rid of the menu bars |
| 14:44 | justicefries | ah nice. |
| 14:44 | justicefries | I was thinking of using technomancy's starter kit. |
| 14:44 | hiredman | you should |
| 14:44 | gtrak | yea.. I started from modifying his stuff |
| 14:44 | hiredman | abosolutely |
| 14:45 | amalloy | gtrak: you make it sound like it took you two days to figure out how to get rid of them, rather than learning how to go without them |
| 14:45 | gtrak | then printing the cheat sheets for emacs and paredit... and M-x describe-bindings for the rest |
| 14:45 | gtrak | amalloy, yes, I mean, learning how not to need them anymore took about 2 days of using it at work |
| 14:46 | amalloy | gtrak: C-h b, btw |
| 14:46 | gtrak | ya |
| 14:48 | gtrak | and I'd been meaning to get around to it for about 10 years... |
| 15:03 | amalloy | i think ten years ago i was just realizing programming might be fun |
| 15:04 | amalloy | if i'd thought emacs was required, at the time, i might have given up. scary stuff to learn, at first |
| 15:04 | technomancy | ten years ago I was just recovering from the damage "Learn C++ For Macintosh" inflicted on my enthusiasm for computoring. |
| 15:04 | amalloy | nice |
| 15:04 | gtrak | yea... in high school I read Learn C++ in 21 days |
| 15:05 | pcavs | ⁃ /clear |
| 15:05 | gtrak | i didn't learn it in 21 days |
| 15:05 | amalloy | TI-BASIC ftw |
| 15:07 | ibdknox_ | 10 years was VB6 for me lol |
| 15:10 | fdaoud | There is no possible way to say it without offending someone so I'll just be blunt: |
| 15:10 | fdaoud | I think emacs is lame. |
| 15:10 | fdaoud | --Doug Hoyte |
| 15:11 | Nikelandjelo | Hi. I'm trying to use matching lib https://github.com/clojure/core.match . But I have problem with little code snippet (I deleted all reduntant information): (match [expr] [[:div num den] 0 [[func]] 0) . It throws IndexOutOfBound exception while expanding macro. Is it lib bug or my? |
| 15:11 | gtrak | fdaoud, ! |
| 15:11 | jriddy | fdaoud: +1 |
| 15:11 | amalloy | fdaoud: yeah, i read that. doug hoyte is a bit of a tough read |
| 15:11 | fdaoud | amalloy: indeed |
| 15:12 | amalloy | Nikelandjelo: your deletion is incorrect, since that isn't a well-formed sexp |
| 15:12 | fdaoud | personally I prefer vim over emacs but I just keep my mouth shut about it; to each their own. |
| 15:12 | amalloy | i did get a few useful things out of LoL, but most of it is a lot more useful for CL than clojure |
| 15:13 | amalloy | huge focus on mutation |
| 15:13 | fdaoud | true, true |
| 15:13 | fdaoud | still good food for the brain |
| 15:13 | amalloy | *nod* |
| 15:13 | amalloy | provided you spit out the evangelizing (about CL *and* vim) before you swallow |
| 15:13 | fdaoud | heh |
| 15:14 | fdaoud | well I don't get into editor wars; I think each should use what makes them *productive* |
| 15:14 | amalloy | indeed |
| 15:14 | fdaoud | so choose *one* editor and become an expert user of it. |
| 15:14 | Nikelandjelo | @ammalloy, Oh, sorry. I missed one bracket after 'den', but it typo while copying to chat. Is it still incorrect? |
| 15:14 | amalloy | the blog post i wrote about editors is basically "i like emacs, you should use either emacs or vim" |
| 15:15 | fdaoud | i.e. if you're using the mouse, or the arrow keys most of the time, you didn't learn enough about the editor, or the editor's commands are weak |
| 15:15 | amalloy | Nikelandjelo: i dunno, i have no idea how to use match. i'm just saying, you should get something that reproduces your actual error, and then copy-paste that verbatim; trying to make edits by hand will just introduce errors and confuse the issue |
| 15:36 | duck1123 | I just recently found some old printouts of TI-basic games I had written. How did I ever live with only GOTO for flow control |
| 15:42 | dnolen | Nikelandjelo: do you have a gist? there are typos in what you pasted I think. |
| 15:42 | Nikelandjelo | dnolen: https://gist.github.com/1249029 |
| 15:42 | dnolen | Nikelandjelo: that said, core.match is very alpha and in the midst of some big changes - so use at your own peril. |
| 15:43 | dnolen | Nikelandjelo: what input is failing? |
| 15:44 | dnolen | Nikelandjelo: and are you getting match from Clojars? |
| 15:45 | Nikelandjelo | dnolen: it fails while trying to expand match. Fails when I defining test. I use lein, so it must be from clojars |
| 15:46 | dnolen | one second, I'll update it which should fix your issue |
| 15:46 | dnolen | Nikelandjelo: done |
| 15:46 | Nikelandjelo | Ok. I'll try now |
| 15:46 | dnolen | Nikelandjelo: in general tho, it's best to use from source until I do a proper release. |
| 15:48 | dnolen | Nikelandjelo: all that said, I certainly encourage people to experiment with it and file issues here - http://dev.clojure.org/jira/browse/MATCH |
| 15:50 | Nikelandjelo | dnolen: ok, thanks. Yes, it works now. Thanks for link to jira project. |
| 16:01 | bsod1 | hi, I'm trying to implement some algorithms in clojure, can anyone tell my why this code fails when I run (next-prime 16) but doesn't when I run (next-prime 11) ? http://paste.pocoo.org/show/484010/ |
| 16:02 | bsod1 | sorry, forgot to mention, the exception is 'infinite or NaN, java.lang.NumberFormatException' |
| 16:03 | gtrak | bsod1, which line errors out? |
| 16:03 | bsod1 | gtrak: I don't know, I'm using counterclockwise and it doesn't tell this kind of useful information |
| 16:04 | gtrak | ah.. you don't get a stack trace? |
| 16:04 | gtrak | I'll give it a go |
| 16:05 | bsod1 | gtrak: here's my stack trace http://paste.pocoo.org/show/484014/ |
| 16:05 | gtrak | it says line 151 |
| 16:06 | gtrak | looks like the mod has an infinity |
| 16:06 | gtrak | the one all the way on the right would get eval'd first |
| 16:07 | gtrak | hmm, actually not sure about that |
| 16:08 | gtrak | I would say add a bunch of lets and print statements, there's a useful trace macro floating around somewhere |
| 16:08 | gtrak | http://stackoverflow.com/questions/2352020/debugging-in-clojure |
| 16:08 | bsod1 | gtrak: ok, thanks for the link |
| 16:09 | gtrak | but you can see it's all promoted to bigdecimal |
| 16:20 | hiredman | http://hg.openjdk.java.net/mlvm/mlvm/hotspot/file/0afdd88556bc/tagu.txt very exciting |
| 16:24 | amalloy | hiredman: so that's like...i'm not entirely sure i know what tagged unions are in this context. union types, basically? "An object whose type is either Integer or String"? |
| 16:25 | hiredman | fixnums |
| 16:26 | gtrak | what's a fixnum? |
| 16:26 | hiredman | non-primitive composite value types |
| 16:26 | amalloy | *blink* |
| 16:27 | hiredman | http://blogs.oracle.com/jrose/entry/fixnums_in_the_vm |
| 16:29 | amalloy | thanks |
| 16:30 | hiredman | now we just need tco |
| 16:33 | pjstadig | then we'll be where guy steele wanted us to be in 1998 |
| 16:34 | hiredman | :D |
| 16:35 | hiredman | ~lisp machine |
| 16:35 | clojurebot | my lisp machine is the jvm |
| 16:40 | amalloy | hiredman: neat. i'm surprised he says that closures and method references could benefit from this treatment; it seems to me that (a) the types might not be that frequently used, and (b) closures will generally have a payload that is larger than a few words |
| 16:41 | gtrak | do you need tco for CPS? |
| 16:42 | hiredman | gtrak: depends |
| 16:43 | technomancy | ooooooooh tagged unions are fixnums?! |
| 16:43 | technomancy | why didn't they say so =) |
| 16:46 | hamza | How exactly do i add clojure.data.priority-map to leiningen ? tried [org.clojure/data.priority-map "0.0.1"] can find it. |
| 16:46 | hamza | *can't |
| 16:47 | gtrak | hamza, check clojars |
| 16:47 | hamza | it is not there |
| 16:47 | hiredman | hamza: most likely no one has done a build |
| 16:49 | hamza | hmm but who build the one here http://build.clojure.org/job/data.priority-map-test-matrix/ |
| 16:51 | gtrak | not sure i get it |
| 16:51 | hiredman | oh there is a build, but you need to use the snapshot repos |
| 16:52 | hamza | ok but how do i refer to it? in dependencies |
| 16:53 | hiredman | you need to use the full version "0.0.1-SNAPSHOT" |
| 16:55 | hamza | with this [org.clojure/data.priority-map "0.0.1-SNAPSHOT"] I get unable to resolve artifact |
| 16:56 | hiredman | sure, as I said you need to use the snapshot sonatype repo |
| 16:57 | hamza | do i need to add a repo? |
| 16:59 | devn | hamza: by what hiredman said: "use the snapshot sonatype repo" |
| 17:10 | khaliG | The clojure ants link doesn't seem to work anymore. has anyone got the clj handy to paste up? |
| 17:18 | srid | clojurescript repl doesn't work for me -- TypeError: Cannot call method 'appendChild' of null |
| 17:19 | srid | what scares me is that there is source information in the traceback |
| 17:19 | srid | it only shows the compiled js. which means writing large scale javascript in clojurescript is just not a good idea yet. |
| 17:39 | jao | A FF7 reviewer: "a great improvement on my old MBP with only 5 Gb of RAM". *Only* 5Gb. Ludicrous. |
| 17:39 | jao | oops |
| 17:39 | jao | sorry, wrong window |
| 17:40 | gfrederi` | that's the craziest password I've seen yet |
| 17:40 | brehaut | secure though |
| 17:40 | gfrederi` | surely |
| 17:40 | gfrederi` | well, not anymore |
| 17:40 | gfrederi` | switch out one of those 5's for an S maybe |
| 17:41 | amalloy | gfredericks: still 100% secure. we'll all assume he's changed it, so we won't try the old one |
| 17:41 | gfredericks | I bet that was his motivation all along... |
| 17:41 | gfredericks | he's won this round, but next time we'll know what to watch for. |
| 17:42 | amalloy | i really can't help but read that FF as Final Fantasy; i can't believe they want us to think it means FireFox |
| 17:42 | joly | same here |
| 17:43 | gfredericks | maybe they should have gone with MF. That doesn't mean anything else. |
| 17:44 | technomancy | FF7 really was the best. |
| 17:48 | Netpilgrim | If I want to create an empty vector with a certain length, would (vec (repeat length nil)) be considered idiomatic? |
| 17:49 | gfredericks | Netpilgrim: looks fine to me |
| 17:49 | brehaut | its not really empty though is it, its full of nils |
| 17:49 | gfredericks | I think calling it an "empty" vector is a bit misleading, as brehaut points out |
| 17:49 | gtrak | ,[] |
| 17:49 | clojurebot | [] |
| 17:49 | Netpilgrim | Well, you can't really create a vector that's both empty and has a length greater than 0, can you? |
| 17:50 | gtrak | ,(empty? []) |
| 17:50 | clojurebot | true |
| 17:50 | gtrak | ,(empty? [nil]) |
| 17:50 | clojurebot | false |
| 17:50 | amalloy | no, you can't, which is why people are guessing at what you actually mean |
| 17:50 | gfredericks | Netpilgrim: I think "empty" normally communicates "of length 0", so that'd be contradictory in that case |
| 17:50 | amalloy | i mean, it's easy to make a vector of N nils, which seems like what you asked for |
| 17:50 | Netpilgrim | amalloy: OK, sorry. I'll try to be clearer next time. |
| 17:51 | amalloy | nah, i'm just being pedantic. your included example-code made your desire clear |
| 17:51 | Netpilgrim | amalloy: I really don't care for the nils. I need a vector with a certain length to use it with assoc later. |
| 17:51 | amalloy | &(vec (range 10)) |
| 17:51 | lazybot | ⇒ [0 1 2 3 4 5 6 7 8 9] |
| 17:52 | gfredericks | the poor processor running the ADD command for naught |
| 17:52 | gtrak | meh, 80/20 rule |
| 17:52 | gfredericks | :) |
| 17:52 | Netpilgrim | amalloy: Doesn't feel right. If I populate it with numbers it looks as if I cared about the content. |
| 17:52 | gfredericks | &(repeat 20 :dont-care-bout-this-content) |
| 17:52 | lazybot | ⇒ (:dont-care-bout-this-content :dont-care-bout-this-content :dont-care-bout-this-content :dont-care-bout-this-content :dont-care-bout-this-content :dont-care-bout-this-content :dont-care-bout-this-content :dont-care-bout-this-content :dont-care-bout-this-content :do... https://gist.github.com/1249359 |
| 17:52 | gfredericks | woops, not a vec |
| 17:53 | amalloy | gfredericks: gist abuser! |
| 17:53 | gfredericks | amalloy: but if it was only 4 it wouldn't have seemed realistic! |
| 17:53 | gtrak | ,:nil |
| 17:53 | clojurebot | :nil |
| 17:53 | gfredericks | ,(boolean :nil) |
| 17:53 | clojurebot | true |
| 17:53 | gtrak | null keyword pattern :-) |
| 17:54 | gfredericks | gtrak: a chapter in your upcoming book? |
| 17:54 | gtrak | ha, yes |
| 17:54 | gfredericks | "Design Patterns for the Savvy Clojure Coder" |
| 17:54 | gfredericks | gtrak: I want a section on :nil vs. :null |
| 17:55 | gtrak | there will be a special chapter on the :nil visitor factory memento |
| 17:55 | gtrak | facade |
| 17:56 | gfredericks | I also think we need a certification exam |
| 17:57 | gtrak | indeed, I'll implement java in macros for a proper OO |
| 17:59 | TimMc | (do-java '(public class Foo \{ ... \})) |
| 18:00 | gtrak | yea, like that |
| 18:00 | TimMc | Err, that's a function, hold on |
| 18:01 | TimMc | (do-java public class Foo \{ ... \}) |
| 18:15 | srid | can new dependencies be added to a lein project without having to restart swank? |
| 18:19 | amalloy | no |
| 18:38 | michaelr525 | hmm |
| 18:38 | michaelr525 | just installed ido-ubiquitous |
| 18:38 | michaelr525 | now i get Symbol's values as variable is void: collection when I press M-x |
| 18:39 | michaelr525 | anyone know something about it? |
| 19:56 | ataggart | anyone know to whom we speak to get a new contrib version pushed to maven? |
| 19:57 | jeremyheiler | for 1.2? |
| 19:58 | ibdknox | ataggart: I assume one of the stuarts |
| 19:58 | ataggart | yeah, I'm just going to send an email to clojure-dev |
| 20:13 | pdk | ,(Math/pow 1 0) |
| 20:13 | clojurebot | 1.0 |
| 20:13 | pdk | ,(Math/pow 2 0) |
| 20:13 | clojurebot | 1.0 |
| 20:13 | pdk | ,(Math/pow 0 0) |
| 20:13 | clojurebot | 1.0 |
| 20:14 | hiredman | http://en.wikipedia.org/wiki/Exponentiation#Exponents_one_and_zero |
| 20:16 | amalloy | whew, thanks hiredman. i was bracing myself for another aleph-0 iterations of (Math/pow x 0) |
| 20:16 | ibdknox | lol |
| 20:16 | gfredericks | ,(nth (map #(Math/pow % 0) (range)) 84872) |
| 20:16 | clojurebot | 1.0 |
| 20:17 | gfredericks | maybe it's getting bigger but the difference gets rounded out of the float |
| 20:21 | jeremyheiler | hiredman: http://en.wikipedia.org/wiki/Exponentiation#IEEE_floating_point_standard |
| 20:24 | hiredman | what about it? |
| 20:25 | jeremyheiler | hiredman: not sure, what was your point in the first place? |
| 20:25 | jeremyheiler | hiredman: oops, meant to @pdk |
| 20:25 | jeremyheiler | lol |
| 20:25 | jeremyheiler | my bad |
| 21:54 | zakwilson | So I'm running in to an issue where I'm using clj-time and the time objects it uses don't print readably. In CL, I'd be able to define a print function and a reader macro (and most likely, the library would have done so itself). What's the idiomatic way to make this easier to work with in Clojure? |
| 21:57 | cark | i beleive the pretty printer has some way to customize its output |
| 21:58 | brehaut | http://clojuredocs.org/clojure_core/1.2.0/clojure.core/print-dup |
| 21:58 | cark | ahwell even better =P |
| 21:58 | brehaut | zakwilson: i believe you define a method on print-dup for the class |
| 21:59 | zakwilson | I was unaware of print-dup and print-ctor. Thanks. |
| 21:59 | brehaut | no problem |
| 22:00 | dnolen | ,#java.util.Date[0] |
| 22:01 | clojurebot | #<Date Wed Dec 31 16:00:00 PST 1969> |
| 22:01 | brehaut | im curious what the -dup part of print-dup means |
| 22:01 | dnolen | zakwilson: if you're on 1.3.0 there literals now for deftype/record/classes |
| 22:02 | dnolen | zakwilson: but print-dup/ctor probably more flexible |
| 22:04 | zakwilson | dnolen: I'm not on 1.3 yet. My project uses quite a few libraries and I haven't gotten around to making sure they all work. |
| 22:04 | dnolen | zakwilson: gotcha |
| 22:04 | cark | ,(binding [*read-eval* false] (read-string "#java.util.Date[0]")) |
| 22:04 | clojurebot | #<Date Wed Dec 31 16:00:00 PST 1969> |
| 22:05 | cark | mhh |
| 22:05 | zakwilson | dnolen: and it's in production, so I don't want to update it haphazardly even though it's not in a very important role yet. |
| 22:09 | zakwilson | On another note, I have a bunch of maps and I want to persist them in a data store that makes getting them by key easy. I do NOT want all of my data in memory at once or I think Redis would be the way to go. I'm tempted to just use the filesystem and slurp/spit but that doesn't seem to be the most performant way to go. Any suggestions? |
| 22:10 | cark | sqlite =) |
| 22:10 | dnolen | pretty awesome to see that the ClojureScript compiler is eatin Clojure's own dogfood - no types, just plain maps and multimethods |
| 22:11 | seancorfield | zakwilson: MongoDB? |
| 22:11 | zakwilson | I'm very sure an RDBMS isn't what I want. Mongo might be. |
| 22:11 | cark | oh you're the one ! |
| 22:11 | seancorfield | with congomongo it's easy to save / read maps against mongodb... |
| 22:11 | seancorfield | we have that in production at world singles |
| 22:11 | brehaut | dnolen: why? |
| 22:12 | zakwilson | What's world singles? |
| 22:12 | cark | dnolen: i had some strange thing hapenning with core.match, wasn't working the same from a AOT program |
| 22:12 | dnolen | cark: yup, this why I should have used maps and multimethods. that should be fixed now. |
| 22:13 | cark | ah ok i see i'm coming after the battle =P |
| 22:13 | dnolen | extend-type is not something that AOT can know about. |
| 22:13 | dnolen | so bad stuff was happening if you weren't using core.match at the REPL |
| 22:13 | brehaut | dnolen: would multis and plain maps had as good performance? |
| 22:13 | cark | that's the troulbe, multis are slow |
| 22:14 | cark | tho usually good enough for me |
| 22:14 | brehaut | cark: but match uses them in the compiler right? |
| 22:14 | dnolen | cark: brehaut: this a compiler we're talking about, I'm not sure it would have made much difference here. |
| 22:14 | dnolen | not one that most users would care about anyway. |
| 22:14 | brehaut | dnolen: that does make sense. |
| 22:14 | cark | ahh ok |
| 22:15 | brehaut | http://xkcd.com/303/ |
| 22:17 | chouser | dnolen: multimethods instead of deftypes? |
| 22:17 | dnolen | chouser: yeah |
| 22:18 | amalloy | brehaut: "dup" has always sorta seemed to me to be related to "duplicate", but it's not really clear how that fits in with "print readably" |
| 22:18 | dnolen | chouser: actually, we already using multimethods everywhere. really just representing our types w/ maps. |
| 22:18 | chouser | ah |
| 22:18 | brehaut | amalloy: yeah thats as far as i could get (eg, dup2 in posix) |
| 22:19 | dnolen | chouser: types and the protocols those types are involved in |
| 22:23 | dnolen | wow backtracking saves a lot of space! |
| 22:23 | dnolen | GOTO FTW |
| 22:24 | zakwilson | If I want to use a Clojure function instead of the constructor, is there a more reasonable thing to do than (str "#=(parse (formatters :rfc822) " (unparse (formatters :rfc822) o) ")")? Outputting code by string concatenation seems the the Wrong Thing. |
| 22:32 | tomoj | so why output code by string concatenation? |
| 22:32 | tomoj | I don't get it |
| 22:40 | napping | http://www.haskell.org/hoogle/?hoogle=setHeaders |
| 22:40 | zakwilson | tomoj: I want both human and reader readability here. I'm not sure how best to get it. |
| 22:40 | napping | sorry, wrong channel |
| 22:41 | napping | click through to the haddock |
| 22:41 | napping | grr |
| 22:42 | napping | click through to the haddock |
| 22:42 | tomoj | zakwilson: huh? |
| 22:42 | tomoj | what are you actually trying to do? |
| 22:43 | zakwilson | tomoj: were you present in the channel for the initial question about clj-time and readable printing? |
| 22:45 | mcoffbyone | hi all, I have been looking the internet for hints on how to implement undo/redo in clojure (I am manipulating a stateful Java object) this is my prototype (http://pastebin.com/Zm7vcazy), could anyone have a look its pretty short. |
| 22:48 | tomoj | zakwilson: ah, no |
| 22:48 | tomoj | I mean, yes |
| 22:48 | tomoj | but I hadn't seen it |
| 22:50 | cark | ,(prn (let [o "hello"] `(parse (formatters :rfc822) ~o))) |
| 22:50 | clojurebot | (sandbox/parse (sandbox/formatters :rfc822) "hello") |
| 22:50 | cark | no string concatenation |
| 22:50 | cark | does this answer your question ? |
| 22:50 | brehaut | mcoffbyone: i think a vector zipper of functions of current state -> new state should do |
| 22:51 | tomoj | still going to have to concatenate #= onto str of that |
| 22:51 | tomoj | ? |
| 22:51 | brehaut | mcoffbyone: look at clojure.zip/vector-zip |
| 22:51 | cark | i guess =) |
| 22:51 | mcoffbyone | brehaut: thanks, I will have a look |
| 22:52 | amalloy | mcoffbyone: you should be aware of ##(doc update-in) |
| 22:52 | lazybot | ⇒ "([m [k & ks] f & args]); 'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure. If any levels do not exist, hash-maps will be created." |
| 22:52 | amalloy | and also :keys destructuring, it looks like |
| 22:54 | mcoffbyone | amalloy: update-in is exactly what I I need, thanks |
| 22:59 | zakwilson | cark: yeah, what tomoj said. I think I'll just use print-ctor and not worry about human-readability. |
| 23:00 | sjl | Can anyone point me at a sane README for how to use Redis with Clojure? |
| 23:02 | sjl | I'm trying to use redis-clojure but one of the following happens: the lib is out of date, the new version doesn't match the docs, or I get cyclic dependencies. |
| 23:04 | mcoffbyone | brehaut: the zipper is new to me, although it is similar to functional-graphs (http://web.engr.oregonstate.edu/~erwig/fgl/haskell/), I generally find it difficult to think of trees/graphs in inductive terms. |
| 23:05 | brehaut | mcoffbyone: the zippers are a little confusing for linear structures as its a general tree walking lib |
| 23:06 | brehaut | mcoffbyone: you could write a pathalogical one by hand to handle just a doubly linked list |
| 23:08 | mcoffbyone | brehaut: I have two stacks where move forward/backward by moving do/undo functions between them, its ugly |
| 23:09 | brehaut | yeah thats the one |
| 23:09 | brehaut | and its not ugly :P |
| 23:09 | brehaut | (conceptually) |
| 23:11 | mcoffbyone | brehaut: I have to avoid saving copies of objects, because ontologies can become huge |
| 23:11 | brehaut | mcoffbyone: dont save the _state_ save the transformation |
| 23:12 | mcoffbyone | brehaut: this is what I do the a "do" function modifies the object and returns the "undo" function+arguments |
| 23:13 | mcoffbyone | this part would be difficult in java without some huge designe patterns |
| 23:16 | amalloy | sjl: just use aleph's redis support. redis-clojure is not so great from what i hear |
| 23:17 | ibdknox | sjl: https://github.com/nathell/redis-clojure/branches/clojure-1.2 |
| 23:17 | sjl | amalloy: I've never heard of aleph (I'm usually not a clojure person)... I'll take a look, thanks. |
| 23:18 | ibdknox | I've used that one for typewire, had no real issue with it |
| 23:18 | ibdknox | there's also this one, which wraps the fairly well built java redis library: https://github.com/mmcgrana/clj-redis |
| 23:19 | ibdknox | I would probably go with clj-redis |
| 23:20 | ibdknox | Zolrath: I pushed that change up, you should be able to have spaces in your routes now :p |
| 23:20 | Zolrath | ibdknox: You're the man, thank you very much! |
| 23:21 | Zolrath | ibdknox: Thanks for letting me know that putting an event on a partial makes it work on newly created partials as well! |
| 23:22 | Zolrath | ibdknox: I'm sinking back into closure to achieve what I'm trying right now as I assume theres no way with pinot to find the last occurance of a partial on the page? |
| 23:23 | ibdknox | hm |
| 23:23 | ibdknox | not that I can think of, no |
| 23:25 | Zolrath | ibdknox: Good to know, trying to make an auto pagination thing that calls for the next elements based on data in the last element |
| 23:25 | Zolrath | ibdknox: pinot already does so many things I didnt think it would, seemed like a good idea to ask! |
| 23:39 | brehaut | hahaha |
| 23:39 | brehaut | sjl: having trouble with clojars? |
| 23:48 | dnolen | core.match is now a backtracking optimizing pattern match compiler |
| 23:51 | sjl | brehaut: Nah, I tried aleph on amalloy's suggestion and it's working great. |