#clojure log - Nov 06 2009

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

1:30 Drakeson`: just thought you might want to know, slime (from git://git.boinkor.net/slime.git) breaks in Oct 31. The last commit on Oct 30 seems to be fine.

2:38 qed: We should forget about small efficiencies, say about 97% of the time; premature optimization is the root of all evil.

2:38 ~ Donald Ervin Knuth

2:38 clojurebot: I don't understand.

2:47 aatifh: Ping

2:48 How do i bind multiple values for test in the if-let macro?

2:50 hiredman: you don't

2:50 clojurebot: ping?

2:50 clojurebot: PONG!

2:50 hiredman: hmm

2:52 aatifh: sure? The doc says (if-let bindings then else & oldform)

2:53 hiredman: *shrug*

2:53 ,(if-let [a nil b nil] :then :else)

2:53 clojurebot: java.lang.IllegalArgumentException: if-let requires exactly 2 forms in binding vector

2:55 aatifh: clojurebot, right

3:55 ordnungs`: knock knock?

4:29 stephenj: (+ 1 1)

4:29 clojurebot: 2

4:30 tomoj: why is she doing that???

4:30 (map + [1 2] [3 4])

4:30 (+ 3 4)

4:30 clojurebot: *suffusion of yellow*

4:31 tomoj: hrmm

4:31 (+ 1 3.1)

4:32 (+ 1 3)

4:32 clojurebot: 4

4:32 tomoj: (+ 1 4)

4:32 clojurebot: *suffusion of yellow*

4:32 tomoj: ,(+ 1 +)

4:32 clojurebot: java.lang.ClassCastException: clojure.core$_PLUS___4443 cannot be cast to java.lang.Number

4:32 tomoj: ,(+ 1 4)

4:32 clojurebot: 5

4:32 tomoj: ach ja

4:33 morphling: tomoj: are you expecting (4 6)?

4:33 try (map #'+ [1 2] [3 4])

4:33 tomoj: uh

4:33 hiredman: morphling: +

4:33 tomoj: ,(map + [1 2] [3 4])

4:33 clojurebot: (4 6)

4:33 tomoj: just trying to figure out what clojurebot was doing

4:34 (* 1 2)

4:34 opqdonut: morphling: thinking common lisp?-)

4:34 clojurebot: 2

4:34 tomoj: seems it does elementary math upto 4 like the i-ching calculator

4:34 hiredman: that is preposterous

4:35 only towel toting hickhickers use i-ching calculators

4:37 tomoj: (if (> out 4) "*suffusion of yellow*" out)

4:38 :P

4:39 I would like to understand clojurebot's guts someday

4:39 writing a bot in clojure sounds fun

4:39 hiredman: weird is I swear I removed that three or four times, but somehow while git merging it gets added back in

4:40 tomoj: it would help if I wrote docstrings I suppose

4:41 tomoj: you can't escape the interconnectedness of things, I suppose

