#clojure log - Aug 15 2009

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:21 lrenn: holy crap.

0:21 (global-set-key (kbd "C-x C-i") 'ido-imenu)

0:21 do that in a clojure file. Thank you thank you thank you technomancy.

0:24 lowlycoder: is there anyway to have clojure startup faster?

0:25 i'm willing to waste memory / precompile / draw a pentagon & slaughter cute kittens

0:26 andyfingerhut: Some Common Lisp implementations have the idea of saving a core/dump file at some point after loading whatever you want, with the intent of starting up to that state faster. Does the JVM have such a thing?

0:26 hiredman: the nailgun server from vimclojure

0:26 ~nailgun

0:26 clojurebot: No entiendo

0:27 hiredman: ~google java nailgun

0:27 clojurebot: First, out of 3420 results is:

0:27 Nailgun: Insanely Fast Java

0:27 http://martiansoftware.com/nailgun/index.html

0:27 hiredman: it works ok, but it isn't perfect

0:28 the easiest way to use it is to grab it from vimclojure

0:28 I have my netbook start up a nailgun server when it boots, so "clj" brings up an instant repl

0:29 lrenn: oh, ido-imenu isn't part of ido mode. my bad.

0:36 andyfingerhut: Apparently there is no standard for saving a core file in JVMs like some Lisp implementations have (also no Common Lisp standard for it -- implementation-specific). A JSR was proposed but rejected, according to a very recent thread in comp.lang.lisp titled "Q: JVM based Lisp implementations and saving images - possible?"

0:36 nailgun sounds faster, anyway, if that solution works for you.

0:37 hiredman: some operating systems like dragonflybsd can "freeze" processes

0:38 not sure if you can restart the image multiple times though

0:38 http://hackety.org/2008/02/27/dragonflysFreezer.html

0:49 lowlycoder: why does java com.martiansoftware.nailgun.NGServer work; but java -server com.martiansoftware.nailgun.NGServer does not

0:49 does classpath not apply to -server?

0:55 hiredman: eh? works here

1:01 andyfingerhut: Would it be possible to make something like an immutable Java array in Clojure? By which I mean it would really be immutable, but then you'd lose the ability to efficiently conj on it?

1:02 hiredman: eh?

1:02 I am pretty sure there are no immutable arrays in java

1:03 andyfingerhut: Well, all the persistent data structures in Clojure actually have their internals mutated in Java code during operations like conj, assoc, etc.

1:04 hiredman: erm

1:04 andyfingerhut: But I think they are prevented from being mutated by *other* Java code by being private, so no other methods can twiddle with their insides.

1:04 What if we put a Java array inside of such a class?

1:04 so only methods written for it would have permission to touch them.

1:05 I don't know if there are other possible advantages, but the one that motivated the thought was saving space for large arrays of Java primitives. That might be a special enough case not to be terribly interesting...

1:08 It is just bugging me that in order to have something immutable right now, it has to be 3 to 4 times larger, if you only want to stick ints or doubles into it.

1:09 because of java.lang.Object and java.lang.Double overheads.

1:39 lowlycoder: for vimclojure, what is vimdir=/custom/installation/path/for/vimplugin

1:39 supposed to do?

1:39 what dir is this vimplugin they want?

1:39 /usr/share/vim/vim72/plugin?

3:02 konr: What are your editor-to-repl bindings set to?

4:13 lowlycoder: what are good web frameworks for clojure?

4:19 arbscht: lowlycoder: compojure is quite popular. (feel free to discuss it in #compojure if you're interested)

4:19 others are listed at http://clojure.org/libraries

4:42 konr: lisping all night long, lalala

5:40 argh, I can no longer think

5:40 I guess I'll sleep with the other tutorial videos turned on

5:41 time to cloje my eyes ;)

10:03 osaunders: Is there a way to break from a map?

10:03 cark: no

10:03 but you don't need it

10:03 osaunders: What do you do instead?

10:03 cark: remember that map is lazy

10:04 so you may filter

10:04 or even filter before maping

10:05 worst case you still may use loop

10:05 osaunders: I understand how I would filter before mapping, but how would the other one work?

10:05 cark: well that would depend on what you want to do i guess

10:06 osaunders: OK so how would I write this (Ruby) in Clojure: [1, 2, 3, 4].each { |n| puts n; break if n == 3 }

10:06 I could filter [1 2 3 4] beforehand.

10:06 But otherwise I don't know.

10:07 cark: or (map #(if (> % 3) nil %) [1 2 3 4])

10:07 and take-while not nil

10:07 actually directly take whil not nil =P

10:08 osaunders: :-s

10:08 AH

10:09 ,(take-while #(not (nil? %)) (map #(if (< % 4)) [1 2 3 4])

10:09 clojurebot: EOF while reading

10:09 osaunders: (take-while #(not (nil? %)) (map #(if (< % 4)) [1 2 3 4]))

10:09 cark: ,(take-while (partial >= 3 ) [1 2 3 4])

10:09 clojurebot: (1 2 3)

10:09 cark: do this before maping

10:10 but it really depends on your specific case

10:10 tomoj: no reason to map if you just want to print them out

10:10 sometimes I feel like it would be useful to have a take-while-inclusive

10:10 cark: selecting the correct subset of your sequence is a different concern than mapping it

10:11 tomoj: which would take while the condition is true AND include the first element for which the condition was false

10:12 osaunders: cark: I want up to 3. Isn't it < 4 not >= 3

10:12 It's still just a hypothetical example but I need to know I'm not going insane.

10:12 cark: ,(take-while #(<= % 3) [1 2 3 4])

10:12 clojurebot: (1 2 3)

10:12 cark: same thing

10:12 tomoj: that partial up there says `3 >=`, not `>= 3`

10:13 osaunders: <= != >= :-)

10:13 tomoj: it's in the opposite order

10:13 osaunders: Ah

10:13 OK, that explains.

10:13 tomoj: (partial >= 3) is like #(>= 3 %)

10:13 osaunders: Yeah.

10:14 cark: yep sorry that was introducing a difficulty

10:15 anyways the thing to remember is that the map operation is only there to map one thing to the other

10:15 it is not there for selection

10:15 tomoj: it's just like ruby's map

10:15 you can't throw things out

10:15 osaunders: Yeah OK.

10:15 Thing is I'm thinking "OK I want to map now and then I'll break here" only you can't do that.

10:16 cark: but while thinking like that you mix 2 concerns

10:16 tomoj: yup, filter or take-while first

10:16 osaunders: So map with a break becomes (map sth (take-while pred list))

10:16 tomoj: paredit helps with that :)

10:17 osaunders: cark: Yeah, I can see Clojure's way is better.

10:21 partial, take-while, conj etc. are called forms not functions right?

10:22 cark: mhh no

10:22 these are functions

10:22 osaunders: defn is a form?

10:22 cark: that is a form : (map sth (take-while pred list))

10:22 osaunders: Oh.

10:22 A macro isn't a function though?

10:22 cark: but you could say the "take-while form is neat"

10:23 a special kind of function

10:23 osaunders: I thought form was a collective term for macros or functions.

10:23 cark: form is the all-inclusive thing

10:23 it orks for special forms too

10:23 works

10:23 osaunders: form isn't the function plus its arguments?

10:24 ... as an example.

10:24 cark: or the macro plus arguments

10:24 or just the name

10:24 osaunders: Or just the name?

10:24 cark: everything is a form (to me)

10:24 osaunders: Gah.

10:24 Um. :-s

10:24 cark: some forms are atoms

10:24 some are lists

10:25 osaunders: 10 is a form to you?

10:25 "blah" is a form to you?

10:25 cark: i'd say that, i might be the only one tho

10:25 osaunders: lol

10:26 If the purpose of such a word is for communication it might be a problem if you're the only one.

10:26 cark: hehe well it's up to you to start the big survey

10:26 osaunders: Dammit >_<

10:27 cark: if "if" is a special form

10:27 that would mean that a form can be a single word

10:27 or is it the full (if condition true-form false-form) thing ?

10:27 tomoj: CLHS says "form" is "any object meant to be evaluated", "a symbol, compound form, or a self-evaluating object"

10:28 osaunders: It might be referring to if in a wider sense.

10:28 cark: ah thanks tomoj

10:28 tomoj: of course CLHS isn't binding here, but...

10:28 cark: does that include literals?

10:28 tomoj: yeah, those are "self evaluating objects"

10:28 cark: one might say that the reader is evaluating "blahblah"

10:29 tomoj: so, I think `(if condition true-form false-form)` is the "special" form, but "if" is still a form since it's a symbol

10:29 osaunders: I'm trying to work out what CLHS stands for.

10:29 cark: ok great i'm not the only one then =)

10:29 common lisp hyper-spec

10:29 an wonderfull document

10:30 tomoj: CLHS's forms don't include [1 2 3] or {:a 3}

10:30 I suppose ours do

10:30 osaunders: "foo" can't be evaluated

10:30 ,("foo")

10:30 clojurebot: java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn

10:30 cark: ,"foo"

10:30 tomoj: ,"foo"

10:30 clojurebot: "foo"

10:30 "foo"

10:30 tomoj: :)

10:31 cark: and even more :

10:31 ,("foo" 2)

10:31 clojurebot: java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn

10:31 cark: oh yes =/

10:31 pff

10:31 tomoj: I did think strings were associative?

10:31 cark: vectors are, but this cannot be done because clojure uses java strings

10:32 osaunders: ,('(1))

10:32 clojurebot: java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn

10:32 cark: i forgot that for a minute =)

10:32 tomoj: ,(let [{a 2, b 3} "foobar"] [a b])

10:32 clojurebot: [\o \b]

10:32 cark: ,([0 1 2 3] 2)

10:32 clojurebot: 2

10:32 tomoj: ah, that must seq it first?

10:33 cark: sequences are not associative either

10:33 because of O(n) random acess

10:33 tomoj: well.. does it convert it to a vector of characters first, then, I suppose?

10:34 cark: i guess there's some magic in the destructuring code

10:35 osaunders: Clojure strings are atoms.

10:35 Because they are Java objects.

10:35 I always thought.

10:35 They probably should be vectors of characters though imho.

10:35 tomoj: atoms can be forms too

10:36 osaunders: But is this really being evaluated:

10:36 ,"foo"

10:36 tomoj: in CL atoms are everything except conses

10:36 clojurebot: "foo"

10:36 tomoj: a bit more difficult to decide what an atom is in clojure, I think

10:36 osaunders: conses?

10:37 tomoj: a cons is basically a 2-tuple

10:37 a pair

10:37 (in CL)

10:37 osaunders: OK.

10:37 cark: does not exist in clojure

10:37 tomoj: everything in CL is either an atom or such a pair

10:37 but we also have vectors, maps, seqs, etc..

10:38 osaunders: Yeah I don't think you have pairs as a first-class type in Clojure. I haven't encountered it.

10:38 tomoj: I don't think the atomic/other distinction really makes as much sense in clojure

10:38 osaunders: Actually, I suppose (1 2) is a pair.

10:38 tomoj: not the same

10:39 osaunders: Why?

10:39 tomoj: (1 2) in CL is (1 . (2 . nil))

10:39 that is, 1 paired with (2 paired with nil)

10:39 osaunders: CL = Clojure?

10:39 tomoj: CL = common lisp

10:39 osaunders: Oh!

10:39 ffs

10:39 I have to re-read everything you said now.

10:39 cark: there is no pair in clojure, that would be very wastefull with the jvm

10:39 tomoj: haha, sorry

10:41 osaunders: Hm.

10:42 The distinction between a pair and a sequence of two for me was that a pair takes on a new meaning as a result. A sequence is a collection. A pair is a unification.

10:43 It's possible to unify more things than 2.

10:43 tomoj: "cons" means something very special in CL, I was just saying even though clojure has "pairs" like (1 2), they are not similar to canses

10:43 s/canses/conses/

10:43 cky: cark: There are ways to "simulate" pairs fairly effectively in the JVM. Have an ArrayList of cons cells (global, I know), then each reference to a cons cell can be represented as an int, the index to that global array. :-P

10:43 cark: cky : how about garbage collectionthen ?

10:44 cky: cark: Use weak references. :-P

10:44 cark: an integer is not a reference

10:44 osaunders: tomoj: I don't quite understand what's special about conses in CL?

10:44 tomoj: they're a special data structure

10:45 cky: cark: No, the ArrayList contains WeakReferences.

10:45 tomoj: a cons can only have 2 elements

10:45 osaunders: tomoj: I didn't understand that example you gave, I don't know CP.

10:45 cky: cark: Then, you have a reference queue that gets notified when items get collected.

10:45 tomoj: lists are built out of multiple conses chained together

10:45 cark: cky: right, but your arraylist will grow indefinitely

10:45 cky: cark: No, when your reference queue gets notified, then the associated slots can be reused.

10:45 tomoj: so (1 2 3) is (1 . (2 . (3 . nil)))

10:45 in clojure (1 2 3) is just (1 2 3)

10:46 osaunders: So it can have more than 2?

10:46 tomoj: no, the "." separates elements of the pair

10:46 osaunders: You just said it couldn't.

10:46 Ah, OK.

10:46 Binary tree.

10:46 cark: cky: but you would get notified when the content of the conses are freed, which might be before you don't need them (you still hold an index somewhere)

10:46 tomoj: osaunders: yup, but for lists it's just a linked list ending with nil

10:46 cky: cark: Hmm.

10:47 cark: I'll think on this some more. :-P

10:47 cark: hehe ok

10:47 tomoj: so in CL there's (1 2), the list, and (1 . 2) the pair, and they are very different

10:47 cky: cark: Well played, etc. :-)

10:47 tomoj: in clojure we juts have (1 2) the list

10:47 cark: =)

