#clojure log - Jan 26 2009

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

0:07 technomancy: automated tests for functional code are so easy; I love it

0:46 ecret: in eclipse I can add src subfolders with java. I need to do this for clojure, add java src paths, is this possible?

0:48 hiredman: are you talking about classpaths?

0:48 what do you mean by source subfolderS?

0:53 ecret: java source files. I am trying to load a project in clojure. To do it in java, I need to add source paths in eclipse so that it gets compiled as well. I suppose I should make jar files first?

0:53 durka42: the java files are going to have to compiled first

0:53 ayrnieu: 'load a project in clojure' doesn't make sense. Do you mean enclojure?

0:54 ecret: i mean, can clojure build java files as well by using the jdk?

0:54 hiredman: build java files?

0:54 ecret: no, not enclojure. I should of said build a project.

0:54 yes

0:54 durka42: i mean, i guess you could make a clojure ant task

0:55 that's sort of a tangential problem though

0:55 hiredman: you mean java source or jvm bytecode or...

0:55 ecret: source

0:55 hiredman: so you want to generate java source from clojure?

0:56 ecret: no

0:56 hiredman: so what do you want?

0:57 ecret: i realize I should of just made jar files or use ant. I thought maybe clojure could handle java files in the background so long as you had the jdk installed.

0:57 durka42: i think you want to have java source files and clojure source files in the same project and have everything build when you click a button?

0:57 that would require ant

0:57 ecret: yes

0:58 durka42: clojure will look for class files, but it won't compile java source

0:58 hiredman: and javac cannot handle clojure files

0:58 arohner: stairstep: takes a seq of numbers, and adds each member to every value after it in the seq. (stairstep [1 1 1 1 1]) => (1 2 3 4 5). Does this function already exist? is there a better way to write it than using loop/recur?

0:59 ecret: thanks for the help

0:59 hiredman: maybe you could do it lazy like with seqs

1:02 Chouser: arohner: similar to reductions

1:02 arohner: Chouser: I've never quite understood how reductions works. Can you give me an example?

1:02 Chouser: ,(use '[clojure.contrib.seq-utils :only (reductions)])

1:02 clojurebot: nil

1:02 Cark: (defn stair-step [seq] (reduce (fn [val item] (conj val (+ item (last val)))) [(first seq)] (rest seq) ))

1:02 Chouser: ,(reductions + [1 1 1 1 1])

1:02 clojurebot: (1 2 3 4 5)

1:03 Cark: hoo =)

1:03 (doc reductions)

1:03 clojurebot: No entiendo

1:03 Chouser: ,(doc reductions)

1:03 clojurebot: "([f coll] [f init coll]); Returns a lazy seq of the intermediate values of the reduction (as per reduce) of coll by f, starting with init."

1:04 Cark: ,(reductions + 4 [1 1 1 1 1])

1:04 clojurebot: (4 5 6 7 8 9)

1:05 arohner: thanks

1:06 ayrnieu: where is this defined?

1:06 hiredman: clojure.contrib.seq-utils

1:06 Chouser: where is 'this' defined?

1:07 durka42: ,(this)

1:07 clojurebot: java.lang.Exception: Unable to resolve symbol: this in this context

1:07 Cark: in proxy !

1:07 Chouser: Cark: right!

1:07 Cark: yay =)

1:07 ayrnieu: ah, I missed it.

1:07 * durka42 needs to experiment with proxy

1:08 arohner: is the last update to clojure contrib really 2008-12-27?

1:08 Cark: i'd like to see more use cases for reductions

1:09 Chouser: arohner: no, it's moved to google code

1:09 Cark: something less trivial maybe

1:09 arohner: Chouser: ah, that would explain it

1:09 Chouser: https://clojure-contrib.googlecode.com/svn/trunk

1:09 arohner: thanks

1:09 Chouser: or maybe http instead of https

1:10 Cark: clojurebot: where is contrib ?

1:10 clojurebot: contrib is http://code.google.com/p/clojure-contrib/

1:10 durka42: ~contrib

1:10 clojurebot: contrib is http://code.google.com/p/clojure-contrib/

1:13 hiredman: ~ seen arohner

1:13 clojurebot: arohner was last seen joining #clojure, 0 minutes ago

1:13 arohner: yay, mixing emacs and mac shortcuts

1:21 technomancy: nice; how long has clojurebot done seen?

1:21 durka42: yesterday or thereabouts

1:21 hiredman: about a day, day and a half

1:22 the current instance doesn't recognize quits because I haven't restarted it

1:22 durka42: ~ seen cadsmack

1:22 clojurebot: cadsmack was last seen joining #clojure, 102 minutes ago

1:23 hiredman: yeah

1:32 Cark: hum there is something in don't understand

1:32 ,(java.lang.Character/isWhitespace \a)

1:32 clojurebot: false

1:32 Cark: ,(split-with java.lang.Character/isWhitespace (seq "qs fq df"))

1:32 clojurebot: java.lang.Exception: No such namespace: java.lang.Character

1:32 durka42: java methods are finicky like that

1:32 Chouser: somebody's reading the book

1:32 hiredman: java.lang.Character/isWhitespace is not a clojure fn object

1:32 durka42: ,(split-with #(java.lang.Character/isWhitespace %) (seq "qs fq df"))

1:32 clojurebot: [nil (\q \s \space \f \q \space \d \f)]

1:32 durka42: you have to wrap them

1:33 Cark: ah thanks !

1:33 and no i'm not reading the book !

1:33 durka42: ,(split-with (memfn java.lang.Character/isWhitespace) (seq "qs fq df"))

1:33 clojurebot: java.lang.IllegalArgumentException: No matching method found: isWhitespace for class java.lang.Character

1:33 hiredman: ,(macroexpand-1 '(java.lang.Character/isWhitespace \a))

1:33 clojurebot: (. java.lang.Character isWhitespace \a)

1:33 Cark: thank you all

1:33 Chouser: Cark: oh!? I just finished that page.

1:33 ayrnieu: where's the book?

1:34 Chouser: ~book

1:34 clojurebot: book is http://www.pragprog.com/titles/shcloj/programming-clojure

1:34 hiredman: clojurebot: know anything about the book?

1:34 clojurebot: book is http://www.pragprog.com/titles/shcloj/programming-clojure

1:34 hiredman: love that fuzzy lookup

1:36 Cark: chouser : must be a good book anchored in practical problems =)

1:38 Chouser: :-)

1:50 Cark: ~ regex

1:50 clojurebot: Huh?

1:52 durka42: clojurebot: regex is <reply>Sometimes people have a problem, and decide to solve it with regular expressions. Now they have two problems.

1:52 clojurebot: 'Sea, mhuise.

1:52 durka42: ~ regex

1:52 clojurebot: Sometimes people have a problem, and decide to solve it with regular expressions. Now they have two problems.

1:53 Cark: i have to ... http://java.sun.com/javase/6/docs/api/javax/swing/RowFilter.html

1:54 ayrnieu: what question do you have about them?

1:55 Cark: just wanted to see if clojurebot knows where to find a reference on java's regex

1:55 found it now, thanks

2:46 ayrnieu: ,2 3 (+ *1 *2)

2:46 clojurebot: hello?

2:46 clojurebot: BUENOS DING DONG DIDDLY DIOS, fRaUline ayrnieu

3:47 jli: user> (+ 1,000,000 2,000,000)

3:47 3

3:47 darn it. I was all excited that I'd finally be able to insert commas into my numbers

3:51 ayrnieu: you could write nr such that (+ (nr 1,000,000) (nr 2,000,000)) = 3000000

3:52 jli: that's true. maybe if we ever get to twiddle the reader macros...

4:10 te: Is everything in clojure a function?

4:12 jli: "everything"?

4:12 ayrnieu: ,(class "not a function")

4:12 clojurebot: java.lang.String

4:12 jli: ,3