4:42 ordnungswidrig: gaa, clojure can be unreadable (comp #(some #{%} [1 2 3]) :params :some)

4:43 tomoj: hmm

4:45 hiredman: (some #(-> % :some :params list set) [1 2 3])

4:45 :D

4:46 #(-> % :some :params list set (some [1 2 3]))

4:46 ordnungswidrig: list set ?

4:46 hiredman: set takes a seq/collection

4:46 :/

4:46 ordnungswidrig: why is this needed here?

4:47 tomoj: is (some #{foo} [bar baz]) the idiomatic way to see if a vector contains some value?

4:47 hiredman: in your example you put something in a set

4:47 #{%}

4:47 (-> % list set) is equivilent

4:47 ordnungswidrig: tomoj: yes, that's the idiom I used

4:48 hiredman: ,#{:a}

4:48 clojurebot: #{:a}

4:48 ordnungswidrig: macroexpand?

4:48 hiredman: ,(-> :a set)

4:48 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: Keyword

4:48 ordnungswidrig: brb

4:48 hiredman: ,(-> :a list set)

4:48 clojurebot: #{:a}

4:49 ordnungswidrig: re

4:49 hiredman: ,(-> :a ((partial conj #{})))

4:49 clojurebot: #{:a}

4:50 hiredman: anyway, I don't believe there is a function like list for sets

4:50 tomoj: I have sometimes felt there should be a sort of inverse to apply

4:51 ordnungswidrig: tomoj: which would do what?

4:51 tomoj: so that (foo set 1 2) would give #{1 2} where foo is this thing

4:51 hiredman: ah!

4:51 #(-> % :some :params sorted-set (some [1 2 3]))

4:52 ,(-> :a sorted-set)

4:52 clojurebot: #{:a}

4:52 tomoj: well that is peculiar

4:52 hiredman: excellent

4:52 ordnungswidrig: hiredman: now please make it a higher order function in [1 2 3] :-)

4:52 hiredman: ((foo [1 2 3]) 1) -> true

4:53 tomoj: hmm

4:53 ,((set [1 2 3]) 1)

4:53 clojurebot: 1

4:53 tomoj: ,((set [1 2 3]) 4)

4:53 clojurebot: nil

4:54 hiredman: (fn [x] #(-> x :some :params sorted-set (some %)))

5:11 Chousuke: ,(hash-set 1 2 3)

5:11 clojurebot: #{1 2 3}

5:11 Chousuke: :P

5:19 tomoj: Chousuke: aha

5:19 that makes it seem much less peculiar

6:19 Chousuke: tomoj: there's also sorted-set

6:20 tomoj: right, sorted-set is what made it peculiar to me

6:20 because it's different from set

6:20 but hash-set fills in the gap and makes it make sense

6:26 Chousuke: debugging this reader thing I wrote is getting on my nerves. I'm hitting some bug re-recompiling Clojure with it that doesn't even give consistent exceptions ;/

6:27 I suspect there's something wrong with syntax-quote because it seems to complain when macroexpanding definline.

6:28 most of the time it complains about ArraySeq not castable to IFn but then sometimes I get a "wrong number of arguments passed to 'vector?'"...

6:29 the worst of it is that when I try to execute those definlines using a repl, everything seems to work fine

6:31 probably the error is somewhere else and it just triggers on definline :/

6:55 stephenj: ~comparator

6:55 clojurebot: Titim gan éirí ort.

6:56 stephenj: That's not very nice clojurebot

6:56 comparator

6:56 'comparator

6:58 _ato: ,comparator

6:58 clojurebot: #<core$comparator__5152 clojure.core$comparator__5152@10c6482>

6:58 _ato: ,(doc comparator)

6:58 clojurebot: "([pred]); Returns an implementation of java.util.Comparator based upon pred."

6:59 _ato: ~def comparator

7:01 stephenj: Thanks _ato

7:17 gerry`: (deftype person [] [Runnable]

7:17 (.run [] (println "ok")))

7:17 java.lang.IllegalArgumentException: Wrong number of args passed to: core$distinct-QMARK- (NO_SOURCE_FILE:8)

7:17

7:18 hello

7:18 how to define deftype without fields?

7:19 and what's "distinc-QMARK..." stuff?

7:19 though reify can work in this case

7:22 anyone here?

7:22 stephenj: yes, but new so I know less...

7:23 gerry`: hmm

7:29 liwp: gerry`: I know nothing about deftype, but distinct-QMARK is a call to (distict? ...) somewhere

7:29 ,(doc distict?)

7:29 clojurebot: It's greek to me.

7:29 liwp: ,(doc distinct?)

7:29 clojurebot: "([x] [x y] [x y & more]); Returns true if no two of the arguments are ="

7:32 stephenj: ~def deftype

7:34 gerry`: (displayInterface 'java.lang.Runnable)

7:34 java/lang/Runnable extends java/lang/Object {

7:34 run()V

7:34 }

7:36 (displayInterface 'clojure.lang.IObj)

7:36 clojure/lang/IObj extends java/lang/Object {

7:36 withMeta(Lclojure/lang/IPersistentMap;)Lclojure/lang/IObj;

7:36 }

7:43 liwp: i need look into clojure sources, but i my poor java knowledge seems can't help me :)

7:44 _ato: gerry`: looks like a bug, deftype is only a few days old

7:49 AWizzArd: rhickey: is in the PAR branch a pfilter?

7:49 gerry`: hmm

7:49 rhickey: AWizzArd: no

7:54 AWizzArd: Maybe a pfilter could be a nice addition to core :)

7:56 rhickey: AWizzArd: patch welcome! but an order-preserving pfilter for vectors is tricky

7:56 gerry`: i'm testing reify/deftype with asm, reify works great

7:56 rhickey: gerry`: asm?

7:56 gerry`: clojure.asm.*

7:57 rhickey: is deftype without fields bug?

7:57 rhickey: gerry`: yes

7:57 gerry`: ok

7:57 rhickey: not your bug, mine

7:58 gerry`: ;-)

8:12 solussd: if I memoize a function that takes a ref as an argument and checks the contents of a ref in an 'if', will that check be preserved, or will it always return the same output for a given ref after it is called once for that ref?

8:14 cgrand: solussd: will always return the same result for a given ref whatever its actual value is

8:14 solussd: that is what i thought it should do, but it doesn't appear to be working that way.. hm

8:15 cgrand: ,(let [i (memoize deref) a (atom 1)] (i a) (reset! a 2) (i a))

8:15 clojurebot: 1

8:16 rhickey: gerry`: fixed - was bug in case

8:16 gerry`: great

8:20 rhickey: gerry`: one sec - breakage

8:21 _ato: hehe, now it *only* takes no fields :)

8:22 * rhickey needed to remember how condp works :)

8:23 rhickey: ok now fixed

8:24 someone's writing case/refify/deftype/defclass tests to contribute, right?

8:34 gerry`: ok,now it works, rhickey: thx for good job

8:35 chouser: I don't think we have a 'new' branch for contrib.

8:35 rhickey: chouser: current contrib works with new, I test before each checkin

8:36 obviously it doesn't have any new-specific code

8:36 but tests for reify et al can go right into core

8:37 are you thinking about converting proxy to reify, defstruct to deftype, etc?

8:37 chouser: oh! no, I simply forgot that clojure's tests were no longer in contrib. sorry

8:38 need more tea, apparently.

8:39 is proxy on the chopping-block? defstruct? Even if their not, using those tests as a starting point may not be a bad idea.

8:39 gerry`: proxy works with inherit class ,how can reify do that?

8:39 rhickey: chouser: I'm trying to stay away from chopping block, but that's a good idea

8:39 gerry`: reify can't

8:43 gerry`: so reify can't replace proxy,right?

8:43 rhickey: gerry`: not everywhere

8:43 chouser: only for well-designed APIs

8:44 Clojure is opinionated. :-)

8:44 rhickey: chouser: fighting the good fight - thanks :)

8:44 gerry`: ok

8:45 interfaces + data = clojure ,not include classes

8:47 is my understanding right?

8:48 rhickey: + protocols, will be more important than interfaces

8:48 but in the same space

8:48 gerry`: thx

8:54 rhickey: I had been thinking about (implement AProtocol AType fn-map), but now think it might be more convenient to implement multiple protocols in a single place (___? AType AProtocol fn-map BProtocol fn-map ...)

8:55 gerry`: but due to java interop,and reify is faster than proxy, reify support superclass may be one of choices,.java interop shouldnot be punished by bad API :)

8:57 chouser: gerry`: and even a good Java API can't provide implementations to inject via macros or whatever becomes the Clojure way -- inheriting implementation may be the only choice.

8:58 gerry`: so, I believe an uber-proxy is planned, though I don't understand the layers under deftype/defclass/reify enough yet to know where it fits in there

8:58 lisppaste8: rhickey pasted "name this" at http://paste.lisp.org/display/89891

9:00 rhickey: chouser: it basically means a painful and huge hack to the reify/deftype underpinning to support superclass, super ctors, ctor bodies, super method access, protected access etc

9:00 chouser: rhickey: yeah, that's sorta what I was afraid of. A shame to mess up perfectly good code that's already there.

9:01 rhickey: doing it in the current Java compiler is something I don't want to spend my time on

9:01 chouser: ah

9:01 rhickey: with cinc, and knowing the requirement in advance, we can probably structure things so reify and proxy share code

9:05 mixins as ordinary maps of names to fns is going to be fun

9:07 chouser: provide, support, satisfy, fulfill

9:07 will this be the primary interface to implement a protocol(s) for a specific type?

9:08 rhickey: I think so, since it can do one as easily as n

9:09 the notion of satisfy might be derivable (still pondering protocols on protocols and bridges), so this should be more concrete

9:18 gerry`: impl? achieve? deploy? assemble? compound?

9:19 rhickey: maybe extend?, as there could be many independent (extend X ...) for and X

9:19 for any

9:20 of course that's a very different meaning from Java's X extends Y

9:20 or maybe not

9:21 chouser: almost a pun

9:22 at first you extend A by providing Foo (extend Foo A)

9:23 then you extend B by providing Foo and also extend Foo itself (extend Foo B)

9:24 rhickey: chouser: In Java, extends is more about "adds stuff to" then extending an interface to reach new types

9:25 but none of this English is very precise

9:25 I think of it as extending the type to support more protocols

9:26 cgrand: supplement?

9:26 rhickey: cgrand: that's the idea

9:27 I'm not concerned about the JAva overlap here

9:27 chouser: in a grid of all types (y axis) and all protocols (x axis), each map in a 'extend' form fills in one cell.

9:27 rhickey: yes

9:28 * chouser doesn't suppose fill-in-one-cell passes muster.

9:28 rhickey: :)

9:29 if only it were that simple - you should see my current omnigraffles - when interfaces and inheritance, and potential protocols-on-protocols come into play it gets tricky

9:30 * chouser watches his mental grid crumble and gets back to writing junit tests.

9:31 rhickey: I asked my wife to email me one of these diagrams the other day and she gave it the subject line: Spaghetti

9:32 froog: :)

9:32 rhickey: so maybe we should call it 'toss'

9:32 chouser: heh

10:52 fradiavalo: How do I slice strings in clojure? For eg in python I can do "abcde"[:-2] to get abc

10:54 tomoj: ,(doc subs)

10:54 clojurebot: "([s start] [s start end]); Returns the substring of s beginning at start inclusive, and ending at end (defaults to length of string), exclusive."

10:54 tomoj: no negative indices I guess, though

10:55 fradiavalo: Ah, that is really what I am after, to get everything but last 2 characters

10:55 tomoj: well

10:55 ,(let [s "abcde"] (subs s 0 (- (.length s) 2)))

10:55 clojurebot: "abc"

10:55 tomoj: guess you can write a little wrapper around that if you want

10:56 eevar2: fradiavalo: you could also use any of the functions which work on seqs

10:56 or the java String api

10:56 tomoj: is there something which drops n from the end of a seq?

10:56 fradiavalo: I think seq functions might help here, let me see

10:57 tomoj: well, (butlast (butlast aseq)) I guess...

10:57 but turning a string into a seq and then back into a string seems strange to me just to chop off two characters

10:58 subs just uses .substring

11:00 fradiavalo: yeah, I can't seem to find an elegent way to do this

11:01 tomoj: on my computer subs is like ten times faster than doing butlast twice

11:01 what, you don't want to ask the string for its length?

11:02 as far as I know java strings have no support for python-style negative indices, so asking the string for its length is the only way

11:02 fradiavalo: I could write a function along the lines you suggested, but I was hoping I could do without it

11:02 tomoj: well, you can :)

11:02 fradiavalo: In general it would be nice to have this work for all sequences

11:02 tomoj: even if it did work for all sequences, doing it the sequence way is lots slower than doing it the string way

11:04 fradiavalo: tomoj: true, could one write a multimethod here to choose different implementations?

11:05 tomoj: guess you could, but I don't really understand why you would want to

11:06 fradiavalo: Just to have a general function which works across all seqs or seq like objects

11:06 tomoj: #(butlast (butlast %)) works

11:06 but is (subs foo 0 (- (.length foo) 2)) too ugly, or..?

11:08 hiredman: clojurebot: ping?

11:08 clojurebot: PONG!

11:09 rhickey: (deftype Foo [a b c])

11:09 ,(deftype Foo [a b c])

11:09 clojurebot: java.lang.Exception: Unable to resolve symbol: deftype in this context

11:09 fradiavalo: tomoj: your soln is good, I am just being finicky

11:28 cemerick: rhickey: Everything's been gone swimmingly since yesterday morning. There was a bit of nip and tuck here and there because of the dashed-names, but everything we have is now using the HEAD of the new branch.

11:29 rhickey: cemerick: great! I had a question for you - had you/are you using the accessor fn capability of defstruct?

11:30 cemerick: rhickey: yes, we still have one struct still, which is tied up with our crazy struct/genclass macros. That won't last though, at which point we'll be struct free.

11:30 and, to answer your question, yes, struct accessors are used there

11:31 rhickey: but were you using accessors and have you provided similar things for your deftypes?

11:32 cemerick: oh, I see what you're getting at. We were using accessor fns as the targets of gen-class getter method impls -- with field access, that's clearly unnecessary.

11:33 rhickey: ok, because leaving any wrapper around (:field x) will seriously diminish the benefits of the keyword call site caching I put in. If you are using (.field x) directly it's moot

11:34 cemerick: right. We have those set of interfaces that define simple .fieldname getters for various slots. Certainly no need for separate accessor fns there.

11:38 The only similar thing that exists now are some accessor fns that dynamically unpack slots. e.g. so you can use the same bounds fn to get the value out of any Bounded (our interface that defines a .bounds getter method), a map (or deftype/defclass now) with a :bounds slot, and have it automatically deref the result if necessary. I'd like to get rid of that mechanism, but it's going to take a while to unwind that -- and it's only used for ~5 slots.

11:45 chouser: slightly better layout for iphones now at http://clojure-log.n01se.net/

11:45 cemerick: "I don't need no stinkin' youtube on my phone, I need #clojure log files!" :-D

11:45 chouser: so true!

11:46 hiredman: there're not #clojure logs, there're #clojure: The Definitive Reference

11:46 chouser: each day is still way too long now. I need some kinda of intra-day navigation.

11:46 hiredman: they're

11:46 good loard

11:46 chouser: hiredman: so true!!

11:47 although it's been months since I gave up reading the overnights :-/

11:48 hiredman: I glance over the scroll back looking for rhickey

11:49 chouser: yeah, that's one option for the intra-page. direct links to rhickey posts.

11:49 hiredman: haha

11:49 rhickey: a summary of questions asked would be nice

11:49 hiredman: yeah

11:50 Dialogues with the Benevolent Dictator

11:52 Kjellski: Hi there...

11:54 Is there any way to alias a java import? Like (ns de.kjellski (:import (javax.sip) :as foo)) ?

12:00 fradiavalo: tomoj: where did you import butlast from? str_utils2.clj?

12:01 tomoj: fradiavalo: it's in core

12:01 ,(doc butlast)

12:01 clojurebot: "([coll]); Return a seq of all but the last item in coll, in linear time"

12:02 chouser: Kjellski: alas, no. The best you can do is use import and then refer to just the classname part instead of requiring the whole package.

12:02 fradiavalo: tomoj: Oh yeah, I saw another one in str_util2.clj

12:03 "Returns s without the last n characters. Returns an empty string

12:03 if n is greater than the length of s."

12:03 (butlast "ABC")

12:03 oops wrong window, sorry

12:03 tomoj: oh, cool

12:04 source is pretty much the same thing

12:05 except they use count and check to make sure you don't try to take too much

12:05 take too much off I mean

12:05 fradiavalo: It also works with last n characters

12:05 tomoj: I mean same thing as (subs s 0 (- (.length ......

12:06 fradiavalo: Also I wonder why all the underscored filenames are converted to hyphens for import?

12:06 tomoj: cus hyphens are more lispy

12:06 hiredman: eh?

12:06 chouser: because underscores are ugly and hard to type

12:06 hiredman: for import?

12:06 patrkris: where do I ask about VimClojure-related stuff?

12:07 chouser: patrkris: right here, though it works best when kotarak is around

12:07 hiredman: this is as good a place as any

12:07 chouser: ~seen kotarak

12:07 clojurebot: no, I have not seen kotarak

12:07 Kjellski: chouser : Thanks.

12:07 patrkris: chouser: ok, thanks

12:07 hiredman: I wasn't aware that import also did the name munging

12:08 chouser: hiredman: I assume he means use|require

12:08 hiredman: fradiavalo: well?

12:09 fradiavalo: hiredman: so why not have hyphenated filenames?

12:09 hiredman: fradiavalo: hyphens are not legal in java classnames/package names

12:09 Kjellski: chouser : uhm, nope... I need to import a few things for an sip stack... and just wondered what to do instead of typing all imports... thought I could "alias" javax.sip as sip or so...

12:09 fradiavalo: hiredman: Ah okay. Thanks, that makes sense.

12:10 hiredman: really?

12:10 chouser: Kjellski: sorry, by "he" I meant fradiavalo -- I should have specified.

12:10 hiredman: I mean of course it does!

12:10 Kjellski: chouser : okay... ^^ nevermind...

12:11 fradiavalo: chouser: yeah, you are right. Sorry for the name mangling

12:11 I am still getting my head around (import use require)

12:17 hiredman: http://lambda-the-ultimate.org/node/3673

12:19 chouser: macros

12:19 well, probably not, but it's my go-to answer

12:20 hiredman: except neither haskell nor erlang have those, yes?

12:21 chouser: right. which is why it's the next order of magnitude

12:21 hiredman: :P

12:21 chouser: actually, template haskell is all there for macros. But the static typing requirement increase the complexity of writing them quite a bit it seems.

12:28 I have a list of expressions, each with a logical name. I'd like a seq of the names of the true ones.

12:29 cemerick: man, it's taking me a while to get my web dev sea legs back :-/

12:29 chouser: ,(map first (filter second {:foo true, :bar false}))

12:29 clojurebot: (:foo)

12:29 chouser: hm. I guess that's not too bad.

12:30 hiredman: clojurebot: web dev is the worst dev

12:30 clojurebot: In Ordnung

12:32 cemerick: I'm half-tempted to throw my hands up and bust out JSPs, just because that'll come flowing back in a cinch from 8 yrs ago. :-P

12:33 Kjellski: How can I do someting like --> new SipFactory.getInstance.setPathName("nist.gov");

12:34 chouser: Kjellski: that doesn't need to be getInstance() ?

12:35 Kjellski: chouser : Couldn´t I combine the two in one row? Actually it´s getInstance() and in the next step setPathName ...

12:36 hiredman: ->

12:36 Kjellski: chouser : misunderstood you, sorry... yes it´s a method call...

12:36 hiredman: doto

12:36 ..

12:36 Kjellski: ,(doc ->)

12:36 clojurebot: "([x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."

12:36 hiredman: etc etc

12:36 chouser: (-> SipFactory. .getInstance (.setPathName "nist.gof"))

12:36 Kjellski: chouser : Thanks!

12:38 hiredman: you might need some parans around SipFactory.

12:38 chouser: hiredman: are you doubting ME!?!?!!!?

12:39 er, I mean, hiredman's right.

12:39 :-)

12:39 Kjellski: *grin* ^^

12:39 djork: clojurebot: web dev?

12:39 clojurebot: web dev is the worst dev

12:39 djork: I see

12:39 Kjellski: clojurebot: hiredman

12:39 clojurebot: hiredman is lazy

12:40 Kjellski: heh...

12:40 clojurebot: kjellski

12:40 clojurebot: Huh?

12:40 Kjellski: Noooooooooo... how dare you ...

12:41 hiredman : actually I´m reading a lot of the clojurebot sources to dive deeper... thanks for the sources...

12:49 djork: Kjellski: good move. That and clojure.contrib.

12:49 clojurebot: clojurebot

12:49 clojurebot: clojurebot is amazing

12:49 hiredman: Kjellski: keep in mind that code is a form of expression, and reading a lot of code by one person is rather one sided

12:51 djork: clojurebot: windows

12:51 clojurebot: I don't understand.

12:51 djork: me either

12:52 Kjellski: hiredman : of course, but I think starting with something not as abstract as clojure.contrib is easier for me...

12:52 st__: would anybody be able to provide help re. Emacs & swank-clojure-project ?

12:52 AquaMacs, to be exact

12:53 Kjellski: st__ : I suggest you to just ask and look who´s responding...

12:53 st__: If I try to run the elisp function to set my classpath, I get a prompt that I can't get out of ? directory completion doesn't work, and <RET> doesn't work, either

12:54 (apologies if this is a mere Emacs question; I've never seen this before)

12:54 djork: C-g doesn't get out of it?

12:54 Kjellski: st__ : and now I can tell you, that I have no clue... sorry...

12:55 st__: C-g sort of gets me out of it, but the minibuffer still has it

12:55 and I can't use the function, which means I can't really use Emacs :-(

12:56 any other hint to set the classpath would be appreciated, too

12:57 technomancy: st__: what's the "elisp function to set the classpath"?

12:57 you should be able to just use setq.

13:10 Kjellski: Should I use doto also for member methods that return things?

13:10 chouser: not if you want to be able to use the returned values.

13:11 Kjellski: And what if I want to use them?

13:12 I want to call a memberfn of a javaobject that has attrs...

13:13 Would this be okay? (.. sipFactory (.createSipStack "args")) looks like doubled expression of that is a memfn...

13:13 chouser: or just (.method obj "args")

13:15 Kjellski: chouser : Oh my... thanks again... I need a say thanks to one of you button...

13:17 chouser: Kjellski: don't bother. I can assume you're thankful. :-)

13:18 Kjellski: chouser : thanks. *grin*

13:38 Anyone a quick link to a complex proxy example?

13:49 AWizzArd: How can I find out if an object O is a (deftype Foo [x y])?

13:49 chouser: (= (type O) ::Foo) ?

13:50 AWizzArd: ok

13:51 Will that soonish work with intance? or isa??

14:04 ambient: yeah, i'd need a good tutorial for complex proxies also

14:04 i just can't quite grok them

14:06 chouser: how complex? there's one in contrib lazy-xml

14:08 ambient: i still feel like im shooting ducks with a blindfold on

14:08 how do i define a callback function types in a proxy?

14:10 im trying to convert this into clojure: http://code.google.com/p/jrtaudio/source/browse/trunk/examples/src/OscillatorBank.java

14:10 to learn how to use jrtaudio

14:14 Kjellski: ambient : I don´t see where you need a proxy there...

14:14 ambient: audio.openStreamOut(new OscillatorBank()); where OscillatorBank containst a callback function to generate the audio output

14:16 it's calling a java class, and i dont know how to do that other than proxies

14:16 java class, that i'm supposed to construct

14:17 im open to suggestions :)

14:17 Kjellski: What interface is the callback in? Or is there none?

14:17 ambient: its a JNI wrapper for a C++ class

14:18 http://www.music.mcgill.ca/~gary/rtaudio/

14:18 Kjellski: Hmmm... I thought that with proxys you could just _implement_ things from interfaces... but I´m pretty sure I´m wrong...

14:19 ambient: well i have no clue what to do with this, that's why I'm asking. I've tried to browse the documentation and the web but still unsuccesfully

14:19 the only way currently for me to do this is to write something and see if it works, write something new, etc...

14:19 Kjellski: What about defining your own interface with excatly h

14:20 that method signature and implement that in a proxy to be set in the function call?

14:20 ambient: you mean write some java?

14:21 Kjellski: ambient : japs, but that would suck like trial and error right?

14:21 ambient: well i could probably do it with java, but i'd rather not write any java because the goal in this project for me is to do it with 100% clojure

14:22 jasapp: I'm probably missing something here, but what's wrong with gen-class and compile?

14:22 ambient: jasapp i've still yet to look into that deeper, because i thought this could be done with proxies

14:22 jasapp: ahh

14:23 it's not bad at all

14:23 provided compiling stuff ahead of time doesn't pose a problem

14:24 ambient: hmm, if it can be done from emacs, i suppose it doesn't ;)

14:24 jasapp: heh, is there anything that can't be done from emacs?

14:24 ambient: would a simple C-c C-k work?

14:25 jasapp: I've never figured out where emacs actually puts the class files

14:25 ambient: anyhow, back to reading stuff about gen-class, thanks guys

14:25 Kjellski: ambient: , in the JRtAudio.java file it looks like that openStreamOut is just getting an Object type as the parameter... maybe it would be enough to just throw an Object with callable interface in there... and that could be done with writing a proxy for the callable interface...

14:26 ambient: Kjellski ok, thanks

14:26 Kjellski: ambient : http://code.google.com/p/jrtaudio/source/browse/trunk/src/JRtAudio.java

14:57 qed: 'lo

14:58 I need some help building a proper prime sieve -- I need to find the sum of all the primes below 2 million for project euler #10 -- I've seen some examples of prime sieves but I simply am not advanced enough to be able to take their code and claim I know what's going on

14:58 If it's not 100% lazy or efficient I don't really care

14:58 I just need something that will work

14:58 ambient: http://paste.lisp.org/display/69952

15:01 qed: amb is that for me?

15:01 ambient: yes

15:02 Kjellski: ambient : could I take that too? ^^

15:03 qed: ambient: why the initial (let [n (int n)]?

15:03 ambient: enforcing types

15:03 qed: ah

15:03 ambient: i don't know, i didn't write it, rhickey did

15:03 reflection is the performance killer

15:04 tomoj: seems weird that you'd do the reverse list trick

15:04 reverse is linear time for a list, isn't it?

15:04 ambient: unless you have a doubly linked list ;)

15:04 chouser: that's not just avoiding reflection, it's using a primitive local

15:05 Kjellski: chouser : whatever you say: amen.

15:05 chouser : In other words, what does that mean?

15:06 notallama: i just did a prime generator in haskell a little while ago. i did it in clojure first, but i don't know where i put it. http://pastebin.com/me4e71f3

15:07 Kjellski: What about the Java probableNextPrime from Java-Math or so...?

15:09 tomoj: I wonder if generating the primes efficiently requires you to store them all in memory at once

15:09 ambient: nope

15:09 you can keep just about 10 in memory when generating more iirc

15:09 tomoj: I think I used a next-prime thing which went off and checked each successive number for primality, so that you didn't have to store them all

15:09 but that was slow

15:10 chouser: ~primes

15:10 clojurebot: Gabh mo leithscéal?

15:10 chouser: ~sieve

15:10 clojurebot: see the genuine sieve of eratosthenes

15:11 chouser: ~genuine sieve

15:11 clojurebot: see the genuine sieve of eratosthenes

15:11 chouser: ~genuine sieve of eratosthenes

15:11 clojurebot: see the genuine sieve of eratosthenes

15:11 chouser: sheesh

15:11 ~the genuine sieve of eratosthenes

15:11 clojurebot: the genuine sieve of eratosthenes is http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf

15:13 qed: ooooooo this is neat

15:13 chouser: im sure you've probably solved this one

15:14 how did you do problem 11 in proj. euler -- the one where you have a 20x20 grid and you need to find the greatest product of 4 adjacent numbers up/down/left/right

15:14 how did you represent the grid in clojure?

15:14 chouser: no, the genuine sieve was too much for me. :-)

15:14 qed: chouser: haha i doubt that :)

15:14 notallama: that haskell code i posted is either the same as that article, or very close.

15:15 ambient: qed you could represent it just as a 1-d array

15:15 qed up=-20, left=-1, right=1, down=20

15:15 chouser: my solution for 11 uses a vector of vectors

15:16 notallama: that grid problem sounds like a job for comonads. i'm still not entirely sure what a comonad is, but i'm starting to recognize where you can use them.

15:17 tomoj: I had a vector of vectors too

15:17 and then a direction is a function on a pair

15:17 * chouser just used 'for'

15:17 tomoj: and get-in grabs a value from the grid

15:17 qed: clojure doesnt like numbers as 0n, does it?

15:17 like 08

15:18 hiredman: ,08

15:18 clojurebot: Invalid number: 08

15:18 chouser: octal

15:18 hiredman: ^-

15:18 chouser: ,10

15:18 clojurebot: 10

15:18 qed: ahhh

15:18 chouser: er

15:18 notallama: ,07

15:18 clojurebot: 7

15:18 chouser: ,010

15:18 clojurebot: 8

15:18 Kjellski: huh?

15:18 ,090

15:18 clojurebot: Invalid number: 090

15:19 ambient: 0 is a prefix for octals

15:19 0-7

15:19 Kjellski: ,0010

15:19 clojurebot: 8

15:19 Kjellski: got it... thanks...

15:19 ambient: ,0xFF

15:19 clojurebot: 255

15:19 qed: so is there a way to use the grid they provided

15:19 without running some regex or something on it

15:20 ambient: ,0xCAFEBABE

15:20 clojurebot: 3405691582

15:20 notallama: ,(bigint "08")

15:20 clojurebot: 8

15:20 qed: ah-ha

15:20 chouser: ,(class (bigint "08"))

15:20 clojurebot: java.math.BigInteger

15:21 notallama: ,(Integer/parseInt "08")

15:21 clojurebot: 8

15:21 chouser: ,(class (Integer. "08"))

15:21 clojurebot: java.lang.Integer

15:21 ambient: ,(int "08")

15:21 clojurebot: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Character

15:21 ambient: :(

15:21 Kjellski: ,(int 08)

15:21 clojurebot: Invalid number: 08

15:21 Kjellski: ,(int 07)

15:21 clojurebot: 7

15:21 Kjellski: ,(int 017)

15:21 clojurebot: 15

15:21 qed: so i have this grid -- my first intuition is to use map #(int %) my-grid-which-contains 08

15:22 but that's not working

15:22 err not int, bigint

15:22 tomoj: hmm

15:22 I wonder how I got my grid

15:22 I found my old solution and I stripped off the extra 0 somehow

15:22 notallama: qed: Integer/parseInt will work too, and give you an int.

15:23 qed: notallama: how would you map it across a list or a vector though?

15:23 chouser: ,(map #(Integer. %) (re-seq #"\d+" "08 02 22 97 38"))

15:23 clojurebot: (8 2 22 97 38)

15:23 tomoj: nice

15:23 qed: whoa -- that's cool

15:23 thanks chouser

15:24 ambient: ,(frequencies "feoifoenfoeijvoiejf")

15:24 clojurebot: java.lang.Exception: Unable to resolve symbol: frequencies in this context

15:24 ambient: :(

15:25 duncanm: dum de dum

15:26 ambient: ,(clojure.contrib.seq-utils/frequencies "dum de dum")

15:26 clojurebot: {\e 1, \space 2, \m 2, \u 2, \d 3}

15:29 Chousuke: this is not fun anymore :(

15:30 notallama: what isn't?

15:30 Chousuke: I'm writing a reader, and as far as I can tell, my reader produces identical output to Clojure's, and still compilation fails

15:30 it also fails with a completely mind-boggling error

15:30 jasapp: maybe I should write a reader

15:31 notallama: you're writing a reader too?

15:31 jasapp: it seems like the popular thing to do

15:32 qed: that movie "The Reader" only had me thinking about lisp the whole time

15:32 ambient: heh :)

15:32 Chousuke: It for some completely ???"#?€? reason tells me that something is passing wrong arguments to a certain function but all debug prints show completely sane inputs...

15:33 in the inputs look identical to what LispReader produces.

15:33 -in

15:33 notallama: did you try (= (read-str blah) (your-read blah)), just to make sure?

15:33 chouser: Chousuke: you're comparing metadata too?

15:33 Chousuke: hmm, I haven't tried that actually.

15:34 chouser: = won't

15:34 of course

15:34 ambient: i remember the time when i had an extra space in my XML build file which completely broke my whole project

15:35 Chousuke: hmmh.

15:35 jasapp: I had similar trouble with some xml I'm working on

15:35 I ended up having to call trim on almost all my strings

15:35 but printed, it was annoyingly the same

15:35 Chousuke: it'll be difficult to compare the two readers :/

15:36 jasapp: what are you writing your reader in?

15:36 Chousuke: Clojure

15:36 of course :P

15:36 * ambient is anxiously awaiting for cinc

15:36 tomoj: so will your reader someday read itself? O_o

15:36 jasapp: not going the java route?

15:36 Chousuke: that's what I'm trying to make it do.

15:37 tomoj: that kind of thing blows my mind

15:37 Chousuke: tomoj: I can use Clojure to compile the reader and then recompile it once, but a second recompilation using the newly produced reader blows up.

15:37 ambient: wonder how easy it would be after cinc to port clojure for eg. running on top of LLVM

15:38 Chousuke: also it compiles contrib just fine, and all tests pass save for one which for some reason blows up the stack

15:39 qed: you want to conj onto vectors right?

15:40 oops nevermind

15:42 notallama: ambient: you'd have to get defclass and such doing sensible things on llvm, so i'm thinking it'd still be pretty tough.

15:43 ambient: yes, the java interop would have to go and just keep the lispy parts

15:44 notallama: it doesn't sound to great to me. you'd get to call c code instead i guess, but i dunno how well that would work.

15:45 chouser: It'll be interesting to see how it all plays out. Clojure does expect the host to provide at least a minimal OOP system I think, so porting to C++ (without templates and with a GC lib) might be easier than C or LLVM.

15:45 ambient: interesting

15:46 notallama: templates are my favourite part of c++. minus the syntax.

15:46 chouser: hm, though once clojure.lang classes are all actually deftypes and protocols, I wonder how much OOP the host would actually need to have.

15:47 jbendig: Calling C++ libraries at runtime would be painful wouldn't it? Clojure with C seems easier to me.

15:47 It's painful with CL anyways.

15:47 chouser: I call C++ libraries from Clojure all the time.

15:47 jbendig: Using JNI?

15:47 chouser: the usage isn't too painful, though the initial setup was a bit.

15:48 yeah, JNI as generated by swig

15:48 ambient: i thought about that, but at first look it seems extremely painful

15:49 jbendig: I haven't tried that yet. Sounds like a good idea. I don't have much use for Java libraries but I do for C++ .

15:49 ambient: but that's just because I'm on windows :p

15:50 Chousuke: What I don't get is that the clojure-reader Clojure works just fine when compiled with a java-reader and then with itself but not when compiled only with itself ;(

15:56 Raynes: technomancy: Whenever you get a chance, I left a message on the swank-clojure mailing list, asking a question about using alternate clojure and clojure-contrib jar files. It appears someone else has posted a query as well.

15:59 chouser: even without trying to thread responses, it seems quite tricky to programmatically pick out new topics from an IRC log.

16:01 StartsWithK: chouser: how about then we tell the bot what it was? like !tag -30min reader error

16:01 chouser: maybe we can train everybody to start with "new topic:"

16:02 ambient: why is there a need to do that?

16:03 if you don't mind me asking

16:03 chouser: ambient: I'm trying to figure out a descent way to provide intra-page navigation for the #clojure logs

16:04 a list of links at the top of the page to specific topics would be brilliant, if it were possible.

16:04 ambient: lexical affinity has been found an useful way to categorize random text

16:05 tomoj: but we don't have training data

16:05 chouser: I just listed every poast that ends in a ? but the results are essentially useless.

16:05 rhickey: huh

16:06 lisppaste8: Chouser pasted "questions" at http://paste.lisp.org/display/89911

16:06 chouser: or at the very least too noisy.

16:06 ambient: what about categorizing everything where "hello" or "hi" occurs with "problem" in the same line ;)

16:07 or words like "so," with at least two "I"'s

16:08 chouser: ambient: heh.

16:08 * chouser warms up 'grep'

16:09 shoover: chouser: or... a view that only shows lines starting with "rhickey:", mouse over or click to see the rest

16:09 chouser: hm, lines at least 30 chars ending in ? is quite a bit better

16:09 shoover: my sandbox here has all rhickey posts in red. :-)

16:10 rhickey: including how,what,where, why , will ?

16:10 jbendig: I've noticed some interesting questions were in reference to Clojure's idioms. Might be able to filter some questions by searching for the word "idiom."

16:10 shoover: chouser: erc shows *my* posts in red :)

16:11 rhickey: in any case it is a lot less to go through than the entire log if used as anchors

16:11 ambient: jbendig i feel so _conflicted_ using "bla bla bla.", which is linquistically correct, instead of "bla bla bla". which is logically correct

16:12 shoover: any kind of anchors with j/k style navigation would be great

16:12 chouser: shoover: j/k ?

16:12 shoover: chouser: single key next/prev

16:13 chouser: so I've got 54 relatively interesting lines for today -- you want a list of links at the top of the page? down the side?

16:13 jbendig: ambient: I completely agree.

16:13 chouser: shoover: it sounds like you're talking about using them differently, but I don't understand yet.

16:14 shoover: chouser: links are fine, but for blazing through a few days logs I would prefer to use the keyboard

16:15 ambient: i think vimperator has keybindings for that

16:15 chouser: shoover: right -- you want a key that skips to the next "interesting" line?

16:15 shoover: chouser: Yes. My use is "Oh, I haven't been on for 2 weeks, what's been going on?"

16:16 chouser: hm ... I like not repeating the text.

16:16 Licenser_: the key that skips to the next interesting line is the oftne ctrl+end

16:17 chouser: rhickey: is that what you're thinking too? I'm not sure what "used as anchors" means.

16:17 rhickey: chouser: yes

16:17 nav

16:18 chouser: so a key to skip forward/backward to interesting lines.

16:18 maybe up/down clickables on those lines for the keyboard-impared

16:18 hiredman: Chousuke: have you looked at the metadata?

16:20 Chousuke: it's pretty difficult to debug because I only seem to get the exceptions when compiling with ant :/

16:20 hiredman: :/

16:20 time for print statements

16:20 Chousuke: I have them all over :P

16:21 hiredman: at one point I had every single fn in my reader printing when it was called, and then inside several of the more complicated fns I had more prns

16:21 I had a new var *trace-reader* that you could bind to true to get this big long trace

16:22 which I took out in the final version, because of a few issues

16:22 Chousuke: all my individual tests show no problems with metadata, at least :(

16:23 tomoj: could you have ant hang and start a swank server somehow?

16:23 Chousuke: I also tried using LispReader's syntaxquote but it didn't help :)

16:30 * chouser considers mutating a var in a map function.

16:30 chouser: hold me back!

16:31 I have (map post-to-html posts) but now I need a bit of state [next interesting post number] passed along.

16:31 hiredman: :(

16:31 chouser: I guess I can use reductions. :-/

16:31 hiredman: use r educe

16:32 or that

16:33 chouser: but the conversion for both is so clumsy because the intermediate state leaks into the output seq/collection too.

16:35 ha! I already have (map post-to-html (cons nil posts) posts) so I can look one post behind as I go along.

16:36 raek: (random clojure nicks: http://ohthehugemanatee.net/word-o-matic/1211/ )

16:36 The-Kenny: I just got "Repl" :)

16:37 chouser: clojurebot: Who's job is it to generate random nicks?

16:37 clojurebot: is is

16:38 hiredman: hmmm

16:38 clojurebot: whose job is it to generate random nicks?

16:38 clojurebot: is is

16:39 ambient: heh "Monkey"

16:39 hiredman: clojurebot: whose job is it to generate random nicks?

16:39 clojurebot: that's fgtech's job

16:41 hiredman: clojurebot: whose job is it to remove factoids that break things?

16:41 clojurebot: that's frodwith's job

16:41 hiredman: I really have to do something about the fuzzer, it takes forever

16:42 jasapp: fuzzer?

16:42 ambalek: clojurebot: who's your daddy?

16:42 clojurebot: Gabh mo leithscéal?

16:42 jasapp: heh

16:42 adityo: i got Holt

16:43 hiredman: if there isn't an exact match for a lookup clojurebot splits the input into words, and generates a list of a lot of possible combinations of those words, and tries them

16:43 adityo: clojurebot: who's fuzzer

16:43 clojurebot: Huh?

16:44 hiredman: http://github.com/hiredman/clojurebot/blob/master/hiredman/clojurebot/factoids.clj#L117

16:45 tomoj: that's so it can answer things even if we don't ask just right?

16:45 adityo: behold Ambitbckey :)

16:46 qed: clojurebot: What is it?

16:46 hiredman: more or less

16:46 clojurebot: What is meta

16:46 qed: oh so it's a markov?

16:46 clojurebot: Who am I?

16:46 clojurebot: Pardon?

16:46 hiredman: the whose job factiod just says "whose job is <reply> that's #someone's job"

16:47 clojurebot: whose job is it to keep the metric system down?

16:47 clojurebot: that's TheBusby's job

16:47 chouser: ,(reductions (fn [a b] (if b (inc a) a)) 0 (map odd? (take 10 (repeatedly #(rand-int 2)))))

16:47 clojurebot: java.lang.Exception: Unable to resolve symbol: reductions in this context

16:47 jasapp: ahh

16:47 chouser: ,(use '[clojure.contrib.seq-utils :only (reductions)])

16:47 clojurebot: nil

16:47 Chousuke: raek: heh, I tried the dinosaurs and got "Chilisaurus" :)

16:47 chouser: ,(reductions (fn [a b] (if b (inc a) a)) 0 (map odd? (take 10 (repeatedly #(rand-int 2)))))

16:47 clojurebot: (0 0 0 1 1 2 3 3 3 3 4)

16:47 qed: clojurebot: whose your daddy? is <reply> #someone's my dadd

16:47 clojurebot: Ik begrijp

16:48 chouser: ~daddy?

16:48 clojurebot: Pardon?

16:48 raek: "Clojurka"...

16:48 qed: ~dad?

16:48 clojurebot: Gabh mo leithscéal?

16:48 qed: lol that's like 3 languages right there

16:49 raek: what's with all the gaelic?

16:49 ...and dutch?

16:50 hiredman: ~english

16:50 clojurebot: English is the official language of the universe

16:50 jasapp: is clojurebot running in a repl somewhere?

16:50 Chousuke: it responds in a random language when it doesn't understand.

16:50 jasapp: clojurebot: where are you?

16:50 clojurebot: where is your source code

16:51 Chousuke: ~source

16:51 clojurebot: source is http://github.com/hiredman/clojurebot/tree/master

16:51 Chousuke: clojurebot: forget where

16:51 clojurebot: I forgot where

16:53 The-Kenny: clojurebot: xmpp

16:53 clojurebot: Pardon?

16:54 chouser: destructuring should use (:k m) instead of (get m :k)

16:55 hiredman: clojurebot is on xmpp as clojurebot@thelastcitadel.com

16:55 tomoj: why?

16:55 hiredman: why not?

16:56 tomoj: chouser: why?

16:56 hiredman: :P

16:56 the new superfast :foo lookup works in the furst case, I believe

16:56 Chousuke: chouser: what if k is not a keyword? :(

16:56 chouser: yeah

16:56 Chousuke: I suppose it could be specialised for the :keys case.

16:57 chouser: Chousuke: and for actual keys

16:57 (let [{the-a :a, :keys [b c]}])

16:57 tomoj: keywords as functions are faster now?

16:58 or, only for deftype/whatever stuff that I don't understand yet?

16:58 chouser: tomoj: the latter

16:58 tomoj: ah

16:58 rhickey: (:k m) is only fast when :k is a literal keyword, when a var/local holding a keyword it is normal lookup

16:59 chouser: but that should fit nicely with let bindings

16:59 hiredman: makes sense

16:59 rhickey: e.g. (let [k :k] (k m)) is ordinary lookup

16:59 but yes, macros can see they have literal keywords

17:18 marcg: pretty quiet here

17:20 Chousuke: marcg: you just missed the discussion :)

17:20 but don't worry, there will be another, eventually :P

17:20 mauritslamers: Question: I am trying to build a pattern finding algorithm and until now I have tried do to that using a recursive loop

17:21 the speed isn't too good though

17:21 marcg: alright, when I know more about clojure I'll start a discussion :-D

17:21 ambient: mauritslamers strings?

17:22 mauritslamers: not necessarily

17:22 just any type of data

17:22 I need a loop to be able to pass on some data to the next loop to prevent false doubles

17:22 but I wondered whether there was a more efficient way to do that

17:23 ambient: pasting your code/problem might help

17:23 mauritslamers: I was already in the process of doing that :)

17:23 notallama: what sort of patterns are you trying to find? like a regex, but for general seqs, or what?

17:25 lisppaste8: mauritslamers pasted "pattern finding" at http://paste.lisp.org/display/89917

17:26 mauritslamers: notallama: I am trying to find any pattern of any length

17:28 ambient: hmm the way i'd do it is just use integers, not any type

17:29 mauritslamers: notallama: So I know it is quite cpu intensive anyway, but I was wondering whether using recur in this way would introduce overheads in either memory or cpu

17:30 ambient: would it be very inefficient to use strings for these symbols? that is, even when they would be numbers?

17:31 I use a vector of characters now because that is the type of input I received

17:31 ambient: i usually use integers for algorithms that can be easily mapped as such. like strings can be easily mapped to ascii integer values

17:31 it doesnt have to be characters, you can map any type of thing to integer that just supports that abstraction

17:32 mauritslamers: would it improve speed much?

17:32 or would it enable a complete new kind of pattern finding?

17:33 ambient: as i dont completely understand what you're trying to do it's hard to say

17:36 notallama: mauritslamers: do you have an example of how you use it?

17:38 mauritslamers: ambient: what the idea is now, is that I partition the entire input in sequences of 2

17:38 so, in case of the first input that is commented out

17:38 the first element in that sequence is (1 2)

17:39 so I filter the entire sequence for all places where that sequence occurs

17:39 next I go to the next item (2 3) and do the same

17:39 the same also for (3 1)

17:40 the next element is (1 2), but because I already did search for that sequence, I skip that one

17:40 that repeats for the entire input

17:41 next I partition in three and do the same for the entire sequence

17:41 and so on until the length of the sequence has been reached

17:41 ambient: so you want to find unique sequences of length n?

17:41 mauritslamers: yep, exacly

17:42 what is also important is that if a subsequence of a longer pattern also occurs as a pattern, the algorithm should also return that pattern as a unique sequence

17:43 ambient: ,(map #(set (partition % 1 "efeokjfekj")) (range 2 4))

17:43 clojurebot: (#{(\f \e) (\k \j) (\e \f) (\e \k) (\e \o) (\j \f) (\o \k)} #{(\e \o \k) (\e \f \e) (\e \k \j) (\k \j \f) (\j \f \e) (\f \e \k) (\o \k \j) (\f \e \o)})

17:44 ambient: that find all unique sequences between in range 2 to 3

17:44 mauritslamers: mmm, trying to understand what happens

17:47 ambient: you wouldn't happen to be programming a compression algorithm?

17:47 mauritslamers: no, I don't :)

17:47 ambient: oh, ok heh

17:48 mauritslamers: why do you ask?

17:48 :)

17:48 ambient: finding repeating patterns is just the thing to do to in compression

17:48 so instead of ffffffff you can write 8f

17:48 mauritslamers: true, but this case the patterns are being used to do other stuff :)

17:54 ambient: thanks a LOT!

17:54 that speeds up the algorithm at least 100 times

17:54 ambient: np :)

18:01 mauritslamers: ambient: small additional question: what should I do when I want to have a pointer to the original place inside the input data?

18:02 because when I use the indexed-partition instead it returns far too much results (of course :) )

18:02 ambient: you'd have to find a way to add an index into the "partition" function

18:03 mauritslamers: that is what indexed-partition does, but wouldn't that influence the set function?

18:03 ambient: ,(indexed (partition 2 "foobar"))

18:03 clojurebot: java.lang.Exception: Unable to resolve symbol: indexed in this context

18:03 ambient: ,(clojure.contrib.seq-utils/indexed (partition 2 "foobar"))

18:03 clojurebot: ([0 (\f \o)] [1 (\o \b)] [2 (\a \r)])

18:04 ambient: hmm

18:04 but if you want to have pointers to places where the sequence is located, you can't have unique items

18:05 because then they're all different because of the location indicator

18:05 mauritslamers: that is what I just found out indeed

18:06 ambient: so you would do (indexed (partition 2 1 "foobar")) to find the locations and for example (frequencies (partition 2 1 "foobar")) to count the occurrances

18:07 mauritslamers: could I force set into only looking at a specific element of the value it gets?

18:07 ambient: functions usually do only one thing

18:07 mauritslamers: the same as saying: "ignore that index")

18:08 mmm

18:08 ambient: i'd probably just save intermediate values and then do different things unto them

18:08 mauritslamers: it wouldn't be too difficult to search for those patterns later on

18:09 the use of set already increases the speed of the algorithm hughely, so just searching for the already known pattern shouldn't be a problem to do afterwards

18:09 ambient: it's still N/2

18:10 mauritslamers: true, but in my original algorithm it was N!

18:10 ambient: hehe

18:10 mauritslamers: and luckily the amount of data is not enormous :)

18:11 so that will be more than fast enough

18:11 ambient: thanks a million :D

18:11 ambient: nah, it's the power of functional programming

18:12 things like these are pretty simple

18:13 useful stuff: http://richhickey.github.com/clojure-contrib/seq-utils-api.html

18:26 mauritslamers: ambient: I thought I started to get the basic idea of functional programming, but I now see that I need to keep thinking inside out :)

18:26 but that url is absolutely making it into my favourites!

18:30 ambient: if you want to learn more about functional programming, here's a good book

18:30 http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-4.html#%_toc_start

18:31 it has a lot of stuff in it, i'd suggest just reading some chapters that introduce the functional style

18:35 javuchi1: and the best tutorial about clojure?

18:36 ambient: i bought the book, it's pretty good

18:36 hiredman: ~blip.tv

18:36 clojurebot: blip.tv is http://clojure.blip.tv/

18:37 ambient: then there is mark volkmann's clojure pages, which for being free, are pretty awesome http://java.ociweb.com/mark/clojure/

18:37 qed: how does apply work compared to reduce

18:37 ambient: i love his audio

18:37 ambient: i registered getclojure.org/com

18:37 just for giggles

18:38 i need to put something up on them -- havent decided what yet

18:38 ambient: apply applied, reduce reduces

18:38 i really can't explain it better D:

18:38 qed: you mean apply allies

18:38 applies

18:38 ambient: ,(apply + [1 2 3])

18:38 clojurebot: 6

18:38 danlarkin: qed: dangerous, considering you don't own the copyright to all the words in your domain name :)

18:38 ambient: ,(reduce + [1 2 3])

18:38 clojurebot: 6

18:39 ambient: ,(clojure.contrib.seq-utils/reductions + [1 2 3])

18:39 clojurebot: (1 3 6)

18:39 javuchi1: ,'nice

18:39 clojurebot: nice

18:39 javuchi1: hehe

18:39 qed: danlarkin: oh god -- i know that's in jest, but really -- rich is gonna sue me?

18:39 ambient: probably, and you're going to prison

18:39 for life

18:39 danlarkin: I can't speak on his behalf... but he could! :)

18:40 qed: yeah -- let's hope clojure doesn't make anyone any money

18:40 otherwise im screwed

18:40 hiredman: I think it would be a trademark, not a copymark

18:40 javuchi1: ,(if nil true false)

18:40 clojurebot: false

18:40 danlarkin: hiredman: oh you're right

18:40 hiredman: er

18:40 copyright

18:40 danlarkin: are you sure?

18:40 javuchi1: ,(= nil false)

18:40 clojurebot: false

18:40 javuchi1: do you see?

18:40 nonsense

18:41 ambient: ,(== nil false)

18:41 clojurebot: false

18:41 danlarkin: hiredman: yeah you trademark brands

18:41 and you copyright IP

18:41 hiredman: nil and false are different, but they are both treated as false by if

18:41 javuchi1: hiredman: really strange behavior

18:41 qed: (def lie true) (if lie false)

18:41 javuchi1: can't undertand why

18:42 hiredman: javuchi1: because a. you should not need false, you should just use nil b. java interop needs false

18:42 so clojure has nil and false

18:42 qed: i think b is probably the more important of your explanation

18:42 the more important part*

18:44 javuchi1: hiredman: so it is a jvm issue?

18:44 hiredman: it's not an issue

18:45 javuchi1: i understand it is

18:45 hiredman: it's not

18:45 danlarkin: ,(false? nil)

18:45 clojurebot: false

18:45 danlarkin: oh no!

18:45 :)

18:45 javuchi1: at least false should be equal to nil to be consistent

18:45 hiredman: why?

18:45 Chousuke: javuchi1: false can't be equal to nil because false is not nil

18:45 javuchi1: however, both are *logically* false.

18:46 javuchi1: it has no sense

18:46 ,(= nil false)

18:46 clojurebot: false

18:46 qed: it has plenty of sense, it's just weird

18:46 javuchi1: should return true

18:46 hiredman: I just explained the sense

18:46 javuchi1: why?

18:46 Chousuke: javuchi1: no, because nil is not false :)

18:46 javuchi1: because nil should be a sinonim of false ;)