10:47 tomoj: ...but we still have a function named "cons" :D

10:48 cark: indeed there still are some kind of ons cells in clojure but these are not the same as CL cons

10:48 +c

10:49 osaunders: The motivation for pairs is performance?

10:49 tomoj: uhh

10:49 cark: nope, the motivation is these are universal

10:49 osaunders: Binary tree can be searched faster, can't they?

10:49 tomoj: I'm not sure really, it's just the fundamental building block of CL

10:50 cark: cons are a good building block, usefull in many ways

10:50 osaunders: Trees are universal.

10:50 Binary trees are a special type of tree.

10:50 cark: yes, but you may build tree from cons cells

10:50 tomoj: its just in most cases in CL, they're not binary trees, they're just linked lists

10:50 so I don't think binary search was a motivating factor

10:50 osaunders: Hm.

10:51 cark: you can build almost any data structure from cons cells

10:51 osaunders: What exactly is a cell?

10:51 cark: a cons cell is a pair =P

10:51 osaunders: OK. I've got to get this terminology straight.

10:51 So, thanks.

10:52 cark: it does not apply to clojure, so you may forget all about it

10:52 i mean while learning clojure

10:52 osaunders: Sure. I'm interested in language design though.

10:55 Why does (apply println [1 2]) print "1 2\n" not "1\n2\n"?

10:55 Oh wait, ignore that.

10:58 OK, confused again :-) What's going on here http://pastebin.com/m3ecc2e6a ?

10:58 tomoj: osaunders: use doseq

10:59 ,(doseq [n [1 2]] (println n))

10:59 clojurebot: 1 2

11:00 tomoj: map is not meant to be used for looping

11:01 osaunders: Up until now I didn't know how else to do it.

11:01 Thanks for the doseq.

11:01 cark: remember that map is only to transform the items of a list

11:01 osaunders: I will.

11:02 tomoj: actually, I like this even better: (println (str-join "\n" [1 2]))

11:02 need clojure.contrib.str-utils/str-join

11:02 it's a strange thing to loop over a sequence and print each element, to me

11:03 cark: b

11:03 osaunders: Why's that?

11:03 tomoj: I'd rather just functionally transform the sequence into something like the output I want, then print it

11:03 minimize the occurrence of side-effects

11:03 as much of your code as possible should be purely functional

11:03 osaunders: I see.

11:06 tomoj: e.g. say you're writing some code that formats and prints a big structured report

11:06 if you do the printing deep in the inner loops, to test you have to bother with capturing output and stuff like that

11:06 if instead you have a bunch of little functions which do no printing, just build up a string to be printed at the end, you can test each individual function quite easily

11:07 osaunders: How would you build up the string without side-effects though?

11:07 tomoj: well.. it's certainly possible

11:07 cark: for this kind of stuff i build a very large structure with lists containing lists, and as the very last step convert the whole thing to a big string

11:08 osaunders: Is CL purely functional?

11:08 tomoj: building up strings is probably inefficient

11:08 cark: CL is not purely functional

11:08 tomoj: heck no, CL doesn't even place any particular emphasis on functional

11:08 cark: clojure is not either

11:08 tomoj: that's why we're here and not in #lisp :)

11:08 osaunders: OK.

11:28 eevar_: tomoj: or because of the java ecosystem

11:28 osaunders: I'm not here for that.

11:28 * eevar_ balks at asdf

11:29 osaunders: asdf?

11:30 eevar_: CL's package system. which you need to do _anything_ of interest

11:30 even opening a file :p

11:31 *naming

11:32 * osaunders is reading more about Lisp and CL.

11:35 eevar_: by package system i mean library management, btw. my english/writing blows ;)

11:35 osaunders: Are you German by any chance?

11:37 eevar_: neh, norwegian

11:37 osaunders: OK.

11:37 Not that it matters.

11:45 Apparently the type of expression I mentioned before, (whitespace sensitive) has a name: I-expressions.

11:45 Quote WP: "A more recent variant is I-expressions, which use indentation to indicate parentheses implicitly, and are thus in some ways intermediate between S-expressions and M-expressions."

11:46 tomoj: nice, I didn't know there was a reader syntax for ratios :)

11:46 osaunders: tomoj: Are you using Clojure for real work?

11:47 tomoj: does "real work" mean "getting paid"? then no

11:48 I have decided to do my pet project in clojure instead of ruby, though

11:49 osaunders: Fair enough.

11:49 What is your pet project, if you don't mind my asking?

11:49 tomoj: a web app for college course planning

11:49 specifically for UT-Austin at this point since parsing course schedules is such a pain

11:49 osaunders: Neat. Good luck then.

11:50 tomoj: thanks :)

12:00 LauJensen: Top of the evening gents

12:09 tomoj: there is no reader syntax for a MapEntry, huh?

12:10 is it efficient to use a literal hashmap with one keyval pair instead?

12:10 as in:

12:11 ,(conj {:a 3} {:b 7})

12:11 except, what if I'm doing that a whole lot? seems scary to create a new hashmap there in the last argument every single time, but does clojure save this from inefficiency?

12:19 well, that's a silly example :)

13:16 Chousuke: tomoj: (assoc map key val)? :/

13:22 tomoj: yeah :)

13:23 I can't remember why I wanted literal mapentries

13:32 stuarthalloway: I am sitting in a room with Steve Gilardi! Should we have a contributors meeting? :-)

13:56 rlb: Is there anything like -> that will work in cases where the pass-through should be something other than the first arg?

13:56 drewr: rlb: not built-in, I don't think

13:56 rlb: i.e. you want to do something like (foo x (foo y (bar z w)))

13:56 I was specifically thinking of something like this:

13:57 (-> foo

13:57 (re-gsub x %)

13:57 (re-gsub y %)

13:57 (re-gsub z %)

13:57 (re-gsub w %))

13:58 for a sequence of transformations.

13:58 stuarthalloway: rlb: don't think it exists, but it would be cool if someone wrote a macro like ->, but with a placeholder showing where the argument gets threaded into the next form

13:58 rlb: right

13:58 drewr: (-> foo #(re-gsub #"." x %) ...)

13:59 rlb: Though I suppose you might want to use something other than %

13:59 perhaps _ or similar

14:00 Anyway, thanks.

14:03 Chousuke: stuarthalloway: isn't there one in contrib?

14:03 let-> or something

14:03 rlb: Chousuke: Oh, ok, I'll look.

14:04 stuarthalloway: me too. I have been wrong before. :-)

14:07 Chousuke: hmm, I can't find it. But I did see something like that mentioned on the group once

14:08 stuarthalloway: grr, let-> isn't google-searchable

14:08 tomoj: just found -?> and .?., nifty

14:08 Anniepoo: ok, stupid noob question of the morning - I'm not getting the practical application of ->

14:09 stuarthalloway: Anniepoo: changes order of reading from inside-out to left->right

14:09 Anniepoo: example?

14:09 stuarthalloway: (. (. (. this) is) pain)

14:09 cark: Anniepoo: (-> "a.txt" FileReader. BufferedReader.)

14:09 rlb: Anniepoo: also helps avoid going of the right side of the page..

14:09 stuarthalloway: (-> this is easy)

14:10 tomoj: ,(-> {} (assoc :a 3) (assoc :b 1))

14:10 Chousuke: ,(-> "foobar" .toUpperCase (.substring 3))

14:10 stuarthalloway: where's the bot?

14:10 Chousuke: hm. slow :P

14:10 ah, it's gone :(

14:10 cark: ,(let [t {:a {:b {:c 1}}}] (-> t :a :b :c))

14:10 hum

14:11 clojurebot is on vacation

14:11 tomoj: mine and cark's examples are sortof silly I suppose

14:12 rlb: (-> a-file sort reverse take-10)

14:13 Anniepoo: so, what's that expand to?

14:13 tomoj: take-10?

14:13 rlb: Assuming I didn't do it wrong (take-10 (reverse (sort a-file)))

14:13 tomoj: just a fake example

14:13 Anniepoo: ah, thanks

14:13 rlb: tomoj: i.e. "head -n 10"

14:13 Anniepoo: now I get it

14:13 tomoj: ah

14:14 Anniepoo: ok it's left to right