4:12 :(

4:12 ayrnieu: ,(do 3)

4:12 clojurebot: 3

4:12 jli: ,(prn 3)

4:12 :(

4:12 clojurebot: 3

4:13 jli: :)

4:13 ayrnieu, hey, you're here too.

4:13 * ayrnieu 'd just noticed that.

4:23 ayrnieu: http://gnuvince.wordpress.com/2009/01/25/response-to-problems-with-lisp/

4:24 jli: I thought it was interesting that hash tables are functions in Ruby, as well. Any other languages have that, that I was unaware of?

4:25 ayrnieu: it's an Arc idea, but hash tables aren't function in Ruby.

4:26 jli: er, right, it was Arc.

4:31 AWizzArd: Moin

8:41 stuarthalloway: "Can't await in agent action" is giving me fits...

8:41 rhickey: would it be possible to relax the restriction on awaiting in agent actions when using the send-off pool?

8:44 rhickey: stuarthalloway: await is really a simplistic thing - real workflow is going to involve queues/latches. In any case, the prohibition is not to avoid thread starvation, but deadlock: A awaits B awaits A

8:45 gnuvince: Hi

8:46 Lau_of_DK: rhickey: Did you consider this http://mindtouchsoftware.com/random/git_two.jpg ?

8:46 Chouser: or if you feel like ignoring the queue/latch advice, you can do your send-offs and awaits in a regular thread

8:49 stuarthalloway: rhickey: got it. Not sure how I ever decided to use agents for runonce -- just went back through the email thread where you quite clearly said the agent approach wouldn't compose

8:54 rhickey: Chouser: maybe using pmap from a regular thread? although pmap does use send...

8:55 jacky_: Has anyone managed to add a new folder to the classpath of clojurebox?

8:56 (add-classpath) does not seem to work

8:57 rhickey: maybe this pvals stuff needs promotion: http://paste.lisp.org/display/73650

8:58 shoover: jacky_: from the REPL or during initialization?

8:59 Lau_of_DK: call-par is cool, never saw that before

8:59 stuarthalloway: rhickey: if I use latches instead of await, I still have the potential for deadlock, right? It's just up to me to avoid circularity

9:02 I can't see a way to write runonce in a composable way while sticking to Clojure-level concurrency abstractions: agents won't compose, and transactions assume no side-effects...

9:03 rhickey: stuarthalloway: latches, and all j.u.concurrent blocking constructs, offer timeouts

9:04 stuarthalloway: what does runonce do?

9:04 stuarthalloway: rhickey: takes a Clojure fn, and returns a fn that runs only a single time, caching the result

9:05 rhickey: why do you need threads then?

9:06 stuarthalloway: rhickey: maybe I don't. Other build tools are logically single threaded until you introduce an explicit parallel task

9:06 rhickey: sending-off one job and awaiting it is essentially single-threaded

9:07 stuarthalloway: rhickey: my intention is to create a build system that is parallel-ready

9:08 so that (at a later date) once can kick off multiple build targets that do *not* have a direct dependency, safe in the knowledge that if they share a subtask that it will run only once

9:09 rhickey: you have already answered my question on this in detail: http://groups.google.com/group/clojure/browse_thread/thread/12b48c9f7954901b/c4a8f351e9b17787?lnk=gst&q=macro+specified#c4a8f351e9b17787

9:09 I just realized that I still haven't understood all the implications

9:10 Lau_of_DK: (let [gitdir (javax.swing.JOptionPane/showInputDialog "Git dir" "/home/lau/coding/gitrepo/")]

9:10 (with-sh-dir gitdir

9:10 (sh "git" "log --stat > mynewlog.txt")

9:10 (slurp (str gitdir "mynewlog.txt"))))

9:11 This fires without errors, but produces no new file - Why?

9:12 stuarthalloway: Lau_of_DK: I think you need to break the command args into separate strings

9:12 Lau_of_DK: same

9:13 As in - No file produces, no errors returned

9:13 rhickey: Chouser: did you see the thread on sync watchers? That might apply to stuarthalloway's issue here too. Like your watcher problem, he is going to asynchronously generate an indefinite amount of work, then need to know when it's complete

9:14 hiredman: ,(let [nr (comp #(Interger/parseInt %) str)] (nr 1,000,000))

9:14 clojurebot: java.lang.Exception: No such namespace: Interger

9:14 hiredman: ,(let [nr (comp #(Integer/parseInt %) str)] (nr 1,000,000))

9:14 clojurebot: 100

9:14 stuarthalloway: Lau_of_DK: If sh is failing with an error, you won't see it because the return value of with-sh-dir is the return value of slurp. Try println-ing the call to sh

9:15 Lau_of_DK: oh yes, youre right

9:15 fatal: ambiguous argument '>': unknown revision or path not in the working tree.

9:15 Use '--' to separate paths from revisions

9:15 That gives me a better clue

9:15 Chouser: As I recall you wrote sh - Can I used > < | operators in my calls ?

9:19 Chouser: Lau_of_DK: no. If you're sure you want that, you'll have to use sh to launch an actual shell process, like /bin/bash or something, to interpret those chars

9:19 Lau_of_DK: but be aware that there are security issues with that -- you have to be extra careful about the context in which you're running them

9:20 rhickey: haven't read that thread yet, thanks.

9:20 Lau_of_DK: Oh ok - Man you run a tight shift :)

9:24 Chouser: "ship" I think. :-)

9:24 Lau_of_DK: hehe

9:24 born danish -> learn english -> fail

9:24 :)

9:27 Chouser, I get another type of error now which is pretty confusing, from CL "sh git log" works of course, but when I do it with your sh script I get "/bin/sh: Can't open git, or "/bin/bash/git: cannot execute binary file

9:29 StartsWithK: Lau_of_DK: http://paste.pocoo.org/show/101445/ you don't need temp file to capture programms output

9:31 Chouser: right, and 'sh' returns stdout and stderr contents by default

9:33 Kerris7: Chouser: how's the ultra-alpha Clojure editor-repl coming along? :)

9:34 Chouser: karmazilla's fixing it right up.

9:34 he's added several features to his own fork of it.

9:35 Kerris7: that's nice, thanks for the update =)

9:38 Lau_of_DK: StartsWithK: Doh! Youre right ofc :)

9:41 * ayrnieu looks for "Clojure for Erlang Programmers"

9:46 Chouser: you might need to take the inverse of a "Erlang for Java Programmers" and compose with "Clojure for Java Programmers"

10:13 I suppose it's intentional that there's no way to create a local Var with a given root binding?

10:14 short of using the Java methods directly, I suppose.

10:26 LordOfTheNoobs: ,(doc gensym)

10:26 clojurebot: "([] [prefix-string]); Returns a new symbol with a unique name. If a prefix string is supplied, the name is prefix# where # is some unique number. If prefix is not supplied, the prefix is 'G__'."

10:26 rhickey: Chouser: yes, it's intentional - do you have a use case for a root binding?

10:33 Chouser: rhickey: nothing very compelling, but I've noticed it before. Most recently was the 'my-defmethod' brought up last night.

10:35 * rhickey searches

10:37 Chouser: http://paste.lisp.org/display/74247

10:37 the purpose being to provide a place to hang some metadata, so a bit of an abuse of a Var

10:38 conversation starts here: http://clojure-log.n01se.net/date/2009-01-25.html#19:43

10:39 rhickey: probably just need a non-macro (add-method multi dispatch-val fn)

10:39 then fn could be regular defn'ed var

10:39 you'd get name and metadata

10:41 gnuvince: How do I get args into main?

10:42 (defn main [args] ...)?

10:50 ayrnieu: ,(do *command-line-arguments*)

10:50 clojurebot: java.lang.Exception: Unable to resolve symbol: *command-line-arguments* in this context

10:50 ayrnieu: ,(do *command-line-args*)

10:50 clojurebot: nil

10:51 Chouser: gnuvince: how is your 'main' getting called?

10:51 gnuvince: Chouser: it's not.

10:52 Chouser: I wonder how i'm supposed to get the command line args

10:52 Chouser: ah. just as ayrnieu demonstrated.

11:00 stuarthalloway: rhickey; is it possible to add my own latch to an agent-based implementation, accepting the possibility of deadlock? My simple test fails: http://paste.lisp.org/display/74268

11:12 rhickey: stuarthalloway: you need to 1) release pending sends, 2) return the same thing from your send-off as send-off (the agent), 3) deref the agent before using it in + : http://paste.lisp.org/display/74268#1

11:13 stuarthalloway: rhickey: thanks! is this so gross that I shouldn't be using agents at all, or can you imagine scenarios where agent + deadlockable send-off is the most clojurish way?

11:15 rhickey: I still think send one job and wait for it is not multithreaded, so why bother?

11:17 * stuarthalloway goes away to think and compose motivating example

11:18 rhickey: you can't parallelize in the small like this. in the large, you'd have sets of things that could run in parallel, which when done constitute a single unit of work that might need to precede another (i.e. serially), and a way to express those parallel/serial dependencies

11:22 stuarthalloway: I think build tasks are large enough to merit parallelization

11:23 and I was hoping to use runonce semantics as a way to implicitly specify serial dependencies

11:23 while the top level caller can kick off multiple tasks in parallel

11:23 rhickey: stuarthalloway: so only do the parallel part with agents

11:24 hiredman: stuarthalloway: each task or target should get it's own agent, so building a target is firing a "build" to that target's agent, with some sort of "return to this task" when you are done

11:24 rhickey: doing the serial part with agents just makes it hard, since you have to keep waiting

11:24 stuarthalloway: hiredman: that's pretty much what Rich is talking me out of :-)

11:25 hiredman: really?

11:25 stuarthalloway: hiredman: yes. read back through the irc log. agents and awaits are not composable, nor necessary

11:26 so I end up using agents only at the top level, and letting individual tasks run on the agent that hits them first

11:26 hiredman: ok

11:27 rhickey: stuarthalloway: the problem seems more of a fork/join one, which Chouser has also encountered recently

11:28 stuarthalloway: rhickey: will take a look at the fork/join stuff. Had planned to leave it out of the book for space reasons, but this is making me reconsider

11:28 rhickey: stuarthalloway: I sketched something here: http://paste.lisp.org/display/73650

11:28 stuarthalloway: I don't mean official Fork/Join

11:29 stuarthalloway: rhickey: gotcha, thanks!

11:30 rhickey: you don't really want agent identity, just thread launching and results gathering

11:34 it's the identity aspect of agents that require guarding against deadlock, without it, you can't wait on the thing waiting for you since you can't get a handle on it

11:34 I should make this pval stuff official, since it is so easy to use

11:34 stuarthalloway: rhickey: that would be very cool

11:35 rhickey: cgrand argued for a macro in-between pval and pargs, that just took exprs and returned vector of values

11:36 i.e. getting rid of the f of pargs

11:36 stuarthalloway: rhickey: makes sense

11:37 pvals is a little weird: you can't get completed results in the order they become complete

11:38 I would want some way to carry around which calculation went with a result, so they could be pulled off as they complete, instead of in the order they kicked off

11:39 rhickey: stuarthalloway: I disagree

11:39 stuarthalloway: rhickey: then I am probably wrong :-)

11:39 rhickey: it would be a substantially weaker promise, would require job identity etc

11:40 stuarthalloway: rhickey: then don't make it lazy. The laziness is misleading, isn't it?

11:40 * stuarthalloway retracts

11:40 stuarthalloway: the laziness is useful if the tasks added first finish first

11:41 but not otherwise

11:41 lisppaste8: rhickey annotated #73650 with "pexprs" at http://paste.lisp.org/display/73650#2

11:42 stuarthalloway: rhickey: I would use pexprs immediately if it were in core, and include it in the book

11:43 rhickey: name ok with everyone?

11:44 danlarkin: +0

11:45 LordOfTheNoobs: pdo, pardo?

11:45 rhickey: I'm not sure anyone would use pvals directly, and is the better name