18:46 Chousuke: and pretending it is would cause problems.

18:46 qed: "Yes it is!" "No it isn't!"

18:46 hiredman: javuchi1: but it isn't

18:47 qed: 'round and 'round we go.

18:47 Chousuke: javuchi1: nil is java null, false is java false.

18:47 hiredman: nil is nothing, false is a boolean value

18:47 javuchi1: that's weird, hehe

18:47 qed: agreed

18:47 hiredman: qed: hey, I ask why

18:47 Chousuke: you bet clojure wouldn't have false if it could be avoided but it can't. :P

18:47 qed: why is it weird?

18:47 hiredman: "it should be this way!" "why?" "because I want it that way!"

18:48 qed: heh -- i mean i can see where he's coming from

18:48 it's a weird little case

18:48 hiredman: *shurg*

18:48 Chousuke: though sometimes being able to differentiate between nil and false is useful

18:48 qed: agreed

18:48 ambient: Chousuke so the test? functions would returns something-something or nil?

18:48 javuchi1: i don't see when

18:48 Chousuke: nil means "nothing", which could be taken to mean neither true or false.

18:49 hiredman: mostly when doing java interop

18:49 Chousuke: that is, that the value is not known.

18:49 hiredman: but I cannot remember ever having a situation where I cared about false vs. nil