14:14 tomoj: does -> have a pronounceable name?

14:15 cark: thread ?

14:15 as in thread through

14:15 tomoj: not very googleable either

14:15 :(

14:16 Anniepoo: ok, thanks, leads to second noob question of morning

14:17 user=> (macroexpand (-> [1 2 3] sort reverse)) => (3 2 1)

14:17 which looks like it evaluated it

14:17 cark: you need to put a '

14:17 (macroexpand '(-> [1 2 3] sort reverse))

14:17 Anniepoo: ah

14:17 thanks

14:17 cark: because there you're macroexpanding the result

14:18 tomoj: unfortunately that doesn't help all that much

14:18 because macroexpand isn't recursize

14:18 cark: i mean in your attempt, the thing you're macroexpanding is the result of evualting (-> [1 2 3] sort reverse))

14:18 Anniepoo: yes, I see what my mistake was

14:19 the implementation of -> is to take the last item and go (last-thing (-> rest-of-it))

14:20 tomoj: not really

14:20 (use 'clojure.contrib.repl-utils)

14:20 (source ->)

14:21 Chousuke: Anniepoo: it puts the first parameter as the second item in the next parameter, then repeats

14:21 tomoj: it just looks like that because of the way macroexpand works

14:21 Chousuke: Anniepoo: as a special case, a plain symbol is treated as a single-item list

14:22 Anniepoo: Yah, Chousuke, that's the thing that I couldn't understand that prompted all this

14:22 Chousuke: most functions take their primary argument as their first one, so it's pretty convenient.

14:23 Anniepoo: maybe have a markered version

14:24 (-> arg1 arg2 :funcs fun1 fun2 fun3)

14:24 Chousuke: if you do (-> "foobar" .toUpperCase (.substring 3)) it becomes (-> (.toUpperCase "foobar") (.substring 3)) which becomes (.substring (.toUpperCase "foobar") 3)

14:24 tomoj: is there already something to get full macro expansion?

14:25 Chousuke: mexpand-all in contrib I think

14:25 tomoj: ah yes, thanks

14:25 Anniepoo: hope clojurebot isn't sick, or got in an accident, or something

14:26 kidnapped by imperative programmers who are making him do J2EE

14:46 rlb: So is (reverse (take 3 (reverse x))) the clojure equivalent of something like (tail 3 x)?

14:48 Chouser: rlb: http://www.assembla.com/spaces/clojure/tickets/151 would allow (last 3 x), if that's what you mean.

14:48 Anniepoo: nuuurg.....

14:49 Chouser: 'reverse' is hardly ever idiomatic clojure

14:49 rlb: I just wanted the last N items of the sequence.

14:49 Anniepoo: start emacs with 'emacs' - try to exit with C-x C-c, it beeps and does nothing

14:49 tomoj: (drop (- (count coll) n) coll)

14:49 Chouser: rlb: yeah, that's what the new 'last' would allow. Until then...

14:50 use tomoj's solution. :-)

14:50 rlb: tomoj: right

14:50 Chouser: if it's a vector, you might prefer to use subvec

14:51 tomoj: Anniepoo: that's odd..

14:52 Anniepoo: I'm able to do read and write file

14:52 (amazing how these things hang on, I recognize these commands from PMATE, which I used in 1984)

14:52 rlb: I need to get clojure's operation costs more clearly fixed in my head...

14:53 tomoj: Anniepoo: maybe try C-h k C-x C-c

14:53 Anniepoo: installed emacs module to existing cygwin

14:53 rlb: Anniepoo: or M-x kill-emacs

14:53 tomoj: oh.. cygwin.. :(

14:53 rlb: Anniepoo: you're probably having keyboard mapping issues.

14:54 i.e. if you're on a console (rather than in X).

14:54 Anniepoo: yah, I'm on a console

14:54 tomoj: C-x C-c works in every console I've used, but maybe cygwin is weird

14:54 rlb: tomoj: I think it can be

14:54 tomoj: only problems I've had in console is like C-RET and S-up

14:55 (since C-RET == RET)

14:56 rlb: Anniepoo: you might want to try X (and xterm, emacs in X, etc.). I think there's a command that'll fire up a rootless server if you have the right pkgs installed.

14:56 Anniepoo: yah, typing x gives me a totally blank x desktop

14:56 rlb: By default, I still think in scheme/lisp structures...

14:56 Anniepoo: I don't think that's what you want.

15:04 mebaran151: Anniepoo, how recent is your laptop

15:04 much easier than cygwin is to just use virtualization package

15:04 like VirtualBox from Sun

15:05 Anniepoo: XP tablet

15:06 rlb: Chouser: fwiw, it was a string -- just wanted the last 4 chars.

15:07 Anniepoo: thanks all, there's a direct windows port as well

15:07 I'll try that

15:07 and thanks rlb for helpign with the wierdness with exiting

15:11 Chouser: rlb: while you certainly can use the seq library on strings, it often works best to use Java methods or the contrib str-utils lib.

15:12 rlb: Chouser: ok, thanks. In the end, I may actually just want a regex for this particular bit.

15:13 Chouser: ,(re-find #".{3}$" "hello there")

15:14 rlb: Chouser: I obviously need to learn java regexes better. I've just been sticking to the really cross-regex-platform bits.

15:15 Chouser: Java mostly follows perl, though without some of the trickier bits.

15:15 Anniepoo: Java libs wrap many things just to be wrapping

15:16 you make a Pattern from the string

15:16 which is just an object that represents the regex pattern

15:16 Chouser: well, it supposedly does some "compilation" too. Not sure how much that buys you.

15:17 Anniepoo: then you get a Matcher, which is an object that seq's sequential matches of a pattern against a string

15:18 Chouser: and is a scary, mutable thing I'd recommend not touching if at all possible.

15:18 Anniepoo: I got bit by a Matcher once and had to go to the emergency room for shots

15:18 Chouser: I don't doubt it.

15:19 Chousuke: Matcher seems like it's unnecessarily mutable :/

15:19 Chouser: fortunately we have re-seq

15:19 Anniepoo: and totally fail to understand why regex libraries don't just implement the

15:19 Chousuke: I mean, is creating a new matcher really that expensive? :)

15:19 Anniepoo: emacs/qed/whatever

15:20 gs/regex/replacement/

15:20 command

15:20 rlb: Chousuke: it may be building DFA, so it could be non-trivial.

15:20 (I imagine it is building something like that...)

15:20 Chousuke: rlb: shouldn't that happen when the pattern is compiled, not when it's matched against a string?

15:20 rlb: s/building DFA/building a DFA/

15:20 Chousuke: oh, I misunderstood.

15:20 Anniepoo: the speedup is important if you're using one to find something in the middle of a huge string

15:21 rlb: Chousuke: right -- I would think it was built when the regular expression was created, i.e. at #"foo" time.

15:21 Chousuke: I read yesterday that you don't actually have to quote parens in emacs regexps, because they're matched against so often.

15:21 Anniepoo: yes, matchers are resettable - they aren't truly seq's

15:22 rlb: Chousuke: right

15:22 Chousuke: if you want matching groups, THEN you quote the parens.

15:22 Chouser: Anniepoo: contrib str-utils2 has global search/replace. quite handy.

15:22 Chousuke: which is amusing.

15:22 rlb: Chousuke: emacs inverts that.

15:22 Chouser: which is old-school. like sed

15:23 instead you have to escape groups. and you have to escape the escaping, I beieve, so you end up with "\\\(this\|that\\\)"

15:23 oops

15:23 instead you have to escape groups. and you have to escape the escaping, I beieve, so you end up with "\\\(this\\|that\\\)"

15:23 or something. anyway, it's painful whatever it is.

15:24 rlb: Chouser: exactly how it depends on whether you're typing in source code, or issuing an interactive expression, i.e. M-x search-regexp, etc.

15:24 Chouser: ah, ok.

15:27 rlb: (...surprised I'm messing with rss, and also surprised how easy clojure's making it...)

15:31 Anniepoo: fwiw, if you're on winders, the direct winders version is far saner than X or console cygwin versions

15:32 it's even got a toolbar! 8cD

15:36 tomoj: I always turn that off anyway :)

15:39 Anniepoo: yah, we all do, but it's nice they're not doing the passive-aggressive unix "cross platform == the unix way" thing

15:39 (they did ship the windows release with unix line endings)

15:41 rlb: So does anyone happen to know if java has a built in table mapping common mime types to file-extensions, i.e. audio/mpeg -> .mp3?

15:42 Anniepoo: you mean in the core libs? there's probably one in the JAI or Java media libs, but getting to it sounds like a trail of tears

15:43 rlb: I just didn't know if there was something obvious. In any case, for now I'm fine with just hard-coding a small lookup table.

15:43 (and using the last 4 url chars if they match #"\..{3}" (thanks Chouser)

15:43 )

15:44 Anniepoo: you could slurp the RFC off the net and use regex's to extract the information

15:44 then if they change the RFC you'd still be right 8cD

15:45 rlb: Now I just need a (dump-url-to filename)...

15:46 tomoj: duck-streams?

15:47 rlb: tomoj: not familiar -- I'll have to look.

15:47 osaunders: (defn factors [n]

15:47 (filter #(zero? (rem n %)) (range n 1 -1)))

15:48 Does that look OK?

15:48 More specifically, is it all lazy?

15:49 Anniepoo: yes, but you can apply an increment to range

15:49 osaunders: I am, -1.

15:49 Anniepoo: rlb, you might find fetch-url on this page useful

15:49 http://gnuvince.wordpress.com/2008/10/31/fetching-web-comics-with-clojure-part-1/

15:50 rlb: Anniepoo: right, thanks, I was looking at that.

15:50 Anniepoo: that should move to clojure.contrib somewhere - this is the third time somebody's asked for it in my memory

15:50 tomoj: doesn't duckstreams fetch urls?

15:51 Anniepoo: really hate that everything left google code

15:52 tomoj: (with-open [file (reader "http://www.google.com/&quot;)] (slurp file))

15:52 rlb: tomoj: it looksl like it.

15:52 tomoj: and it has copy -- it looks like it might be exactly what I wanted.

15:52 tomoj: oh.. slurp is wrong there

15:53 rlb: (with-open [in ... out ...] (copy in out)) etc.

15:53 tomoj: cool

15:53 Anniepoo: (slurp "http://www.foo.com") definitely won't work

15:53 rlb: Anniepoo: you have to have the (reader ...) bit.

15:53 Anniepoo: sure

15:54 but it seems unclojurelike

15:54 why shouldn't it just be smart and do the right thing?

15:55 arguably, there's no point in file IO any more, since files are URL's

15:55 rlb: This is really too easy...

15:55 Anniepoo: LOL

15:55 rlb: (not that I'm complaining, mind you)

15:56 tomoj: oh you can just slurp* the url

15:56 well, if you want to read it instead of copying it I mean

15:56 rlb: OK, so now I just need some way to insert a progress meter into the stream ;>

15:56 Anniepoo: lovely, that's exactly what's wanted

15:56 rlb: Though I suppose I can just monitor the file size.

15:57 Just set up an agent/thread/whatever.

15:57 And for the first pass, we'll just pretend like people don't actually care about knowing what's going on.

15:59 Anyway, fwiw, what I'm working on is a clojure version of something like hpodder or podget, but one that may be simpler, but is at least more flexible about retention policies, i.e. keep the last N copies of this, but all of this, etc. For example, you might use it to maintain some podcast/news-stream/whatever dirs for mpd from cron.

16:00 (at least that's what *I* may use it for)

16:00 tomoj: rlb: what's the interface like?

16:00 rlb: tomoj: command-line only ATM.

16:00 tomoj: great

16:00 rlb: tomoj: and intentionally simple

16:00 tomoj: I love things that are command-line only

16:00 Anniepoo: haptic feedback only

16:01 tomoj: hmm.. I wonder if there is java stuff for ncurses

16:01 rlb: i.e. perhaps "foo rss-update --keep 10 http://...."

16:01 i.e. perhaps "foo rss-update --keep 10 --dest some-dir http://...."

16:01 not sure yet

16:02 Just got a decent start in under 100 lines of code, though...

16:02 Anniepoo: When I get there I want to wrap ImageMagick (a command line image processor, also available as libs) with a clojure binding

16:03 rlb: Anniepoo: I just heard a long claim that graphicsmagick is much "better" for some definition of better FWIW (no idea myself).

16:03 Anniepoo: lol

16:04 tomoj: the only thing I know is that rmagick sucks

16:04 Anniepoo: it's a classic old feud between two halves of what was once one OS dev team

16:05 rlb: Yeah, I think the intro quote I saw was this: "ImageMagick uses convoluted and arcane code paths in an apparent attempt to defeat human comprehension""ImageMagick uses convoluted and arcane code paths in an apparent attempt to defeat human comprehension".

16:06 Anniepoo: http://www.linux.com/archive/articles/59223

16:06 rlb: I think it's in some graphicsmagic performance comparison (again, no idea myself).

16:06 Anniepoo: yah, per this GM concentrates on library support, IM concentrates on cmd line usage

16:11 The IM syntax is painful, and I'm going to be a heavy user of it over the next 6-12 months, so

16:11 a wrapper would be a convenience

16:12 osaunders: It seems like loop is just fn and let combined but it's a special form.

16:12 Why is it a special form? There must be something significant about it.

16:15 kotarak: osaunders: because it creates a recursion point for recur

16:16 osaunders: fn does that too.

16:16 kotarak: but fn does create a class, loop does not

16:16 osaunders: fn creates a class? A java class?

16:16 kotarak: yes

16:16 osaunders: Why?

16:17 kotarak: each fn generates a class, which is instantiated on runtime.

16:17 rlb: OK, that didn't work at all -- resulting .mp3 is not right (much longer than it should be).

16:17 osaunders: kotarak: Why is that something you would want to use loop in order to avoid?

16:19 Does loop exist in other Lisps?

16:19 kotarak: osaunders: because you then have to instantiate the class, invoke some method on it, etc. while loop just works in the same call stack.

16:19 tomoj: osaunders: not in the same form

16:19 kotarak: osaunders: yes, but in different form

16:20 osaunders: Doesn't recur avoid use of call stack anyway?

16:20 tomoj: stuff like: (loop for i from 1 to 5 collecting i) => (1 2 3 4 5)

16:21 kotarak: osaunders: but the initial entry would require it. And the calling would be awkward: ((fn [a b c] .... (recur x y z)) :initial-a :initial-b :initial-c)

16:21 tomoj: kotarak: how often do you have to instantiate the class?

16:21 kotarak: tomoj: when you create a function.

16:21 osaunders: kotarak: Hardly warrants a special form.

16:21 tomoj: ah, ok

16:22 kotarak: osaunders: you don't have to use it.

16:22 rlb: So any idea why "wget URL" would get the right content, but duck-stream (copy (reader URL) (writer "filename")) would get something much longer, that's not a proper mp3?

16:22 tomoj: osaunders: so how would you do (loop [a (range 10) b (range 10)] [a b]) ?

16:22 rlb: Is there some "binary mode" business perhaps?

16:22 kotarak: ((fn [a b] [a b]) (range 10) (range 10))

16:22 Not very nice.

16:23 tomoj: that's not the same thing

16:23 oh, yes it is

16:23 I was thinking of "for"

16:25 osaunders: loop could be implemented as a macro.

16:25 From what I've been told so far.

16:25 Chousuke: maybe loop is a special form because it supports primitives :/

16:25 kotarak: osaunders: obviously not, since you don't get the recursion point for recur

16:26 osaunders: You can recur on a fn.

16:26 Can't you?

16:26 Chousuke: fn arguments are always boxed though.

16:27 and you'd have to create a class for every loop

16:27 kotarak: osaunders: I would prefer not to hide things, which generate classes

16:28 osaunders: Is this right? (fn [y] (let [x y] (recur)) == (loop [x y] (recur))

16:28 kotarak: no

16:28 (loop [x] (let [x y] (recur))

16:29 oops

16:29 first x should b y

16:29 be

16:29 osaunders: That could be simplified to (loop [x y] (recur))

16:30 Loop does binding.

16:30 kotarak: osaunders: then it doesn't correspond to the fn you gave

16:30 osaunders: clojure.org/special_forms says: "loop is exactly like let, except that it establishes a recursion point at the top of the loop"

16:30 kotarak: (fn [y] (recur))

16:31 osaunders: Wait a second.

16:32 ((fn [x] (recur)) y)

16:32 Yeah I think that's what I want.

16:32 So I'm saying now: ((fn [x] (recur)) y) == (loop [x y] (recur))

16:33 kotarak: Effectively, yes but not really.

16:33 osaunders: Apart from the class thing/

16:33 *?

16:33 kotarak: As Chousuke said above: fn does not work with primitives

16:33 (it does work, but boxing happens => slow)

16:34 osaunders: Could you explain that.

16:34 What's a primitive and boxing?

16:34 tomoj: also the fn version is ugly :)

16:34 uh, but macro, yeah

16:34 Chousuke: java has two kinds of variables. primitives, and references

16:34 kotarak: Java has primitives and corresponding clases. A primitive is a value, but not an object.

16:34 5

16:34 Chousuke: int, char, long etc. are primitives.

16:34 kotarak: boxing means wrapping this values into class objects.

16:35 Since all invokation interfaces are based on objects you can't pass in primitives.

16:35 They have to be boxed.

16:36 osaunders: So loop exists for performance reasons only,

16:36 Chousuke: that, and to avoid generating useless classes

16:36 kotarak: exactly

16:36 osaunders: Kinda wanky.

16:36 Sorry, I'm not used to JVM languages.

16:37 Why does fn need to generate a class rather than just an instance of a class?

16:37 kotarak: osaunders: theoretical elegance is sacrificed if necessary in Clojure. It has a very practical point of view.

16:38 osaunders: kotarak: But it's not necessary.

16:38 Chousuke: osaunders: how would you have different code for each instance of the class?

16:38 the java system is not designed for that.

16:38 osaunders: Well code is data :-P

16:38 kotarak: plus the closed over values

16:39 Chousuke: osaunders: in clojure, yeah, but eventually it needs to be compiled to jvm bytecode.

16:39 osaunders: Lame

16:39 Chousuke: you're being unnecessarily negative about it :P

16:39 osaunders: Well, that's subjective.

16:40 Thanks for all the info though.

16:40 Chousuke: and you can actually have multiple instances of the same function (== class)

16:40 for example, if you have a function that returns a lambda, then there will only be one class for the lambda, but new instances for each call of the factory function.

16:40 osaunders: You can have multiple copies of an object too.

16:41 But we're arguing now.

16:41 Chousuke: and those instances will have different instance attributes.

16:41 they won't be copies of each other.

16:41 tomoj: why do you care whether it's a special form or macro anyway?

16:41 Chousuke: fn actually is a macro :D

16:41 (the special form is fn*)

16:42 and even that might go away

16:42 tomoj: I meant loop

16:42 Chousuke: since apparently it should be possible to implement fn* with newnew

16:43 osaunders: It's hard for me to explain why I care.

16:43 But this kind of low level elegance or absence of is important in language design.

16:43 kotarak: osaunders: try, we are patient. :)

16:44 Chousuke: osaunders: true, but clojure is already very elegant.

16:44 osaunders: I think it's probably best articulated in Paul Graham's Hundred Year Language essay.

16:44 Chousuke: osaunders: loop is just a practical choice to solve a problem.

16:45 if a better solution comes up, loop may well become a macro in the future.

16:45 but for now, it's a special form

16:45 kotarak: As I said: Clojure has a very practical point of view.

16:45 osaunders: Chousuke: loop was created to workaround a problem that in other situations wouldn't exist at all.

16:45 Chousuke: osaunders: what other situations?

16:46 osaunders: If Clojure wasn't implemented on top of the JVM.

16:46 tomoj: that would be terrible

16:46 kotarak: Chousuke: no autoboxing and TCO support

16:46 osaunders: tomoj: Why?

16:46 Chousuke: osaunders: but if Clojure weren't implemented on top of the JVM it would be pointless :)

16:46 tomoj: JVM is part of the whole point imo

16:46 Chousuke: osaunders: see arc :P

16:46 tomoj: access to java libraries is _awesome_

16:46 bad libraries are a big problem for a custom lisp

16:47 osaunders: Chousuke: I haven't looked at Arc.

16:47 I think you guys may well be right.

16:48 Chousuke: in the end, programming languages are nothing but tools

16:48 osaunders: The cost of needing things like loop is greatly dwarfed by the benefits of being on the JVM.

16:48 tomoj: I think clojure would be nowhere close to where it is today without java

16:48 Chousuke: using the JVM as a basis was a practical decision that ensured Clojure has value as a tool.

16:48 osaunders: Chousuke: No, programming languages are more than tools. They are a means of expression.

16:48 Chousuke: osaunders: but before that, they are tools.

16:48 the elegance in the implementation comes AFTER that.

16:49 osaunders: Well it depends how you look at it.

16:49 If you want something that does a job, then it's a tool.

16:49 Chousuke: I see Clojure as a rather succesfull attempt to bring elegance to the JVM.

16:50 sure there are warts. but no language is without them

16:50 osaunders: If you want something that provides a nice way of thinking and expressing problems/computation then it's a language.

16:50 kotarak: That does not depend on the ugliness under the hood...

16:50 osaunders: Yes, and so far Clojure has far fewer warts than any language I've encountered.

16:50 kotarak: I don't agree.

16:51 tomoj: a programming language that is a great means of expression but a useless tool will have few users

16:51 Chousuke: And hopefully Clojure will become popular and drive the JVM to improve as well!

16:51 osaunders: tomoj: Sure.

16:51 I'm being impractical, granted. Maybe I'm an idealist.

16:52 tomoj: like, how many people without PhD's ever _use_ the lambda calculus?

16:52 Anniepoo: I'm totally disinterested in learning a toy language. I need to get real work done.

16:53 I started looking at Clojure and was blown away that the first tutorial I found

16:53 osaunders: If you want to get stuff done why bother learning Clojure at all. Java will do all this stuff anyway.

16:53 Chousuke: Clojure is interesting in that it's almost as attractive as the neatest of the toy languages, while maintaining a lot of the practicality.

16:53 of non-toy languages, that is.

16:53 osaunders: Chousuke: Right. Clojure is a great balance.

16:53 kotarak: osaunders: turing tar pit alert....

16:53 Anniepoo: osaunders, you are wrong

16:54 fact - I got interested in Clojure

16:54 osaunders: It is despite your arguments very elegant.

16:54 (Clojure)

16:54 Chousuke: osaunders: java will do it, but you're going to rip your hair out making java do it :P

16:54 Anniepoo: I needed to write a Swing GUI

16:54 short time frame

16:54 tomoj: why use Java? assembly will do it.

16:55 Anniepoo: feeling it'd be professionally irresponsible to do it in 'my new toy', I started writing in Java

16:55 I get into it a ways, see I'll never make it

16:55 kotarak: Why assembly? We can wrote down 0s and 1s directly! (turing tar pit alert...)

16:55 Anniepoo: In desperation, I switch to Clojure

16:56 I'm late 1 week finishing, abotu the same amount I spent on the failed Java attempt

16:56 osaunders: All I'm saying is that language elegance is important. For the same reason why Clojure is a better language than Java. There's a balance. For all of you Clojure is it. Clojure is elegant enough and practical enough. Chousuke said it. All I'm trying to highlight is there are these places where Clojure's elegance is held back by the practicalities you celebrate. I don't mean to suggest that makes Clojure a bad language.

16:56 Chousuke: osaunders: I think we all agree on that.

16:57 osaunders: Chousuke: Yeah I think we do :-)

16:57 Chousuke: If you can think of *practical* ways to make Clojure more elegant, I'm sure everyone will want to hear it!

16:57 Anniepoo: I describe Clojure to other (mostly java) programmers I know as "the lisp guys finally grew up"

16:58 osaunders: Chousuke: I'm always on the look out. So far, so good though.

17:00 Unfortunately in order for me to find these places where the practicality over elegance compromise has been made I have to dig a bit before I can definitely say that elegance has been compromised. Before I started asking about loop I was expecting there to be a reason of elegance behind it's existence. That digging combined with the identification of that compromise seems to piss people off a bit. Which is a shame. I don't mean to do that.

17:00 JAS415: lisp guys never grow up

17:01 osaunders: JAS415: Mostly I find people don't grow up. I include myself.

17:01 JAS415: true

17:04 Anniepoo: I grew up once. Fortunately, I got over it

17:05 osaunders: Anniepoo: lolz

17:05 Heard of Peter Pans?

17:07 Anniepoo: well, I was a typical programmer

17:07 osaunders: http://www.cbc.ca/canada/story/2008/05/21/f-vp-handler.html

17:07 Anniepoo: about 2000 I burnt out badly

17:07 drove a cab for two years

17:07 now I do interesting programming

17:08 osaunders: Good for you.

17:08 Anniepoo: if it's not interesting I still have an A card

17:08 osaunders: I'm fairly dissatisfied with the software development industry myself.

17:08 Although more with myself.

17:08 Anniepoo: cool

17:10 I work in Second Life, writing Clojure to support learning in Virtual Worlds

17:10 I make less than a bus driver

17:10 8cD

17:11 osaunders: What a strange world we live in.

17:11 Anniepoo: I don't care that I don't make a lot - I spend most of my waking hours in a virtual world anyway

17:11 tomoj: you can write clojure in SL?

17:11 rlb: A key point for loop is exactly that (TCO) -- otherwise you can't recurse without exploding the stack.

17:11 osaunders: I don't really know much about Second Life.

17:11 rlb: (in java)

17:12 Anniepoo: no, you have to write the in world stuff in LSL, but it's like javascript and the web

17:12 rlb: s/without exploding/without risking exploding/

17:12 Anniepoo: you get out of that world as fast as you can

17:12 rlb: And scheme has a similar syntax (let loop bindings form+)

17:12 tomoj: I know someone else who works in SL

17:13 Anniepoo: yah? Not too many of us

17:13 tomoj: I think for a dept at my university

17:13 rlb: Though scheme *really* doesn't need it since it guarantees TCO.

17:13 Anniepoo: ah, cool

17:13 I work for U of Houston

17:13 technomancy: Is there a reason map and filter and friends need a clojure.lang.IFn while alter just needs a Callable?

17:14 Anniepoo: If I give you a key to the UH-HHP builder bot you could use Clojure to manipulate SL

17:15 I'm finishing up the bridge now

17:15 tomoj: so you do it by writing bots in clojure?

17:16 Anniepoo: I have a command line driven bot I wrote in C#

17:16 kotarak: technomancy: alter takes a IFn in my version...

17:16 Anniepoo: and an in-world prim making robot that acts as an HTTP server

17:17 and clojure code that has my business logic

17:17 and a clojure GUI desktop app, so I can draw out what I want to make without doing it one prim at a time

17:17 cause I make a lot of repetitive stuff

17:17 tomoj: nice

17:18 Anniepoo: the C# bot uploads resources like textures

17:18 for example, I make these stepped 'concept plates'

17:18 technomancy: kotarak: you're right. oddly enough you can use JRuby procs with alter though.

17:18 but not with map

17:19 Anniepoo: reports back the SL internal UUID

17:19 and then the clojure code uses that to order the bot to make something and texture it

17:22 rlb: So any thoughts about why "wget URL" would get something different from (copy (reader URL) (writer FILENAME))?

17:23 tomoj: rlb: encoding problems? dunno

17:24 rlb: Yeah, it's looking like it.

17:26 Anniepoo: anybody know, if I start a command in the minibuffer in emacs and want to abort, how I do it?

17:26 dnolen: C-g C-g, ESC ESC

17:26 but you have to be in the minibuffer I believe

17:26 Anniepoo: thanks

17:27 no, I mean I start to type C-c C-f som ... oops, didn't want to do that

17:27 rlb: C-g should nearly always "get you out" of whatever's going on in emacs.

17:28 Anniepoo: thanks

17:30 emacs is still the horror I left behind back when phones had cords

17:30 tomoj: just takes a bit of getting used to :)

17:31 Anniepoo: moving a block of code with the mark commands is NOT as convenient as drag and drop

17:31 rlb: Anniepoo: it is if you don't want to reach for the mouse ;>

17:32 Anniepoo: also newer emacs may support what you want.

17:32 Not sure.

17:33 Anniepoo: no drag and drop, but there's cut copy paste on the winders version

17:33 rlb: Also I find C-space C-s M-w pretty good much of the time.

17:33 Anniepoo: I'm just totally in suspicious of the dog that bit me mode

17:33 rlb: i.e. mark, incremental search to other end, then copy (or cut).

17:34 C-r if you need to go backwards

17:34 Anniepoo: C-space?

17:34 * technomancy remembers when he used to use the mouse to edit text

17:34 technomancy: back when I thought PHP was awesome. =)

17:34 rlb: Anniepoo: sets the mark

17:34 * Anniepoo remembers when she used to edit text in emacs cause that's all there was

17:34 rlb: i.e. start the block

17:35 same as C-@ I think

17:35 (but much easier to type)

17:35 * Anniepoo and a mouse was a strange thing, like a 6 axis joystick is today

17:36 rlb: Also some of the new bits in emacs 23 are quite interesting (IMO). "emacs --daemon", for example.

17:39 technomancy: I wonder why alter would accept a JRuby proc as an IFn but map would not.

17:39 strange

17:39 Anniepoo: is there something like IntelliJ's ctrl-] ? (which extends the selection to the next node up in the parse tree of the current language)

17:39 technomancy: ah... aliasing call to invoke in Proc fixes it

17:40 oops, never mind

17:40 rlb: Anniepoo: I think clojure-mode probably allows the normal emacs code traversal commands.

17:41 Anniepoo: I don't know if you can use something like ebrowse with clojure.

17:41 Anniepoo: happy happy joy juy

17:42 g/juy/s//joy/p

17:42 (see, still remembers QED, with horror)

17:43 rlb: Anniepoo: see "editing programs" in the emacs info pages.

17:44 Anniepoo: thanks

17:44 I'm going to spend today reading all the emacs docs and I'm making flash cards

17:44 8cD

17:45 maybe I'll make a moodle course for editing Clojure in emacs when I'm done

17:46 rlb: Anniepoo: there's also slime, which people seem to like, though I haven't really looked in to it yet. I still do things the hard way most of the time.

17:47 Anniepoo: ok, so when I get through with basic emacs learning, my choices are slime or soemthing called 'clojure mode'?

17:49 tomoj: slime is good _with_ clojure mode

17:51 you can compile clojure source files and then play with the results in the slime repl

17:51 Anniepoo: http://technomancy.us/126 is a good start

17:51 rlb: Anniepoo: clojure-mode.clj is what makes it so that when you open a file ending in .clj, the major mode switches to clojure-mode, and then emacs knows specifically about clojure syntax, etc.

17:53 bitbckt: Anniepoo: also from technomancy is http://github.com/technomancy/emacs-starter-kit

17:54 Anniepoo: install that and M-x clojure-install will get you up and running with SLIME + clojure

17:54 tomoj: except I think you have to install slime beforehand separately, right?

17:54 bitbckt: tomoj: No.

17:54 tomoj: nice :)

17:54 bitbckt: Quite. :-)

17:57 Anniepoo: ok, hang on folks

17:57 osaunders: What's the difference between = and ==?

17:57 Anniepoo: so is there someplace special I should git technomancy's emacs starter kit to?

17:58 bitbckt: Anniepoo: ~/.emacs.d

17:58 Chousuke: osaunders: == is for comparing numbers. it's faster.

17:58 Anniepoo: winders

17:59 bitbckt: Uhm... C:\Documents and Settings\<user>\Application Data\...

17:59 something

17:59 osaunders: Is == Java == and = Java .equal()?

17:59 Chousuke: osaunders: no :/

17:59 osaunders: identical? is java ==

17:59 == maps to a special method in clojure.lang.Numbers or something

17:59 osaunders: Oh OK.

18:00 bitbckt: Anniepoo: http://www.gnu.org/software/emacs/windows/Installing-Emacs.html

18:00 Section 3.5

18:00 Chousuke: that fft person on the forums is getting obnoxious. ;/

18:00 on the group, rather :P

18:01 * bitbckt chuckles

18:01 bitbckt: The P.S. really makes it.

18:01 Chousuke: he's started cc'ing people because he thinks Chouser is censoring his posts. :(

18:02 And you know, I'm starting to think he should be censored.

18:02 osaunders: Is this the Clojure group you're talking about?

18:04 bitbckt: osaunders: Yes.

18:04 osaunders: What is he saying?

18:04 Chousuke: he's got something against Rich for saying in his talks that Clojure is fast.

18:05 Chouser: oh, please please don't copy his statements here. They're on the group if you want to read them.

18:05 Anniepoo: <bitbckt> Anniepoo: install that and M-x clojure-install will get you up and running with SLIME + clojure

18:05 osaunders: OK.

18:05 bitbckt: Anniepoo: ?

18:05 Chouser: just search for fft, you'll find all of it.

18:05 Anniepoo: that's not working

18:05 bitbckt: Explain.

18:05 Chousuke: He's not being very friendly about it, so apparently Chouser censored some of his posts, and now he thinks the mods are out to suppress him. ;/

18:05 Anniepoo: M-x clojure-install says [no match]

18:06 bitbckt: tinfoil hat types are endlessly amusing, to me

18:06 Chousuke: but now he's spamming my inbox.

18:06 and I do not appreciate that.

18:06 bitbckt: Anniepoo: Then it probably didn't load the init.el properly

18:06 Where did you extract the starter kit?

18:07 Anniepoo: C:\Documents and Settings\Annie\Application Data\.emacs.d

18:07 but in .emacs.d I now have auto-save-list and emacs-starter-kit directories

18:07 rlb: Hmm, I think I need to learn more about java network operations -- using an explicit urlconnection via url.openconnection, etc. works fine. duck-streams don't. I assume it's probably a text/html vs binary issue.

18:08 Anniepoo: the starter kit dir has .git, elpa, and elpa-to-submit

18:08 bitbckt: Anniepoo: You need the emacs-starter-key to *be* your .emacs.d

18:08 Not be within it.

18:08 s/key/kit/

18:17 Anniepoo: ok, got it to install

18:18 osaunders: Readline support for the REPL would be really nice.

18:19 tomoj: use slime :P

18:19 or I think you can do something with JLine

18:19 Anniepoo: sliming away here

18:19 bitbckt: Anniepoo: :-)

18:19 tomoj: Anniepoo: you may need to tweak your paredit

18:20 osaunders: tomoj: OK, thanks.

18:20 Anniepoo: ok, before tweaking anything need to get some stuff installed and figure out what I'm doing

18:20 tomoj: mine didn't have bindings for paredit-wrap-square or paredit-wrap-curly

18:21 Anniepoo: ah, OK

18:21 tomoj: learning paredit would probably be a good idea sometime too

18:21 http://mumble.net/~campbell/emacs/paredit.html

18:21 rlb: exec java -cp /usr/share/java/jline-0.9.94.jar:/usr/share/java/clojure.jar:/usr/share/java/asm3-commons.jar:/usr/share/java/asm3.jar jline.ConsoleRunner clojure.lang.Repl ...

18:22 i.e. in a #!/bin/bash script

18:22 Anniepoo: ok, lunch, then all this

18:22 tomoj: what's the asm stuff for?

18:23 rlb: and you probably want "$@" instead of ...

18:23 tomoj: not sure -- I was under the impression that clojure needed that for compilation

18:23 tomoj: ah

18:23 rlb: I just copied that from the debian /usr/bin/clojure-repl (which doesn't use jline)

18:23 tomoj: I haven't tried any advanced stuff yet

18:24 you mean like AOT complation?

18:24 rlb: not sure

18:27 * osaunders likes list comprehensions

18:34 Chousuke: heh

18:34 rlb: Got it. The problem was that duck-stream (copy in out) doesn't do a binary copy if "in" is a reader. So instead of (reader url) you have to manually create the InputStream, i.e. (.openStream (URL. url)).

18:34 Chousuke: I guess they should be called seq comprehensions in clojure :P

18:35 rlb: I think it was doing a Character/TYPE copy -- not quite what I wanted.

18:35 mebaran151: I always thought the for macro was a little too heavy weight

18:35 osaunders: Chousuke: *shrug*

18:35 mebaran151: I prefer to map filter and reduce my way to fame and fortune

18:35 Chousuke: mebaran151: you mean the implementation or the usage of it?

18:36 mebaran151: a little of both

18:36 Chousuke: because the implementation is something unbeliveable :P

18:36 mebaran151: the macro has a little too much magic in it

18:36 tomoj: I have this idea that it's idiomatic to have a function foo which reduces with a function foo*. true or false?

18:36 don't know where I got that idea

18:36 Chousuke: mebaran151: all sufficiently complex macros have a lot of magic in them.

18:36 mebaran151: foo* is usually like a reduce private version of the function

18:36 tomoj: great, that's what I thought

18:36 Chousuke: mebaran151: the point is, it's done for you already so you don't have to do it yourself :)

18:36 mebaran151: that's why avoid sufficiently complex macros, especially when something like filter map and reduce are pretty good

18:37 I don't think for makes my code any clearer than a sequence of mappings and filterings

18:37 osaunders: Where is str-join defined?

18:37 Chousuke: I mean, for *works*, there's little doubt of that.

18:37 tomoj: osaunders: clojure.contrib.str-utils

18:38 osaunders: OK. I think I need to read about libs now.

18:38 tomoj: it's a fairly simple function

18:38 Chousuke: mebaran151: the (IMO) best answer to the clojure golf on the group uses for, though :P

18:39 mebaran151: but debugging a magical macro can get irksome very quickly

18:39 Chousuke: yeah but you don't need to debug for :P

18:39 tomoj: (apply str (interpose \, seq))

18:39 Chousuke: it's done and debugged already.

18:39 mebaran151: I meant things you do in for

18:39 macros obscure the logic

18:40 Chousuke: ... at least until someone goes and adds chunked seq support for it.

18:40 hmm, I guess.

18:40 rlb: OK, I need to stop this and go work on emacs23 or similar... Thanks all.

18:40 mebaran151: what are chunked seqs?

18:41 Chousuke: mebaran151: a recent improvement by Rich that allows you to take advantage of the internal structure of some of the persistent data structures (vectors and maps I guess)

18:42 tomoj: just found a pdf about them http://clojure.googlegroups.com/web/chunks.pdf?gda=WIF8ADwAAAC-wnUK1KQ919yJcmM1ACuZUsYXlXWR5Y8qvjzEXQCX1uwyCdwt79_BXi8-B36MGsn9Wm-ajmzVoAFUlE7c_fAt

18:43 Chousuke: I guess chunked seqs are mostly hidden inside the seq functions.

18:43 mebaran151: so wouldn't for automagically use them?

18:43 because it just expands to a bunch of map and filters right?

18:43 Chousuke: ~def for

18:43 ah, damn

18:43 but no, for doesn't expand to a bunch of maps and filters :)

18:44 osaunders: Nested recursive loops.

18:45 At a guess.

18:45 mebaran151: it seems like you could do much of it using a bunch of map and filter though

18:45 Chousuke: well, hm.

18:45 mebaran151: though I've never really explored for in detail enough

18:46 Anniepoo: When it's done, it will configure SLIME and swank-clojure, and it will give you instructions on a few lines to add to your personal config (usually found in $HOME/.emacs.d/init.el) so it will work for future sessions.

18:46 osaunders: As soon as you have more than one sequence in for you're doing more than map can do.

18:46 Anniepoo: 8cI got no instructions

18:46 osaunders: (I think)

18:46 mebaran151: map can take multiple seqs if I remember correctly

18:46 osaunders: Yeah but they don't work in the same way at all.

18:46 ,(map + [1 2 3] [1 2 3])

18:46 lisppaste8: tomoj pasted "mexpanded for" at http://paste.lisp.org/display/85460

18:47 osaunders: Where's clojurebot?

18:47 Anniepoo: and M-x slime => [no match]

18:47 mebaran151: osaunders, that does exactly what I would expect

18:47 Anniepoo: clojurebot got roaring drunk at a bar and went home with an Alice based chatterbot

18:47 mebaran151: later they cybered

18:48 osaunders, it returns '(2 4 6)

18:48 osaunders: mebaran151: Now compare with (doall (for [x [1 2 3], y [1 2 3]] (+ x y)))

18:48 mebaran151: To see what's going on: (doall (for [x my-list, y my-list] [x y]))

18:48 Anniepoo: (purred she (str "Oooh!" (fully (functional you))))

18:49 Chousuke: mebaran151: but with for you can do (for [x [1 2 3] y [1 2 3] :when (= 5 (+ x y))] [x y])

18:49 mebaran151: I see

18:49 Chousuke: gives you ([2 3] [3 2])

18:49 mebaran151: it does a cartesian product

18:49 osaunders: Chousuke: Nice.

18:49 tomoj: you'd need contrib's combinatorics to easily get away without for, huh?

18:50 Chousuke: mebaran151: with :when, yes.

18:50 mebaran151: there's also :while for stopping early

18:50 and :let for binding arbitrary stuff in the expression

18:50 it's very powerful

18:50 mebaran151: the stopping early is the one thing that you probably couldn't do with map and reduce

18:50 osaunders: for reads the keyword?

18:50 mebaran151: but you could easily get the combinations with reduce

18:50 osaunders: s/reads/checks/

18:51 Chousuke: mebaran151: reduce is not lazy though ./

18:51 osaunders: yeah. the keywords are part of for's syntax

18:51 mebaran151: oh

18:51 I didn't think of that

18:51 I should appreciate for more

18:51 osaunders: lol

18:51 Sounds like you do already.

18:51 mebaran151: but I gotta admit, there's a lot of magic going on

18:51 Chousuke: yeah.

18:51 mebaran151: and I'm suspicious of any macro that I couldn't sketch out myself

18:52 Chousuke: then again, even in plain lets and defns there is a lot of magic going on.

18:52 osaunders: Are list comprehensions a math thing?

18:52 Chousuke: ever checked out the destructure function?

18:52 mebaran151: I also try to avoid destructuring :)

18:52 osaunders: I mean did they originate in math?

18:52 mebaran151: though I just started using it, and I got admit

18:52 Chousuke: why? it's great.

18:52 tomoj: for was pretty useful to me for finding pythagorean triples

18:52 mebaran151: it's very convenient

18:52 osaunders: Chousuke: What does it do?

18:53 mebaran151: sure beats firsting and seconding everything

18:53 Anniepoo: hhmmm....

18:53 Chousuke: osaunders: the destructure function is what the destructuring macros use to... destructure their argument forms :P

18:53 * osaunders blinks

18:54 osaunders: I'm not even close to understanding how macros work.

18:54 Chousuke: osaunders: eg, with (let [[x y z] triple] ...) the destructure function is what transforms the [[x y z] triple] into something like [x (nth 0 triple) y (nth 1 triple) z (nth 2 triple)]

18:54 mebaran151: yeah

18:55 Chousuke: osaunders: they take in clojure code, do arbitrary transformation with it, and the result is what gets executed.

18:55 mebaran151: I do a lot of packing things into vector tuples

18:55 Chousuke: remember, clojure code is just a data structure

18:55 mebaran151: so destructing is actually a very convenient way

18:55 tomoj: yeah, I do that too

18:55 mebaran151: to get at those things

18:55 but I just as often use (first x) (second x) etc

18:55 tomoj: with the value reduce carries around

18:56 osaunders: Is destructure a representative name to what it does?

18:56 Seems to be a kind of map from what you've told me so far.

18:57 Chousuke: osaunders: well, it's not a public function. but it's the magic behind clojure's destructuring :)

18:57 tomoj: it's called destructuring in other languages too

18:57 osaunders: OK, what is destructuring in general then?

18:57 tomoj: like a,b = [7,3] in ruby

18:57 except it's more flexible in clojure

18:58 osaunders: Oh OK.

18:58 Anything in common with pattern matching?

18:58 tomoj: it nests arbitrarily deeply

18:58 Chousuke: osaunders: the primitive let* special form can only handle bindings in the form [a 1 b 2 c 3 ...]. destructure is used in the let macro to transform the complicated binding vector into the simple sequential form

18:59 tomoj: osaunders: http://clojure.blip.tv/

18:59 the two on data structures are good

18:59 rlb: osaunders: somewhat related to pattern matching, I'd say, yes.

18:59 tomoj: haven't gotten to the rest yet

19:00 mebaran151: list comprehensions were originally a python thing right?

19:00 Chousuke: probably not :P

19:00 osaunders: I know them from Haskell.

19:00 Chousuke: though I wonder which language had them first.

19:00 osaunders: I was asking if they came from Mathematics because most stuff in Haskell does.

19:00 Chousuke: but if your language is less than 50 years old, chances are it wasn't the first at anything.

19:00 tomoj: wikipedia says ones I've never heard of


19:01 mebaran151: the wiki says it's based on set-builder notation

19:02 Chousuke: heh.

19:02 Anniepoo: 8cX how do I know I'm in clojsure mode?

19:02 Chousuke: set comprehension for clojure: (set (for ...)) :P

19:02 mebaran151: I always wished sql worked more like that

19:02 I actually finished my little library for using bdb like a giant lazy list

19:02 tomoj: Anniepoo: it should say "Clojure" on the mode line

19:02 mebaran151: that fetches records in a variable chunksize

19:02 tomoj: though in slime it won't

19:03 mebaran151: it's been really convenient for just running a filter and then asking for a take on it

19:03 osaunders: mebaran151: You can say SELECT * FROM table1, table2 WHERE table1id = table2id

19:03 mebaran151: it never felt natural

19:03 especially for mapping

19:03 osaunders: Instead of LEFT JOIN

19:04 mebaran151: try to get sql to match where colb is 4*col a

19:04 or something like that

19:04 osaunders: colb?

19:04 Column?

19:04 mebaran151: yeah

19:04 where the value in col b is 4 times the value of col a

19:04 it's doable

19:04 but it's nasty

19:05 osaunders: WHERE 4 * a = b?

19:05 mebaran151: and sometimes the sql engine will forgo optimizing this sort of query with an index

19:05 on a join?

19:05 Chousuke: I think I'll take thetime to learn paredit mode

19:05 I tried using it in slime and it was pretty nice

19:06 osaunders: I dunno really. I'm no SQL expert. SQL isn't a very nice language. It's barely a language at all in fact.

19:06 mebaran151: yeah, I had to do some DBA

19:06 and it's nasty

19:06 Chousuke: though it was somewhat difficult to tell which s-expr I was editing at which time because of all the closing parens :P

19:06 osaunders: I consider SQL to be a user inferface not a language.

19:06 replaca: Chousuke: paredit is awesome. Makes emacs feel like a structure editor

19:06 osaunders: SQI, if you like.

19:06 mebaran151: I have a layer on top of berkeleydb that lets me lazily evaulate a collection of bdb's and treat them as a table

19:07 and do all sorts of lazy filtering and mapping on them

19:07 osaunders: Sounds cool.

19:07 mebaran151: it's nice to pretend your tables are just an infinite list of tuples

19:08 osaunders: They kinda are.

19:08 Or at least they should be.

19:08 mebaran151: yep

19:08 internally I chunk fetches, so it's actually fairly performant, and using clojure it was incredibly simple to write

19:09 osaunders: Make a video! :-)

19:24 Does anyone know what the mdworker process is in OS X?

19:25 Oh yeah Google. Duh.

19:32 mebaran151: I'm gonna blog it up

19:33 the code is on github if anybody's interested

19:33 *bitbucket

19:33 Anniepoo: gotta say, this is certainly nonintuitive

19:34 mebaran151: Chousuke, the example in common lisp of basic list comprehensions uses map and filter essentially

19:35 Anniepoo: I installed the clojure-mode. It ran something when I did it, but now it just treats a new foo.clj buffer as plaintext

19:35 mebaran151: sight, fighting emacs can be such a terrible pain

19:35 Anniepoo, you abandoned IntelliJ?

19:36 Anniepoo: no, though Fossi made good arguments for trying emacs

19:36 I try not to be 'dedicated' to anything,

19:36 tomoj: Anniepoo: you did M-x clojure-install?

19:36 osaunders: I like Anniepoo already.

19:36 Anniepoo: yes, I did that

19:37 osaunders, ask on this list abotu projector support in unix ;c)

19:37 tomoj: did you add a clojure-slime-config to your username.el?

19:37 Anniepoo: no

19:37 mebaran151: I think sticking with one tool can be a pretty good strategy

19:37 tool jumping can just be painful at times

19:38 Anniepoo: I agree mebaran

19:38 tomoj: inside emacs.d with the starter kit if you make a username.el (where username is your username) it will be loaded on startup

19:38 not sure how that works with windows

19:38 Anniepoo: ok

19:38 mebaran151: I wouldnt' say be religious about it, but i fyou got a working IDE setup, it's rarely that worth it to chane for ti's own sake

19:39 projectors are easy to use if you're running a nvidia graphics card on linux

19:39 tomoj: Anniepoo: C-h v user-login-name

19:39 use that with .el

19:39 mebaran151: I was incredibly surprised how simple nvidia made it by not skimping out on the hardware :)

19:39 tomoj: then add (clojure-slime-config "/path/to/the/place/you/installed/clojure")

19:39 osaunders: Anniepoo: Why? Did you write it or something?

19:40 Anniepoo: the starter kit seems to not have installed clojure-mode or slime

19:40 tomoj: Anniepoo: e.g. I have clojure in /Users/thomasjack/code/clojure/src/clojure/, so I use /Users/thomasjack/code/clojure/src for the clojure-slime-config

19:40 you need to get clojure-mode from elpa first of all

19:40 Anniepoo: osaunders: no, it's a joke - at a clojure talk everybody had a laptop, was supposed to do a 10 minute speed presentation

19:40 tomoj: otherwise you wont have a clojure-install to run, I believe

19:41 Anniepoo: instead every single one had trouble with unix and the projector

19:41 osaunders: Oh lol

19:41 Anniepoo: given how simple this is on winders, I had to laugh

19:41 ah, ok

19:41 tomoj: even the mac people? odd

19:41 mebaran151: well X for the longest time assumed configuration was fairly static

19:41 Anniepoo: I've missed a step

19:41 mebaran151: only recently have they given up that delusion

19:41 tomoj: Anniepoo: M-x package-list-packages

19:42 Anniepoo: kk, hang on

19:42 mebaran151: nvidia is actually easier to get to work on linux than windows ironically

19:42 tomoj: Anniepoo: go to clojure mode and press i, then press x

19:42 mebaran151: intel still hasn't caught up

19:42 tomoj: Anniepoo: then you probably need to M-x load-library clojure-mode

19:42 Anniepoo: then M-x clojure-install

19:43 Anniepoo: ok, hang on, how do I copy text out of emacs?

19:43 tomoj: "M-x load-library RET clojure-mode" rather

19:43 depends on your emacs

19:44 osaunders: Yeah I think I'll leave you guys to your X and Emacs and all that jazz for a few years yet.

19:44 tomoj: for me it's the same as everything else here, cmd+c

19:44 osaunders: are you on windows?

19:44 osaunders: Mac.

19:44 tomoj: you really should give clojure-mode+slime a try, I think

19:44 it's easy with the starter kit and aquamacs

19:45 osaunders: I know bash well and I've got TextMate. Pretty happy with that. Not for Clojure mind but I probably won't do a lot of programming in Clojure.

19:45 tomoj: ah, well then getting clojure-mode+slime set up probably isn't worth it

19:46 Anniepoo: sorry, I got the package names

19:46 tomoj: I'm actually in the process of giving up textmate altogether for emacs

19:46 Anniepoo: but can't get them copied to paste into pastebot

19:46 tomoj: Anniepoo: what, clojure-mode isn't on the list?

19:48 Anniepoo: who freaking knows?

19:48 tomoj: well.. hopefully you would since the list is right there for you to see

19:48 Anniepoo: or at least one page of it

19:48 8cD I'm not too good with emacs

19:48 but managed to copy to notepad

19:48 tomoj: clojure-mode should be not too far down

19:49 Anniepoo: and yes, clojure-mode is on the list

19:49 tomoj: then, do what I said :)