11:45 LordOfTheNoobs: do implies side effects, and this is useful w/o side effects

11:46 stuarthalloway: papply?

11:46 cgrand: rhickey: plist?

11:46 rhickey: apply implies a collection last arg

11:46 hiredman: pexprs is good for me

11:46 rhickey: cgrand: it's kind of like list, but lazy

11:46 stuarthalloway: brown-noser :-)

11:47 hiredman: stuarthalloway: I have another nameing issue, so I will let this one pass

11:47 LordOfTheNoobs: pcollect

11:47 hiredman: :P

11:47 LordOfTheNoobs: implies reduce

11:47 stuarthalloway: these names are all too long, how about "p"?

11:48 hiredman: parallel expressions is exactly what they are

11:48 * Chouser frowns in stuarthalloway's direction.

11:48 LordOfTheNoobs: parallel-map-apply

11:48 * LordOfTheNoobs resigns

11:49 hiredman: expressions-evaluated-in-parallel-and-returned-as-a-lazy-seq

11:49 AWizzArd: too long

11:49 hiredman: eeiparaals

11:49 rhickey: another difference from list is that it is not a function, not that that matters much

11:51 maybe the p part implies the lazy difference between plist and list

11:51 cgrand: pvals is a good name, let rename pvals pcalls and pexprs pvals!

11:51 hiredman: rhickey: (scope ...) should be (horizon ...) and calling (when-hrz ...) outside of a horizon should throw a naked singularity exception

11:51 rhickey: cgrand: I agree, it's between pvals and plist

11:51 * stuarthalloway hates plist

11:51 hiredman: plist is nice

11:51 danlarkin: I dislike pvals, sounds too much like vals, which is totally unrelated

11:51 * stuarthalloway but likes hiredman just fine

11:52 * hiredman interprets that as a sign of weakness

11:52 MarkVolkmann: Why does (ns-map 'clojure.contrib.math) return include all the mappings from core?

11:52 Chouser: danlarkin: nice point.

11:52 rhickey: danlarkin: true, pcals and vals are unrelated

11:52 pvals

11:53 stuarthalloway: MarkVolkmann: use ns-interns instead

11:53 AWizzArd: or why not embed pvals into the macro, then there is only one thing that needs a name (the macro)

11:53 rhickey: AWizzArd: that's not important, only the resulting macro name

11:54 pseq?

11:54 danlarkin: pexprs is kinda neat, since it's a play on sexprs, Parallel versus Serial?

11:55 hiredman: hah, cute

11:56 AWizzArd: danlarkin: ah that's what the s stands for... ;)

11:57 I think plist sounds nice. It is close to list.

11:58 cgrand: pvalues? there are more differences between pseq and seq than between plist and list

11:59 rhickey: cgrand: I like pvalues

11:59 * danlarkin wonders if this is how most of the time writing the common lisp spec was spent

11:59 AWizzArd: We could ask Kent Pitman

12:00 if it is between pvals and pvalues I like pvals better, as this is shorter

12:01 rhickey: Ok, vote, pvals or pvalues?

12:01 AWizzArd: vals

12:01 stuarthalloway: pvals

12:02 arbscht: pvals, in keeping with 'vars' and 'keyvals'

12:04 cgrand: pvalues because of vals

12:04 Chouser: pvalues because cgrand said so

12:04 rhickey: Chouser: cop out :)

12:04 danlarkin: same as Christophe

12:05 Chouser: er, um, I mean -- for the reasons cgrand gave.

12:05 danlarkin: that is, pvalues

12:05 rhickey: wait for clojurebot...

12:06 thanks all for the feedback!

12:07 LordOfTheNoobs: , (if (> 0.5 (rand)) "pvalues" "plist")

12:07 ,(if (> 0.5 (rand)) "pvalues" "plist")

12:07 clojurebot: "pvalues"

12:07 * danlarkin cheers!!

12:10 clojurebot: svn rev 1235; added pcalls, pvalues

12:12 rhickey: have at it

12:15 lisppaste8: danlarkin annotated #74247 with "using defn" at http://paste.lisp.org/display/74247#1

12:16 danlarkin: rhickey: is that paste like what you were suggesting regarding multimethods saving vars instead of function objects?

12:17 rhickey: danlarkin: not quite - add-method should be a function