18:49 it's a non-issue

18:49 Chousuke: javuchi1: Clojure has false because the JVM has it, but because treating nil as a boolean false is useful, that's also done.

18:50 javuchi1: but Clojure still won't pretend that they're the same thing .)

18:50 javuchi1: then, Chousuke, from your point of view, (if nil true false) should return true, as nil is not a boolean, it is just nothing

18:50 Chousuke: javuchi1: I said it's false in a boolean context.

18:50 hiredman: javuchi1: you are talking about logical value

18:50 Chousuke: which nothingness often is.

18:50 hiredman: boolean is a type

18:51 null is not a type

18:51 javuchi1: hiredman: nil is fully featured type which only one value, nil

18:51 qed: ,(if false nil true)

18:51 clojurebot: true

18:51 javuchi1: at least it is that way in CL

18:51 hiredman: javuchi1: by your logic anything that is not nil should = true

18:51 ,(if :a :b :c)

18:51 clojurebot: :b

18:52 Chousuke: heh :D

18:52 ,(boolean nil)

18:52 clojurebot: false

18:52 hiredman: common lisp can go do unpleasent things to itsself

18:52 Chousuke: there.

18:52 javuchi1: hiredman: yes if you accept the logic of nothing being false

18:52 Chousuke: javuchi1: nil is false in CL too. and nil is nothing :P