19:49 move the point down to the clojure-mode line (click or C-n down there)

19:49 press "i"

19:49 then press "x"

19:49 Anniepoo: did that

19:50 tomoj: ok, then try M-x load-library RET clojure-mode

19:50 (where RET means press return)

19:50 Anniepoo: ok, ran some long script

19:50 tomoj: should say "loading ... done"

19:50 as long as it doesn't say "Cannot open load file..." you should be good

19:51 now try M-x clojure-install

19:51 it should ask you for a path to install clojure to

19:51 Anniepoo: ok

19:51 it is

19:51 thanks for the walk thru, BTW

19:51 accept the default?

19:51 tomoj: if you like it

19:52 when it's done installing it should tell you what to add to your username.el

19:52 Anniepoo: briefly gave an installation failed message

19:52 tomoj: doh

19:52 Anniepoo: moving mouse over it erased it

19:53 tomoj: maybe some incompatibility with your windows version of emacs?

19:53 I doubt much of this stuff is tested on windows

19:53 Anniepoo: at one point I was being encouraged to make an Annie.el file

19:53 tomoj: yeah, that's where you'd put the clojure-slime-config line

19:53 Anniepoo: that's never been done

19:54 tomoj: you wouldn't need to until after it installed anyway

19:54 try M-x clojure-mode

