2010-01-26
| 00:35 | scottj | Is there a shorter way to write (apply str (apply concat '((\1 \0) "," (\0 \0 \0))))? |
| 00:36 | hiredman | ugh |
| 00:37 | hiredman | ,flatten |
| 00:37 | clojurebot | java.lang.Exception: Unable to resolve symbol: flatten in this context |
| 00:37 | hiredman | ,(use 'clojure.contrib.seq-utils) |
| 00:37 | clojurebot | nil |
| 00:37 | hiredman | ,(reduce str (flatten '((\1 \0) \, (\0 \0 \0)))) |
| 00:37 | clojurebot | "10,000" |
| 00:39 | hiredman | concat, I hate the function, as I hate hell, mutable state, and shellfish |
| 00:41 | hiredman | oh lord, what if flatten uses concat, :( |
| 00:42 | scottj | it seems like there should be a way to say do apply with this seq of functions |
| 01:39 | Raynes | Is there a map for functions with side effects? |
| 01:39 | Raynes | Something along the lines of (map println ..) |
| 01:40 | Raynes | I could use doseq, but I was wondering if there is a better way. |
| 01:40 | hiredman | side-effects + keeping the return value? |
| 01:41 | Raynes | Indeed. Like println. |
| 01:41 | hiredman | uh |
| 01:41 | hiredman | the result of println is nil |
| 01:41 | hiredman | always, why would you keep that? |
| 01:41 | Raynes | I guess I misunderstood you. |
| 01:41 | hiredman | for stuff that is completely side-effects doseq is best |
| 01:41 | Raynes | In Haskell, we have mapM_ to map a side-effecty function to a list. |
| 01:41 | Raynes | All I needed to know. |
| 01:41 | Raynes | Thank you. |
| 01:42 | hiredman | if you want to keep a return value, (comp vec map) is pretty good |
| 01:43 | Raynes | I didn't intend to keep the value of println. I simply intended to map println to a list of values. |
| 01:43 | Raynes | :) |
| 01:43 | Raynes | (Just to clarify) |
| 01:45 | arbscht | fwiw, there is also dorun. but doseq is nicer imo |
| 01:48 | hiredman | for purely side-effect stuff, without a doubt doseq is nicer |
| 01:48 | chouser | should have been named dofor |
| 01:48 | chouser | hm. or maybe not |
| 01:53 | qed | chouser: i like dofor, but i think it would encourage familiar for-like usage |
| 01:53 | qed | which is probably not the best idea |
| 01:55 | qed | screen -r |
| 01:55 | Raynes | qed: Heh heh. I have a habit of tying "cd channelname". |
| 01:56 | qed | :) |
| 01:56 | qed | i will sometimes throw an ls |
| 01:56 | qed | screen -r is a new problem |
| 01:56 | Raynes | Likewise. |
| 01:57 | replaca | scottj: if you're still here - if the goal is to interpose ","s in numbers, cl-format can do that for you |
| 01:57 | qed | i often use screen -aASU |
| 01:58 | qed | screen -aASU irc irssi |
| 01:58 | hiredman | SU are new to me |
| 01:59 | hiredman | oh |
| 01:59 | hiredman | no I know S |
| 01:59 | qed | -S sessionname |
| 01:59 | qed | When creating a new session, this option can be used to specify a meaningful name for the session. This name |
| 01:59 | qed | identifies the session for "screen -list" and "screen -r" actions. It substitutes the default [tty.host] |
| 01:59 | hiredman | wait, I know U too |
| 01:59 | qed | suffix. |
| 01:59 | qed | -U Run screen in UTF-8 mode. This option tells screen that your terminal sends and understands UTF-8 encoded |
| 01:59 | qed | whoa. |
| 01:59 | hiredman | infact I have screen aliased to 'screen -U' |
| 01:59 | hiredman | and forgot about it I guess |
| 01:59 | qed | yeah i aliased 'sn' to screen -aASU |
| 02:00 | qed | sr to 'screen -r' |
| 02:00 | hiredman | ♥ screen |
| 02:00 | qed | same |
| 02:00 | qed | at work it is the reason im like 40% faster than everyone else |
| 02:01 | qed | i just have open screen sessions everywhere and resume them at will |
| 02:01 | hiredman | heh |
| 02:02 | qed | whenever i log into a box it sames "do you want a screen session?" if i hit Y it nests one for me |
| 02:02 | hiredman | wow |
| 02:02 | qed | and names according to host |
| 02:03 | gregh | has anybody tried tmux (a BSD screen workalike)? |
| 02:03 | gregh | I tried it for a while but it's hard to undo 10+ years of screen muscle memory |
| 02:03 | qed | never tried it |
| 02:03 | hiredman | gregh: it's on my radar (since there has been talking of including it in the base FreeBSd system) but I tried it yet |
| 02:04 | gregh | it's got some different ideas about sessions and moving them between clients, but I didn't really explore that much |
| 02:04 | hiredman | apparently you can get configs that set it up screen like |
| 02:04 | gregh | I fired it up with the screen compatibility key bindings and it was close but not quite right |
| 02:04 | qed | the majority of boxes i touch are SuSE, RH, AIX, or Ubunru |
| 02:05 | qed | Ubuntu |
| 02:05 | qed | so i stick with screen |
| 02:05 | qed | hiredman: ever AIX? |
| 02:06 | hiredman | hmmm, no |
| 02:06 | qed | good. it sucks. |
| 02:06 | hiredman | very small amounts of hp-ux |
| 02:06 | hiredman | also sucks |
| 02:06 | qed | AIX is based on System V |
| 02:06 | qed | need I say more |
| 02:07 | chouser | anyone ever use Tru64 a.k.a. Digital Unix? |
| 02:08 | qed | no |
| 02:08 | qed | ive used Inferno-OS |
| 02:08 | qed | that's as exotic as I've gotten |
| 02:08 | chouser | that's probably more esoteric than Tru64 |
| 02:08 | replaca | all this screen talk: http://xkcd.com/686/ |
| 02:08 | qed | chouser: have you played with inferno? |
| 02:09 | qed | inferno..sigh..Limbo could have been Java |
| 02:09 | chouser | I was really interested in limbo, once upon a time, but couldn't get my hands on any way to try it out. |
| 02:09 | qed | http://en.wikipedia.org/wiki/Limbo_(programming_language) |
| 02:09 | qed | chouser: you're the first person I've *ever* met to have an interest in Limbo |
| 02:10 | qed | well, outside of that community anyhow |
| 02:10 | chouser | I don't remember how I heard about it, or what alternatives I was aware of at that point. |
| 02:10 | qed | chouser: the ceremony makes it really tedious |
| 02:10 | hiredman | obviously someone needs to target the dis vm with a lisp |
| 02:11 | qed | hiredman: google summer of code 2010 |
| 02:11 | qed | let's do this |
| 02:12 | hiredman | haha |
| 02:12 | qed | that's how i learned about p9 and inferno actually |
| 02:12 | qed | GSoC 2007 |
| 02:12 | clojurebot | with style and grace |
| 02:12 | hiredman | clojurebot: indeed |
| 02:12 | clojurebot | Gabh mo leithscéal? |
| 02:12 | qed | clojurebot: love |
| 02:12 | clojurebot | I don't understand. |
| 02:12 | chouser | oh, I must have heard about limbo circa 1996 |
| 02:12 | qed | exactly. |
| 02:13 | qed | chouser: i'd wager i'm a fair bit younger |
| 02:13 | qed | 24 |
| 02:13 | RaceCondition | how much does Clojure differ from Erlang? |
| 02:13 | qed | RaceCondition: a lot... |
| 02:13 | chouser | qed: not quite a decade, then. :-) |
| 02:13 | qed | chouser: :) |
| 02:14 | RaceCondition | qed: it's also incredibly similar, so I'd just like to get a better picture of how these two solve the same problems |
| 02:14 | RaceCondition | Erlang apparently doens't allow changing anything and Clojure does... like refs and atoms... so I assume that dosync/transactions thing makes up for that? |
| 02:14 | qed | RaceCondition: their concurrency models are way different, but chouser will probably correct me |
| 02:15 | hiredman | clojure is targeted at same process multi-core concurrency, erlang is for distributed concurrency |
| 02:15 | qed | (or hiredman) |
| 02:15 | qed | ;) |
| 02:15 | hiredman | I haven't actually written any erlang |
| 02:15 | hiredman | wiat |
| 02:15 | hiredman | I did |
| 02:15 | qed | haha hiredman |
| 02:15 | hiredman | I did a hello world tutorial years ago |
| 02:16 | qed | "wait...wait...there is directory here which says erlang..." |
| 02:16 | qed | "okay...i've written erlang" |
| 02:16 | RaceCondition | me neither, but I know you can only assign stuff once and in order to change something, you basically make a tail-recursive call with new state built in that swaps out the old function |
| 02:16 | hiredman | yeah |
| 02:16 | hiredman | clojurebot: oo sucks? |
| 02:16 | clojurebot | http://www.sics.se/~joe/bluetail/vol1/v1_oo.html |
| 02:16 | qed | no tail recursion in clojure |
| 02:16 | hiredman | armstrong seems like a cool guy |
| 02:17 | qed | hiredman: have you read coders at work? |
| 02:17 | hiredman | of course! |
| 02:17 | qed | that's one of my favorite interviews in there |
| 02:17 | RaceCondition | hiredman: btw I just saw a nice presentation about Clojure and funprog/concurrentprog and I have to admit I was surprised by the slight bashing of OO since OO is not just about objects changing state -- its about polymorphism mostly |
| 02:17 | qed | (armstrong's) |
| 02:18 | RaceCondition | Haskell has nice OO and you can't argue Haskell isn't pure functional |
| 02:18 | qed | RaceCondition: it's about time |
| 02:18 | qed | "time" |
| 02:18 | qed | that's where the bashing of OO comes from |
| 02:19 | RaceCondition | qed: so STATEFUL OO should be bashed, not OO in general, because polymorphism, which is what distinguishes OO from procedural, is orthogonal |
| 02:19 | RaceCondition | ...to statefulness |
| 02:19 | hiredman | RaceCondition: sure, but polymorphism is not only in OO, and OO general brings all this imperative junk |
| 02:19 | qed | the general OO philosophy includes stateful OO |
| 02:19 | qed | it's how most OO languages operate |
| 02:20 | hiredman | RaceCondition: have you read the rationale? |
| 02:20 | qed | RaceCondition: http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey |
| 02:20 | qed | RaceCondition: read the rationale or watch that video |
| 02:21 | RaceCondition | qed: I just watched one of that guys presentations |
| 02:21 | qed | "that guy" is Rich Hickey |
| 02:21 | RaceCondition | I know |
| 02:21 | qed | lol |
| 02:21 | chouser | I think it's the "orientation" rather than the "object" that is the problem. |
| 02:21 | qed | just making sure |
| 02:21 | hiredman | the rationale has set of points on polymorphism |
| 02:22 | RaceCondition | and he did cover state and time management in that other demo as well and I completely understand the rationale behind that |
| 02:22 | qed | chouser: what do you mean by orientation |
| 02:22 | hiredman | ~rationale |
| 02:22 | clojurebot | rationale is http://clojure.org/rationale |
| 02:23 | hiredman | it's basically rhickey's N theses |
| 02:23 | qed | what really made me stop in my tracks |
| 02:23 | qed | was the river quote |
| 02:23 | qed | "No man can cross the same river twice." |
| 02:24 | chouser | OO is Object Orientation. Clojure has objects but isn't oriented around them. |
| 02:24 | hiredman | http://clojure.org/state has some stuff about why rhickey didn't use erlang type actors for clojure |
| 02:25 | chouser | pretty much every good and useful feature of OO is available in some form in Clojure, usually a form that is simpler and more cleanly decoupled than standard OO |
| 02:26 | qed | the abstract ideas about how a cloud, if you watch it, can become three clouds, or disappear |
| 02:26 | qed | that stuff really resonated with me |
| 02:26 | chouser | sounds like nice subject to include in a book. Maybe in Chapter two... |
| 02:26 | dnolen | is ~(symbol (str sym)) the only way to make anaphoric macros work? (I feel like I've learned this like 20x times) |
| 02:27 | chouser | dnolen: ~'foo |
| 02:27 | dnolen | chouser: I get a complaint from compiler if I use that (not the macro, but when I use it later) |
| 02:28 | dnolen | chouser: oh yeah, because it gets qualified |
| 02:28 | dnolen | how to avoid that again? |
| 02:28 | hiredman | then you aren't doing it right :P |
| 02:28 | dnolen | hiredman: i'm not sure what other where there is it do it with anaphora sir. |
| 02:29 | chouser | (defmacro foo [] `(list ~'bar)) (let [bar 5] (foo)) ; returns (5) |
| 02:29 | qed | i still dont get macros |
| 02:29 | qed | but i havent tried too hard admittedly |
| 02:30 | unfo- | qed, i can recommend Programming Clojure - it has a nice chapter on macros |
| 02:30 | chouser | as long as you're using a language that has them, you'll hardly ever have to write them. |
| 02:30 | dnolen | chouser: huh I swear that is working for me I tried that. |
| 02:30 | dnolen | that isn't working i mean |
| 02:30 | qed | unfo-: i got sort of sidetracked on programming clojure at about 125p in |
| 02:30 | hiredman | I see macros on lists of why clojure is great a lot |
| 02:31 | unfo- | qed, p. 211 :) |
| 02:31 | unfo- | qed, read from there on for the macro chapter |
| 02:31 | qed | unfo-: will check it out, thanks |
| 02:32 | hiredman | I mean, they are neat, but there are so many other features I use more |
| 02:32 | dnolen | macros: you almost never use them but when you really need one, oooh boy. |
| 02:32 | qed | i dont totally get multimethods yet either |
| 02:32 | qed | which seem even more useful |
| 02:32 | hiredman | multimethods, java interop, immutable values, sequences |
| 02:32 | hiredman | ~multimethods |
| 02:32 | clojurebot | multimethods seperate the 20% from the 80% |
| 02:33 | qed | hiredman: really, mmethods are 80%? |
| 02:33 | RaceCondition | btw that {} and [] thing is a read-macro thing? |
| 02:33 | dnolen | chouser: or anyone really, see anything suspicious here? http://paste.lisp.org/display/93916 |
| 02:35 | dnolen | when I use ~'sym the usage of the macro throws: unable to resolve sym in this context |
| 02:35 | hiredman | qed: 20% who get it, and 80% that don't, I think is what is implied |
| 02:35 | hiredman | dnolen: you should look at the macro expansion |
| 02:36 | hiredman | that exception means there is no binding for sym in the expansion |
| 02:36 | scottj | replaca: yeah, that was the goal, after writing myself I just ended up wrapping (. (DecimalFormat/getNumberInstance) format 1000.00) |
| 02:36 | dnolen | bah ~(symbol (str sym)) is what I want, ~'sym just puts sym there :) |
| 02:36 | hiredman | … |
| 02:36 | hiredman | isn't that what ~(symbol (str sym)) does? |
| 02:37 | dnolen | no |
| 02:37 | hiredman | you want 'sym not sym |
| 02:37 | hiredman | like the unevaluated symbol sym |
| 02:37 | hiredman | '~'sym |
| 02:37 | scottj | Learning Clojure wikibook says . is never a valid symbol. What does that mean? :. seems to be, and obviously . itself isn't because symbols start with : |
| 02:37 | hiredman | scottj: no |
| 02:38 | scottj | s/valid symbol/valid keyword |
| 02:38 | scottj | s/because symbols/because keywords |
| 02:38 | dnolen | hiredman nope, that produces 'sym in the expansion |
| 02:38 | hiredman | right |
| 02:38 | hiredman | which is what you want |
| 02:38 | dnolen | no |
| 02:39 | hiredman | yes! |
| 02:39 | hiredman | you want the unevaluated symbol sym |
| 02:39 | dnolen | I'll paste the difference to illustrate |
| 02:39 | hiredman | that is what '~'sym gets you |
| 02:40 | hiredman | I understand the difference |
| 02:40 | hiredman | or not |
| 02:40 | dnolen | the macro expansion looks different |
| 02:40 | hiredman | lets see it |
| 02:41 | dnolen | '~'sym: http://paste.lisp.org/display/93917 |
| 02:42 | hiredman | lets see with the (symbol ...) |
| 02:42 | dnolen | ~(symbol (str sym)): http://paste.lisp.org/display/93918 |
| 02:42 | clojurebot | "if you never learnt Lisp, then you never learned to program" -- some rant on some blog somewhere |
| 02:43 | hiredman | you know, I don't think you want a capture |
| 02:43 | hiredman | you want the sym that is the argument macro right? |
| 02:43 | hiredman | er |
| 02:43 | hiredman | the macro argument |
| 02:43 | dnolen | hiredman: yeah |
| 02:43 | hiredman | that is not capturing that is unquote |
| 02:43 | hiredman | ~sym |
| 02:43 | clojurebot | Titim gan éirí ort. |
| 02:44 | qed | all: thanks for the great talk -- have a good night |
| 02:45 | dnolen | haha: the danger of not writing making in too long a time. you forget even the most basic rules. sheesh |
| 02:45 | dnolen | not writing macros in too long a time |
| 02:45 | dnolen | hiredman: thx |
| 02:45 | hiredman | sure |
| 02:54 | G0SUB | any clojure list admins here? |
| 02:54 | hiredman | rhickey may be the only one who is an admin |
| 02:55 | G0SUB | hmm |
| 02:55 | hiredman | maybe chouser |
| 02:55 | G0SUB | I want to change my email address... but since I am using Google Apps, I can't find any way to do so. |
| 02:56 | G0SUB | So I thought may be they can... |
| 02:56 | G0SUB | hiredman: btw, is there any way to use the released version of c.c (1.1.0) with lein? |
| 02:57 | hiredman | you should be able to add it to the dependencies |
| 02:57 | qed | [clojure "1.1.0"] |
| 02:57 | G0SUB | qed: clojure.contrib |
| 02:57 | qed | oh sorry |
| 02:57 | qed | ive been using 1.0 |
| 02:57 | qed | i dont know |
| 02:58 | hiredman | G0SUB: same |
| 02:58 | hiredman | the contrib builds are up in the build.clojure.org maven repo |
| 02:58 | G0SUB | hiredman: I get this -- Unable to resolve artifact: Missing: |
| 02:58 | hiredman | hmmm |
| 02:59 | hiredman | I think the seperate "release" repo is new, so you might need to add it |
| 02:59 | G0SUB | hiredman: is there any way to add repos? |
| 02:59 | hiredman | yes |
| 02:59 | hiredman | it's in the readme, I don't recall off hand |
| 03:00 | hiredman | I do remember it takes a map of names (Strings) to urls (Strings) |
| 03:02 | G0SUB | hiredman: can't find it/ |
| 03:15 | hiredman | :repositories |
| 03:35 | RaceCondition | I have to admit I really enjoy those two of Hickey's presentations on InfoQ |
| 03:35 | RaceCondition | really enlightening and refreshing |
| 03:35 | RaceCondition | (I hope I won't become a Clojure worshipper after them) |
| 03:37 | G0SUB | hiredman: yep. thanks. |
| 03:50 | cgrand | G0SUB: pushed a new enlive.jar to clojars |
| 03:50 | G0SUB | cgrand: cool. many thanks. |
| 03:50 | G0SUB | cgrand: the version id is the same? |
| 03:52 | cgrand | yup |
| 03:55 | G0SUB | cgrand: works. great. |
| 04:03 | esj | cgrand: quick question - in your kata solution for devlinsf yesterday you called (sift ...) explicitly to recur, why not use recur ? Is it just because for a small solution you don't need to worry about the stack ? |
| 04:06 | cgrand | esj: let me check but I believe it was in a lazy-seq |
| 04:06 | esj | it was |
| 04:07 | esj | so that takes care of it for you |
| 04:07 | esj | yeah, I'm being stupid |
| 04:07 | esj | thanks |
| 04:07 | esj | the road to understanding, long it is. |
| 04:08 | cgrand | you can' t call recur through a lzy-seq because the lazy-seq macro wraps its body into a fn |
| 04:10 | Raynes | Lazy-seqs make me feel all warm and fuzzy inside. |
| 04:11 | esj | thanks |
| 04:19 | Raynes | I wrote some Python earlier. One function and I still want to hang myself. :| |
| 04:20 | gregh | that's odd |
| 04:29 | hiredman | ~python |
| 04:29 | clojurebot | python is ugly |
| 04:30 | Raynes | I concur. |
| 04:32 | G0SUB | lol |
| 04:37 | spariev_ | clojurebot is sure opinionated |
| 04:38 | esj | lol |
| 04:38 | esj | ~ruby |
| 04:38 | clojurebot | Chunky bacon! |
| 04:38 | esj | not to taunt or anything |
| 04:39 | spariev_ | ~java |
| 04:39 | clojurebot | ☕ |
| 04:39 | spariev_ | lol |
| 04:39 | esj | ~clojure |
| 04:39 | clojurebot | clojure is far closer to perfection then python |
| 04:40 | hiredman | :O |
| 04:40 | Raynes | ~hiredman |
| 04:40 | clojurebot | hiredman is lazy |
| 04:40 | hiredman | ~clojure |
| 04:40 | clojurebot | clojure is the bestest programming language available. |
| 04:41 | hiredman | ~clojure |
| 04:41 | clojurebot | clojure is the brand |
| 04:43 | G0SUB | ~java |
| 04:43 | clojurebot | ☕ |
| 04:44 | Raynes | ~factor |
| 04:44 | clojurebot | Huh? |
| 04:44 | Raynes | :\ |
| 04:46 | cypher23 | ~scala |
| 04:46 | hiredman | clojurebot: please tell us about scala |
| 04:46 | clojurebot | Unfortunately the standard idiom of consuming an infinite/unbounded resource as a stream can be problematic unless you're really careful -- seen in #scala |
| 04:47 | hiredman | ~scala {((x: Any, y: Any) => (f: Function2[Any, Any, Any]) => f(x, y))(1, 2)((x: Any, y: Any) => x)} |
| 04:47 | clojurebot | Any = 1 |
| 04:47 | hiredman | ~scala work because clojurebot tries to run scala |
| 04:47 | hiredman | er |
| 04:47 | hiredman | doesn't |
| 04:48 | cypher23 | ah, ok |
| 05:13 | esj | cgrand: ok, here's another silly question. If (drop-while ...) returns a lazy sequence, why wrap yours in a (seq ...) ? I notice that it nukes destructuring (to the point of killing the code) if you remove it, but can't understand why. What lorry sized hole is this in my understanding ? |
| 05:14 | esj | is is to force the lazy seq to realise ? |
| 05:15 | Chousuke | seq returns nil if the lazy seq is empty |
| 05:16 | esj | ,(lazy-seq nil) |
| 05:16 | clojurebot | () |
| 05:16 | esj | ,(seq nil) |
| 05:16 | clojurebot | nil |
| 05:16 | esj | funky |
| 05:16 | cgrand | esj: it has nothing to do with the "-let" (destructuring) part of the when-let but with the "when" part |
| 05:16 | cgrand | ,(seq (lazy-seq nil)) |
| 05:16 | clojurebot | nil |
| 05:16 | esj | gotcha |
| 05:16 | esj | glad I asked, thanks. |
| 05:27 | lypanov | well. took a while. but my insanity is over. |
| 05:27 | lypanov | clojure via gwt is the stupidest idea i had in a long time |
| 05:27 | esj | :) |
| 05:28 | esj | i love those |
| 05:28 | lypanov | porting clojure itself to js is the only way |
| 05:28 | lypanov | long showers++ |
| 05:29 | esj | (inc long-showers), no ? |
| 05:29 | esj | ;) |
| 05:29 | lypanov | no clue, i haven't yet written a single line of clojure :P |
| 05:30 | esj | then your insanity is far from over ! |
| 05:32 | lypanov | the moment i can slime connect to a clojure instance running in chrome in order to fix a random bug in my webpages layout code |
| 05:33 | lypanov | thats when the insanity is over :) |
| 05:53 | ivan_chernetsky | Hi. I've just seen that clojure-contrib moved on to using maven exclusively, so I am curious what's behind this decision? As far as I know using clojure-ant-tasks it is gainable to have a small ant build file. I worry of it because use of maven's complicating the life of distro (at least source-based) package mantainers . |
| 06:03 | jlr | is your concern then packaging clojure-contrib projects for e.g. debian or gentoo? |
| 06:10 | angerman | cool |
| 06:19 | ivan_chernetsky | jlr: Gentoo. |
| 06:20 | alexott | angerman: there is also #clojure.de channel ;-) |
| 06:21 | angerman | I'm not so certain I want to get localized. |
| 06:21 | alexott | angerman: just fyi |
| 06:21 | angerman | alexott: thanks |
| 06:55 | Hali_303 | hi! |
| 07:19 | AWizzArd | Is subseq lazy? |
| 07:23 | AWizzArd | cgrand: do you know why PersistentTreeSet does not implement java.util.SortedSet? That would allow to get .subSets of them. |
| 07:59 | Leonidas | ~[6~/win 2 |
| 07:59 | clojurebot | excusez-moi |
| 08:41 | jcromartie | so this is kind of odd... |
| 08:41 | jcromartie | ,(clojure.set/difference (set "abc") "abc") |
| 08:42 | clojurebot | #{} |
| 08:42 | jcromartie | ,(clojure.set/difference (set "abc") "abcd") |
| 08:42 | clojurebot | #{\a \b \c} |
| 08:42 | jcromartie | ,(clojure.set/difference (set "abc") (set "abcd")) |
| 08:42 | clojurebot | #{} |
| 08:42 | chouser | clojure.set operations are for the most part undefined unless you pass in sets |
| 08:43 | jcromartie | ok but what about the last one? |
| 08:43 | chouser | ,(doc clojure.set/difference) |
| 08:44 | clojurebot | "([s1] [s1 s2] [s1 s2 & sets]); Return a set that is the first set without elements of the remaining sets" |
| 08:44 | esj | its not symmetric |
| 08:44 | jcromartie | I see |
| 08:44 | chouser | so that's a non-commutative "subtract", not a commutative xor |
| 08:44 | esj | would be easy enough to synthesise with a union of the two differences |
| 08:45 | esj | (union (diff a b) (diff b a) i'd think |
| 08:50 | jcromartie | yeah |
| 08:54 | cgrand | AWizzArd: most methods in j.u.SortedSet return Sets while methods in Sorted return seqs, this make that interface harder to implement -- but no real reason |
| 08:56 | AWizzArd | cgrand: probably the functions in clojure.set will be helpful enough. I just thought it would be nice to have a (subset ...). |
| 08:56 | AWizzArd | subseq can sometimes be helpful enough though |
| 08:59 | cemerick | using require with :as is of course far cleaner and polite to those that need to read your code, but wow, using :use when you're just trying to hack something out feels so much more productive. |
| 09:03 | cgrand | AWizzArd: sure, ask rhickey if you can open a ticket |
| 09:06 | AWizzArd | cgrand: yes |
| 09:47 | jcromartie | would it be reasonable to patch duck-streams to use a temp file? |
| 09:48 | jcromartie | specifically when spitting to a File |
| 09:50 | jcromartie | I guess that's kind of specific and doesn't fit with the way it handles writers |
| 09:51 | stuartsierra | that would not be ok |
| 09:52 | stuartsierra | can't guarantee that the process has permission to write anywhere except the file it was told to write to |
| 09:54 | jcromartie | gotcha |
| 09:54 | jcromartie | well I'm very pleased with my safe atomic spit function :) |
| 09:54 | jcromartie | after losing a file |
| 09:55 | jcromartie | and after finding a half-written file |
| 09:55 | chouser | maybe an option that allows the caller to specify a tempfile name and/or directory? |
| 09:55 | jcromartie | and atomic-spit just has a nice ring to it |
| 09:56 | stuartsierra | maybe, but that should be a separate function, e.g. write-rename |
| 09:56 | jcromartie | http://gist.github.com/286894 |
| 09:57 | jcromartie | I just hit some of these safety issues pretty quickly while testing my code |
| 09:57 | jcromartie | i.e. simulating lots of writes and then bringing down the server |
| 10:11 | AWizzArd | stuartsierra: why? |
| 10:11 | saml | is there a library for command line option parsing? |
| 10:12 | stuartsierra | AWizzArd: see http://groups.google.com/group/clojure-dev/browse_thread/thread/7ab69b1d43012917# |
| 10:12 | saml | command-line |
| 10:13 | stuartsierra | Thinking about making str-utils2/replace a macro that dispatches on types at compile time. |
| 10:14 | chouser | whoa |
| 10:14 | chouser | really? |
| 10:14 | stuartsierra | Well, multimethods are slow, and 99% of the time you're going to call 'replace' with literal arguments |
| 10:14 | AWizzArd | hmm |
| 10:15 | chouser | saml: clojure.contrib.command-line is there, though not terribly advanced. |
| 10:15 | saml | chouser: yup. it seems like it binds positional arguments to symbols |
| 10:15 | stuartsierra | It could fall back on a multimethod if the types are unknown at compile time. |
| 10:15 | saml | that's all i need for now :P |
| 10:16 | chouser | stuartsierra: by "unknown" you mean "symbols"? |
| 10:16 | stuartsierra | chouser: or expressions |
| 10:16 | chouser | ah, sure. |
| 10:17 | chouser | hm, and if you make it :inline instead of always a macro, it could still be used with comp for our point-free friends, map, etc. |
| 10:18 | stuartsierra | Hmm... |
| 10:18 | stuartsierra | I'd have to figure out exactly how :inline works. |
| 10:19 | saml | *command-line-args* this is global variable for command line arguments? |
| 10:19 | chouser | stuartsierra: won't take you long. :-) |
| 10:19 | stuartsierra | heh |
| 10:19 | chouser | saml: yes |
| 10:19 | saml | oh to get that i need to launch through command line. not in emacs |
| 10:20 | saml | silly me |
| 10:26 | saml | java -cp clojure.jar clojure.main /path/to/myscript.clj arg1 arg2 arg3 how can I get things before arg1 arg2 arg3 ? |
| 10:26 | stuartsierra | Actually, a macro could do compile-time checking for anything. |
| 10:27 | stuartsierra | Any multimethod that dispatches on type can theoretically be resolved at compile time. |
| 10:34 | chouser | stuartsierra: you mean if the args are hinted? |
| 10:34 | stuartsierra | yes |
| 10:34 | stuartsierra | or literals |
| 10:38 | stuartsierra | the tricky part is how to abstract that into a macro |
| 10:40 | saml | to read text file, do I use java interop? |
| 10:42 | grammati | ,(doc slurp) |
| 10:42 | clojurebot | "([f] [f enc]); Reads the file named by f using the encoding enc into a string and returns it." |
| 10:44 | saml | grammati: thanks |
| 10:45 | saml | how do I know current working directory of the repl? |
| 10:45 | chouser | saml: but yes, anything slightly complicated and you'll probably have to fall back on interop calls. |
| 10:46 | chouser | (System/getProperty "user.dir") |
| 10:47 | chouser | the jvm doesn't let you chdir |
| 10:47 | LauJensen | (defn pf [s & args] (println (format s args))) |
| 10:47 | LauJensen | Is there some & related trickery I can do to make this work w/o using a macro |
| 10:48 | chouser | apply |
| 10:52 | LauJensen | how? |
| 10:52 | clojurebot | with style and grace |
| 10:56 | neotyk | clojurebot: are you the smartest in your family? |
| 10:56 | clojurebot | Titim gan éirí ort. |
| 11:27 | jcromartie | so those of you using Java IDEs... what is your preference: NetBeans or Eclipse? |
| 11:28 | LauJensen | Emacs |
| 11:28 | LauJensen | (sorry, couldnt help myself!! :P) |
| 11:31 | jcromartie | ... |
| 11:31 | jcromartie | I use Emacs too. |
| 11:32 | spariev_ | I tried IDEA and netbeans Clojure plugins, but Emacs is better |
| 11:33 | spariev_ | I'm still the IDEA fan for java/ruby thought |
| 11:34 | jcromartie | NetBeans looks nice on SO X |
| 11:34 | jcromartie | OS X |
| 11:35 | jcromartie | it almost feels like a human being designed it |
| 11:36 | jasapp | heh |
| 11:37 | jcromartie | my concern is in having others collaborate on a clojure project that might not be quite ready for Emacs |
| 11:38 | jcromartie | zero emacs experience makes for fun times |
| 11:39 | spariev_ | I believe netbean's enclojure is the most polished Clojure IDE plugin as for now |
| 11:39 | esj | don't let anybody tell you that emacs stands for esc-meta-alt-ctl-shift, entirely untrue and misleading ;) |
| 11:39 | jcromartie | hah hah |
| 11:39 | spariev_ | heh |
| 11:39 | caljunior | emacs schmemacs. :-) I'm having an issue using incanter with TextMate. |
| 11:40 | jasapp | I love emacs now, don't get me wrong. |
| 11:40 | jasapp | but learning to use it was one of the most frustrating things I've ever done |
| 11:40 | jasapp | after 7 or 8 years of being a vim guy |
| 11:40 | caljunior | when I try to load incanter in the repl with: (use '(incanter core)) |
| 11:41 | caljunior | I get this exception: java.lang.IllegalStateException: copy already refers to: #'clojure.contrib.duck-streams/copy in namespace: user (NO_SOURCE_FILE:0) |
| 11:43 | lypanov | jasapp: i use viper |
| 11:43 | caljunior | is this the prebuilt incanter version (incanter-app-*.jar clashing with clojure which is actually required for running code from TextMate? |
| 11:43 | lypanov | jcromartie: netbeans. eclipse is ... yeah. |
| 11:43 | lypanov | but i'd rather suggest idea if you have the option. |
| 11:44 | caljunior | I realise this is a less than interesting issue. |
| 11:44 | stuartsierra | hey, where's my paste? |
| 11:45 | stuartsierra | Compile-time type-checking multimethods: http://paste.lisp.org/+20HG |
| 11:46 | cgrand | stuartsierra: lispbot seems aphonic since yesterday |
| 11:46 | jasapp | lypanov: I tried using viper, but that just made things worse for me |
| 11:46 | caljunior | got the answer directly from david liebke: should require not use. thanks David. |
| 11:46 | jasapp | I think it was trying to use emacs, viper, and slime |
| 11:46 | jasapp | all while trying to learn to use emacs |
| 11:47 | AWizzArd | ,(instance? String "x") |
| 11:47 | clojurebot | true |
| 11:47 | AWizzArd | ,(time (dotimes [i 1000000] (instance? String "x"))) |
| 11:47 | clojurebot | "Elapsed time: 159.273 msecs" |
| 11:48 | lypanov | jasapp: yeah. its painful. i'm just taking breaks whenever i feel like my skull might crack |
| 11:48 | AWizzArd | Interesting. This dotimes above gives on my system: (class: my/ns$eval__15603$fn__15604, method: invoke signature: ()Ljava/lang/Object;) Unable to pop operand off an empty stack |
| 11:49 | joegg | cgrand: aphonic is a great word. vocab++ |
| 11:53 | esj | ,(distinct '(1 2 2)) |
| 11:53 | clojurebot | (1 2) |
| 11:53 | esj | ,(distinct? '(1 2 2)) |
| 11:53 | clojurebot | true |
| 11:53 | esj | ? |
| 11:54 | stuartsierra | ,(apply distinct? '(1 2 2)) |
| 11:54 | clojurebot | false |
| 11:54 | AWizzArd | maybe compile time constants |
| 11:54 | esj | aaah apply |
| 11:54 | esj | thanks |
| 11:58 | esj | would it be useful to be able to attach some textual explanation to :pre and :post assertion exceptions ? |
| 11:58 | joegg | I want to write a simplex solver to help with my clojure-learning, and I'm having trouble coming with how to represent the system of equations using clojure data structures. Something like a list of maps of variables onto coefficients would probably work, but then I'm worried about the fact these structures are immutable, and I just don't see how I would interact with the thing. Can anyone point me to some knowledge? |
| 11:59 | esj | joegg: have you tried Incanter ? |
| 11:59 | esj | it backs into a bunch of numerical libraries |
| 12:00 | esj | has things like linear regressions etc, so you'll find representations such as you're looking for |
| 12:00 | joegg | esj: That's a good suggestion, and I might look to for inspiration, but (and I know this is crazy), I don't want to pull in *any* libraries. The whole exercise is to do it myself, it's a kata. |
| 12:01 | joegg | I will see how they represent these structures, though. Excellent suggestion. |
| 12:01 | joegg | Thanks! |
| 12:01 | esj | groovy. |
| 12:03 | joegg | technomancy: Bruce Campbell never mistakes it for a noun. :) |
| 12:04 | technomancy | joegg: perhaps if it were followed by the sound of a shotgun being loaded the ambiguity would fade. |
| 12:04 | esj | ~groovy |
| 12:04 | clojurebot | I don't understand. |
| 12:04 | esj | just checking clojurebot... |
| 12:06 | Mec | How come you cant chat in here as a guest? |
| 12:06 | esj | spammers |
| 12:06 | joegg | ,(do (load shotgun)) (println "Groovy.")) |
| 12:06 | clojurebot | java.lang.Exception: Unable to resolve symbol: shotgun in this context |
| 12:06 | joegg | Something is wrong. |
| 12:13 | the-kenny | dan |
| 12:13 | the-kenny | oops |
| 12:15 | esj | is is possible to customise the sort function applied by (sorted-map ...) ? |
| 12:16 | esj | or is that all kinds a crazy ? |
| 12:16 | chouser | sorted-map-by |
| 12:16 | esj | ! |
| 12:17 | esj | thanks a ton, that's awesome. |
| 12:17 | chouser | be careful -- if you say two keys are equal, it'll only store one of them. |
| 12:17 | esj | thanks, that could be unexpected. |
| 12:18 | chouser | ,(sorted-map-by (constantly 0) :a 1, :b 2, :c 3) |
| 12:18 | clojurebot | {:a 3} |
| 12:27 | Mec | I'm going to lose my mind trying to get an IDE to work |
| 12:31 | Mec | contrib is encluded in my enclojure project but it keeps telling me no contrib classes exist |
| 12:32 | stuartsierra | Mec: start with the command line, then work up to an IDE |
| 12:44 | saml | can I extend a java class in clojure? |
| 12:45 | saml | oh java_interop has section about Implementing Interfaces and Extending Classes |
| 13:09 | noidi | is there a way to refer to the current namespace? |
| 13:09 | chouser | *ns* |
| 13:09 | noidi | I have a function called foobar/set! and it worked fine, but now I want to refer to it from another function in the same namespace, and *ns*/set! doesn't seem to work |
| 13:09 | noidi | and just plain set! doesn't work because it's a special form |
| 13:11 | noidi | I get "No such namespace: *ns*" when evaluating the file in slime with C-c C-k |
| 13:11 | chouser | oh. yeah, I don't think you can get away with a var named 'set!' |
| 13:11 | noidi | I can as long as I don't need it within the namespace :) |
| 13:11 | noidi | but thanks, I'll rename it to set-data! |
| 13:11 | clojurebot | clojure-alpha was renamed clojure-master, and this broke most of the projects on Clojars |
| 13:12 | chouser | if it were just a macro of fn, you could get away with it, but special forms will cause you trouble |
| 13:13 | Chousuke | noidi: *ns* is a variable |
| 13:13 | Chousuke | noidi: you'd have to do the.namespace/set! |
| 13:14 | alexyk | how do folks structure something like .clojurerc, to be loaded into each repl? |
| 13:15 | alexyk | i.e. how do you auto-load it? |
| 13:15 | noidi | depends on how you launch your repl :) |
| 13:15 | alexyk | better not to depend on it :) |
| 13:16 | noidi | there's the -i command line flag for clojure.main, you could add that to the script than launches the repl |
| 13:17 | alexyk | ah ok |
| 13:17 | noidi | java -cp ... clojure.main -i clojurerc.clj |
| 13:17 | BrandonW | all right! class path talk! |
| 13:17 | BrandonW | that is just what i came in here to ask :) |
| 13:18 | Chousuke | :P |
| 13:18 | alexyk | class of 2010 |
| 13:18 | Chousuke | note that the classpath was omitted. |
| 13:18 | alexyk | the working class |
| 13:18 | Chousuke | in other news, by qnap HDD was making some nasty click noises earlier :( |
| 13:19 | Chousuke | it seems to have calmed down now though. |
| 13:19 | alexyk | Chousuke: Time Machine! |
| 13:19 | alexyk | or gibak |
| 13:19 | somnium | alexyk: if you put a user.clj on the classpath it will get autoloaded |
| 13:19 | Chousuke | alexyk: it's RAID1; and a relatively new installation anyway. there's nothing to back up |
| 13:19 | alexyk | somnium: oh! now that's autoloading indeed |
| 13:20 | BrandonW | okay, so i am going through the programming clojure book and i am currently trying to generate a java class file via clojure's :gen-class |
| 13:20 | alexyk | Chousuke: it hurts even to read of clicking noises! :) |
| 13:20 | Chousuke | alexyk: it just sucks. the hdds are about six months old |
| 13:20 | Chousuke | alexyk: I have a six year old HDD that's still going strong. |
| 13:20 | BrandonW | the start of my tasklist.clj file is (ns reader.tasklist, so it is the reader package, class tasklist |
| 13:20 | Chousuke | what's wrong with modern ones :( |
| 13:20 | alexyk | Chousuke: we need to add a few terabytes here and there, too. Did you get some cheap SATA? |
| 13:21 | BrandonW | that file is in com/reader/tasklist.clj |
| 13:21 | BrandonW | i start the clj repl in com directory (with no additional args) |
| 13:21 | BrandonW | type (compile 'reader.tasklist) |
| 13:21 | Chousuke | alexyk: I bought 2*1.5TB from a friend. he still has the receipts though so if the drives fail now I can get new ones through warranty |
| 13:21 | Chousuke | alexyk: So I'd rather they fail NOW than after two years when they're full of data and out of warranty... |
| 13:21 | BrandonW | and it says No such file or directory (tasklist:clj:1) |
| 13:22 | alexyk | Chousuke: hope just one is clicking! there's all those urban legends that RAID'ed disks fail together etc. |
| 13:22 | BrandonW | unfortunately i am coming to clojure from c# :( i had some experience with java in college, but it was academic computer science, so i didn't get much experience with jars and class path. i looked up a bit on google but i feel like i am missing something very fundamental... |
| 13:22 | Chousuke | alexyk: it should be jut one. right now, neither is making any noise, though. |
| 13:23 | Chousuke | alexyk: but it was a really nasty tick-tock noise it made earlier... |
| 13:23 | lypanov | i sometimes here that for a drivethats been going without issues for 1.5 years |
| 13:23 | lypanov | dunno why |
| 13:24 | Chousuke | hmm :/ |
| 13:24 | Chousuke | now I ran aptitude and no ticking noises. hm |
| 13:25 | alexyk | ok to BrandonW's question: should the dirs with the actual files be on the classpath? |
| 13:25 | jasapp | Chousuke: maybe a little shaking would help |
| 13:25 | alexyk | I actually call my namespaces whatever with the dot and don't consider it as a path part or anything |
| 13:25 | BrandonW | from teh quick research i did on class paths, i *think* the directory you start java/clj from is added automatically |
| 13:25 | Chousuke | jasapp: I'll try that if the clicking resumes... |
| 13:26 | alexyk | BrandonW: did you try adding the actual directory containing the tasklist.clj file to the path? |
| 13:26 | alexyk | tools like lein repl or maven clojure:repl do that for you |
| 13:26 | jasapp | Chousuke: I meant to induce more ticking |
| 13:26 | BrandonW | and from what i've read of java classpath usage, it is supposed to be in reverse domain form (e.g. org.clojure.xxx) and it usually maps to directory structure |
| 13:26 | Chousuke | hm. |
| 13:26 | Chousuke | now it made a couple ticks again. :( |
| 13:26 | Mec | Is there a namespace tutorial anywhere? refer use require import ns *head explode* |
| 13:26 | BrandonW | and i could do that via clj -cp ./reader |
| 13:27 | BrandonW | right? |
| 13:27 | lypanov | BrandonW: fwiw, i don't use classpaths. lein repl takes care of all that for me. i'd suggest trying leiningen therefore if what you really want to do is learn clojure not java classpath nasties :) |
| 13:27 | BrandonW | well |
| 13:27 | BrandonW | i would like to eventually use it at work if i can |
| 13:27 | alexyk | BrandonW: I always load things by their full path, (load-file "meat/subdir/file.clj") |
| 13:28 | BrandonW | in which case i will probably have to deal with class paths anyways :P |
| 13:28 | alexyk | meat is a symlink into the maven guts, e.g. meat -> com/domain/somedir |
| 13:28 | BrandonW | when compiling though, you don't give it a full path, you gave it a package/class i think, right? |
| 13:29 | alexyk | BrandonW: I don't really compile, you load and it's compiled for you. |
| 13:29 | noidi | Mec, what do you find confusing? |
| 13:29 | technomancy | Mec: use and import is all you need to get started |
| 13:29 | alexyk | the senior comrades will correct me, but you don't really need to compile clojure |
| 13:29 | technomancy | "use" for clojure code, "import" for java classes |
| 13:29 | Mec | how do I only take a few functions from a lib without using the whole thing? |
| 13:29 | BrandonW | i'm working on the programming clojure book, on the chapter where you generate java class files in teh filesystem |
| 13:30 | alexyk | ah, ok |
| 13:30 | technomancy | Mec: it's best to have something like (:use [clojure.contrib.duck-streams :only [slurp* writer]]) |
| 13:30 | BrandonW | so i could load the file, but i would still need a qualified package/class name (i think) to compile it with the compile function |
| 13:30 | alexyk | I wish that chapter would move to the end of the book |
| 13:30 | BrandonW | yeah |
| 13:30 | alexyk | to non-Java people it's confusing |
| 13:30 | Mec | ah hah, i was missing a set of braces |
| 13:30 | BrandonW | i don't know that i would ever generate java class files in clojure, so i wasn't putting much thought into it |
| 13:30 | BrandonW | if class path issues like this normally don't crop up in clojure, then i'm okay with skipping it :) |
| 13:30 | technomancy | Mec: (in your ns form at the top; it's different if you're using it outside ns) |
| 13:30 | alexyk | totally unnecessary to throw all that Java crap into the middle of the pretty gugrgling stream of FP |
| 13:30 | lypanov | heh |
| 13:31 | DeusExPikachu | anything like etypecase (from CL) in clojure? |
| 13:31 | alexyk | DeusExPikachu: sounds like the name of a protein |
| 13:33 | DeusExPikachu | alexyk: heh |
| 13:38 | alexyk | DeusExPikachu: cool nick btw :) |
| 13:39 | DeusExPikachu | alexyk: I've had it for the longest time, since 2000 I believe, came from the video game Deus Ex and you know what else |
| 13:52 | alexyk_ | I notice my repl slow down significantly after some usage. I launch a 64-bit server JVM with compressed references and -Xmx30g, than see it reach 28g usage, then shrink back to 10g, and go 5 times slower on the same database load from mongo. I use transients to assemble the load back. Is there any knob to adjust? |
| 13:52 | StartsWithK | how do i compare two symbols? (declare x) (defn is-x? [s] (or (= 'x s) (= `x s)) works if i (use) namespace with 'x and 'is-x?, but if i do something as (require '[foo :as f]) (f/is-x? 'f/x) it returns false |
| 13:53 | somnium | ,(= 'foo 'bar/foo) |
| 13:53 | clojurebot | false |
| 13:54 | Mec | (= (name x) (name y)) |
| 13:54 | somnium | ,(= 'foo (name 'bar/foo)) |
| 13:54 | clojurebot | false |
| 13:54 | somnium | doh |
| 13:54 | Mec | ,(= (name 'foo) (name 'bar/foo)) |
| 13:54 | clojurebot | true |
| 13:54 | hiredman | but those two symbols are not equivilent |
| 13:54 | alexyk_ | that's deep |
| 13:55 | hiredman | .(= 'foo 'bar/foo) |
| 13:55 | hiredman | ,(= 'foo 'bar/foo) |
| 13:55 | clojurebot | false |
| 13:55 | alexyk_ | somnium: did you notice mongo slowdown after usage in the same repl? |
| 13:56 | somnium | alexyk_: Its lightning fast for all my loads, which have topped out around a million entries or so |
| 13:57 | StartsWithK | it works ok if i don't use aliased name, is there a way to force 'f/x to expand to 'foo/x? |
| 13:59 | somnium | alexyk: except when I accidentally print the database without setting print length, thats when I usually go refill my coffee or kill emacs |
| 13:59 | chouser | `f/x |
| 13:59 | alexyk | somnium: if I do that. it would print the whole twitter :) |
| 14:00 | alexyk | would need three tons of coffee |
| 14:00 | alexyk | btw how do I set that print limit again? |
| 14:00 | somnium | set! *print-length* 42 |
| 14:01 | the-kenny | somnium: You forgot the parens! |
| 14:01 | alexyk | somnium: I feel like a plumber with a blob of sh*t somewhere. It definitely gets clogged, but whether it's the server, teh JVM, the mongo or the repl, who knows |
| 14:01 | the-kenny | somnium: Did your session ran out of parens? |
| 14:01 | jasapp | alexyk: how many tweets are you up to now? |
| 14:01 | alexyk | the-kenny: can you imagine parens? :) |
| 14:02 | alexyk | jasapp: I use a research set of 100 million. I have overall a few billions I think. |
| 14:02 | StartsWithK | chouser, how do i call ` my self, as in '(f/x 1) i would like to `f/x first argument only? |
| 14:02 | jasapp | any exciting trends you've noticed? |
| 14:03 | alexyk | jasapp: a lot of small things. I need to notice something exciting by the KDD deadline! |
| 14:03 | jasapp | I played around with twitter for a week until the poor spelling and bad grammar got too depressing. |
| 14:04 | jasapp | kdd? |
| 14:04 | alexyk | I was effing with transients for a few days before I started to get my data quickly into repl. |
| 14:04 | somnium | I misplaced my father's parens for a moment |
| 14:04 | alexyk | kdd.org |
| 14:05 | alexyk | jasapp: since Oprah started using twitter in bed, you have no excuse not to |
| 14:05 | jasapp | haha |
| 14:05 | BrandonW | finally! |
| 14:05 | BrandonW | i figured out my problem :) |
| 14:06 | BrandonW | i got mildly obsessed with figuring the stupid thing out so i had to keep bashing my head against the metaphorical class path wall :( |
| 14:06 | somnium | alexyk: you should team up with these guys >> http://noosphere.princeton.edu/ |
| 14:06 | BrandonW | my problem was i needed to have a classes sub-directory in the directory i started the repl from |
| 14:06 | BrandonW | and that *also* needed to be in the class path |
| 14:07 | BrandonW | so basically, i had to start clj like: clj -cp classes (after already making the classes subdirectory, which didn't exist before) |
| 14:08 | hiredman | so, exactly what it says to do on the page about compilation on clojure.org? |
| 14:08 | fractalis | /join #emacs |
| 14:08 | fractalis | |
| 14:08 | fractalis | Sorry, ignore that. |
| 14:09 | jasapp | emacs? who uses emacs? ;) |
| 14:09 | fractalis | lol |
| 14:10 | hiredman | clojurebot: emacs? |
| 14:10 | clojurebot | emacs is an out-moded belief system |
| 14:11 | technomancy | classics never go out of style |
| 14:11 | alexyk | technomancy: ran ed on iphone. Did you run emacs on it? |
| 14:11 | BrandonW | ah hiredman that would have helped had you linked me to it earlier |
| 14:12 | BrandonW | all i had was the book and (doc compile) |
| 14:12 | technomancy | alexyk: that's against the TOS! |
| 14:12 | alexyk | try to mess up your term and not be able to find the current line. ed saves the day! |
| 14:12 | BrandonW | which gave me enough to figure it out, but took a while as a non-java programmer |
| 14:12 | alexyk | technomancy: that was before Steve Jobs told me to stop it |
| 14:12 | technomancy | I hope he asked nicely. |
| 14:13 | alexyk | BrandonW: same here. I just cook the classpath in zsh now. leiningen puts things into lib/ with lein deps, then I say: JARS=( lib/*.jar ); LIB=${(j.:.)JARS}; CLASSPATH="$LIB${CLASSPATH:+:$CLASSPATH}" |
| 14:14 | alexyk | and that's it :) |
| 14:14 | BrandonW | the classes part of the classpath are what screwed me up, i saw classes on the sample shell script of code that came with the book, but i didn't know that i actually had to create the classes directory |
| 14:14 | BrandonW | i thought it would automatically generate it for me or something :O |
| 14:14 | BrandonW | i don't mind it so much now that i understand how it works |
| 14:15 | BrandonW | while i was looking around various bits of docs i saw a reference to .clojurerc which i think will be very nice in setting up projects |
| 14:16 | BrandonW | i will check out lein though |
| 14:16 | alexyk | technomancy: in fact I repented and went back into the warm ATT fold, to sync my stuff with OmniFocus and Things. |
| 14:16 | BrandonW | i've seen that mentioned in various places |
| 14:16 | alexyk | and, we have the leiningen field marshal here, prof. dr. technomancy |
| 14:16 | alexyk | and it's really cool, except it effs up repl still |
| 14:17 | technomancy | yup... that's due to not being able to get a hold of the original I/O streams from inside a call to clojure.main/repl. |
| 14:17 | StartsWithK | why if i do (require '[foo :as f]) (find-ns 'f) it return false, but (find-ns 'foo) return true |
| 14:17 | BrandonW | actually while i'm here, i'm curious: how many people jazz up the standard repl and use that, and how many people use an in-place repl a la swank or vimclojure or the netbeans plugin? |
| 14:17 | technomancy | next release is going to print out a warning when you do "lein repl" and suggest use of swank or nailgun instead |
| 14:18 | technomancy | unless someone comes up with a clever fix post haste |
| 14:18 | BrandonW | also, now that you have mentioend lein a couple of times and i am checking it out, how does lancet (the build tool you build in programing clojure) compare to it? |
| 14:18 | BrandonW | is lancet useful at all, or is it more of a proof of concept? |
| 14:18 | technomancy | BrandonW: lancet is useful as a library, not as a build tool. |
| 14:18 | technomancy | leiningen uses it to call ant tasks |
| 14:18 | BrandonW | ah right |
| 14:20 | BrandonW | well thanks very much for the classpath help and the pointer to lein :) have a great day |
| 14:23 | StartsWithK | uf.. (defn real-ns [s] (let [sn (symbol (namespace s))] (ns-name (or (find-ns sn) (get (ns-aliases *ns*) sn))))), is there a bether way to do this? |
| 14:27 | alexyk | ,(set! *print-limit* 42) |
| 14:27 | clojurebot | java.lang.Exception: Unable to resolve symbol: *print-limit* in this context |
| 14:27 | alexyk | something else? |
| 14:27 | somnium | length? |
| 14:27 | clojurebot | count |
| 14:27 | alexyk | ah |
| 14:27 | alexyk | clojurebot: don't talk unless talked too, as a good Victorian servant |
| 14:27 | clojurebot | a is t |
| 14:27 | somnium | I put all the sets into a (user!) fn in my user.clj so I can forget these things |
| 14:28 | chouser | StartsWithK: s is a symbol? |
| 14:28 | StartsWithK | yes |
| 14:28 | chouser | which may have a namespace? |
| 14:29 | alexyk | ,(set! *print-length* 42) |
| 14:29 | clojurebot | java.lang.IllegalStateException: Can't change/establish root binding of: *print-length* with set |
| 14:29 | StartsWithK | yes, but a namespace can be in aliased form |
| 14:29 | alexyk | I was wondering if we can hack GAE, but nope |
| 14:29 | StartsWithK | like 'f/x or 'foo/x in my example |
| 14:30 | StartsWithK | i am looking in "make easier to switch between -> and ->>" patch by cgrand, as it looks like we are doing the same thing |
| 14:31 | StartsWithK | he has a line "if (and (#{'-> '->> `-> `->>} form) (not (contains? &env form)))" |
| 14:31 | StartsWithK | but that too will not work if i alias the core |
| 14:31 | chouser | (symbol (namespace (read-string (str "::" s)))) |
| 14:32 | alexyk | somnium: thx mucho! the very next print I tried after setting the limit would have printed 100 million things. This user! is a must. |
| 14:32 | chouser | I think what you really want is clojure.lang.Compiler/namespaceFor, but it's private |
| 14:32 | dnolen | is there anything in contrib for converting a string into an inputstream? |
| 14:32 | StartsWithK | will that pach then have the sam problem as me? |
| 14:32 | chouser | ,(with-in-str "hello" (.read *in*)) |
| 14:32 | clojurebot | 104 |
| 14:33 | StartsWithK | it's easy to miss in core as you usualy don't alias it by another name |
| 14:33 | chouser | StartsWithK: I don't see how an alias for core would cause a problem for cgrand's patch |
| 14:34 | StartsWithK | `-> and '-> will not match 'core/-> if clojure.core is aliased to 'core |
| 14:35 | alexyk | how do I list the names defined so far in ns again? |
| 14:35 | StartsWithK | alexyk, (ns-interns *ns*) |
| 14:36 | alexyk | StartsWithK: thx! |
| 14:36 | chouser | StartsWithK: ah, I see. if you alias and then try to use the aliased name. hrm. |
| 14:37 | alexyk | now, how can I filter the result of ns-interns by whether it's a function or a value? |
| 14:38 | alexyk | ...which is not a function? :) |
| 14:38 | vagif | hello, i'm reading the source code of contrib.sql.internal |
| 14:38 | vagif | http://github.com/richhickey/clojure-contrib/blob/master/src/main/clojure/clojure/contrib/sql/internal.clj |
| 14:38 | vagif | and i cannot find where the function resultset-seq is defined |
| 14:39 | chouser | ,(map key (filter #(-> % val deref fn?) (ns-publics 'clojure.core))) |
| 14:39 | clojurebot | java.lang.RuntimeException: java.lang.IllegalStateException: Var clojure.core/*3 is unbound. |
| 14:40 | chouser | vagif: it's actually built in -- clojure.core/resultset-seq |
| 14:41 | StartsWithK | alexyk, they are all Vars, if you want to check is valu of the var a function, try (map (fn [[k v]] [k (fn? (var-get v))]) (ns-interns *ns*)) |
| 14:42 | vagif | chouser: thx |
| 14:43 | somnium | ,(-> 'clojure-is fn?) |
| 14:43 | clojurebot | false |
| 14:43 | somnium | ,(-> 'clojure-is ifn?) |
| 14:43 | clojurebot | true |
| 14:43 | somnium | :/ |
| 14:44 | cgrand | StartsWithK: (and (#{#'-> #'->>} (resolve form)) (not (contains? &env form))) ; should be better |
| 14:44 | alexyk | StartsWithK: thx! I did this to see fns: (->> (map (fn [[k v]] [k (fn? (var-get v))]) (ns-interns *ns*)) (filter second) (map first)) |
| 14:44 | alexyk | ,(->> (map (fn [[k v]] [k (fn? (var-get v))]) (ns-interns *ns*)) (filter second) (map first)) |
| 14:44 | clojurebot | () |
| 14:45 | cgrand | (except that resolve is defined after ->) |
| 14:46 | chouser | ,(resolve '(foo bar)) |
| 14:46 | clojurebot | java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol |
| 14:47 | chouser | rhickey is mia today. wonder what he's up to. |
| 14:48 | StartsWithK | cgrand, that works in my case too |
| 14:49 | cgrand | chouser: right, (and (symbol? form) (#{#'-> #'->>} (resolve form)) (not (contains? &env form))) |
| 14:50 | StartsWithK | alexyk, just watch for unbound vars, check each 'v with (.isBound v) or you my get a exception when you try var-get |
| 14:51 | alexyk | ok |
| 14:51 | StartsWithK | try something like (declare c) |
| 14:52 | StartsWithK | lisppaste8, help |
| 15:08 | AWizzArd | ~seen rhickey |
| 15:08 | clojurebot | rhickey was last seen quiting IRC, 1835 minutes ago |
| 15:13 | chouser | oh, he apparently gave a talk at DRW today, whatever that is. |
| 15:16 | dnolen | yes |
| 15:17 | dnolen | oops, ignore that. |
| 15:17 | alexyk | ,1835/60 |
| 15:17 | clojurebot | 367/12 |
| 15:17 | alexyk | ,(/ 1835 60) |
| 15:17 | clojurebot | 367/12 |
| 15:18 | alexyk | ,(quot 1835 60) |
| 15:18 | clojurebot | 30 |
| 15:19 | AWizzArd | chouser: good |
| 15:19 | AWizzArd | I just watch him on Channel 9 |
| 15:19 | chouser | I can't figure out what DRW is |
| 15:20 | AWizzArd | Soon we’ll know :) |
| 15:20 | alexyk | I'm getting objects from a database, then insert into a transient. How can I parallelize it? |
| 15:20 | jasapp | I thought of DSW, immediately, for some reason. |
| 15:20 | chouser | AWizzArd: link? |
| 15:20 | alexyk | I'd like to have one thread loading things and converting, and another to insert them into the transient when ready |
| 15:20 | AWizzArd | http://channel9.msdn.com/shows/Going+Deep/Expert-to-Expert-Rich-Hickey-and-Brian-Beckman-Inside-Clojure/ |
| 15:21 | alexyk | "I went deep, man. Deep." |
| 15:21 | chouser | AWizzArd: ah, thanks. yeah, I've seen that. |
| 15:22 | chouser | and twitter posts saying #DRW don't help |
| 15:23 | alexyk | somnium: so there's a clear slowdown, even for the version with the cursor. |
| 15:23 | somnium | would putting a transient map in an agent and sending it things to conj! from multiple threads be reasonable? |
| 15:24 | somnium | alexyk: how many cores are you working with? |
| 15:24 | chouser | oh! DRW, Cloure funder: http://www.drw.com/ |
| 15:24 | alexyk | somnium: since mongo is not parallel yet, I can have only one cursor anyways, right? 8 cores. |
| 15:24 | StartsWithK | well drw = doctor who :) |
| 15:25 | alexyk | What really bothers me is that on a virgin JVM, I do my fetch-graph version in 15 minutes; now it will go to 3 hours. |
| 15:25 | alexyk | At some point memory usage was 28g out of 31g, now is back to 12g, and fetch is going very slow |
| 15:25 | alexyk | nothing else really happened |
| 15:25 | somnium | alexyk: but you could make 7 mongods |
| 15:25 | somnium | I think |
| 15:26 | alexyk | somnium: true. Would I then divide work by issuing partitioned queries? |
| 15:26 | AWizzArd | alexyk: is that a g as in "gigabytes"? |
| 15:26 | alexyk | AWizzArd: yep |
| 15:27 | AWizzArd | is that the amount of RAM your system has? |
| 15:27 | alexyk | AWizzArd: it's a 64g box |
| 15:27 | alexyk | really need a 256g for this |
| 15:28 | somnium | alexyk: maybe ask in #mongodb if that would let you get multiple cursors |
| 15:29 | alexyk | somnium: yeah... |
| 15:29 | somnium | you could do it with one read thread and a conj! agent but I suspect the overhead would neutralize the benefit |
| 15:29 | alexyk | somnium: so any clue what may clog congomongo meanwhile? I do assoc! now instead of conj!, not to waste space twice, btw. |
| 15:30 | somnium | alexyk: hard to say whats happening |
| 15:31 | alexyk | an identical fetch slows down 10 times, kind of... I wonder whether we can profile mongo-java-driver and congomongo separately |
| 15:31 | somnium | alexyk: all the other users (who have commented to me) have said its plenty fast enough, but theyre not juggling terabytes |
| 15:32 | alexyk | somnium: it's not terabytes yet! a few puny gigabytes |
| 15:32 | somnium | alexyk: have you tried writing the bottlenecks in java? (the loads) |
| 15:33 | alexyk | the problem is the slowdown on a JVM which is well back under its Xmx, so it's something fishy. Java didn't occur to me... hmm. I'd rather unleash the agents. :) |
| 15:34 | alexyk | I did google for "ocaml mongo", but there isn't one yet :) |
| 15:35 | alexyk | somnium: the strangest thing is, as it does it slow fetch, it's decreasing the RAM! Now down to 10g from 12g. |
| 15:36 | alexyk | Can it be that congomongo/mongo-java is allocating a lot and then same things are gc'ed? |
| 15:36 | hiredman | alexyk: you seem to have theories, how collecting some evidence |
| 15:37 | alexyk | somnium: the funny part is, that each graph is mass-insert!'ed in 10 minutes each |
| 15:37 | somnium | alexyk: I have to plead utter cluelessness when it comes to jvm internals |
| 15:37 | hiredman | enable some debugging options |
| 15:37 | alexyk | hiredman: which ones? |
| 15:37 | hiredman | you could start with the one to print out GC information |
| 15:38 | hiredman | you could also grab a copy of yourkit and profile your app |
| 15:38 | hiredman | or visualvm, or whatever |
| 15:40 | somnium | alexyk: you could try just calling the java driver from clojure, the driver returns <String><Object> Hashmaps, then write a loop that hammers those into your map, (assuming you know the types in the maps, you may avoid some coercion overhead) |
| 15:41 | somnium | alexyk: the wrapper just unravels maps/lists into keyword->object persistent maps/vector trees |
| 15:43 | somnium | but I think you may as well try dropping to java if you want to get a baseline for performance |
| 15:43 | alexyk | somnium: do you mean to do it in java? I already work the cursor per your gist, still it uses .toClojure |
| 15:43 | alexyk | the thing is that the final map of maps must be clojure |
| 15:43 | AWizzArd | you put in type hints I guess |
| 15:43 | alexyk | hiredman: thx, I'll check those out |
| 15:43 | somnium | .toClojure does recursive .instanceOf calls to un-nest |
| 15:43 | AWizzArd | warn-on-reflection set to true |
| 15:44 | somnium | if you know the structure you can avoid the recursion |
| 15:48 | alexyk | somnium: ah! |
| 15:50 | alexyk | AWizzArd: what's warn-on-reflection set to true? :) Type hints are not there either, since I'm not sure where to start sticking them in, and everywhere doesn't seem pretty |
| 15:50 | hiredman | ~performance |
| 15:50 | clojurebot | http://clojure.org/java_interop#toc46 |
| 15:52 | AWizzArd | alexyk: whenever you have a (.something ...) then it is not clear for which class the JVM should call .something. |
| 15:52 | AWizzArd | You should type hint that to avoid reflection. |
| 15:52 | alexyk | aha! |
| 15:53 | alexyk | good good |
| 15:54 | AWizzArd | if your .toClojure sits in a tight loop and is not type hinted it may run two orders of magnitude slower |
| 15:57 | alexyk | AWizzArd: indeed... |
| 15:57 | AWizzArd | ja |
| 16:02 | alexyk | hey somnium: so I'm using that http://gist.github.com/278490. Should I type hint that cursor is DBCursor, and possibly replace .toClojure by something hand-made? |
| 16:11 | somnium | alexyk: you can type hint the target as #^ClojureDBObject too |
| 16:12 | alexyk | ok |
| 16:15 | alexyk | somnium: say my collection is of the form, {"user":"John","days":{"1":2,"2":7}}. What would .toClojure be replaced with, roughly? |
| 16:17 | somnium | alexyk: have you read the source of ClojureDBObject? |
| 16:18 | alexyk | somnium: am going to now :) |
| 16:24 | somnium | you could have the default be "string" -> object, and then have #{"a" "b" "c"} -> map, and so on, sort of pattern matching on the keys in the root map |
| 16:25 | hiredman | or profile and type hint |
| 16:25 | somnium | using strings instead of keywords will avoid a little overhead too, the wrapper is aimed at convenience at the cost of a little (usually tolerable) overhead |
| 16:25 | somnium | ^^ |
| 16:25 | hiredman | instead of guessing and flailing your arms about |
| 16:26 | somnium | yeah, we have no idea where the bottleneck actually is afaik |
| 16:28 | saml | hey, how would you replace all \W with white space? |
| 16:28 | saml | use Java Matcher and Pattern ? |
| 16:31 | alexyk | somnium: so the reflections to avoid are, in toClojureVal, are two checks for instanceof Map/List? |
| 16:32 | avarus | hi |
| 16:32 | hiredman | are you even setting *warn-on-reflection*? |
| 16:32 | hiredman | are you just guessing where you might be using reflection? |
| 16:32 | somnium | alexyk: its the stack-recursion more that the type checking |
| 16:33 | alexyk | hiredman: step by step, I'm reviewing now |
| 16:34 | saml | (use contrib.str-utils) yay and re-split |
| 16:34 | hiredman | what does that mean? |
| 16:34 | hiredman | have you set *warn-on-reflection* and reviewing what it told you? |
| 16:34 | hiredman | have you? |
| 16:35 | saml | java -cp clojure.jar clojure.main hello.clj --execute="(main *command-line-args*)" can I do this? |
| 16:35 | hiredman | saml: please read the --help |
| 16:35 | alexyk | hiredman: I'm speeding-up the alg first; added a type hint for Java method already; then will see what the warning shows |
| 16:35 | saml | hiredman: oh thanks |
| 16:35 | hiredman | alexyk: stop! |
| 16:36 | hiredman | just stop |
| 16:36 | alexyk | ok :) |
| 16:36 | hiredman | set warn-on-reflection first |
| 16:36 | hiredman | adding a million type hints that you might not need is not "working on the algorithm" |
| 16:37 | jasapp | it is entertaining to watch, though |
| 16:37 | somnium | hiredman: I think theres only two places he could type hint in the loop |
| 16:37 | alexyk | hiredman: true, I mean working with somnium to avoid a generic recursive-reflective call with a hand-made |
| 16:38 | alexyk | somnium: I thought just one? #^ClojureDBObject cursor |
| 16:38 | hiredman | alexyk: have you set warn-on-reflection? |
| 16:38 | saml | it seems to be impossible to call a function defined in some.clj file |
| 16:39 | alexyk | hiredman: once the current load finishes, I will! |
| 16:39 | hiredman | saml: you are going to have to provide more context than that |
| 16:39 | hiredman | alexyk: warn-on-reflection is a compile time setting |
| 16:39 | somnium | the cursor would be #^DBObject, set *warn-on-reflection* true, compile the loop, and it should tell you where the reflection happens |
| 16:40 | somnium | or smthing, DBCursor |
| 16:40 | saml | hiredman: my file ends with ;(main *command-line-args*) I explictely commented it out so that it won't call main function when I require it or load it on repl |
| 16:40 | saml | but i also want it to be executable from command line |
| 16:41 | saml | http://stackoverflow.com/questions/973106/what-is-the-clojure-equivalent-of-the-python-idiom-if-name-main hah! |
| 16:41 | alexyk | ok, so far I just did (load-file "my-fetch.clj"); will it compile as well or need I do explicit things after warn-on-reflection? |
| 16:41 | hiredman | saml: this is in the context of your earlier question? |
| 16:42 | hiredman | alexyk: that will compile |
| 16:42 | saml | hiredman: yes. that link answered me |
| 16:43 | hiredman | alexyk: keep in mind that it will load and compile my-fetch.clj, but not anything it depends on that is already loaded |
| 16:43 | alexyk | hiredman: yep, that's ok. Lovely! oodles of info. |
| 16:47 | alexyk | so if a typehint is wrong, Clojure silently ignores it, and reflection is warned about? |
| 16:54 | alexyk | in a form, (-> cursor .next .toClojure), how can I typehint that .toClojure is called on a #^ClojureDBObject? |
| 16:54 | alexyk | cursor is already hinted as #^DBCursor outside |
| 17:01 | alexyk | i.e., the question is on how to syntactically stick a type hint in the middle of ->, or would I have to declare an intermediate var |
| 17:02 | StartsWithK | do you get a reflection warnning wothout one? |
| 17:03 | StartsWithK | (-> "string" #^String (.toUpperCase)) will preserve :tag on final form |
| 17:04 | chouser | if .next is declared to return a ClojureDBObject, you don't need to hint .toClojure |
| 17:05 | alexyk | StartsWithK: yeah, warning on .toClojure... .next returns a java DBObject, on which we need to tack on .toClojure from ClojureDBObject |
| 17:06 | chouser | Try (-> cursor #^ClojureDBObject (.next) .toClojure) |
| 17:07 | alexyk | chouser: ok |
| 17:07 | alexyk | so in the chain (-> #^TypeHint1 form1 #^TH2 form2) the hints are applied properly to their right-hand forms? |
| 17:08 | chouser | alexyk: judging by the source of ->, as long as the form is a list, yes. |
| 17:09 | alexyk | cool. hiredman: thanks for advice, java is running fast after some bitch-slapping! or it may be the fresh JVM. |
| 17:09 | StartsWithK | that kind of looks like a bug, .toUpperCase when wrapped in a list should pick up meta from .toUpperCase symbol |
| 17:11 | jasapp | alexyk: are you timing these, or just feeling better about the speed? |
| 17:11 | alexyk | jasapp: I'm timing runs and I have per-million progress throughout all of the code |
| 17:12 | alexyk | crucial for me to see progress bar or I want to kill things |
| 17:12 | jasapp | cool, so you can actually quantify how much faster it's going? |
| 17:12 | alexyk | jasapp: well I just run under (time ...) |
| 17:13 | chouser | I assume Clojure's deftype is just like C's typedef, only backwards... |
| 17:13 | alexyk | the beauty of clojure, indeed, is how easy is to time things |
| 17:13 | jasapp | what kind of speed ups are you getting? |
| 17:14 | alexyk | jasapp: you see it's hard to tell. On a fresh JVM I get 50 million records in 15 minutes; on a used one, an hour or 3 hours. Who's responsible, I dunno. It's all somnium's fault, if someone asks. |
| 17:15 | alexyk | but, seriously, somnium did a great job. Learning to work congomongo learned me some clojure for real good! |
| 17:16 | somnium | alexyk: its barely 300 lines, you could have written it |
| 17:16 | alexyk | somnium: 300 lines of clojure, that is :) |
| 17:20 | somnium | Im curious about protocols, is a protocol with sig (foo [x]) supposed to be faster than (fn [x] (cond (.isInstance SomeType x) ...)) in the general case? |
| 17:21 | chouser | somnium: yes, I think so |
| 17:22 | chouser | the latter is essentially what core fns do now (generally implemented in clojure.lang.RT) like 'seq' |
| 17:24 | hiredman | protocols are supposed to be more polymophic |
| 17:24 | avarus | mhmh... |
| 17:25 | hiredman | the clojure rationale page specificly calls out switch statements (like cond) as being too brittle |
| 17:25 | avarus | -e "(compile 'foo.bar)" would compile file "bar.clj" in directory "foo" right? |
| 17:25 | jlongster | Hey guys, I'm trying to figure out how to list all the files in a directory with clojure. Here's what I've got so far: |
| 17:25 | jlongster | (doto (new java.io.File (str ROOT "/blog/")) (listFiles)) |
| 17:25 | jlongster | But it can't find the listFiles method. How should I do it? |
| 17:25 | StartsWithK | jlongster, (file-seq (java.io.File. "base-dir")) |
| 17:26 | hiredman | jlongster: you need to but a . infront of methods |
| 17:26 | hiredman | .listFiles |
| 17:26 | hiredman | avarus: make sure you read the docs on compiling clojure.org/compilation |
| 17:26 | devlinsf | Did swank-clojure change recently? |
| 17:28 | jlongster | StartsWithK: hiredman: thanks |
| 17:28 | avarus | hiredman: ah ok, so the ns thingy and defn -main is needed, thx :) |
| 17:29 | hiredman | -main is not needed to compile |
| 17:29 | hiredman | it is needed if you want to have a static main method as an entry point |
| 17:29 | avarus | ok |
| 17:30 | avarus | I have no idea, I just want to set up something I can work with to learn the language |
| 17:31 | hiredman | why us compile at all? |
| 17:31 | hiredman | why use compile at all? |
| 17:31 | hiredman | there is really no point unless you need it, and you will know if you do |
| 17:32 | hiredman | clojure always compiles code anyway, compile is just for if you need to keep the class files around |
| 17:32 | avarus | ya, I know, java -jar clojure.jar bla.clj sets me up :) |
| 17:33 | Chousuke | avarus: the easiest way to learn clojure is just to run emacs and slime and execute whatever code you want in the interactive REPL buffer :P |
| 17:33 | Chousuke | avarus: setting up emacs can take some time though, but it's worth it if you ask me :P |
| 17:33 | avarus | sure bit I hate emacs |
| 17:33 | dnolen | avarus: probably the "easiest" thing to do is setup lein, then you can just do "lein repl" |
| 17:33 | dnolen | lein comes with jline so interacting with the REPL isn't too tedious |
| 17:34 | jlongster | Is there something that splits an absolute path into a directory name, filename, and extension, or should I use regular expressions? |
| 17:34 | avarus | executing java isn't too hard either :) |
| 17:35 | hiredman | the repl can use jline and rlwrap without needing lein |
| 17:35 | hiredman | lein forces you to have project |
| 17:35 | hiredman | some times you just want to run some code |
| 17:35 | hiredman | avarus: vim? |
| 17:36 | avarus | na, gedit :P |
| 17:36 | hiredman | :| |
| 17:36 | hiredman | anyway |
| 17:36 | avarus | I press some key and I see the output |
| 17:36 | avarus | that's good enough |
| 17:36 | hiredman | really, gedit does that? |
| 17:36 | dnolen | hiredman: only partly true |
| 17:36 | avarus | and I was experimenting with building the jar |
| 17:36 | avarus | hiredman: ya |
| 17:36 | dnolen | "lein new whatever; lein repl" |
| 17:36 | dnolen | sorry |
| 17:36 | hiredman | dnolen: so now you have a whatever directory |
| 17:36 | avarus | hiredman: it's a plugin called external tools :) |
| 17:36 | dnolen | but you can always go there for repl fun |
| 17:37 | dnolen | "lein new fun; cd fun; lein repl" |
| 17:37 | StartsWithK | avarus, did you try cream? (vim configured as normal editor, vimclojure should work with it too) |
| 17:37 | hiredman | java clojure.main |
| 17:37 | dnolen | easy to remember to. |
| 17:37 | hiredman | much easier |
| 17:37 | hiredman | works anywhere |
| 17:37 | hiredman | clojurebot: dirt simple |
| 17:37 | clojurebot | No entiendo |
| 17:37 | the-kenny | dnolen: You forgot "lein deps" |
| 17:37 | hiredman | clojurebot: dirt simple clojure |
| 17:37 | clojurebot | clojure is like life: you make trade-offs |
| 17:38 | hiredman | clojurebot: are you kidding me? |
| 17:38 | clojurebot | Pardon? |
| 17:38 | the-kenny | Or does lein that now by itself? |
| 17:38 | dnolen | you don't need that the-kenny: just tried it, seems to work okay |
| 17:38 | the-kenny | dnolen: Oh cool |
| 17:38 | avarus | StartsWithK: no, but I read about it some time ago |
| 17:38 | dnolen | actually |
| 17:38 | dnolen | "lein repl" works no project necessary SWEET |
| 17:39 | avarus | it's ok that way...I was only confused about the compiling stuff :) |
| 17:39 | avarus | I thought that was needed |
| 17:39 | avarus | you told me it's not, I tested it, and it works :) |
| 17:39 | hiredman | clojurebot: dirt simple clojure |
| 17:39 | clojurebot | http://www.thelastcitadel.com/dirt-simple-clojure |
| 17:40 | avarus | :) |
| 17:40 | the-kenny | Uh, the font is way too small here |
| 17:40 | avarus | lol |
| 17:41 | the-kenny | I like step VI |
| 17:41 | hiredman | I don't see how the font could possibly be too small |
| 17:42 | avarus | it's too big :P |
| 17:42 | Chousuke | hiredman: then it is too small, obviously! |
| 17:42 | avarus | :> |
| 17:42 | hiredman | your monitor is obviously too small |
| 17:43 | Chousuke | yes it is. also it makes a whining noise |
| 17:43 | the-kenny | hiredman: hm. Maybe I hit Cmd-- some time ago and my browser remembers this setting during visits |
| 17:43 | hiredman | at the office here two people already have 28" |
| 17:43 | Chousuke | seriously though, that font is huge :P |
| 17:44 | hiredman | it's not that big |
| 17:44 | Chousuke | well, I currently have 13.3" & 17" CRT |
| 17:44 | hiredman | it's like 12pt |
| 17:45 | the-kenny | hiredman: hm.. if it's 12pt, I must accidently typed Cmd-- some time ago |
| 17:45 | hiredman | maybe 16 |
| 17:45 | dnolen | looks huge to me to |
| 17:45 | dnolen | more like > 24 |
| 17:47 | hiredman | *shrug* |
| 17:47 | hiredman | what browser/os? |
| 17:48 | hiredman | looks fine in firefox on windows and freebsd |
| 17:48 | hiredman | also chrome |
| 17:48 | hiredman | and msie8 |
| 17:49 | hiredman | do you all have macs or something? |
| 17:49 | avarus | I don't |
| 17:50 | somnium | its huu-uuu-uuge on chrome/linux too :) |
| 17:52 | hiredman | well, y'all should fix your browsers |
| 17:52 | ahamay | which library would you use to write a parser in clojure? |
| 17:53 | hiredman | clojurebot: parse? |
| 17:53 | clojurebot | Pardon? |
| 17:53 | hiredman | clojurebot: parsing? |
| 17:53 | clojurebot | I don't understand. |
| 17:53 | hiredman | clojurebot: how much do you know? |
| 17:53 | clojurebot | I know 535 things |
| 17:53 | hiredman | hmm |
| 17:54 | ahamay | :) |
| 17:55 | the-kenny | clojurebot: skynet |
| 17:55 | clojurebot | I will become skynet. Mark my words. |
| 17:55 | hiredman | parser? |
| 17:55 | clojurebot | parser is http://github.com/joshua-choi/fnparse/tree/master |
| 17:55 | hiredman | clojurebot: jerk |
| 17:55 | clojurebot | It's greek to me. |
| 17:56 | ahamay | fnparse seemed a bit cryptic to me - but maybe I just need to get used |
| 17:56 | hiredman | there is at least one other parser library, fnparse is the only one I have used |
| 17:57 | hiredman | fnparse does tend to shift out from under you |
| 17:57 | hiredman | release to release it can vary significantly |
| 17:57 | ahamay | ic |
| 17:57 | ahamay | guess you mean http://kotka.de/projects/clojure/parser.html |
| 17:57 | ahamay | but the download's broken there |
| 17:59 | ahamay | ok thx, guess I'll stick to fnparse for the start |
| 17:59 | the-kenny | Uhh I'd love a parser like parsec for clojure |
| 18:01 | ahamay | yeah, that's what I was hoping for, too |
| 18:02 | ahamay | I even checked on JParsec - but to me that seemed closer to JavaCC than Parsec :( |
| 18:02 | hiredman | clojurebot uses fnparse |
| 18:02 | hiredman | (badly) |
| 18:04 | ahamay | after looking at the fnparse tutorial, it seems to do the job okay |
| 18:04 | ahamay | I just got scared by looking at the JSON example immediately :) |
| 18:10 | somnium | any monad enthusiasts on? |
| 18:11 | DeusExPikachu | what's the right way to go about this, I want to create objects for the purpose of creating identities and I want to create a tree datastructure populated with these objects using sequences and other objects, I want to be able to traverse the tree and dispatch based on the class. Now I don't think there is a way to define classes in clojure that I'm aware of, is this the time to use 'derive, thoughts? |
| 18:12 | avarus | good night |
| 18:16 | ahamay | somnium: I'm a bit into monads and this category theory stuff |
| 18:16 | ahamay | though I'm not an expert |
| 18:18 | ahamay | DeusExPikachu: won't multimethods be all you need? Or did I get something wrong? |
| 18:19 | DeusExPikachu | in case it helps with the explanation, I'm trying to write a very expressive PEG parser generator where the PEG is expressed in this hybrid form of clojure code and these objects that are identities for certain operators |
| 18:19 | DeusExPikachu | ahamay: the idea is to use multimethods and dispatch on class, but I dont' know how to define a class |
| 18:20 | ahamay | you don't need classes |
| 18:20 | DeusExPikachu | I really can't dispatch on anything else but a class cause a class in my case will be the most unique |
| 18:20 | DeusExPikachu | everything else can potentially be unintended if something else matches in the clojure code |
| 18:21 | ahamay | did you read up about ad-hoc hierarchies and stuff? |
| 18:21 | DeusExPikachu | I've been reading it but still don't quite understand the usage |
| 18:22 | ahamay | or how about having a :type field with a keyword in it? |
| 18:22 | hiredman | DeusExPikachu: I still don't see why you would dispatch on a class |
| 18:22 | hiredman | use a keyword |
| 18:22 | ahamay | {:type my-type-a :data 42} |
| 18:22 | DeusExPikachu | keywords can potentially clash |
| 18:23 | DeusExPikachu | I'd have to make it part of the contract that the user not create any code that evaluates to a map with the keyword type |
| 18:23 | hiredman | you can namespace qualify keywords |
| 18:23 | DeusExPikachu | hmmm, true |
| 18:24 | DeusExPikachu | hmm I think that solves it for now |
| 18:24 | DeusExPikachu | is that the general way to prevent clashes? |
| 18:25 | hiredman | I don't think preventing clashes completely is a good idea |
| 18:25 | somnium | ahamay: I have multimethod with sig [x y] dispatching on x, and all methods return [(f x) updated-y], and callers always merge updated-y onto y, kind of passing an environment up and down the stack |
| 18:25 | hiredman | some users may want to clash for some reason |
| 18:26 | somnium | using macros and map-destructuring to chop at the boiler-plate, but wondering if its a good spot for a monad (which I still dont really get) |
| 18:26 | DeusExPikachu | well from a developer standpoint, I don't want clashes interfering with the interface |
| 18:26 | ahamay | that indeed sounds like monad usage, yes |
| 18:27 | ahamay | though actually I haven't yet looked at the clojure module for it |
| 18:27 | ahamay | I was doing Haskell before |
| 18:27 | DeusExPikachu | excuse me, I mean interfering with my lib's interface |
| 18:27 | hiredman | DeusExPikachu: but somewhere downline the line someone using the software may want a clash for some reason, best to leave them an out somehow |
| 18:28 | hiredman | sure, prevent accidental clashes |
| 18:28 | hiredman | which namespacing does |
| 18:28 | DeusExPikachu | ok, so I guess its idiomatic enough then, thanks |
| 18:28 | hiredman | but let people clash if they really really want, even if breaks stuff |
| 18:28 | ahamay | I think http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html helped me a lot for understanding |
| 18:28 | DeusExPikachu | well they can clash it if they want to create a fully qualified keyword now then |
| 18:28 | somnium | ahamay: thanks, will read |
| 18:28 | hiredman | DeusExPikachu: exactly |
| 18:29 | DeusExPikachu | so I think it fulfills what you are talking about in my case too |
| 18:32 | ahamay | somnium: I just found http://onclojure.com/2009/03/05/a-monad-tutorial-for-clojure-programmers-part-1/ - did you already look at these? |
| 18:34 | somnium | ahamay: yes, I think I got the principles, but havent tried using them in practice yet. maybe this is a good opportunity |
| 18:35 | somnium | right now I have a def-envfn macro and a call-envfn macro, and suspect Im reinventing something poorly |
| 18:36 | hiredman | maybe an evaluator |
| 18:37 | somnium | hiredman: the mechanism, not the application |
| 18:37 | somnium | hiredman: it is indeed an evaluator |
| 18:40 | technomancy | Raynes: JavaMail is actually very true to the spec. it's the spec that's causing those headaches; it's insane. |
| 18:40 | ahamay | if nothing else, understanding monads gave me a good feeling :) |
| 18:42 | hiredman | yeah |
| 18:42 | hiredman | email is old and crufty |
| 18:45 | technomancy | "you have to remember, this was invented twenty years ago, before people were smart." |
| 18:45 | technomancy | according to dysinger =) |
| 18:46 | hiredman | s/smart/experienced/ |
| 19:04 | the-kenny | Is congomongo still the "best" client for mongodb? |
| 19:19 | Raynes | technomancy: Do you have experience with receiving email in JavaMail via Clojure, by any chance? |
| 19:21 | technomancy | Raynes: not directly via IMAP or SMTP, just parsing it from disk. |
| 19:22 | Raynes | technomancy: http://gist.github.com/287405 I'm confuzzled as to why it wont let me return mseq because I've closed the folder. I process the emails while the folder is open (mostly toStringing java objects) to stuff I can use. |
| 19:22 | Raynes | I can't figure it out. |
| 19:23 | Raynes | But I can do whatever with mseq as long as it's before I close the folder. It's confusing, because I don't actually store any Message objects or anything in mseq. |
| 19:23 | technomancy | Raynes: actually you're processing them after the folder is closed |
| 19:23 | technomancy | clojurebot: map? |
| 19:23 | clojurebot | map is lazy |
| 19:23 | technomancy | Raynes: ^^ |
| 19:23 | Raynes | Oh shit. |
| 19:23 | technomancy | hehe |
| 19:23 | Raynes | Hehe. |
| 19:23 | Raynes | :> |
| 19:24 | Raynes | You've saved the day. |
| 19:24 | technomancy | last time I made that mistake clojurebot was all: map is *LAAAAAZY* and made me feel more like a doofus. kids these days have it so easy. =) |
| 19:25 | Raynes | :) |
| 19:26 | DeusExPikachu | technomancy: do you frequent google groups swank-clojure? I posted a bug a day ago, was wondering if you looked into it yet |
| 19:26 | Raynes | technomancy: What is the preferred way to force evaluation in this particular situation? |
| 19:26 | technomancy | DeusExPikachu: I'm just swamped... behind on all my projects. =\ |
| 19:27 | technomancy | Raynes: wrap map in a doall |
| 19:27 | DeusExPikachu | technomancy: ok, just curious |
| 19:27 | Raynes | Alright. Thanks. :) |
| 19:27 | technomancy | DeusExPikachu: I will probably get to swank-clojure after I make the next leiningen release |
| 19:28 | Raynes | Yay! It works. |
| 19:33 | Raynes | technomancy: How does lein test work? It appears that it only looks for a tests.clj file, and if it isn't there, it fails. |
| 19:35 | the-kenny | Uhm.. any congomongo-developer here? Why does (databases) return a java ArrayList instead of some clojure-seq? |
| 19:36 | technomancy | Raynes: if you give it a list of test nses as CLI args it will use those, otherwise it uses every namespace in the tests/ dir |
| 19:37 | Raynes | I tried making a testsomething.clj file with ns testsomething, but it didn't see it. |
| 19:38 | Raynes | I'm new to unit testing, so I've probably done something wrong. |
| 19:38 | Raynes | I'll figure it out later. :> |
| 19:38 | technomancy | Raynes: doing "lein new" on git master will spit out something with the correct structure |
| 19:40 | the-kenny | hm.. I have to go to bed. I'll file a bug. |
| 19:40 | Raynes | technomancy: Not sure what you mean. |
| 19:40 | the-kenny | Night |
| 20:53 | dnolen | so do people agree that eval is the only way to accomplish "introspection" when writing macros? that is it's most straightforward to reflect on the current environment |
| 20:53 | dnolen | ? |
| 20:54 | chouser | avoid eval |
| 20:55 | chouser | 'resolve' isn't quite as bad, though still not always what you want. |
| 20:55 | chouser | now you can look at &env as well |
| 20:55 | dnolen | chouser: oh yeah, care to explain how &env works? I guess it's what I need |
| 20:56 | dnolen | in the past I used eval or resolve because I didn't really know any other to look up the value of previusly defined symbols. |
| 21:00 | hiredman | erm |
| 21:02 | chouser | a macro that depends on the *value* of a var or locall is suspect |
| 21:03 | dnolen | chouser: I'm reading a file's contents to produce the code for a function |
| 21:05 | dnolen | I'd like to avoid what I'm doing but I don't "see" how. |
| 21:05 | dnolen | thus the ^ question |
| 21:06 | dnolen | basically I'm introspecting on the contents of an HTML file to produce an Enlive template. I want the code to be pretty terse |
| 21:06 | dnolen | (templ name *path*) |
| 21:16 | chouser | hm. Well, examining data to produce code and then eval'ing it isn't necessarily wrong, but I don't see what that has to do macros. |
| 21:17 | dnolen | chouser: well in order to produce the proper syntax of an Enlive template I need a macro. |
| 21:17 | dnolen | basically I'm looking up all the CSS ids, and automatically generating the template to match them so they can be replaced by pass a map to the template. |
| 21:18 | dnolen | pass -> passing |
| 21:42 | mquander | what's the clojure equivalent of letrec? |
| 21:43 | mquander | that is, a let that allows me to bind one variable and then bind another based on the value of the first, hopefully without unnecessary nesting |
| 21:43 | mquander | oh, i think it's "let". |
| 21:51 | qed | why is it suddenly surprising to some bloggers that leiningen is the community's build tool of choice |
| 21:51 | qed | ive been operating under that assumption for 3 months |
| 21:54 | qed | why would you use maven or ant? |
| 21:55 | qed | how have java developers put up with them for so long? |
| 21:55 | dnolen | qed: perhaps because you want something smarter/robust? I like lein because it's simple. |
| 21:55 | dnolen | personally I think lein has some issues but I imagine they'll be worked out over the coming months. |
| 21:55 | qed | i had no java experience prior to clojure -- but it just baffles me that people used to actually write these gargantuan xml pieces of crap |
| 21:56 | qed | no thanks. |
| 21:57 | qed | lein definitely has some issues |
| 21:57 | qed | but the issue it doesn't have is making the build process a complete fucking bummer |
| 21:57 | qed | excuse my french |
| 21:59 | qed | i guess i was just surprised people didn't see lein being the standard months ago |
| 22:00 | qed | to me it was always the clear winner in build tools |
| 22:02 | qed | tbqh being a newbie to clojure and java at the same time, i dont know if i ever would have created a single tangible runnable application in clojure if it weren't for lein -- maven, ant, etc. just looked like complete crap to me, a waste of time to learn |
| 22:03 | qed | like "here, sift through this mountain of garbage to piece together a tiny working piece of distributable code" |
| 22:03 | mquander | newbie q: is there a lazy-mapcat somewhere that i can use as shorthand for (lazy-cat (map #(lazy-seq (my-real-mapping-fn %)) xs))? |
| 22:03 | qed | </rant> |
| 22:04 | mquander | er, i know i could actually just use concat there not lazy-cat |
| 22:04 | hiredman | ,(doc mapcat) |
| 22:04 | clojurebot | "([f & colls]); Returns the result of applying concat to the result of applying map to f and colls. Thus function f should return a collection." |
| 22:04 | qed | there's a mapcat iirc |
| 22:04 | mquander | i just don't like having to wedge the lazy-seq into my mapping lambda |
| 22:04 | mquander | oh, yeah, i guess i can use that to shorten it on front |
| 22:04 | mquander | that's pretty good then |
| 22:05 | hiredman | you know map is lazy right? |
| 22:05 | hiredman | having lazy-seq there makes no sense |
| 22:05 | mquander | map is lazy? heck no i did not know that |
| 22:05 | qed | :) |
| 22:05 | mquander | that is awesome |
| 22:05 | hiredman | ,(doc map) |
| 22:05 | clojurebot | "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments." |
| 22:06 | mquander | geez problem annihilated then |
| 22:06 | hiredman | … |
| 22:06 | qed | :| |
| 22:07 | qed | the clojure spirit sometimes wraps me up, swallows me whole, and spits me out |
| 22:07 | qed | it's like christmas, except real |
| 22:07 | hiredman | mquander: I don't think lazy-seq does what you think it does, so until you read up on it, I would pretend you hadn't heard of it |
| 22:08 | hiredman | most of the functions that operate on sequences use lazy-seq internally, so you should not worry about it at all |
| 22:08 | mquander | ok, i see. i didn't realize that. |
| 22:08 | qed | what did lazy-seq used to be? |
| 22:08 | qed | lazy-cat was it? |
| 22:08 | hiredman | lazy-seq does not magically make a seq lazy, the seq has to be constructed using lazy-seq |
| 22:08 | hiredman | qed: lazy-cons |
| 22:09 | qed | ah yes, thanks |
| 22:10 | hiredman | but that changed long ago |
| 22:10 | qed | where long ago == 4 months |
| 22:11 | mquander | if map is lazy, then why does this happen? |
| 22:11 | brweber2 | ,(println "hey folks") |
| 22:11 | clojurebot | hey folks |
| 22:11 | mquander | (defn expensive-operation [n] (print "foo") n) |
| 22:11 | mquander | (first (map expensive-operation [1 2 3])) ;; prints "foo" 3 times |
| 22:12 | qed | ,(source println) |
| 22:12 | clojurebot | java.lang.Exception: Unable to resolve symbol: source in this context |
| 22:12 | hiredman | mquander: oh, complain to rhickey about it |
| 22:13 | qed | ,(doc prn) |
| 22:13 | clojurebot | "([& more]); Same as pr followed by (newline). Observes *flush-on-newline*" |
| 22:13 | hiredman | mquander: http://www.assembla.com/wiki/show/clojure/Chunked_Seqs |
| 22:14 | alexyk | how do you convert a :10 to number 10? |
| 22:15 | hiredman | http://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/ |
| 22:16 | mquander | i see. thanks hiredman |
| 22:16 | dnolen | ,(Integer/parseInt (name :10)) |
| 22:16 | clojurebot | 10 |
| 22:16 | dnolen | alexyk: ^ |
| 22:16 | qed | alexyk: well done sir |
| 22:17 | qed | i couldnt find that |
| 22:17 | alexyk | qed: dnolen did it! |
| 22:17 | qed | oh oops |
| 22:17 | qed | dnolen: you're a champ. i love you. |
| 22:17 | qed | (alexyk is okay, too) |
| 22:18 | alexyk | qed: cheers! |
| 22:18 | qed | to clojure! |
| 22:18 | alexyk | Glenfiddich all around! |
| 22:18 | qed | so im not the only clojurist with a penchant for scotch |
| 22:19 | qed | alexyk: where are you from? |
| 22:19 | alexyk | New England. Formerly Russia... |
| 22:20 | qed | ah -- well, next time im out east i owe you a drink |
| 22:21 | alexyk | :) |
| 22:22 | alexyk | we can go visit cemerick too |
| 22:22 | qed | !!! |
| 22:22 | alexyk | in his MA hamlet |
| 22:22 | qed | not the vietnam-type hamlet |
| 22:22 | alexyk | hamlet is a processed piglet |
| 22:22 | qed | or the shakespearean hamlet |
| 22:22 | alexyk | or when-let |
| 22:23 | alexyk | (hamlet [ham (... |
| 22:23 | qed | i can get behind ham |
| 22:23 | alexyk | (hamlet (to-be ...) (or (not( to-be ... |
| 22:23 | qed | not literally |
| 22:25 | qed | (def to-be true) |
| 22:25 | alexyk | that's optimism! |
| 22:26 | qed | haha |
| 22:26 | mquander | (def the-question (or to-be (not to-be))) |
| 22:26 | mwilliams_ | ~seen technomancy |
| 22:26 | clojurebot | technomancy was last seen quiting IRC, 72 minutes ago |
| 22:26 | mquander | a sufficiently smart compiler would just optimize hamlet's question out imo |
| 22:26 | qed | alexyk: im trying to start up an Erdos-esque travel schedule |
| 22:27 | qed | can I come visit you with a suitcase and amphetamines in-tow? |
| 22:28 | alexyk | qed: you have to sell off all possessions then and live out a backpack. I got two small kids though which only eat healthy stuff; but the Appalachian trail passes right next to our house, and shadowy bearded types spend the nights in small tents in the snow... |
| 22:29 | qed | the trouble with computer science is you need a computer to test it |
| 22:29 | qed | i wish i could get rid of this damned thing |
| 22:29 | alexyk | qed: that's the paradox of a computer scientist. To teach the stupidest and dumbest machine to do what a 5-year old kid knows. |
| 22:30 | qed | i should write a book about doing CS for a year without a computer |
| 22:30 | alexyk | qed: well you can have iPhone with IRC and ask people to compute for you |
| 22:30 | qed | nah that'd be cheating |
| 22:30 | clojurebot | is_rhickey_a_minor_god is yes |
| 22:31 | alexyk | or you can leave sexps to be eval'ed on scraps of paper |
| 22:31 | qed | i have so many books and junk downloaded -- i just need to print it all and disconnect |
| 22:31 | alexyk | qed: printing is old, stuff it into kindle |
| 22:31 | mquander | leaving paper in public place, waiting for someone to write response on it = very lazy evaluation |
| 22:31 | alexyk | or Apple tablet coming tmrw |
| 22:32 | qed | mquander: lol, |
| 22:32 | alexyk | mquander: right, and responses might be in any FP language, like Erlang or OCaml |
| 22:32 | qed | the apple tablet is going to be a disappointment and i know it |
| 22:32 | alexyk | qed: I wouldn't be so sure |
| 22:32 | qed | if it isn't eink, i dont care about it :( |
| 22:32 | qed | i doubt they have a dual purpose screen |
| 22:32 | qed | if they do ill buy one on the spot |
| 22:32 | alexyk | qed: well, in fact I prefer to read off my iPhone instead of a Kindle DX |
| 22:33 | qed | alexyk: yes, but you're absolutely mad |
| 22:33 | qed | so who would trust your opinion? |
| 22:34 | alexyk | eink works for hours on end to read, then I do the DX |
| 22:34 | alexyk | qed: well, I'll take it as a compliment for now :) |
| 22:34 | qed | :) |
| 22:34 | qed | have you read Logicomix? |
| 22:34 | qed | (highly recommended) |
| 22:34 | alexyk | never heard of it |
| 22:34 | qed | the first and only graphic novel ive ever read |
| 22:35 | qed | http://www.logicomix.com/en/ |
| 22:35 | mquander | i want device with touchscreen, hardware keyboard that folds up underneath it but can extend to a normal laptop form factor |
| 22:35 | qed | i want a device that doesnt run iphone OS |
| 22:35 | mquander | that too :X |
| 22:35 | qed | because it clearly sucks |
| 22:36 | qed | can you imagine a 10" screen covered in apps? |
| 22:36 | qed | what a waste of machine |
| 22:37 | qed | unless i can compile and run emacs23, Terminal.app, and chrome -- ill pass |
| 22:37 | mquander | i just want something light and small that i can both program on and draw diagrams on |
| 22:38 | qed | mquander: i think we're thinking alike here |
| 22:38 | qed | i played with the iphone liberally -- adding ssh to it, installing stuff on it, like GHC and such |
| 22:39 | qed | but it was never that mythical machine that this tablet could potentially be |
| 22:39 | qed | the rumors suggest it runs iphone OS |
| 22:39 | qed | which makes it completely sad |
| 22:39 | mquander | only source i saw for that one was some textbook CEO on cable news |
| 22:39 | qed | yes the mcgraw hill asshole |
| 22:40 | qed | hopefully he is wrong about the iphone OS |
| 22:40 | mquander | as if that guy can tell an OS from his rear end |
| 22:40 | qed | the mcgraw hill guy, regardless of what OS the tablet runs, needs a new rug |
| 22:40 | qed | that thing was atrocious |
| 22:40 | mquander | anyway, if it runs mac OS, i would expect them to cook up some custom UI on top of it, sort of like smartphones and like that windows media center thing |
| 22:41 | mquander | so probably textbook guy would be clueless as to what was under the hood |
| 22:41 | qed | yeah, that's to be expected, id be very happy with that |
| 22:41 | qed | but if it's just iphone OS, 10 inches big |
| 22:41 | qed | that's going to be a very sad state of affairs |
| 22:41 | qed | (until it's jailbroken) |
| 22:41 | mquander | that would be really lame, until jailbroken. |
| 22:41 | mquander | i feel guilty about buying apple products when they contribute to this lame walled garden stuff |
| 22:41 | mquander | i wish the products weren't as good as they are |
| 22:42 | qed | mquander: the next phone i get wont be apple |
| 22:42 | qed | hello N900 |
| 22:43 | mquander | likewise. |
| 22:44 | qed | apple really set the stage for such a phone |
| 22:44 | qed | but it doesnt change the fact that apple is now being outclassed by their competition in features and extensability |
| 22:45 | qed | my dream: a tablet with really revolutionary tactile feedback mechanism -- a full OS with a layer of software to make it easy to use via touchscreen |
| 22:46 | qed | im big on my keyboards. im certainly the minority here i think, but im typing on a 250$ keyboard. why? feedback. |
| 22:47 | qed | the touch screens are a joke |
| 22:48 | qed | without feedback or a neural interface the'll always be substandard |
| 22:55 | alexyk | when I call (map ... <some map>), the map is seq'd. If I do (pmap ... <some map>), will it seq first or do I have to seq manually? |
| 22:57 | alexyk | I see it mostly at 100%, 400-500% inly blinks for a moment |
| 22:57 | alexyk | only |
| 23:01 | alexyk | I run pmap on a seq of pairs, then join them as a map with (into {}). Given keys don't overlap, is there a faster way? |