18:52 it's also the empty list which is silly.

18:52 though sometimes useful

18:54 hiredman: javuchi1: which you do

18:54 which is why I said "by your logic"

18:54 Chousuke: javuchi1: no-one is claiming that nil equals false, but if interpreted a a truth value, it's non-true. similarly any non-nil value that is not the boolean value false has a "true" truth value.

18:54 javuchi1: i admit that it is the best aproach

18:55 hiredman: that what is?

18:55 anything not nil = true

18:55 ?

18:55 javuchi1: Chousuke: that's not logic

18:55 Chousuke: javuchi1: logic only has two values.

18:56 hiredman: Chousuke: ahem

18:56 Chousuke: boolean logic

18:56 Chousuke: yeah. that.

18:56 javuchi1: Chousuke: what i claim is that if something nil is considered false, false should mean nil too

18:56 that's my point

18:57 hiredman: nil is only considered to be false in the logical context

18:57 javuchi1: the behaivior of "if" is weird to me

18:57 hiredman: not the context of equality

18:57 Chousuke: javuchi1: but that can't be, because nil and false are separate values. :/

18:57 they both just have a "false" boolean interpretation

18:57 hiredman: if it is not raining then the sentence "it is raining" is false and so is the sentence "5 + 2 = -3"

18:57 javuchi1: Chousuke: a strange "typecast"

18:58 hiredman: but it does not make the sentences equivilant except in the context of boolean logic

18:58 Chousuke: ,(identical? (Boolean. false) (Boolean. false))

18:58 clojurebot: false

18:58 Chousuke: two more false values :P

18:58 javuchi1: hiredman: if you don't know if it is raining, it is not correct to say that it is false that it is raining

18:59 Chousuke: they happen to be equal to false because they're the same type though.

18:59 javuchi1: get it?

18:59 hiredman: javuchi1: that has nothing to do with anything

18:59 I stipulated that it is not raining

18:59 Chousuke: javuchi1: Does the behaviour of if really make no sense to you or are you just claiming that to be pedantic?

19:00 it's perfectly sensible to treat nothing as false.

19:00 tomoj: it would annoy be greatly if it weren't the way it is

19:01 hiredman: just because two things can be treated the same in the logical context does not mean they are the same

19:01 javuchi1: Chousuke: yes, but my claim is that if you treat nil as false, you should treat false as nil, too

19:01 Chousuke: javuchi1: why does that follow?

19:01 javuchi1: simple logic

19:01 hiredman: in the context of boolean logic, where clojure treates nil as false, false is also treated as nil

19:02 Chousuke: A->B does not imply B->A

19:02 javuchi1: if nil is false, false is nil, that simple

19:02 hiredman: nil is not false

19:02 Chousuke: javuchi1: but nil is not false. that's the point.

19:02 hiredman: nil is treated the same as false in the context of boolean logic

19:02 there is no implicint = false inside if

19:02 javuchi1: nil is not false when you are interested in, but not when you are interested... really strange

19:02 Chousuke: in mathematical terms, f(nil) = f(false), but nil is not false

19:03 tomoj: what does it even mean to "treat false as nil"?

19:03 (nil? false) should be true?

19:03 hiredman: javuchi1: I'm interested in it

19:03 er

19:03 not

19:03 like I said. it has never been an issue

19:03 Chousuke: and the f function here is simply {false -> false, nil -> false, otherwise -> true}

19:04 tomoj: javuchi1: do you have an example snippet that should behave differently in your opinion?

19:05 I can't imagine what change you could possibly want to make

19:06 javuchi1: tomoj: to behave consistently

19:06 Chousuke: but... it is consistent

19:06 what part of it is not consistent?

19:06 javuchi1: if you want nil to be considered false in some contexts, then consider false to be nil too

19:06 Chousuke: why?

19:06 ambient: im currently eating crackers but the crackers aren't eating me

19:06 javuchi1: very simple

19:07 imagine the situations in which it is usefull to consider 0 to be nil and false

19:07 like in C

19:07 hiredman: javuchi1: in the context where nil is considered to be false, false is treated exactly like nil

19:07 Chousuke: nil is only considered false in a boolean context, and in the boolean context, false is considered nil.

19:08 but only in that context are they equal, and nowhere else.

19:08 javuchi1: are you sure, Chousuke?

19:08 Chousuke: yes.

19:08 javuchi1: ,(= false nil)

19:08 clojurebot: false

19:08 Chousuke: that's not a boolean context.

19:08 that's value context.

19:09 hiredman: are these two values the same? false

19:09 Chousuke: ,(= (boolean false) (boolean nil)); force to boolean context

19:09 clojurebot: true

19:09 javuchi1: the boolean context of "if" is, then incorrect or inconsistent

19:09 hiredman: how?

19:09 javuchi1: because it treats nil as false

19:10 hiredman: and false as nil

19:10 Chousuke: how is that inconsistent?

19:10 javuchi1: and false != nil

19:10 hiredman: which is what you wanted

19:10 Chousuke: javuchi1: sign(x) treats many x's the same as well. how is that inconsistent?

19:10 hiredman: javuchi1: in the boolean context they are treated exactly the same way

19:10 Chousuke: sign(5) = sign(23819238)

19:10 very inconsistent :)

19:11 javuchi1: if you want to be consistent, you should either a) consider nil as true b) consider false and nil as sinomous

19:11 hiredman: they are sinomous in the boolean context

19:11 Chousuke: synonymous :P

19:11 hiredman: show me where they aren't?

19:11 javuchi1: yeah, that

19:11 ;)

19:12 Chousuke: javuchi1: what I still fail to understand is why you think that only one value may be treated as non-truth

19:12 hiredman: ,(if false :a :b)

19:12 clojurebot: :b

19:12 hiredman: ,(if nil :a :b)

19:12 clojurebot: :b

19:12 hiredman: synonymous

19:12 javuchi1: ,(or false nil)

19:12 clojurebot: nil

19:12 tomoj: ,(if 3 :a :b)

19:12 clojurebot: :a

19:12 tomoj: ,(if 4 :a :b)

19:12 clojurebot: :a

19:12 ambient: btw, what is the plural of lisp? lispes? lisps?

19:12 tomoj: oh noes

19:12 3 and 4 should be sinonimus

19:12 Chousuke: ambient: lisps

19:12 hiredman: tomoj: that is what I was saying before about everything should = true

19:13 tomoj: indeed

19:13 why is true privileged, though?

19:13 ambient: do lisps have true and false? are they even needed? i would think not

19:13 tomoj: everything should = 42

19:13 except for false

19:13 (which is equal to nil)

19:13 hiredman: ambient: they don't

19:13 tomoj: false is here because of java I think

19:13 Chousuke: yeah

19:13 tomoj: (and true as well)

19:14 Chousuke: if the JVM had only null, Clojure wouldn't have false either.

19:14 javuchi1: tomoj: no, because you define as true everything which is not nil

19:14 tomoj: no I don't

19:14 ambient: yeah, so false is just a value, not a truth definition integral to the language

19:14 tomoj: ...that would be wrong

19:14 hiredman: but there is nothing inconsistent with clojure's handling of nil and false

19:14 The-Kenny: I approve tomoj in the 42 thing :)

19:14 javuchi1: tomoj: my point is that, sometimes nil is false but sometimes not, which is nonsense

19:14 Chousuke: but since the JVM has both, so does clojure. and it treats them both as false values.

19:14 notallama: nil and false also have to be distinct for java interop. false for false, nil for null

19:14 tomoj: javuchi1: you are not making sense

19:14 javuchi1: is 4 sometimes true and sometimes not?

19:14 Chousuke: javuchi1: nil always has a false truth value.

19:15 tomoj: just because nil is treated as false by 'if' doesn't mean it sometimes IS false

19:15 javuchi1: no, 4 is always true

19:15 Chousuke: hiredman: but it's still not the value "false"

19:15 javuchi1: but, nil is sometimes false and sometimes not

19:15 tomoj: ,(= 4 true)

19:15 clojurebot: false

19:15 javuchi1: understand?

19:15 hiredman: Chousuke: eh?

19:15 tomoj: 4 is not true

19:15 Chousuke: hiredman: oops.

19:15 hiredman: true is the value true

19:15 Chousuke: hiredman: wrong target.

19:15 ,(class? true)

19:15 clojurebot: false

19:15 javuchi1: tomoj: it should be

19:15 Chousuke: whoop

19:15 ,(class true)

19:16 hiredman: Chousuke: hah

19:16 clojurebot: java.lang.Boolean

19:16 tomoj: javuchi1: uhh

19:16 what?

19:16 Chousuke: ,(class false)

19:16 clojurebot: java.lang.Boolean

19:16 Chousuke: ,(class nil)

19:16 clojurebot: nil

19:16 ambient: why does (number? 3) return true instead of something else though?

19:16 tomoj: if 4 is true, then you can't do math

19:16 hiredman: ambient: why not?

19:16 ambient: if true and false aren't integral to truth values in clojure

19:16 why doesn't it return 3 or nil?

19:16 Chousuke: ambient: it calls to java

19:16 which returns booleans

19:16 hiredman: there is no reason it couldn't return 3

19:16 ambient: so it's not consistent after all

19:16 hiredman: or nil

19:16 ambient: it is

19:17 javuchi1: tomoj: then we have found another inconsistence: everything except nil should be true, but clojure claims it is not

19:17 hiredman: what if it returned 'true

19:17 tomoj: "everything except nil should be true" - who says?

19:17 I don't say that

19:17 ambient: but if number? is a clojure function and not a java interop function, and it still returns stuff from the java land...?

19:17 Chousuke: javuchi1: Clojure simply has a slightly extended definition of booleans.