19:54 oh, well, that will probably work anyway

19:54 but that doesn't mean your clojure/slime/etc is installed :(

19:54 Anniepoo: unmatched bracket or quote

19:55 tomoj: yeah, that's because you weren't in a clojure source buffer

19:55 try M-x slime again I suppose

19:55 though if it said installation failed that's probably the case

19:55 Anniepoo: hey, for some really bizarre reason now it's coloring my clojure test file I got here

19:55 dunno what happened, but it worked

19:56 tomoj: M-x slime worked?

19:56 Anniepoo: I think it's clojure-mode

19:56 I have syntax coloring and indenting

19:56 tomoj: ah, yeah

19:56 Chousuke: Emacs is really neat once you get into it.

19:57 Anniepoo: yah, this is actually the third time I'm learning it

19:57 Chousuke: the beginning is a hurdle though. it's not an easy tool.

19:57 Anniepoo: 78-83 I used QED

19:57 tomoj: I imagine it's probably a less pleasant experience on windows as well

19:57 Anniepoo: 84-87 I used PMATE

19:57 QED is the line oriented ancestor of emacs

19:57 lowlycoder: anyone knows what rick hickey does for a living? (that allows him to work on clojure?)

19:58 Anniepoo: PMATE was a commercial version

19:58 Chousuke: I cloned someone's emacs.d from github as a basis for my emacs installation.