12:18 (add-method manager-dispatch :default #'manager-dispatch-default)

12:19 danlarkin: rhickey: why should it be a function instead of a macro?

12:20 rhickey: danlarkin: because that would have general utility for dynamic use, and could be used for your purpose as well

12:20 (map add-method ...)

12:21 danlarkin: Mmmmhm, that makes sense

12:23 thanks for the help

12:24 rhickey: (+ 1 ##2 3)

12:24 -> 4

12:25 thoughts?

12:25 danlarkin: I kinda like #- but what do I know

12:26 jbondeson: I'm with the #- crowd

12:26 ## looks odd to me

12:28 Chouser: they're all strike me as ugly

12:28 jbondeson: heh

12:28 Chouser: but my problem may be with the concept as much as the syntax

12:28 jbondeson: lesser of the evils Chouser, it's like voting for anything else

12:28 ayrnieu: pvalues says "sequence of the values of the exprs", list says "list containing the items". Is there any difference in how they treat the exprs given to them?

12:29 jkantz: well, coming from common lisp I find #+:foo useful

12:29 with a corresponding *features* variable

12:29 and often write #+nil

12:29 Chouser: can't we group it... (+ 1 (read-if 2 3))

12:29 rhickey: jkantz: right, that's the only problem with using #- here, no test, no use of *features*

12:30 jbondeson: Chouser: that require much more work for quickly getting rid of forms.

12:30 technomancy: so the server-socket library has some example code in the form of a socket-repl, but the example does silly things with java.io.OUtputStreamWriter and LineNumberingPushbackReader that strike me as unnecessary detail. what if we made it use duck-streams instead?

12:30 * technomancy was personally lead astray by the example code

12:30 jbondeson: rhickey: but if you use #- you could always add it later, correct?

12:30 rather than add a second reader-macro for features you could expand.

12:31 rhickey: jbondeson: no, because the immediately following form would not be interpreted as a test

12:31 jkantz: yeah existing code would get confused once it's added

12:31 jbondeson: hmmm, i guess it would be breaking.

12:31 rhickey: if #-foo eats foo it would be a breakling change to later say #-test foo

12:31 breaking

12:31 ayrnieu: (if this is just to have a (comment) that doesn't return anything, why not make (comment) not return anything?)

12:32 technomancy: what's this for?

12:33 jbondeson: reader macro for commenting out a form

12:33 Chouser: oh! see, I already misunderstood the example. I thought ##2 was using the trueness of 2 to include 3

12:34 rhickey: ## (or whatever) would just eat the next form

12:34 technomancy: jbondeson: huh; handy

12:34 jbondeson: i guess with that argument i'm swayed toward ## or something else so #-/+ can be reserved for features

12:35 #~ or something would also work, but is harder to type.

12:35 jkantz: wow that's eery, a random person just walked into my office asking me what #+bugxyz meant in some lisp code

12:36 jbondeson: but that would get confused with ~

12:36 hmmm

12:36 naming is the hardest part of apis

12:36 ayrnieu: Nobody'll ask what (comment ) means. And if they think to notice that it doesn't return anything because it's a magical read-time form, they'll just say "oh, that makes sense."

12:37 jbondeson: but a form is harder to add/remove than a reader macro

12:37 the most common use is quickly adding/removing a form

12:37 rhickey: ayrnieu: it really doesn't work to have to add structure

12:46 duck1123: couldn't we have both, (comment) doesn't return anything and ## is a reader macro for (comment)?

12:47 I've been bitten by the (comment) => nil when trying to remove a section of code in a fn for testing

12:48 gnuvince: I have a doseq that iterates over a list of files given at the command line. What would be the best way to accumulate the total number of lines? I was thinking of using reduce, but I feel uncomfortable sticking side effects in there.

12:48 rhickey: (comment ...) isn't on the table right now, just need to pick a dispatch character for ##/#- reader discarder

12:49 LordOfTheNoobs: #comment:

12:50 WizardofWestmarc: that seems far too verbose.

12:51 and depending on font, #- might not be as readable, so I'd say go w/##

12:51 duck1123: are letters out of the question? #d (for delete)

12:51 kotarak: #; would be nice. Editors can be fixed.

12:52 * technomancy likes #;

12:52 rhickey: leaning towards #-, as when using to remove an existing #{} or #(), ##() and ##{} will work, but when uncommenting easy to make a mistake

12:52 kotarak: eventually, but a real short-term problem

12:53 duck1123: letters are out for now

12:54 kotarak: #% #$ #? #* ...

12:54 % is comment in TeX. So maybe #%?

12:54 duck1123: then I like #- I would vote for #; but the editor breakage would be too much. (especially on the simple editors)

12:54 LordOfTheNoobs: if you could either #; or #\; , emacs, at least, syntactically seems to support the latter.

12:55 mmcgrana: Is there any reason that (name k) would ever return nil for a keyword k?

12:55 ayrnieu: gnuvince, you can write a doseq that also carries the number for you (binding an additional parameter to an initial value, then updating it based on the value of the last form in the body) or you can update a Ref

12:55 LordOfTheNoobs: Of course then noone would update the editors from only supporting the #\; option, so nevermind.

12:57 ayrnieu: I like ## , # has the same comment value of these suggestions, it's easy to type, it doesn't suggest or stomp over CL ideas.

12:57 gnuvince: ayrnieu: I'd rather stay away from refs if I can avoid it without too much of a readability penalty

12:58 ayrnieu: gnuvince - (doseqlet [n 0] [f files] ... (+ n read-lines)) => total-lines

12:58 gnuvince: doseqlet?

12:58 Is that in contrib?

12:58 ayrnieu: as a proposed name.

12:58 rhickey: mmcgrana: shouldn't

12:59 gnuvince: I might also use loop instead of doseq

13:05 That's a whole lot less readable though :-/

13:06 Chouser: gnuvince: what side effects? opening and closing files?

13:06 rhickey: #_ ?

13:06 lisppaste8: gnuvince pasted "loop vs doseq" at http://paste.lisp.org/display/74271

13:07 kotarak: #_ is also nice. Following the _ "don't care" convention for locals and function params.

13:08 jbondeson: #_( ... ) might not look too bad

13:08 hiredman: gnuvince: you can make a lazy seq of thunks calling readline and take-while not nil

13:08 jacky_: I am a bit confused about namespaces -- I have my c:\user directory where I have a file called json/json.clj json.clj contains (ns json). I have another file json_tests.clj which contains (use 'json) . I added c:\user to classpath using (add-classpath "file://c:/user/"). When I run json_tests.clj, I get an error java.io.FileNotFoundException: Could not locate json__init.class or json.clj on

13:08 classpath: (json_tests.clj:0)

13:08 hiredman: and call count on it

13:08 ayrnieu: gnuvince - that isn't a whole lot less readable, it's just longer.

13:08 lisppaste8: Chouser annotated #74271 with "less ceremony" at http://paste.lisp.org/display/74271#1

13:09 * gnuvince always forgets line-seq

13:09 hiredman: oh

13:09 yeah

13:10 *that*

13:10 Chouser: oh, but you're asking about the other loop?

13:10 kotarak: jacky_: the namespace must be named json.json or the json.clj must be moved up one level in the directory hierarchy.

13:10 gnuvince: Chouser: yes

13:10 I commented what I had before

13:10 I wanted to include the total number of lines

13:10 (somewhat like wc -l)

13:10 kotarak: jacky_: I vaguely remember, that there should at least be one . in the namespace. So I would suggest to try json.json.

13:11 gnuvince: And short of using an atom, I don't see how I can keep the code short

13:11 hiredman: wiat

13:11 woa

13:11 fold2

13:12 hmmm

13:12 ayrnieu: makes sense.

13:12 hiredman: the only thing is with fold2 you would end up counting the lines twice

13:12 ayrnieu: can you append a lazy finite seq onto the end of another one?

13:12 hiredman: ayrnieu: concat

13:13 ayrnieu: then string all the files together, with a separator, and then count lines once :_)

13:13 mmcgrana: o boy, i had a parameter named "name" that had a keyword value, got nil because (:foo :bar) => nil, sorry to bother...

13:14 hiredman: ,(name nil)

13:14 clojurebot: java.lang.NullPointerException

13:14 mmcgrana: ,(:foo :bar)

13:14 clojurebot: nil

13:14 hiredman: yeah

13:15 mmcgrana: ,(let [name :foo] (name :bar))

13:15 clojurebot: nil

13:15 hiredman: ,(:foo :bar :baz)

13:15 clojurebot: :baz

13:15 hiredman: mmcgrana: oh, nice

13:15 Chouser: yeah, local names that are tempting but dangerous: name vector vec list map set ref agent count

13:15 kotarak: fn

13:15 Chouser: indeed

13:16 kotarak: Little sins are punished immediately, bigger sins some time later on...

13:19 Lau_of_DK: Gooood evening gents =)

13:19 kotarak: Hi Lau

13:21 shoover: jacky_: you need file:///c:/... on Windows (3 slashes)

13:23 lisppaste8: Chouser annotated #74271 with "spit up side-effects and functional code?" at http://paste.lisp.org/display/74271#2

13:23 stuhood: i just got bitten by the fact that (printf) doesn't flush, and my app finished without outputting something i wanted

13:24 it seems like the clojure runtime ought to flush streams it controls before it closes down

13:24 Chouser: (doc *flush-on-newline*)

13:24 clojurebot: When set to true, output will be flushed whenever a newline is printed. Defaults to true.; arglists

13:24 Lau_of_DK: Shouldnt someone consider closing the sourceforge repo, or is it still kept current ?

13:25 stuhood: Chouser: yes, but this particular app doesn't print any newlines

13:25 LordOfTheNoobs: Would it have been bad form for gnuvince to use `for' instead of `doseq' passing out a seq of lengths and then sum them in a surrounding let?

13:26 stuhood: shouldn't clojure flush out/err before dying?

13:26 hiredman: you could return a data structure of filenames/line counts, pass it to reduce, reduce prints out filenames/line counts while accumulating the line count and then print the output of reduce

13:27 ayrnieu: ,(let [old printf] (defn printf [& args] (apply old args) (flush)))

13:27 clojurebot: DENIED

13:27 Chouser: hiredman: similar to what I pasted.

13:28 gnuvince: LordOfTheNoobs: for is used for list comprehensions, and I don't believe it's good style to stick side effects in there.

13:28 stuhood: ayrnieu: i can understand why the buffering is nice, so i wouldn't want to eliminate it completely

13:28 gnuvince: Like it isn't good style to use println in a map call

13:29 stuhood: i'm just suggesting that the default behaviour to be to 'just work'

13:30 Chouser: stuhood: you were using clojure.lang.Script, or clojure.main?

13:30 stuhood: Chouser: the -main method of a gen'd class

13:38 * technomancy thought of a great slogan for Clojure: "Mutability you can believe in."

13:38 technomancy: s/you/we/

13:39 WizardofWestmarc: pity jquery already uses the "write less, do more" slogan

13:39 technomancy: clojurebot: clojure?

13:39 clojurebot: clojure > scheme

13:40 technomancy: clojurebot: slogan?

13:40 clojurebot: Excuse me?

13:40 rhickey: technomancy: ouch

13:40 technomancy: clojurebot: slogan is "Mutability we can believe in."

13:40 clojurebot: 'Sea, mhuise.

13:40 frodwith: Clojure: There are lambdas in my coffee!

13:40 technomancy: heh

13:40 (since there's nothing there already)

13:42 * kotarak finds "Lisp is not dead! It's just the URL that changed: http://clojure.org" nice. :)

13:42 WizardofWestmarc: haha ok that one's pretty good

13:42 technomancy: ooh; that's good too

13:42 kotarak: idea by AWizzArd

13:42 technomancy: kotarak: 301 Moved Permanently

13:44 * gnuvince gave in and used an atom :-/

13:44 lisppaste8: gnuvince annotated #74271 with "using atoms" at http://paste.lisp.org/display/74271#3

13:45 Chouser: gnuvince: out of curiosity, what didn't you like about #2?

13:45 hiredman: ugh

13:45 I am disgusted with you

13:46 gnuvince: Chouser: I just saw that there was a second annotation.

13:46 I was away from my computer for a while

13:47 Chouser: pretty good

13:48 Chouser: I forgot to include the "no such file" output.

13:48 hiredman: ~horizon

13:48 clojurebot: horizons is http://gist.github.com/51721

13:48 gnuvince: Chouser: I can figure how to do that

13:49 hiredman: you should totally be using Readers that get closed when you leave their horizon

13:50 Chouser: :-( yeah, I always forget that.

13:51 rhickey: Chouser: so how would you feel if line-seq balked if called not in a scope?

13:51 Chouser: rhickey: I think I'd like that.

13:52 rhickey: I was just about to move that into core when I started thinking about named scopes, rather than just nested

13:53 things like line-seq could take an optional scope

13:53 Chouser: named would allow non-nested structures?

13:53 hiredman: is the plan for binding create a scope?

13:53 Chouser: non-nested usage, I guess.

13:53 rhickey: if not supplied would use nearest enclosing

13:54 hiredman: or would you need (binding [a bindings] (scope ...))

13:54 lisppaste8: gnuvince annotated #74271 with "Chouser rocks" at http://paste.lisp.org/display/74271#4

13:54 Chouser: you'd create and "finish" named scopes imperatively?

13:54 rhickey: Chouser: scopes would be nested, but you could be bound to one other than the nearest enclosing

13:54 hiredman: and binding has a scope, so why call scope scope?

13:55 seems like asking for confusion

13:55 Chouser: rhickey: ah, ok. That makes sense. Sounds useful, but not a breaking change.

13:55 hiredman: I am in scope but not in a scope

13:56 Chouser: hiredman: you have a better name for an macro that creates a scope to restrict side-effects?

13:56 hiredman: Chouser: horizon

13:56 as in event horizon

13:56 jbondeson: (dont-do-stupid-stuff-here) ?

13:57 hiredman: as in cosmic censorship which hides singularities

13:57 jbondeson: horizon is a little of a stretch

13:58 sounds like some kind of contract macro

13:58 rhickey: Chouser: it might impact argument ordering, implicit blocks etc, e.g. (when-scope fred-scope :exits ...)

14:00 scope names would alleviate the (common) need to also do a binding, when scope is to be used in nested context with no scopes in parameter lists of intervening call chain

14:00 jbondeson: i just re-read that and realized i took Chouser's "side effect" too literally, sorry

14:10 Chouser: I don't think using the word "scope" would be any more confusing than the word "binding".

14:10 'binding' creates a dynamically scoped binding, but there are other kinds of scopes (lexical and soon IO or whatever) and other kinds of bindings (let, args, etc.)

14:11 hiredman: clojurebot: bucket is http://wiki.xkcd.com/irc/Bucket#Docs

14:11 clojurebot: Ok.

14:11 hiredman: Ok.

14:12 lisppaste8: danlarkin annotated #74247 with "wrapper on add-method" at http://paste.lisp.org/display/74247#2

14:13 danlarkin: rhickey: there's a python decorator-esque wrapper for add-method

14:16 sethtrain: quick question, i am using clojure.main in my java call to run the Repl do I still use clojure.lang.Script to run a script?

14:18 danlarkin: sethtrain: no, you can use clojure.main for running a script too

14:18 sethtrain: ok, thanks.

14:23 kotarak: Can I specify the source information when (read)ing and (eval)ing? Something like (binding [*file* "foo.clj" *line* 5] (read stuff))?

14:25 hiredman: clojurebot: say hello to someone

14:25 clojurebot: Hello, Winterstream

14:26 hiredman: clojurebot: say hello to someone else

14:26 clojurebot: Hello, lisppaste8

14:26 hiredman: Hah

14:27 danlarkin: clojurebot: say hello to hiredman

14:27 clojurebot: BUENOS DING DONG DIDDLY DIOS, fRaUline danlarkin

14:27 danlarkin: ...whoah

14:28 hiredman: hidden depths

14:36 Chouser: kotarak: I think there's no way to set the *line*, and the reader doesn't know or care about the file name.

14:48 noidi: is there a clojure syntax file for vim that handles indentation?

14:49 rhickey: danlarkin: I don't understand the need for def-method as you could just replace it with add-method

14:50 gnuvince: noidi: I just used (past tense, switched to Emacs ;) :set lisp and added a few lispwords

14:50 noidi: ah, stupid me, should've googled first :P

14:50 ozy`: noidi: yes but you have to have the vimclojure plug installed

14:50 noidi: http://kotka.de/projects/clojure/vimclojure.html

14:50 gnuvince: (def, defn, loop, etc.)

14:50 noidi: thanks, and sorry :)

14:50 ozy`: (if you don't, it barfs errors all over your screen and won't indent anything)

14:51 noidi: gnuvince, how's it working out for you?

14:51 danlarkin: rhickey: just sugar I guess, don't have to have a call to add-method after you define a function since the macro does it for you

14:52 rhickey: danlarkin: no, literally, just replace def-method with add-method and it works

14:53 noidi: i tried emacs for a few weeks last summer (been a vim user for 8 years) but i just couldn't live without modal editing :)

14:53 gnuvince: noidi: like I said, I switched to Emacs and Slime

14:53 noidi: gnuvince, the switch, I mean :)

14:53 danlarkin: rhickey: oh.. d'oh you're right, silly me :-o

14:53 gnuvince: noidi: I already had experience. My editor journey has been vim (5 yrs) -> Emacs (2 yrs) -> Vim (2 yrs) -> Both (now)

14:54 noidi: now that I bought Programming Clojure, I might have an incentive to switch editors if the difference is big enough

14:54 gnuvince: noidi: the only advice I can give you is, try to power your way through and try to view the advantages that Emacs brings and learn to cope with the shortcomings.

14:54 WizardofWestmarc: I'm working my way to both land, but they're so different it bends the brain sometimes.

14:54 of course I'm not a vim master.

14:54 gnuvince: Editing text in Emacs is 10x worse than in Vim, but working with an interactive environment is 10x better

14:55 WizardofWestmarc: agreed on that front

14:55 gnuvince: So things sort of even themselves out.

14:55 jbondeson: the day you rebind your control key is the day you give yourself over to emacs...

14:55 WizardofWestmarc: which is why I use vim for everything except lisps

14:55 noidi: sorry about bringing up vim and emacs! :D

14:55 Chouser: gnuvince: does slime provide a significant (for you) advantage over inferior-lisp-mode or whatever it's called?

14:55 WizardofWestmarc: meh, no one's being zealous.

14:55 gnuvince: noidi: no problem; no reason cannot be civil about it.

14:56 noidi: :)

14:56 gnuvince: Chouser: auto-completion is nice, seeing the arguments accepted by a syntax is another one

14:56 There are also keyboard shortcuts like C-c C-d d to view the documentation of the symbol under the cursor

14:57 Chouser: ok, thanks.

14:57 * rhickey is slime free - clojure-mode + inferior-lis only

14:57 rhickey: lisp

14:58 gnuvince: Somebody (billc maybe?) ought to put together a 5 minute screencast of Slime and Clojure

14:58 Chouser: rhickey: it seems like you'd have to be, or otherwise also maintain slime/swank code along with the language.

14:58 WizardofWestmarc: should get the stumpvm guy to voiceover for it

14:58 gnuvince: WizardofWestmarc: who?

14:58 WizardofWestmarc: lemme find the video

14:59 he's got this crazy voice

14:59 jbondeson: i actually leave completion off in the non-repl windows. years of visual studio have made me realize how much of a crutch it can create.

14:59 WizardofWestmarc: and if you don't know it stumpvm is a window manager for x that lets you modify it on the fly with lisp

14:59 err wm

14:59 not vm *dur*

14:59 gnuvince: Oh wait, he has like this super barytone voice?

14:59 WizardofWestmarc: yeah

14:59 kotarak: Chouser: the source information is handled in the compiler, I guess. Is there maybe an interface?

14:59 gnuvince: Yeah, I recall the voice, not so much the screencast itself.

15:00 WizardofWestmarc: http://www.youtube.com/watch?v=tKt_rVO960Q&eurl=http://functionalrants.wordpress.com/2008/09/23/stumpwm/

15:00 Chouser: kotarak: line numbers appear to be handled at the reader level, but I don't see any way to start it off at an arbitrary number.

15:01 kotarak: Chouser: -.- Ok. Thanks for the info.

15:01 Chouser: kotarak: file names are handled at the compiler level, i think, but if you're just calling "read" that level's not involved.

15:01 hm.

15:02 kotarak: Chouser: I'm currently rewriting the gorilla repl. I'd like to set the source file & line info when sending an expression.

15:03 Chouser: yeah, that'd be nice. I don't think it'd be too hard to open up the API a little to allow for that, but I don't see a way to do it currently.

15:03 of course I could just be missing something.

15:05 kotarak: Chouser: Stephen's repl_ln pushed thread-local bindings for Compiler/SOURCE and Compiler/LINE. Is this voodoo or allowed?

15:07 hiredman: clojurebot: whose job is<reply>that is #someones job

15:07 clojurebot: Ok.

15:07 hiredman: clojurebot: whose job is that?

15:07 clojurebot: No entiendo

15:07 hiredman: damn you sure

15:07 clojurebot: whose job is <reply>that is #someones job

15:07 clojurebot: You don't have to tell me twice.

15:07 hiredman: clojurebot: whose job is that?

15:07 clojurebot: that is Zzompps job

15:08 hiredman: clojurebot: whose job is <reply>that is #someone's job

15:08 clojurebot: Ik begrijp

15:13 hiredman: clojurebot: whose job is it to keep the riff-raff out?

15:13 clojurebot: that is te's job

15:13 Lau_of_DK: hiredman: Sometimes I worry about you

15:14 hiredman: clojurebot: whose job is it to worry about hiredman?

15:14 clojurebot: that is hiredman's job

15:14 hiredman: :P

15:15 that is pretty amazing

15:15 it randomly picked my nick out of the list of people in the channel and plugged it into that factoid

15:17 Lau_of_DK: clojurebot: whose taught you to pick random names?

15:17 clojurebot: Pardon?

15:17 Lau_of_DK: noob

15:18 hiredman: clojurebot: whose job is it to make excuses for your bad behaviour?

15:18 clojurebot: that is l_a_m's job

15:20 danlarkin: chances were 1/130

15:20 assuming it can pick itself

15:20 hiredman: uh, it cannot

15:21 infact it picks from the list of everyone in all the channels it is in, so it was like 2/130

15:21 wait, not

15:22 2/131

15:39 knapr: what is the easiest way to play a .mp3 file in java?

15:46 gnuvince: It's funny that this guy is using Haskell-like type signatures: http://npcontemplation.blogspot.com/2009/01/clojure-genetic-mona-lisa-problem-in.html

15:51 hiredman: gnuvince: ugh

15:52 yeah, last week there was a bit of an ado on the group about type tags

15:52 gnuvince: hiredman: ?

15:52 yeah?

15:52 I must've missed that

15:52 What thread was that?

15:52 hiredman: hey, here is a dynamic language, LETS ADD TYPES!

15:53 I don't recall, exactly, I read a bit, was just sort of weirded out that people would be trying to go oop all up on clojure

15:55 gnuvince: hmmm, can't seem to find it.

15:56 danlarkin: whoah, I'm loving the type sig comments

15:56 hiredman: danlarkin: eh?

15:57 gnuvince: danlarkin: it's not the first time I've seen them; I'm pretty sure I recall somebody writing Python code with this notation

15:57 danlarkin: in this guy's code

15:57 ozy`: those are valid haskell type signatures

15:58 hiredman: oh

15:58 ozy`: I wouldn't be surprised if someone translated the whole thing into haskell starting with those comments...

15:58 hiredman: maybe he started with haskell?

15:59 gnuvince: hiredman: his profile suggests a Common Lisp background.

15:59 My guess is he liked the notation and adopted it to comment his functions.

15:59 ozy`: hiredman: or maybe he learned haskell at some point, and ever since then he's liked the "start with the type signature" mindset

16:00 knapr: gnuvince: ive written python code ith that notatioon :) haskell is cool

16:00 gnuvince: Yes it is

16:00 Chouser: My eyes glaze over when I try to read: Integer -> Integer -> Integer -> Integer -> Color

16:00 knapr: i do miss typesdeclarations in dynamic languages, the documentational features are good

16:01 does the monalisa example run for you?

16:01 Chouser: perhaps I just need to get used to it. I suppose my eyes glazed over trying to read lisp paren-code at one point too.

16:01 knapr: java.lang.Exception: EOF while reading (monalisagp.clj:238)

16:01 user=>

16:01 what does that point to really?

16:01 gnuvince: knapr: unclosed paren

16:01 hiredman: missing paren

16:01 gnuvince: did you copy the code from the site or did you clone his git repo?

16:01 ozy`: there's a single close paren on the last line

16:02 don't miss it when you copy it

16:02 hiredman: hmmm

16:03 I guess he uses :type as the dispatch for mutate

16:04 clojurebot: whose job is it to keep knapr's internet connection working?

16:04 clojurebot: that is arbscht's job

16:04 ozy`: clojurebot: dude like whoa

16:04 clojurebot: Huh?

16:08 knapr: im switching in 3months(!) had a long resign-time

16:08 im writing a simple mp3player for myself, what is the best way to play mp3s in java? i already have the gui working

16:08 BigTom: hi - any eulers here?

16:10 knapr: yes im his great great great grandson, wassup?

16:10 Lau_of_DK: BigTom: All Eulers listed on clojure-euler.wikispaces.com :)

16:12 BigTom: ah, thanks

16:12 what is a good time for euler-7?

16:14 Lau_of_DK: 0.5 secs

16:14 BigTom: ah, cool :-)

16:15 I started at 18s which was a bit depressing

16:15 Lau_of_DK: How low can you go ?

16:16 BigTom: but I am down to 513ms now

16:16 hiredman: "Elapsed time: 0.385 msecs"

16:16 hmmm

16:16 oh

16:16 <-- cheating

16:17 Chouser: I've got a version that runs in 0.07 seconds, but you have to give it the size of the seive up front, so that's rather a cheat as well.

16:17 BigTom: I could go multithreaded I guess

16:17 Lau_of_DK: BigTom: I've found the best way to protect your selfesteem in these discussions is simply to run this command from irc /ignore Chouser

16:17 BigTom: :-)

16:18 I think I'll stick with 0.5s until I am a bit better at this

16:18 Chouser: heh

16:18 BigTom: Also...

16:18 Is anyone actually using StringTemplate for web pages?

16:19 Lau_of_DK: 0.5 is very good BigTom, unless youre running your code on a Blade server :)

16:22 BigTom: Well that's nice to know

16:23 onto 8! :-)

16:24 shoover: BigTom: no web pages yet, but I have experimented with StringTemplate in the REPL

16:26 BigTom: ok, I was planning to investigate it over the next few days. Maybe we can compare notes.

16:27 Chouser: I saw a reference to an algorithm for estimating the sieve size, I'm not a mathematician so I don't know if its valid

16:28 Chouser: hm! that's interesting.

16:29 it could be a pretty expensive calculation as long as it consistently overestimates by only 100 or 200% and still be a win.

16:30 cooldude127: technomancy: you in here?

16:31 LordOfTheNoobs: clojurebot: whose job is it to keep track of technomancy?

16:31 clojurebot: that is mrsolo__'s job

16:32 BigTom: http://mathworld.wolfram.com/PrimeNumberTheorem.html

16:32 cooldude127: lol

16:33 hiredman: clojurebot: seen technomancy?

16:33 clojurebot: technomancy was last seen in #clojure, 171 minutes ago saying: kotarak: 301 Moved Permanently

16:34 hiredman: it is clojurebot's job actually

16:34 cooldude127: oh i found him in #emacs

16:34 Chouser: BigTom: thanks

16:35 BigTom: Chouser: Enjoy! :-)

16:38 knapr: god isnt there a simple mp3lib where you cna just load a friggin file and play it?

16:40 Chouser: knapr: the easiest API I know of is stuck inside the Applet class.

16:40 technomancy: knapr: nothing is simple in Java. I predict at least three factories will be involved.

16:40 also: the mp3 format is patented.

16:41 hiredman: knapr: google around

16:41 the first hit on google for "java mp3 player" looks very promising

16:50 LordOfTheNoobs: clojurebot: seen LordOfTheNoobs?

16:50 clojurebot: LordOfTheNoobs was last seen in #clojure, 0 minutes ago saying: clojurebot: seen LordOfTheNoobs?

16:50 LordOfTheNoobs: lol

16:50 technomancy: careful there; you don't want to cause a feedback loop.

16:51 hiredman: the deal there that keeps track of the last thing someone said sits at the top of the priority queue

16:52 Lau_of_DK: Is there a simple way for my program to determine if its running on Windows, Mac or Linux? And I dont mean to check if bootlog for 20 secs or 5 minz

16:53 LordOfTheNoobs: clojurebot: test?

16:53 clojurebot: latest contrib is 334

16:53 LordOfTheNoobs: clojurebot: abc?

16:53 clojurebot: No entiendo

16:53 hiredman: Lau_of_DK: os.name system property

16:53 LordOfTheNoobs: clojurebot: abc is clojurebot: seen clojurebot

16:53 clojurebot: no, I have not seen abc

16:54 LordOfTheNoobs: clojurebot: abc?

16:54 clojurebot: Pardon?

16:54 LordOfTheNoobs: clojurebot: abc is <reply>clojurebot: seen clojurebot

16:54 clojurebot: no, I have not seen abc

16:55 hiredman: LordOfTheNoobs: I recommend #clojurebot for mucking around with clojurebot

16:55 Lau_of_DK: hiredman: Thanks

16:55 LordOfTheNoobs: Ah, thank you.

17:02 hiredman: ~ exceptions

17:02 clojurebot: exceptions is http://wuhrr.wordpress.com/2007/11/22/java-exceptions-list/

17:02 Lau_of_DK: For some reason Im having trouble importing QString from qt.core - anyone else run into this?

17:02 durka42: hmm, if one can remember enough of the exception to generate a regular expression that will match it, my "smuggler" library can help

17:04 Gorilla=> (count (flatten (lookup-re db #"Exception$")))

17:04 835

17:06 walters_: "really it helps lot for me. Is any other exception other than in ur list. if so please update."

17:06 Lau_of_DK: nvm regarding QString

17:06 walters_: awesome.

17:09 knapr: hmm im slowly migrating towards clojure from python for a lot of things

17:10 if i need to use java-threads how should i do? use them directly or use aganets or refs?

17:10 hiredman: clojure functions are Runnable

17:11 so you can (.start (Thread. (fn [] (println "foo"))))

17:11 durka42: lisppaste8: are you alive?

17:11 hiredman: lisppaste8: url?

17:11 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

17:12 knapr: also when i started to play an mp3 it freezed my player, i wasnt using a thread, so that si normal then?

17:12 doe spython thread for you automaticlly or something?

17:13 lisppaste8: durka pasted "exceptions" at http://paste.lisp.org/display/74305

17:13 hiredman: knapr: it depends

17:13 durka42: warning: very large paste

17:13 hiredman: the library may or may not thread stuff

17:13 the java ui stuff can be very particular about threading

17:13 durka42: anyway, to answer that commenter's question: yes, there a few more and here they are

17:14 hiredman: e.g. there is a particular input thread, and god help your soul if you do work in the input thread

17:14 durka42: hmm, should i comment on hai's post

17:15 hiredman: clojurebot: exceptions is <reply>http://paste.lisp.org/display/74305

17:15 clojurebot: Alles klar

17:16 hiredman: org.jibble.pircbot.IrcException <-- ha ha

17:16 durka42: i suppose pircbot isn't on the typical classpath

17:16 so perhaps there are few less than 835

17:17 (this searches classpath, ext dirs and endorsed dirs)

17:17 knapr: any good link to java threads?

17:21 durka42: Gorilla=> (count (lookup-re db #"Factory"))

17:21 696

17:21 sigh

17:21 mrsolo__: "..Lambdas are not garbage collected..." is this still true?

17:22 hiredman: in what context?

17:22 durka42: apparently not, see cgrand's comment beow

17:22 below

17:22 there are 5 FactoryFactory's and they are all in CORBA

17:22 mrsolo__: http://npcontemplation.blogspot.com/2009/01/clojure-genetic-mona-lisa-problem-in.html

17:22 hiredman: ah

17:22 yes, PermGen

17:22 mrsolo__: "...each lambda in Clojure is an anonymous class in Java. The problem is that classes are never garbage collected. They reside in a special place called the PermGen.

17:22 "

17:23 durka42: cgrand says that's no longer true, although he didn't give details

17:23 hiredman: svn rev 1232

17:23 clojurebot: svn rev 1232; made eval use ephemeral classloader in all cases

17:23 hiredman: ^-

17:25 walters_: that guy's program is special in that he's creating function definitions at runtime

17:25 using eval

17:30 mrsolo__: walters: i just start learning clojure but that sounds like a pretty common programming technique?

17:30 hiredman: mrsolo__: no

17:31 eval'ing is general seen as unhygenic

17:32 Chouser: the common exceptions are REPLs and the kind of AI programming in the article. Both cases should be solved by rev 1232, I would think.

17:32 hiredman: clojurebot: whose job is to keep Chouser informed of everything so he can correct me all the time?

17:32 clojurebot: that is noidi's job

17:32 hiredman: :P

17:33 Chouser: hiredman: No, you were absolutely.

17:33 right.

17:35 knapr: anyone have a good codesnippet using threds they could show?

17:36 what is the idiomatic thin to do in clojure when usign threads? use agents?

17:36 durka42: agents are cool

17:36 they do use thread pools internally

17:36 Chouser: there are cases where you need threads that agents are a poor fit.

17:36 hiredman: Chouser: I just enjoy playing with clojurebot

17:37 Chouser: knapr: I wrote a little thing about adding agents to a project euler solution, if that's of any interest: http://blog.n01se.net/?p=34

17:46 knapr: ty

18:47 is there a clojure function to list all files ina dir?

18:48 duck1123: knapr: I think you can do that with one of the apache commons libs

18:48 durka42: do you need to recurse?

18:48 if you don't just use java.io.File

18:49 if you do i have a function built on tree-seq that you might be interested in...

19:05 knapr: how do i make a regex from a string?

19:05 like users passes ganja and i want to find ganja-smuggling by eek a mouse

19:05 (make-regex #str)

19:08 gnuvince_: knapr: (re-pattern str)

19:09 wwmorgan: is there a way to set java annotations in .class files?

19:09 gnuvince_: ,(re-seq (re-pattern "(.)(\d)") "hello3")

19:09 clojurebot: Eval-in-box threw an exception:Unsupported escape character: \d

19:09 gnuvince_: ,(re-seq (re-pattern "(.)(\\d)") "hello3")

19:09 clojurebot: (["o3" "o" "3"])

19:11 Cark: hum : http://npcontemplation.blogspot.com/2009/01/clojure-genetic-mona-lisa-problem-in.html

19:11 i think using eval isn't the right thing to do

19:11 besides it's a big misleading saying "Lambdas are not garbage collected"

19:11 a bit*

19:13 people will think that calling (defn bleh [] (fn [] dosomething)) will go to permgen

19:13 which is not true

19:16 knapr: how would you do without eval?

19:16 Cark: make your own interpreter... there's a tradition of doing such things in lisp

19:17 that's pretty easy too

19:17 i bet you could get better performances in the end

19:18 gnuvince_: Do it :)

19:18 hiredman: Cark: and that issue is fixed, apparently

19:18 gnuvince_: Yes, cgrand pointed it out in the comments.

19:18 hiredman: svn rev 1232

19:18 clojurebot: svn rev 1232; made eval use ephemeral classloader in all cases

19:19 gnuvince_: I like that he used Haskell-like notation for type declarations

19:30 knapr: Cark: but what is the advantage of making your own interpreter?

19:30 except for potential speed-up?

19:30 Cark: i thought about it, and actually would only mutate data structures really

19:30 knapr: i did my own genetic programming with eval

19:30 Cark: (for the problem at hand)

19:31 knapr: but you need to evaluate them somehow...

19:31 Cark: right, data is code

19:31 you only need a bunch of lists of triangles with color there

19:32 mutate that, that's your program

19:32 knapr: yes but how do you eval which ons is better fitted?

19:32 Cark: then interpret it ....draw the triangles

19:32 knapr: yes and then how do you decide...

19:32 Cark: juste the same as he does

19:33 knapr: so then you use eval...

19:33 or your own

19:33 Cark: you don't need an eval at all

19:33 not even an interpreter

19:33 juste draw your triangles on a canvas, and check fitness

19:33 knapr: how?

19:34 for pixel in pixles?

19:34 pixels

19:34 if pixel == pixel

19:34 Cark: i didn't quite look at how he does it, but i guess that's the way, compare pixels, find pixel fitness, sum them all

19:37 hte individual in your population would be a list of maps with fields point1 to point3 and a color

19:37 or an array, which would make the crossover easier i guess

19:42 hiredman: knapr: what do you mean by "eval"

19:42 the way you are using it makes be think you mean something else

19:45 knapr: well i ws doing function finding, dont know which kind of genetic stuff it would be categorized as

19:46 hiredman: eval is a function in most lisps

19:46 Cark: depending on the runtime duration of your functions, it might be better to use eval or do a "fast-eval" yourself

19:46 knapr: gave ti soem data like (2 4 6) that it shoul fit and then i would start with soem parameters and the closest fit wins. so that would regress toward (* :x 2)

19:46 hiredman: that does, well, evaling

19:46 you are talking about something that determines the "fitness" in GP?

19:47 ,(doc eval)

19:47 clojurebot: "([form]); Evaluates the form data structure (not text!) and returns the result."

19:47 knapr: yes

19:48 hiredman: the function "eval" that is in clojure.core is something totally different

19:49 generally, in #clojure, when some says "eval" they mean the specific clojure.core/eval

19:49 knapr: i eman that

19:51 how are java constans accessed?

19:51 Thread.NORM_PRIORITY

19:51 Chouser: ,(prn Thread/NORM_PRIORITY)

19:51 clojurebot: 5

20:29 cooldude127: woohoo, wrote an avl tree in clojure with total lack of mutability. which was totally weird being taught in java where we user setters out the ass

20:35 jbondeson: any reason you used an avl instead of an rb tree?

20:35 (out of curiosity)

20:35 cooldude127: jbondeson: it's for college. avl was the assignment

20:35 jbondeson: ah\

20:36 next up a fibonacci heap? =P

20:37 cooldude127: jbondeson: what are the advantages to red-black? we haven't been taught them yet (prolly tomorrow), but avl trees are far easier to understand for me at least

20:38 jbondeson: avl and rb are very similar, the rb i believe is simply slightly easier in a functional environment

20:39 cooldude127: jbondeson: not gonna lie, this avl tree was pretty straightforward in clojure, i can past the code if you're curious

20:40 jbondeson: i would be interested.

20:40 the ml implementation of rb-trees is really compact ~30loc

20:42 cooldude127: http://paste.lisp.org/display/74323

20:42 i forgot to put the stupid channel lol

20:43 sohail: writing an immutable tree is not very hard

20:43 is it efficient?

20:43 cooldude127: sohail: no idea, probably not

20:43 but i'm just learning data structures

20:43 sohail: ok

20:43 bbl

20:43 cooldude127: k

20:49 knapr: when i need a global should i use agents then or can i use def?

20:49 cooldude127: knapr: do you need to change it?

20:49 knapr: yes

20:49 gnuvince_: How do you design a macro? Write code as you'd want to write it and then write the macro that will perform the task?

20:49 cooldude127: knapr: probably a ref is what you want

20:50 gnuvince_: i write a macro by first typing out how the code should look when using the macro, then the code that should turn into when macroexpanded, then use both of those to write the macro

20:50 knapr: meh i cant figure out how now to steal the main even dispatch thread in swing

20:50 i set the started thread to low prioirty

20:50 * cooldude127 hates and loves swing

20:51 gnuvince_: cooldude127: OK, I'll try

20:51 I'm pretty sure my situation warrants a nice macro

20:51 But it's the first time I've had to use them.

20:51 cooldude127: gnuvince_: they are awesome, and my technique works pretty well in my experience, i can't remember where i picked that up

20:51 i want to say it was on lisp

20:52 gnuvince_: I got the PDF on my computer

20:52 I really, *really* ought to make time to read it quickly eventually

20:53 cooldude127: gnuvince_: it is GREAT

20:53 gnuvince_: Stupid maths

20:53 Sponging a lot of my free time

20:56 cooldude127: lol

20:58 keithb: How do I use the function shorthand to write a fn that returns a constant value. Ex: (def pi (fn [] 3.14)) works, but (def pi #(3.14)) does not. Why?

20:58 cooldude127: keithb: that's equivalent to (fn [] (3.14))

20:58 keithb: no way to do that with the shorthand

20:58 keithb: well, except for #(identity 3.14)

20:59 which isn't really worth it

20:59 lisppaste8: gnuvince pasted "replay macro" at http://paste.lisp.org/display/74324

20:59 gnuvince_: cooldude127: can you check that?

20:59 Does that look like a "good" macro usage?

20:59 keithb: This also works: (def pi #(* 1 3.14)) -- but it seems strange that the simplest case wouldn't.

21:00 cooldude127: keithb: it's not the most common

21:00 functions returning constants aren't used as often

21:00 gnuvince_: is defsection the macro?

21:01 keithb: cooldude127: Thanks.

21:01 cooldude127: keithb: no problem. it's a common question tho, people not realizing that they are already in a list with #()

21:01 gnuvince_: cooldude127: it would be yes; I have a binary file from which I want to extract data, and I don't want to manually do all the (.getInt) calls from ByteBuffer

21:02 keithb: cooldude: I don't understand; already in a list?

21:02 hiredman: ,(doc constantly)

21:02 clojurebot: "([x]); Returns a function that takes any number of arguments and returns x."

21:02 cooldude127: gnuvince_: it looks like a good use of macro, but the name is questionable. usually a def... macro would be a toplevel form

21:03 gnuvince_: cooldude127: I'm open to suggestions

21:03 hiredman: ,((constantly 3.14) 1)

21:03 clojurebot: 3.14

21:03 gnuvince_: parse-something?

21:03 hiredman: ,((constantly 3.14) :foo :bar :baz)

21:03 clojurebot: 3.14

21:03 cooldude127: gnuvince_: i want to say with-something, but i'm not sure what

21:04 gnuvince_: with-buffer?

21:04 Also, is it "good form" to make a macro that will return a value?

21:04 cooldude127: keithb: s-expressions are lists, and you are already wrapped in a list when you use #(). those parentheses are a list

21:04 gnuvince_: I had intended this macro to be (let [...] ...)

21:04 knapr: meh i cant figure out how now to steal the main even dispatch thread in swing. i set the thread to low priority still it consumes the whole application

21:04 cooldude127: gnuvince_: yes that is good form, and i actually think parse-buffer makes more sense

21:05 gnuvince_: all right

21:05 here comes the hard part then :)

21:05 keithb: knapr: I've done a lot of Swing work; what are you trying to do with the Swing thread?

21:06 cooldude127: gnuvince_: it's not really all that hard

21:07 gnuvince_: cooldude127: still wet behind the ears about this stuff

21:07 cooldude127: lol it'll come to you

21:07 you're just writing a translator

21:07 gnuvince_: hopefully

21:08 keithb: knapr: If you want to cripple the Swing thread, you could sneak sleep() calls into the Swing (AWT) thread.

21:08 gnuvince_: Basically, I'm just writing a page in PHP or something right?

21:08 keithb: knapr: Very bad for UI responsiveness, though.

21:08 cooldude127: gnuvince_: ?

21:08 gnuvince_: cooldude127: I'm defining a "page" by plugging in some values

21:09 cooldude127: yeah basically

21:09 mrsolo__: http://paste.lisp.org/display/74325

21:09 cooldude127: gnuvince_: obviously more structured, but yeah same idea. at least for your first few. some macros can get pretty crazy if you're doing a radical transformation

21:09 mrsolo__: so i did a little benchmark... is performance penality pretty big for partial compares to normal defn?

21:09 gnuvince_: almost like <?php foreach ($products as $product => $price) echo "<th>$product</th><td>$price</td>" ?>

21:09 cooldude127: gnuvince_: yeah kinda like that

21:10 ew get that php out of here tho

21:10 gnuvince_: Right

21:10 :)

21:10 Fortunately, I do Django at work :)

21:10 cooldude127: i wish i did anything "at work", i need money

21:10 danlarkin: gnuvince_: oh word? help me name my django clone then!

21:12 gnuvince_: danlarkin: I'm unsure my using Django gives me much credit for picking a fine name ;)

21:12 how about "jimi"? ;)

21:14 cooldude127: this line makes me cry

21:14 public interface AVLNode<K extends Comparable<K>> extends BinaryNode<K> {

21:14 SO VERBOSE

21:15 hiredman: clojurebot: google clojure

21:15 clojurebot: First, out of 131000 results is:

21:15 Clojure » home

21:15 http://clojure.org/

21:15 hiredman: *tada*

21:16 danlarkin: neat feature!

21:16 although maybe reduce it from 3 lines to 1

21:16 hiredman: always a critic

21:16 how about two?

21:17 danlarkin: why not 1

21:17 hiredman: I mean, it's not like it would get used all the time

21:17 it feels neater to have the url and the title of the page on seperate lines

21:18 clojurebot: google Good Earth

21:18 clojurebot: First, out of 69500000 results is:

21:18 The Good Earth - Wikipedia, the free encyclopedia

21:18 http://en.wikipedia.org/wiki/The_Good_Earth

21:18 hiredman: it would be one long line

21:18 danlarkin: 4 lines in the channel just for 1 google search :(

21:19 knapr: hmm is there a way to enforce try catching exceptions in clojure?

21:19 ayrnieu: enforce in what sense?

21:20 knapr: it is good not having to when i play with the interface but once i have decided on the design i want to make the code as safe as possible

21:21 Chouser: you mean checked exceptions?

21:21 knapr: yes

21:22 Chouser: nope

21:27 knapr: how do i compile clojure into a an executable?

21:28 i want to share my mp3player with non-programmers so i want it to be dobleclick->run

21:28 Chouser: you don't actually need to compile it for that.

21:30 knapr: this is a bit old, so there may be a better way now

21:30 http://groups.google.com/group/clojure/browse_thread/thread/3c2010cde7d87a6d/1078e6e75018deb1

21:33 knapr: and does Java ever compile to binary or users need java installed?

21:33 is it possible to compile to binaries

21:33 ayrnieu: users need Java installed.

21:38 Chouser: http://chouser.n01se.net/misc/bug.svg

21:38 any opinions? is something like that worth having around, or is it just scary?

21:39 danlarkin: Chouser: lol

21:40 * Chouser is a little embarrassed

21:40 Cark: what was again the function that does this : (take n (repeat fn)) ?

21:41 Chouser: replicate

21:41 rhickey_: Chouser: make sure you include all the "Rich fixes it" short paths

21:41 Chouser: rhickey_: heh.

21:41 Cark: ahh thank you _again_ chouser

21:42 Chouser: Cark: you're quite welcome.

21:43 danlarkin: Chouser: although I think you are making an assumption here that "Are you satisfied with the response" goes right into "post issues to appropriate issues page"

21:44 hiredman: I like it

21:45 Chouser: danlarkin: hm, you're right.

21:45 hiredman: "Rich fixes it" will be a bunch of lines coming out to the left

21:45 Chouser: "Did you get a request to post the issue?"?

21:46 hiredman: ah, perfect.

22:02 danlarkin: what's the best way to convert either a String or nil into an int/Integer or nil

22:05 hiredman: ,(#(and % (Integer/parseInt %)) "1")

22:05 clojurebot: 1

22:05 hiredman: ,(#(and % (Integer/parseInt %)) nil)

22:05 clojurebot: nil

22:06 hiredman: *tada*

22:06 danlarkin: nicer than my:

22:06 ,(try (Integer/valueOf "10") (catch java.lang.NumberFormatException e))

22:06 clojurebot: Gabh mo leithsc�al?

22:07 danlarkin: clojurebot doesn't do exceptions?

22:07 hiredman: nope

22:10 ozy`: ,(:pizza)

22:10 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to keyword: :pizza

22:10 ozy`: :(

22:11 hiredman: ,(:pizza nil :pizza)

22:11 clojurebot: :pizza

22:11 danlarkin: ,:pizza

22:11 hiredman: needs parens

22:12 ozy`: ,(const :pizza)

22:12 clojurebot: java.lang.Exception: Unable to resolve symbol: const in this context

22:13 hiredman: ,(identy :pizza)

22:13 clojurebot: java.lang.Exception: Unable to resolve symbol: identy in this context

22:13 hiredman: ,(identity :pizza)

22:13 clojurebot: :pizza

22:13 ozy`: ,(#(%) :pizza)

22:13 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to keyword: :pizza

22:13 ozy`: pah

22:19 durka42: ,(#(do %) :pizza)

22:19 clojurebot: :pizza

22:19 hiredman: ,(#(do %) "nothing")

22:19 clojurebot: "nothing"

22:22 durka42: (do 'nothing)

22:22 ,(do 'nothing)

22:22 clojurebot: nothing

22:22 durka42: it didn't follow instructions

22:25 ozy`: ooooohh

22:28 durka42: clojurebot: paste is <reply>lisppaste8: url?

22:28 clojurebot: paste is http://paste.lisp.org/new/clojure if it's working

22:28 durka42: clojurebot: paste is <reply>lisppaste8: url

22:30 lisppaste8, url

22:30 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

22:30 durka42: clojurebot: paste is <reply>lisppaste8, url

22:30 doesn't want to overwrite?

22:31 hiredman: oh

22:31 hmm

22:32 durka42: i was thinking we could cut out the middleman if clojurebot can talk to lisppaste8

22:35 hiredman: clojurebot: paste?

22:35 clojurebot: lisppaste8, url

22:35 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

22:35 hiredman: cute

22:35 gnuvince_: How good of a practice is it to return different data types (besides nil) from a function?

22:36 durka42: what do you mean?

22:36 don't most functions have values to return

22:36 hiredman: I do it all the time

22:36 you mean a {} or a [] or a #{}?

22:37 conj returns different data types

22:43 gnuvince_: hiredman: I mean, like a scalar or a collection

22:43 Fictitious example:

22:43 (take 3 (range 10)) => (0 1 2)

22:43 (take 1 (range 10)) => 0

22:44 hiredman: dunno

22:44 durka42: i think take has a contract to always return a list

22:44 Chouser: that particular example would be a pain to work with.

22:44 ozy`: gnuvince_: makes it a bit harder to reason about the function....

22:44 durka42: otherwise map/filter/reduce would break on edge cases

22:44 hiredman: seems dodgy

22:45 19:44 gnuvince_ : Fictitious example:

22:45 durka42: oh, i see what the question meant

22:45 hiredman: Fictitious

22:45 ^-

22:45 durka42: whether the return type of the function should depend on its arguments

22:46 Chouser: 'first' returns different object types

22:46 (first [1]) vs. (first [[2]])

22:48 gnuvince_: Actually, it doesn't; in Haskell terms, that would be first :: [a] -> a

22:49 hiredman: ...

22:49 Chouser: but *actually* it does.

22:49 hiredman: no wonder no one wnats to write haskell

22:49 Chouser: ,(class (first [1]))

22:49 clojurebot: java.lang.Integer

22:49 Chouser: ,(class (first [[1]]))

22:49 clojurebot: clojure.lang.LazilyPersistentVector

22:50 ozy`: Chouser: the return type of "first" is a function of the argument type, rather than the argument value

22:50 Chouser: ozy`: only if you expand what you mean by "type" to be a whole lot more than a Java class.

22:51 gnuvince_: Anyway, I decided against it

22:51 Chouser: heh

22:52 ozy`: Chouser: can't possibly think of a reason why I would mean "Java class" when I say "type"

22:52 you guys must get a lot of people who think that way O_o

22:53 "first :: [a] -> a" is haskell-ese for "given a list containing type X, 'first' returns a single value of type X"

22:53 just for what that's worth

22:54 hiredman: ,(first [[:a] :b :c :d 1 2 3 4 "a"])

22:54 clojurebot: [:a]

22:54 durka42: i mean, it could be LazilyPersistentVector<T>

22:54 hiredman: where is your type system now?

22:54 Chouser: hiredman: there you go.

22:55 ozy`: hiredman: ah... well. it's stitched up inside half a lemon and half a lime :(

22:55 Chouser: ,(map #(nth [[:a] :b] %) (range 2))

22:55 clojurebot: ([:a] :b)

22:55 durka42: my type system is forced to its knees and relegated to calling everything an Object

22:55 Chouser: heh. well, that one seemed more impressive in my head

22:56 hiredman: ozy`: like 7-up?

22:56 clojurebot: make 7- is <reply>UP YOURS, #who

22:56 clojurebot: Alles klar

22:57 * ozy` weeps in the corner, clutching a bronze statuette of the biting pear of salamanca

22:57 durka42: clojurebot: 7-down

22:57 clojurebot: Huh?

22:57 hiredman: clojurebot: make 7-

22:57 clojurebot: UP YOURS, hiredman

22:58 durka42: clojurebot: the fairest of them all is certainly not #who

22:58 clojurebot: Ack. Ack.

22:58 durka42: clojurebot: who is the fairest of them all?

22:58 clojurebot: the fairest of them all is certainly not durka42

22:58 durka42: clojurebot: the fairest of them all is <reply>certainly not #who

22:58 clojurebot: Roger.

22:58 durka42: clojurebot: who is the fairest of them all?

22:58 clojurebot: certainly not durka42

22:58 durka42: :(

22:59 hiredman: clojurebot: the fairest of them all is also <reply>certainly #someone

22:59 clojurebot: You don't have to tell me twice.

22:59 durka42: you've left open the 1/130^2 possibility of hypocrisy

23:00 cooldude127: clojurebot: who is the fairest of them all?

23:00 clojurebot: certainly rhickey

23:00 cooldude127: lol

23:00 durka42: impresive

23:00 s/s/ss/

Logging service provided by n01se.net