19:17 tomoj: if everything except nil is true, your language is useless

19:17 you only have two values and you can't do shit

19:17 Chousuke: javuchi1: basically, nil and false are boolean false, everything else is boolean true. it's perfectly consistent.

19:18 hiredman: tomoj: javuchi1 is confusing boolean equality and value equality

19:18 tomoj: yes I know :)

19:18 javuchi1: tomoj: if fact we have only two values all the time, as we are working with binary machines

19:18 tomoj: not at the language level

19:18 (at least, not in a language like clojure)

19:19 hiredman: javuchi1: what is the value of true?

19:19 if say this was C and true is 1

19:19 javuchi1: everything that exists... i would define true as a function better than a value

19:19 tomoj: wat

19:19 Chousuke: javuchi1: no, true is not a function.

19:20 javuchi1: true is a value

19:20 * tomoj goes back to tv

19:20 Chousuke: javuchi1: the function is the thing determining what is true and what is false.

19:21 javuchi1: and what is true for you?

19:22 Chousuke: just true. one of the two boolean values.

19:22 hiredman: clojurebot: you have the con

19:22 clojurebot: hiredman: aye aye skipper

19:22 Chousuke: it doesn't matter what it is. I call it true and it is true. :)

19:22 I can just define it so.

19:23 after I define it and its properties (boolean logic) I can define arbitrary functions mapping other values to either true or false.

19:23 javuchi1: in your way of thinking

19:23 if C, for example, everthing which is not 0 is true

19:23 and it has a value

19:23 for example, 4

19:24 Chousuke: yes. in C, there's an implicit predicate in every if which does {0 -> false, not 0 -> true}

19:24 javuchi1: that's how i say that i define true as if it where a function

19:25 Chousuke: clojure has a similar implicit predicate, but it has two branches leading to false

19:25 javuchi1: true = not NULL or true= not false

19:25 not is a function

19:25 Chousuke: I should have said not equal

19:26 notallama: javuchi1: do you do any c++? think of overloading operator bool(), if so.

19:26 Chousuke: so stuff equal to nil or false give false, and stuff not equal to either gives true. :/

19:26 +s

19:27 javuchi1: yes, that would be consistent :)

19:27 Chousuke: that's how it works in Clojure.

19:28 tomoj: don't lots of languages work this way?

19:28 Chousuke: doesn't scheme have a separate false from nil too?

19:28 javuchi1: the problem is that there is avalue fro true and false in clojure

19:28 tomoj: I vaguely remember something like that

19:28 ruby has nil and false the same as clojure

19:28 javuchi1: which is the confusion which is all about

19:28 tomoj: python too? Idon't remember

19:28 there is no confusion here :D

19:29 notallama: i think in scheme, the two booleans are the only things you can use in a boolean context. not entirely sure, though.

19:29 Chousuke: javuchi1: yeah, but they're just values. if itself doesn't really care about that. :)

19:29 javuchi1: they're there to satisfy java.

19:29 ambient: RSR4 <3

19:29 javuchi1: tomoj: how you can say that a value is true? is there only ONE value which is true?

19:29 i don't agree

19:29 tomoj: I say "truthy"

19:30 but I dunno if anyone will understand me when i say that

19:31 notallama: javuchi1: think of "if" and such as implicitly calling "boolean" things.

19:31 Chousuke: javuchi1: the "true" value is just a value representing truth. other things can be "true" too, but then they're really just mapped to the "true" value through some arbitrary function.

19:32 javuchi1: the, Chousuke, true is a characteristic, not a value

19:32 Chousuke: javuchi1: it's very much a value in boolean logic :)

19:32 it's easy to pick any arbitrary value to represent your truth (or non-truth)

19:32 I could call 4 my truth and 5 non-truth.

19:33 ambient: ,(doc reify)

19:33 clojurebot: No entiendo

19:33 Chousuke: which would cause funny things as 4*5 would be 5 and 4+5 would be 4

19:33 javuchi1: you could, but is nonsense

19:33 Anniepoo: 'pipe rotated' is true and 'pipe not rotated' is false (common in rr interlocking)

19:33 Chousuke: javuchi1: mathematically it's perfectly valid.

19:33 I'm free to choose.

19:34 javuchi1: if you brake common sense (in which math is based), yes, it is correct

19:34 Chousuke: maths is not based on common sense :P

19:34 maths is based on... maths.

19:34 javuchi1: but then you are not going to be consistent with the rest of the human race

19:34 Chousuke: it's self-hosting.

19:34 javuchi1: maths are human thoughts, they don't even exists...

19:35 tomoj: finally something we can agree on

19:35 * technomancy has a feeling this conversation has been going nowhere for quite some time.

19:35 Chousuke: :)

19:35 javuchi1: yes, hehe

19:35 Chousuke: I have to disagree with math not existing though :P

19:35 javuchi1: ;)

19:35 technomancy: Chousuke: ah, a platonist!

19:35 tomoj: you don't exist

19:35 danlarkin: alan turing would have something to say about that

19:36 Anniepoo: javuchi1, deliberately the OSI network stack model doesn't refer to zero and one, it refers to 'mark' and 'space'

19:36 Chousuke: I just did some exercises for a "Fourier methods" course the other day and that stuff is very real.

19:36 tomoj: javuchi1: wait, does clojure exist?

19:36 javuchi1: anyway, i prefer, if you wnat to listen, the C aproach of considering everything except 0 to be true

19:36 tomoj: that would be terrible

19:36 javuchi1: tomoj: not at all, it's all virtual ;)

19:36 Anniepoo: those terms were originally when a goose quill pen was or wasn't marking a strip of paper

19:37 tomoj: unless the cdr of a singleton is 0

19:37 notallama: really, when you look close enough at anything, you'll find that there's nothing there. like, look at an atom: it's entirely (or damn well near it) empty space.

19:37 tomoj: which would be highly odd

19:37 Chousuke: javuchi1: won't C actually give you an error if you try to use eg. a struct in an if?

19:37 * ambient has never understood the relevance of metaphysics

19:38 javuchi1: notallama: not even that, it is something you believe it is there because you have the illusion that what you see thouht you eyes is true in some way

19:38 * tomoj has never understood the relevance of anything but metaphysics

19:38 * Chousuke questions the concept of relevance!

19:38 Chousuke: ^^^^physics

19:39 javuchi1: Chousuke: not, but clojure is not, too

19:39 technomancy: tomoj: ah, a chestertonian! =)

19:39 Chousuke: hm