19:58 I got lots of neat features out of the box that I probably wouldn't have found otherwise :P

19:58 osaunders: lowlycoder: I think Clojure is a freetime hobby thing. I could be wrong though.

19:58 Anniepoo: so I should try M-x slime again?

19:58 [no match]

19:58 tomoj: just to see if maybe it actually worked even though it said it didn't :)

19:59 yeah, didn't work

19:59 try C-x b *Messages*

19:59 Chousuke: lowlycoder: Rich used his savings while working on Clojure. That source of money is apparently used up now though.

19:59 tomoj: see if the install failure message is in there

19:59 lowlycoder: is there a donation page for him?

19:59 i'm prety mpressed by clojure so far

20:01 Anniepoo: do it, lowlycoder - I'm sure several people on this IRC can give you an addy to send the money

20:02 Chousuke: lowlycoder: there's a donation button on clojure.org

20:04 Anniepoo: ok, tomoj, git'ing slime

20:04 will put in .emacs.d and try M-x slime again, or do I need M-x clojure-install?

20:04 and should I get swank first?

20:05 tomoj: uhh

20:05 clojure-install is supposed to do everything for you I guess

20:06 did you find the failure message?

20:07 Anniepoo: yah, I think it's not finding the packages somehow

20:07 so I'm downloading them with these inistructions