19:39 tomoj: if (seq '()) returned 0, I would kill myself

19:40 OR, if (seq '()) returned nil, but nil wasn't falsey, I would me mildly annoyed

19:40 Chousuke: ,^^(with-meta 'a (with-meta {:foo 'bar} {:meta 'physics}))

19:40 clojurebot: {:meta physics}

19:40 tomoj: haha

19:41 ambient: metaphysics wont pay my bills or mow my lawn

19:41 Chousuke: metadata about metadata :/

19:41 javuchi1: why would you kill yourself, tomoj?

19:41 what is the definition of seq?

19:42 tomoj: (if (seq '()) :foo :bar)

19:42 ,(if (seq '()) :foo :bar)

19:42 clojurebot: :bar

19:42 tomoj: this is very useful

19:42 javuchi1: ,(doc seq)

19:42 clojurebot: "([coll]); Returns a seq on the collection. If the collection is empty, returns nil. (seq nil) returns nil. seq also works on Strings, native Java arrays (of reference types) and any objects that implement Iterable."

19:42 ambient: "metaphysics can contain nothing but sophistry and illusion."

19:42 tomoj: what, that's not the quote

19:42 javuchi1: it can return 0, which means that it is empty

19:42 Chousuke: javuchi1: but then you'd have to equate 0 to nil :/

19:43 tomoj: if it returns 0, then every time you get a seq, you have to check whether it's a seq or 0

19:43 and you could add stuff to it

19:43 and get 12 or something..

19:43 Chousuke: which is one of the most popular causes of programming errors I think :P

19:43 tomoj: like (+ (rest '(1)) 12)

19:43 javuchi1: you can throw an exception ;)

19:44 tomoj: it would just be so monstrously ugly that I would be forced to end my life

19:44 cupertinochad: May I ask a newbie question?

19:44 Chousuke: sure.

19:45 cupertinochad: I heard somewhere that (. blah) was no longer the best way to do Java interop. I want to do (. System nanoTime) Is this still the preferred way?

19:45 javuchi1: or, you can make an special function test, for example called end? which tells you when the end has reached

19:45 Chousuke: ,(System/nanoTime)

19:45 clojurebot: 1257554820716579000

19:46 javuchi1: it would be even better than nil

19:46 or nil?

19:46 tomoj: javuchi1: but why in the world would we want to do that?

19:46 javuchi1: is clojure your first lisp? just curious

19:46 javuchi1: no, i used CL

19:46 Chousuke: cupertinochad: Foo/bar for static fields/methods, (.field obj args) for non-statics

19:46 tomoj: weird

19:46 technomancy: tomoj: who else but a CL user would want to unify false and nil? =)

19:47 tomoj: sure, but.. into 0?!

19:47 javuchi1: i'm not a CL guy

19:48 perhaps a C guy, probably worse

19:48 cupertinochad: Chousuke: Thanks a million

19:48 Chousuke: Any idea why this way is preferred over "."?

19:48 Chousuke: technomancy: I don't think unifying false an nil is a bad thing per se, but if it means (= false nil) -> true instead of just removing "false" from the language I think it's not worth the trouble.

19:49 cupertinochad: it's lispier and looks better.

19:49 javuchi1: Chousuke: i would agree on simply removing false

19:49 and make anything else just true

19:49 tomoj: removing false is not good for java, though

19:49 Chousuke: cupertinochad: my personal justification is that a mere . in the head of a list (in operator position) is a wasted of a prominent code position :)

19:49 -d

19:50 (foo bar) pretty much always means "operator foo with args bar" in Clojure

19:50 operator . only tells you "java interop". System/nanoTime tells you... the time :P

19:51 javuchi1: java is weird

19:51 tomoj: I don't particularly like java much either

19:51 javuchi1: the jvm is a miracle, but not that good, too

19:52 clojurebot:

19:52 tomoj: but I like being able to use it from clojure very very much

19:52 Chousuke: the JVM is not optimal for a lisp I suppose, but it's not as bad as people think

19:52 I doubt Java even uses half of what the JVM really could do :/

19:52 ambient: btw, when can i use these puppies? http://www.assembla.com/wiki/show/clojure/Datatypes

19:52 javuchi1: i would prefer more like it's own virtual machine like erlang, with facilities to call other languages like java directly

19:53 Chousuke: ambient: I think it's another branch in the repo

19:53 javuchi1: go ahead and implement a virtual machine that competes with the JVM and perhaps you can make Rich consider migration :D

19:53 ambient: Chousuke is it going to be merged into the main branch sometime in the not so distant future?

19:54 javuchi1: Chousuke: as far as I know (and I don't know much), the jvm is very object oriented, and very suboptimal for anything else

19:54 tomoj: I think the JVM is great for clojure :)

19:54 Chousuke: ambient: You'll have to ask Rich about that.

19:54 javuchi1: and it is a monster

19:54 chouser: ambient: post 1.2, I think

19:54 ambient: chouser ok, thanks

19:55 Chousuke: javuchi1: There are great people working on improving the situation, though.

19:55 javuchi1: Chousuke: the jvm is a comodity, but I don't think it would be THAT difficult to make your own vm as everybody says

19:55 tomoj: JVM means clojure runs pretty easily everywhere and there's already a library I can use for pretty much anything

19:55 cupertinochad: Chousuke: Thanks for the explanation; I agree.

19:55 ambient: javuchi1 oh man, you just didn't say that... :D

19:55 Chousuke: javuchi1: it's not difficult to make a VM. it IS difficult to make it rival the JVM.

19:55 tomoj: not least because to really rival the JVM you'd need to write tons and tons of libraries..

19:55 javuchi1: Chousuke: you don't need to. look at erlang, it is able to call Java and C very easily

19:56 Chousuke: in fact, any VM you can code in a year's time will get blown out of the water by the JVM. :)

19:56 javuchi1: tomoj: it is true, also, that most staff from the jvm is useless for a lispy/inmutable based structures like clojure is based on

19:56 Chousuke: it's just a huge responsibility off of Rich's shoulders :P

19:57 chouser: javuchi1: really? like what?

19:57 javuchi1: i won't use much of the staff from the java library just because it is difficult to integrate in the world of inmutable things of clojure, and it would be very little idiomatic

19:58 tomoj: I certainly don't agree..

19:58 jetty, htmlunit, tagsoup, matrix math stuff, jgraph, on and on

19:58 Chousuke: You have a point, but the situation isn't as bad as you think :)

19:58 tomoj: all I love being able to use from clojure directly, even if using them is a bit less pretty than pure clojure

19:58 it's MUCH less work than rewriting them all

19:59 javuchi1: there are plenty of vm out there

20:00 ambient: of JVM's calibre? very few

20:00 javuchi1: some of them are able to comunicate with other vm like the jvm

20:00 JVM is not that good

20:00 Chousuke: it's only perhaps the best :P

20:00 javuchi1: is simply the amount of libraries avaiable

20:01 tomoj: I don't think that's the whole story

20:01 ambient: not to speak of proprietary codebases that some companies have

20:01 tomoj: but that's really important anyway :)

20:01 javuchi1: as i said before, there are ways of calling the jvm from the outside

20:02 erlang is capable of doing so

20:02 tomoj: so go use erlang?

20:02 javuchi1: it's not lispy ;)

20:02 tomoj: ah

20:02 javuchi1: but i considered

20:02 chouser: lfe

20:02 krumholt: javuchi, what exactly is it you don't like about the JVM and which JVM? You could always go and use a JVM not from sun

20:03 Chousuke: I think javuchi1 just thinks the JVM is not as good for lisps as the erlang VM

20:03 javuchi1: lot of things, krumholt

20:03 Chousuke: which is probably true. however, that doesn't mean it still isn't excellent :D

20:04 chouser: javuchi1: have you considered "lisp flavoured erlang"?

20:04 krumholt: i think it is a very excellent plattform too. maybe it could be better but all the work.. :)

20:04 Chousuke: it's got an amazing runtime-profiling optimizing JIT-compiler :P

20:04 how many VMs have that?

20:05 ambient: CLR is pretty good at least on windows

20:05 javuchi1: Chousuke: there are many others that do

20:05 Chousuke: javuchi1: such as?

20:06 ambient: iirc CLR has TCO

20:07 javuchi1: the erlang VM is very good, the CLISP one is also good (and they are making a JIT now), the SBCL compiler is not a VM, but can do very good optimizing compiling on the fly, and many many others... it is not that hard to make another one, but i understand the comodity of the jvm... just that... it feels to much like java

20:08 Chousuke: javuchi1: that "It's not that hard" is utterly false :)

20:08 javuchi1: it's exceedingly difficult.

20:08 javuchi1: you can use an existing one

20:08 ambient: something interesting about JVM and TCO I found. "This is also the reason why JVM doesn't offer tail calls at all. The security sandbox uses stack walking to work out whether an operation is permitted in the current context. Proper tail call optimization would destroy the information needed to make those decisions."

20:08 Chousuke: such as the JVM :/

20:09 javuchi1: for example, take SBCL and transform it until you get something very apropiate for a language like clojure

20:09 Chousuke: I recently read JRose's post about continuations on the JVM. it was pretty interesting.

20:09 chouser: ambient: I believe there is a patch for TCO on the JVM that takes into account such things.

20:09 Chousuke: javuchi1: but then you wouldn't get the libraries.

20:10 javuchi1: why not?

20:10 Chousuke: javuchi1: and I don't think CL would be a good basis for Clojure anyway :/

20:10 it's... mutable :)

20:10 javuchi1: it was just an example

20:10 java is also mutable

20:11 krumholt: javuchi1, the jvm is only a plattform unless you plan on becoming a clojure developer i think there is no real reason to worry about it. from my point of view as programmer i don't really care what plattform is used and why would i?

20:11 javuchi1: and the jvm is pretty much mutable ;)

20:11 Chousuke: Many things aren't though.

20:11 like strings and numbers.

20:11 javuchi1: oh, strings and numbers... even C can do right on that ;)

20:12 chouser: C strings are mutable

20:12 javuchi1: i said can do well, not that they were not mutable

20:12 Chousuke: C "strings" are blobs of memory ;(

20:12 literally. if you want to treat something as just memory you cast it into a C string. :P

20:13 javuchi1: you can program inmutable in C if you want

20:13 ah, and now that we talk about C

20:13 Chousuke: though I suppose the real definition requires that it be null-terminated :/

20:13 javuchi1: C would be an excelent "platform" of "vm" for anything

20:14 look for example at ECL

20:14 tomoj: :'(

20:14 javuchi1: it is doing very well and it uses C as the assembler for everything

20:14 Chousuke: C is not a platform though. :/

20:14 C on unix is a platform.

20:14 C on windows is a platform.

20:14 javuchi1: I said "platform" not platform

20:14 understand what means the "

20:15 http://ecls.sourceforge.net/

20:15 robin_b: does anyone here know about setting the classpath for the interactive REPL started by the textmate clojure bundle?

20:21 krumholt: robin_b, i think you could use add-classpath

20:21 ,(doc add-classpath)

20:21 clojurebot: "([url]); Adds the url (String or URL object) to the classpath per URLClassLoader.addURL"

20:22 robin_b: ah - ok - so just do it within the repl once started

20:22 that makes sense

20:22 I was looking for a textmate command or a place to configure the project

20:23 chouser: add-classpatch is notoriously treacherous

20:23 if it works in a given situation, great, but don't be surprised if it fails in slightly different circumstances.

20:23 robin_b: hmm

20:29 ambient: is it in any way predictable?

20:29 javuchi1: all of this came with (= false nil)

20:29 chouser: ambient: you mean to know when add-classpath with fail?

20:29 Chousuke: heh :P

20:30 ambient: chouser yes

20:30 javuchi1: let me ask something a little delicate

20:30 do you hate CL gus?

20:30 Chousuke: no. :)

20:30 chouser: ambient: yes, it's not actually random, but it depends on how classloaders are being used

20:30 javuchi1: what do you think about them?

20:30 Chousuke: Depends on the person :P

20:31 I think there are quite many CLers here too.

20:32 javuchi1: do you think it is compatible to keep using CL and Clojure?

20:32 at the same time?

20:32 i have the feel that CL is getting to old

20:33 Chousuke: That's kind of my opinion too.

20:34 I never really got into CL... It has some really neat things, though.

20:34 And I really with Clojure had similar debugging facilities :P

20:34 wish*

20:34 The-Kennz: I really love CLOS

20:35 But it's a bit old, I agree... bad library support etc.

20:35 javuchi1: I don't, it is weird for me

20:36 Chousuke: Then again, Clojure does many things better than CL in my opinion. Vectors, maps and sets for instance.

20:36 The-Kennz: It's good to have a real map in clojure.

20:36 ambient: i'd think immutability and robust concurrency constructs are more essential :)

20:37 The-Kennz: I remember the ugly lists of (key . value)

20:37 Chousuke: and lisp1:ness and namespaces and syntax-quote are all cool stuff too, even though they're "minor" features

20:37 javuchi1: the main problem about CL is that everybody said that CL would be able to do anything in the future, but now we can see that there is a vital thing that it is not able to do, and little expectations of being to in the near future: multitasking

20:38 Chousuke: What's the deal with that anyway?

20:39 hiredman: actually, it was durring the standarization process of cl that the phrase "sufficently smart compiler" was coined

20:39 Chousuke: A sufficiently smart Clojure compiler would fix my reader :(

20:39 I still have no idea what's wrong with it.

20:40 javuchi1: with the reader?

20:40 of clojure?

20:40 Chousuke: no, one that I'm writing.

20:41 it compiles just fine and even works with contrib

20:41 but then explodes with the weirdest error if I try to recompile it with "itself"

20:41 javuchi1: are you a clojure devveloper?

20:41 Chousuke: which makes no sense as in order to compile it I already compiled it once with itself.

20:42 but compiling a second time fails.

20:42 hiredman: Chousuke is a Chousuke of the Finnish Chousukes

20:42 Chousuke: :P

20:42 javuchi1: I have a CA.

20:42 javuchi1: perhaps because you compiled it the first time with another version or with an option enabled/disabled?

20:43 hiredman: pffft, even I have one of those

20:43 Chousuke: well, it goes like this:

20:43 javuchi1: what is a CA?

20:43 _ato: javuchi1: http://clojure.org/contributing

20:45 javuchi1: oh i don't like it

20:46 Chousuke: First I compile the java files. Then, I have core.clj and reader.clj; I compile core.clj and reader.clj to class files with a plain java clojure. After that, I add them to classpath and recompile all clj files to classes, and make a jar of those. then I have a clojure.jar which uses my clojure reader but if I then try this process again with "plain java clojure" replaced with this

20:46 _ato: the only thing I don't like is it has to be posted instead of scanned + emailed

20:46 Chousuke: new clojure.jar... boom.

20:46 scottj: Is there a debugger that you can easily run along side slime so when you have a stack trace pop up you can easily see what variables values are?

20:47 Chousuke: scottj: there's http://georgejahad.com/clojure/cljdb.html

20:47 I should try that. :/

20:47 javuchi1: i don't agree very much with that politics

20:48 hiredman: politics?

20:48 (maybe you mean those policies?)

20:48 javuchi1: that

20:49 you hereby assign to me joint ownership, and to the extent that such assignment is or becomes invalid, ineffective or unenforceable, you hereby

20:49 grant to me a perpetual, irrevocable, non-exclusive, worldwide, no-charge, royalty-free, unrestricted license to exercise all rights under those

20:49 copyrights. This includes, at my option, the right to sublicense these same rights to third parties through multiple levels of sublicensees or other

20:49 licensing arrangements;

20:49 bad bad bad

20:50 chouser: javuchi1: my friend, there is no need for you to contribute.

20:50 _ato: hehe

20:50 javuchi1: you're right

20:50 hiredman: well, sorry to lose you, bye?

20:50 javuchi1: and now, much less need

20:50 Chousuke: you can just be a user

20:50 that's good too. File bug reports :P

20:51 Personally I think the CA is trivial.

20:51 chouser: but as a *user* I hope you can take comfort in knowing that when licenses need to be changed, that it can happen smoothly because the contributors have all signed on.

20:51 _ato: IMO Clojure/Sun's is much better than many other CA's eg http://www.canonical.com/contributors

20:51 javuchi1: when i saw the screencast

20:51 it was strange the face rihky put when talking it wan open source...

20:51 now i understand

20:51 Chousuke: huh?

20:51 _ato: what?

20:52 Chousuke: It is open source. Free software, even :P

20:52 _ato: javuchi1: did you miss the bit where it says Rich promises to release the code under an OSI/FSF approved license?

20:52 javuchi1: only until rich wants

20:53 _ato: unlike Canonical's you also retain ownership of your contribution

20:53 Chousuke: you just assign Rich joint copyright for your contributions. Which basically means that Rich *could* close the source but that won't happen; if it does, Clojure either dies or a fork happens :/

20:53 chouser: Chousuke: no, actually, because he promises not to in the same agreement.

20:54 Chousuke: what the CA allows is that if there ever is a licence better than the EPL for Clojure, it can be easily changed.

20:55 chouser: in fact it happened once already

20:56 ambient: there are some restrictions on using clojure in work related stuff?

20:56 chouser: nope

20:56 Chousuke: the EPL is GPL-incompatible, but then again, so are most other licences ;/

20:57 _ato: yeah, that's the only really bad thing about Clojure's licensing IMO

20:57 Chousuke: and even then it's GPL's fault.

20:58 but oh well. plenty of non-GPL java libraries out there :)

20:59 jbendig: I imagine the EPL makes it easier for many businesses to adopt use of Clojure. Don't many businesses stay away from GPL related code without trying to understand the licensing terms?

20:59 javuchi1: note that rich didn't promise anything

20:59 Any contribution I make

20:59 available under any license will also be made available under a suitable FSF (Free Software Foundation) or OSI (Open Source Initiative) approved

20:59 license.

21:00 what is contribution?

21:00 chouser: ambient: I'm not very sure, but I think the only "work related" restriction is that if you distribute clojure in object form with your code, you need to also make the source available (including your changes) under the EPL.

21:00 javuchi1: if it is not a contribution then it can be closed software

21:01 ambient: chouser clojure code? perhaps a link for github would suffice? ;)

21:01 jbendig: I thought only the EPL code had to be made available as open source. Your changes do not have to be.

21:01 Chousuke: jbendig: your changes to clojure have to be released. it's reciprocal like that.

21:02 chouser: ambient: sorry, I meant if you make a change to clojure itself and distributed the class files you'd have to make the source available under EPL.

21:02 Chousuke: jbendig: however, you can link it with a proprietary module.

21:02 ambient: ok

21:02 jbendig: Chousuke: Oh, okay.

21:02 chouser: right, only changes and additions to the program, not other thinks you link with it or any class files or jars it produces.

21:03 other things

21:03 javuchi1: what is rich afraid of? why this agreement enforcement if you want to contribute?

21:03 ambient: just because you're paranoid doesn't mean they're not out to get you

21:03 _ato: hehe

21:03 as said earlier it's so that the license can be changed to a different open-source license

21:04 eg. if the GPL-incompatiblity becomes really problematic Rich can do something about it

21:04 javuchi1: am i the paranoid, or the one who make that agreement?

21:04 why not using LGPL?

21:04 chouser: also he's very careful to track the provinence of every patch so that any claims that clojure contains code owned by others can be effectively refuted.

21:05 Chousuke: javuchi1: the CA basically makes licencing a non-issue.

21:05 if it becomes a problem, it can be changed.

21:05 or if someone wants to pay Rich 2 million USD for a custom-licenced version of Clojure, that can be done :P

21:05 chouser: at the cost of losing some potential contributors who don't like. A know cost that rich has chosen to accept.

21:06 man I can't type

21:06 _ato: Rich doesn't like the LGPL since someone can take clojure and make it GPL and then he can't use their changes

21:06 javuchi1: oh yes i'm pretty sure he can accept a lot of thing for 2 millions

21:07 _ato: then they should change the name, if he has the trademark, as i supose he has

21:07 somnium: javuchi1: is there a particular scenario you're concerned about?

21:08 javuchi1: i'm not american, this is the first

21:08 _ato: javuchi1: it's not about trademarks, it's about him being able to use their changes

21:08 Chousuke: Does that matter?

21:08 I'm not American either :/

21:08 javuchi1: the second is, if somebody, for example sun, or anything else, want to buy clojure, they can do with clojure whatever they want

21:09 Chousuke: javuchi1: the old versions will still be available to us.

21:09 jbendig: Then the source code up to that point could be forked and kept under the existing license.

21:09 chouser: javuchi1: but they can't take away our ability to fork at the point before they take it. This is tru of all free software.

21:09 Chousuke: javuchi1: and Rich is bound to release his contributions to the open as well.

21:09 but if that 2mil USD thing actually happens it'll be awesome though.

21:10 someone just gets a ProprietaryClojure and Rich can work full-time on Clojure.

21:10 javuchi1: but you are not the ownership

21:10 even for past versions

21:11 ambient: it would be pretty awesome if sun adopted clojure and started developing jvm into that direction more

21:11 javuchi1: he can change the license even for past versions

21:11 chouser: javuchi1: nope

21:11 _ato: javuchi1: no, it's non-revokable

21:11 javuchi1: you hereby

21:11 grant to me a perpetual, irrevocable, non-exclusive, worldwide, no-charge, royalty-free, unrestricted license to exercise all rights under those

21:11 copyrights

21:12 that's what it says

21:12 he can do whatever he wants

21:12 Chousuke: javuchi1: the contributors also retain those rights.

21:12 _ato: nad he's already released old versions of Clojure under the EPL, and he can't undo releasing it

21:13 Chousuke: which branch should I look at for your reader? reader-integrated?

21:13 javuchi1: where does it say so, Chousuke?

21:13 Chousuke: _ato: oh, the latest stuff is not there.

21:13 _ato: the latest stuff is a mess.

21:13 :)

21:14 I'll push it, wait a moment.

21:15 jbendig: javuchi: Look at section 2A of the EPL. http://www.opensource.org/licenses/eclipse-1.0.php

21:16 javuchi1: jbendig: the problem is that, with the CA, Rich makes himself the owner of everthing

21:16 _ato: he made *joint* owner

21:16 you retain ownership

21:16 jbendig: For future work, yes. Once the code is distrubted under the EPL then that set of work is tied to that license.

21:17 javuchi1: yes, but your contribution alone has not much value

21:17 jbendig: distributed*

21:17 javuchi1: jbendig: that is not what it says in his CA

21:18 Chousuke: javuchi1: yes, but it holds still.

21:18 javuchi1: you grant him an unrestricted license to exercise all rights under your code

21:18 Chousuke: javuchi1: revoking a licence for no reason after you grant it is fraud :P

21:18 chouser: if you want to contribute to emacs you have to assign copyright to the FSF, retaining no ownership of your own code. This is less extreme.

21:19 jbendig: The CA just makes it easier for Clojure to mature. Look how Squeak suffered later on by not having such a system in place.

21:20 ambient: CA is certificate authority or something?

21:20 hiredman: clojurebot: ca?

21:20 clojurebot: CA is Contributor Agreement: http://clojure.org/contributing

21:21 Chousuke: javuchi1: all the horror scenarios are purely theoretical and will simply not happen :)

21:22 and because of that the CA is a minor annoyance that gives flexibility benefits

21:23 javuchi1: I know that the FSF is not going to shell Emacs to Sun...

21:23 chouser: how do you know that?

21:24 somnium: if Sun bought emacs would you stop using it?

21:24 javuchi1: and, the most important

21:24 you give the copyright to the FSF, but you don't allow them to sublicense it with another license

21:24 Chousuke: chouser: Well, it's the FSF :P

21:25 javuchi1: with this CA, you allow Rich to change the license

21:25 it's much, much worse

21:25 _ato: javuchi1: giving FSF copyright allows them to change the license

21:25 javuchi1: in fact it means you can no longer change the license

21:25 since you don't retain ownership in your own code

21:26 Chousuke: yeah. you won't be able to use that contributed code under any other licence :/

21:28 chouser: red-letter edition with question-links at http://clojure-log.n01se.net/

21:28 the links still need some kind of tweaking, but I'm not sure exactly what.

21:29 but I've got to quit messing with it for now.

21:30 Chousuke: _ato: I pushed my current code into reader-mess

21:30 _ato: Chousuke: so the idea is, you compile once with the java reader generating clojure-slim.jar, then copy that to bootstrap/clojure.jar and recompile and this time it's with your reader?

21:31 Chousuke: clojure-slim.jar has to be a full-java clojure

21:31 ambient: chouser nifty, i think the arrows are too tiny, though

21:31 or too close together

21:31 Chousuke: the buildfile takes care of the rest

21:31 oh, and you'll need to use -Dclojure.reader=true to use my reader... I think

21:31 As I said, it's a mess. :P

21:32 there are debug prints in core.clj and syntaxquote-macro is broken and temporarily not even in use

21:32 chouser: ambient: yeah, probably both.

21:32 Chousuke: syntax-quote* (the function) should work instead of LispReader's syntaxquote method.

21:33 _ato: ah, so I build clojure-slim.jar with rich's "new" branch?

21:33 Chousuke: I haven't tested.

21:33 use master.

21:33 _ato: ok

21:33 jbendig: chouser: Very nice! I can see myself using this to catch up on questions over night. Would it be possible to fold the questions for faster scanning?

21:34 chouser: ambient: but small links are better than none, and big links may be worse (depending on what they do to the layout)

21:34 Chousuke: you can also edit the build file a bit to try and enable the "complete" build process (which still fails for me)

21:34 chouser: jbendig: yes, possibly, but will require more work.

21:36 Chousuke: _ato: if you get any exceptions using the reader in a repl, report to me. I haven't found anything.

21:37 _ato: Chousuke: cool it works. was getting some NPE with build because I was using the wrong clojure-slim.jar.

21:37 I'll have a play with it and see if I can break it

21:37 Chousuke: did you use the -D switch?

21:38 try typing for example '(foo] in the repl. if the error message includes column you're fine :)

21:38 _ato: java.lang.Exception: Unexpected closing character ] (line 1, column 7)

21:38 very nice :)

21:40 Chousuke: there's also a known bug with one of contrib's tests. for some reason, I get a stack overflow :/

21:41 but now I need to sleep. have fun :P

21:42 leafw: is there any way to do an "if-let" for multiple bindings? I.e. bind all if none are nil?

21:48 krumholt: will doseq execute every command?

21:48 somnium: attempt ->

21:48 ,(if-let [[x y z] (if (every? #(not (nil? %)) [1 nil 3]) [1 2 3] nil)] (println x y z))

21:48 clojurebot: nil

21:48 somnium: ,(if-let [[x y z] (if (every? #(not (nil? %)) [1 2 3]) [1 2 3] nil)] (println x y z))

21:48 clojurebot: 1 2 3

21:48 somnium: a bit clunky

21:48 _ato: krumholt: you mean will it consume the entire sequence? yes

21:49 krumholt: so i can use it for side effects?

21:51 _ato: krumholt: yes, that's what it's intended for

21:51 ,(doc doseq)

21:51 clojurebot: "([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."

21:52 krumholt: what i want to do is measure speed. i need fast matrix multiplication and my first implementation in clojure is allready about 60% faster then the java implementation that seems strange

21:55 what i want is a block in which no lazyness can happen. is that possible? like (without-lazyness ...)

21:56 _ato: ,(doc doall)

21:56 clojurebot: "([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through the successive nexts of the seq, retains the head and returns it, thus causing the entire seq to reside in memory at one time."

21:57 _ato: as in:

21:57 ,(time (doall (map inc (range 10))))

21:57 clojurebot: (1 2 3 4 5 6 7 8 9 10)

21:57 "Elapsed time: 0.183 msecs"

21:58 krumholt: thanks

22:01 ok now its really slow :) is there a fast-math library or something for clojure?

22:01 somnium: krumholt: you can use primitives and arrays

22:02 danlarkin: Is there a better way to check that everything in required is in sent? (reduce #(and (sent %1) (sent %2)) required)

22:03 krumholt: somnium, ok thanks

22:03 _ato: ,(empty? (difference #{:a :b} #{:a})

22:03 clojurebot: EOF while reading

22:03 _ato: ,(empty? (difference #{:a :b} #{:a}))

22:03 clojurebot: java.lang.Exception: Unable to resolve symbol: difference in this context

22:04 _ato: ,(use 'clojure.set)

22:04 clojurebot: nil

22:04 _ato: ,(empty? (difference #{:a :b} #{:a}))

22:04 clojurebot: false

22:04 _ato: ,(empty? (difference #{:a :b} #{:a :b}))

22:04 clojurebot: true

22:04 danlarkin: _ato: difference doesn't work because sent can have things that aren't required

22:04 _ato: ,(empty? (difference #{:a :b} #{:a :b :c}))

22:04 clojurebot: true

22:05 _ato: oh

22:05 wait no (difference required sent) ?

22:05 shouldn't that work?

22:06 your way might be faster though as it doesn't tell you what's missing

22:06 somnium: sent is a map and required is a collection of keys?

22:07 (every? {:foo :bar :baz :quux} [:foo :bar])

22:08 ,(every? {:foo :bar :baz :quux} [:foo :bar])

22:08 clojurebot: false

22:08 somnium: (every? {:foo :bar :baz :quux} [:foo :baz])

22:08 bah

22:08 danlarkin: _ato: difference does work that way... I didn't realize it wasn't commutative

22:08 _ato: so it'll work just fine, thanks

22:09 _ato: somnium: ah yeah, that's nicer

22:11 Anniepoo: ,(doc load-file)

22:11 clojurebot: "([name]); Sequentially read and evaluate the set of forms contained in the file."

22:12 Anniepoo: The page http://clojure.org/evaluation says

22:13 The loading functions occur in a temporary context, in which *ns* has a fresh binding. That means that, should any form have an effect on that var (e.g. `in-namespace), the effect will unwind at the completion of the load.

22:13 leafw: what could be an efficient way of searching a table for for keys that match a specific regex?

22:14 do I have to loop all keys, or are clojure keys somehow different? PArticularly if searching for a "starts with" predicate?

22:17 Anniepoo: I can't figure out what this means. It obviously doesn't mean I can't put (def foo 7) in a file and load it and have

22:17 foo be 7 afterwards.

22:17 hiredman: :/

22:18 annoyingly the developement appengine environment doesn't seem to want me to delete records from the datastore

22:19 _ato: leafw: you'll have to loop all the keys in the general case. If you really wanted I guess you could implement something that speeds up partial matches, but Java's standard regex library won't do that for you AFAIK. You might be able to find another java library that does it though

22:19 s/partial matches/prefix matches/

22:20 Anniepoo: does it mean simply that *ns* will be rebound to some local version, so if you do in-namespace it won't have any effect?

22:21 somnium: hiredman: what's your url?

22:21 _ato: Anniepoo: yes.. it just means if you do (ns bar) (load-file "foo.clj") (def x 3) and foo.clj contains (ns foo), then x will be decalred in namespace bar not namespace foo

22:22 hiredman: somnium: my url?

22:22 somnium: is your site up on ae?

22:22 hiredman: yes

22:22 but the only thing that works right now is a single facebook app

22:22 Anniepoo: ah, ok, thanks

22:22 somnium: hiredman: I want to look at it :)

22:22 konr: !proxy

22:23 hiredman: apps.facebook.com/agegraph I think

22:23 konr: clojurebot: proxy

22:23 clojurebot: proxy is <Chouser> proxy teases with its ease of use, then suddenly betrays.

22:23 _ato: Anniepoo: but if foo.clj contains (ns foo) (def y 4) then y *is* declared in ns foo. It's just means changes to *ns* within a loaded file don't leak out of that file

22:23 Anniepoo: ok, yes

22:24 effectively load-file contains

22:25 a wrapper that binds *ns* locally

22:25 _ato: kind of like: (let [old-ns *ns*] .... do the load .... (ns old-ns))

22:26 Anniepoo: kk, got it

22:29 Oooh!

22:32 * Anniepoo waves wildly and inappropriately at mike!

22:34 leafw: _ato: I suspected so. Thanks in any case.

22:38 mikehinchey: Anniepoo: hi!

22:38 Anniepoo: 8cD

22:41 djork: interesting, chouser

22:42 I guess always had the sieve right in my head and wondered why examples were usually wrong

22:42 oh wait that was at 3:11... way to go, me

22:44 Anniepoo: I bet this is one line somehow. I want to write (load-without-side-effects [reader]) that does a load but doesn't allow any side effects (modulo java interop)

22:45 krumholt: is there a way to just write (parseInt "5") instead of (Integer/parseInt "3")

22:45 slashus2: create a wrapper function

22:46 somnium: I think there's a static import function somewhere in contrib

22:47 ,(doc import-static)

22:47 clojurebot: "clojure.contrib.import-static/import-static;[[class & fields-and-methods]]; Imports the named static fields and/or static methods of the class as (private) symbols in the current namespace. Example: user=> (import-static java.lang.Math PI sqrt) nil user=> PI 3.141592653589793 user=> (sqrt 16) 4.0 Note: The class name must be fully qualified, even if it has already been imported. Static methods are defined as MACROS, not

22:48 krumholt: cool thanks

22:48 somnium: hmm, it makes macros though, so it might not do what you want

22:49 krumholt: thats exactly what i want :0

22:49 thanks

22:57 _ato: Anniepoo: I don't think that's possible, well unless you somehow sandbox the file so the only functions available to it are ones that can't have side-effects. Is there a particular use-case you have for this?

22:57 Anniepoo: yes

22:58 if I can make such a thing, then I can make a sandboxed repl

23:00 which could make a wonderful tool for making web stuff - you interact with me by sending clojure code

23:00 _ato: you could have a look at what clojurebot does: http://github.com/hiredman/clojurebot

23:00 but I don't think it's easy

23:00 Anniepoo: already have done so

23:01 no, it's not turning out to be, but I'm digging

23:01 George Jahad gave a talk about server-socket at last clojure meetup, inspired me,

23:02 this seems like a nice remote agent mechanism.

23:07 It seems like it should be the sort of thing that's 25 lines of file and net IO stuff and 6 completely incomprehensible lines that do the real work

23:09 but it's being icky

23:10 well, I'm done 4 2day

23:10 nighte

23:22 leafw: hum

23:22 how to call super in a proxy ?

23:22 clojurebot: a is b

23:24 leafw: clojurebot: zen ?

23:24 clojurebot: Excuse me?

23:24 leafw: not zen enough.

23:25 chouser: ,(doc proxy-super)

23:25 clojurebot: "([meth & args]); Use to call a superclass method in the body of a proxy method. Note, expansion captures 'this"

23:25 chouser: leafw: be careful, that's not thread-safe.

23:26 tomoj: hum, why not?

23:28 leafw: thanks chouser

23:53 _ato: good grief, Chousuke's reader exception is non-deterministic, each time I run it it happens in a different place

23:55 hiredman: time to start disabling pieces

Logging service provided by n01se.net