20:07 http://riddell.us/tutorial/slime_swank/slime_swank.html

20:08 tomoj: ah

20:08 well you already have clojure-mode installed

20:08 Anniepoo: yes

20:08 but I got it same way

20:08 tomoj: for the rest, put them in vendor

20:08 Anniepoo: ok, I got a bunch of lisp code

20:08 tomoj: then instead of editing .emacs, edit .emacs.d/Annie.el

20:08 Anniepoo: vendor?

20:09 tomoj: make a vendor dir in your .emacs.d

20:09 Anniepoo: kk

20:09 tomoj: and then you'll be doing stuff like (add-to-list 'load-path "/path/to/.emacs.d/vendor/slime")

20:12 Anniepoo: testing

20:12 tomoj: and replace the paths to clojure(-contrib)?.jar in that tutorial with whereever you really put them

20:18 Anniepoo: ok, so swank-clojure goes in vendor too?

20:18 (hate doing this much voodoo)

20:18 tomoj: yup

20:18 Chousuke: it doesn't really matter where it goes I think. :P

20:18 as long as it is in load-path

20:19 tomoj: indeed

20:19 Anniepoo: ok, cool

20:19 tomoj: I heard somewhere that vendor/ was the conventional place for the starter kit

20:19 Chousuke: my stuff is scattered around ~/opt/lisp/, ~/.emacs.d/site-lisp/ etc.

20:19 Anniepoo: swank-clojure has two .el files and a directory swank in it

20:20 Chousuke: Anniepoo: you don't want to touch the contents of the dir. just put the whole dir somewhere and then add it to the load path

20:20 Anniepoo: ok

20:20 making sure I got the dir and not the dir that contains the dir

20:21 I have no .emacs file

20:22 tomoj: indeed, you should not

20:22 as I said, use .emacs.d/Annie.el instead

20:22 Anniepoo: ah, thanks

20:22 so add all the tutorial's boilerplate and update the paths

20:23 tomoj: yup

20:23 and, don't forget to also update the paths to the clojure jars

20:25 Anniepoo: do I need to double the backslashes here?

20:26 osaunders: Baaaaccccccckslllaaaaaasssssshhhh

20:27 It's got a nice ring to it.

20:27 Or should that be shhling.

20:27 Chousuke: oh, and useful functions: M-x apropos, M-x describe-key, M-x describe-function

20:27 describe-key especially

20:27 just run it, hit some random combo and discover new stuff!

20:28 lisppaste8: Anniepoo pasted ".emacs.d" at http://paste.lisp.org/display/85464

20:28 tomoj: it's C-h k here

20:28 you've got an extra .emacs.d in the slime load path

20:29 I dunno whether you need to escape the backslashes or not

20:29 Anniepoo: hate voodoo

20:29 tomoj: yes, I think you do

20:30 Anniepoo: need backslashes or hate voodoo?

20:30 tomoj: need extra backslashes

20:30 here installing clojure-mode from elpa and doing M-x clojure-install made everything work fine

20:30 didn't have to add anything to my username.el

20:31 Anniepoo: sorry, I'm stuck on winders

20:34 ahh... the installer is failing because it can't find git

20:35 but in theory it's all running now

20:36 how do I get the buffer into a repl?

20:37 tomoj: M-x slime

20:37 oh

20:37 if you already have a repl up, go to the source buffer and C-c C-k

20:37 Anniepoo: it's doing something different with the indenting, and it's doing syntax coloring, and it says slime in the bar at the bottom

20:38 tomoj: ok, no go to a clojure source buffer with some function and C-c C-k

20:38 then you should be able to call it in the repl

20:38 osaunders: Good night all.

20:39 Anniepoo: thanks for all the help

20:39 tomoj: working?

20:39 Anniepoo: this'd just be impossible on my own

20:40 it' can't find my function

20:40 tomoj: well.. is it in a namespace?

20:40 Anniepoo: hmm

20:40 tomoj: otherwise something's not hooked up right

20:40 Anniepoo: I did M-x slime

20:40 tomoj: (i.e. do you have a call to ns at the top of your clojure source buffer)

20:40 Anniepoo: it asked if I wanted another repl

20:40 yah, I didn't put one

20:41 just (defn foo [x] (+ 3 x))

20:41 tomoj: maybe try restarting emacs if you haven't already

20:41 Anniepoo: ok

20:41 tomoj: just to be sure all the config is loaded

20:41 Anniepoo: can't get emacs to exit

20:43 I'm doing a project for NASA, I'm reading a bunch of astronaut books for background

20:43 somebody asked one what the most dangerous thing he ever did was, he said training student pilots

20:44 feel like that today (like a dangerous student pilot)

20:44 damn

20:44 restarted and nothing loads

20:44 no clojure mode no nothing

20:45 tomoj: hmm

20:46 M-x clojure-mode says no match?

20:46 Anniepoo: no, that worked

20:46 tomoj: M-x slime says no match then?

20:46 Anniepoo: now I got the 2 space indent and syntax highlight

20:46 ah, I see

20:54 fsm: Hello everyone.

20:55 Is there a way to solve the problem of having circular dependencies between two namespaces?

20:59 Anniepoo: going C-c C-k says not connected

20:59 slime hung and I restarted

20:59 now it's doing that

20:59 tomoj: something's wrong with your swank/slime config I suppose

20:59 Anniepoo: ok

20:59 cark: fsm : just don't do it

20:59 fsm : or use callbacks

21:00 Anniepoo: there's a user's group meeting coming up

21:00 fsm: :)

21:00 Anniepoo: I'll get up to speed on emacs and hit up one of the emacs junkies to help me with it

21:00 fsm: my situation is, i have a ray-tracer in one namespace that calls shaders in another namespace

21:00 some of those shaders need to call the raytracer to do more shading

21:00 Anniepoo: ok

21:00 fsm, each should 'use' the other

21:01 cark: which one is the boss ? raytracer or shaders ?

21:01 Anniepoo: neither

21:01 you're in my address book

21:01 I'm in your address book

21:01 fsm: they can't use each other because clojure silently stops when it hits the recursive 'uses'

21:01 as far as i can tell

21:01 raytracer is the boss, i guess

21:01 Anniepoo: I've got a mass of code in a dozen namespaces that mostly use each other

21:02 cark: when you call into the shaders, privide them with the raytracer functiobns they might use

21:02 Anniepoo: you can't forward reference - that one got me once or twice

21:03 cark: you're kinda defining an interface

21:03 a protocol really

21:03 lilike shaders are some kind of plugins

21:03 fsm: i get you

21:03 thanks, i will do that now

21:05 Anniepoo: I'm going to take a break and then do some cleanup on prim chalk

21:05 ttyl

21:10 technomancy: Anniepoo: sorry, I don't have resources to test on Windows

21:10 oh... she left.

21:14 fsm: thanks, all working now

21:14 have a virtual cup of tea on me: http://tu.be/graphics/teapot2.png

21:30 tomoj: am I supposed to write a build.xml by hand? O_o

22:34 fsm: I copied the build.xml from clojure-contrib and modified it

22:51 Anniepoo: try (nth 0 '[10 20 30]) in a repl, you'll find it throws a fairly unhelpful exception.

22:51 minor bug

22:54 never mind

22:54 noobism strikes badly

23:02 tomoj: I do wish it said what the attempted cast was

23:03 it seems all you know is that a vector was cast to something wrong

23:04 Anniepoo: I was trying (nth 0 '[10 20 30])

23:04 but yes

23:04 tomoj: yeah

23:04 so I guess it tried to cast that vector to an integer

23:05 but it just says "....PersistentVector, ClassCastException"

23:05 dmiles: Anniepoo: you still working with LibOMV>

23:05 tomoj: rather than "Can't cast a PersistentVector to an Integer" or something useful

23:05 dmiles: Anniepoo: well secondlife

23:06 Anniepoo: I am still working with both of those

23:06 dmiles: are you writing the clientlib in clojure?

23:07 or are you using ClojureCLR?

23:07 Anniepoo: neither, the libOMV bot is in C#, and I shell out to it

23:08 compared to the time delay while it signs on, the delay for the process launch is trivial

23:08 dmiles: once its connected.. you use a socket?

23:08 between clojure and the bot

23:08 Anniepoo: the bot?

23:09 dmiles: yeah

23:09 Anniepoo: no, the bot's a command line driven bot

23:09 it just uploads textures

23:09 so it gets filenames on stdin and responds iwth UUID's

23:09 dmiles: oh i see.. makes sense you can just batch it out

23:09 Anniepoo: yah, I don't want to play with the bot, it does it's job

23:09 http://slurl.com/secondlife/HHP%20at%20UH/16/15/1001

23:10 my current location

23:10 sitting on a builder robot run by clojure

23:10 fly!

23:19 dmiles: oh right on.. hrrm canty get above 167m

23:20 Anniepoo: need a flight feather? IM me , Annie Obscure

Logging service provided by n01se.net