#clojure log - May 01 2010

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

0:00 cemerick: ninjudd: yeah, don't let me bring you down. I just managed to eliminate a pile of java with some deftype usage, so I've got a shiny new hammer to drive nails with. :-)

0:00 uberjar: if clojure could use protobufs without having to write java to the filesystem.. that would indeed be pretty slick

0:01 as far as bragging rights go @ least

0:01 cemerick: I have a sneaking suspicion that that's what chouser's got bubbling away at work.

0:01 ninjudd: uberjar: you mean compile the protobufs on the fly?

0:01 uberjar: yeah.. like if I wanted to compile them from the repl to do some experimentation

0:03 ninjudd: hmm

0:03 well, i can say that wrapping the google java code let me write a working protobuf implementation in a weekend

0:04 it would have taken much longer writing it from scratch, but i'm open to an all clojure implementation

0:05 uberjar: it would certainly give clojure the coolest protobuf library of any dynamic language.

0:05 ninjudd: though at the time, deftype didn't exist, and there would have been no way to make it fast

0:05 and i wrote it becuase i needed fast

0:06 hiredman: ,(doc add)

0:06 clojurebot: "clojure.contrib.accumulators/add;[[acc item]]; Add item to the accumulator acc. The exact meaning of adding an an item depends on the type of the accumulator."

0:06 hiredman: :D

0:07 replaca: sweet!

0:07 ~def add

0:09 ninjudd: cemerick: did you say chouser is working on an implementation of protobufs?

0:09 cemerick: he's hinted at it, I think

0:09 for work though, so it's apparently not trivial to get open-sourced, etc

0:10 ninjudd: oh

0:10 i did my implementation for work too, though my company is awesome when it comes to open source

0:11 cemerick: I don't know any of the details, so the same may happen there

0:12 ninjudd: do you think a deftype version could be as fast as the pure java version?

0:12 or even better, faster

0:13 cemerick: hrm

0:13 parity is probably the realistic goal

0:14 I presume google's impl is pretty thight

0:14 tight*

0:15 ninjudd: well, i do use DynamicMessage rather than their specific generated message classes

0:15 so there may be some room for improvement

0:16 i assume the reflection has some cost

0:16 cemerick: reflection is a killer for IO, yeah

0:17 ninjudd: well, i'm not sure how much "Java Reflection" they use

0:17 cemerick: probably none, but if you're using some....

0:18 ninjudd: i use instanceof

0:18 and i cache all costly actions like looking up fields by name

0:19 it is still really fast

0:19 though this is pretty core to what we are doing, so any speed boosts we can get would be worth me spending more time on it

0:20 cemerick: I'd think the development process improvement would be a big enough win, even if the actual perf didn't change.

0:21 ninjudd: well we aren't actively adding features to that code

0:22 it already supports all non-deprecated protobuf types

0:22 and we added extensions for sets and maps

0:23 i wouldn't ming doing it to learn about deftype though

0:23 *mind

0:24 maybe i'll chat with chouser about it

0:25 cemerick: yeah, that's a good plan

0:25 he's always pretty excited about protobufs anyway :-)

0:27 ninjudd: yeah, protobufs are seriously awesome

0:29 cemerick: so they're generally useful for serialization?

0:29 i.e. not just for network comm?

0:29 ninjudd: yeah, that's all we are using them for

0:29 we use json for network comm

0:30 we use them as the data serialization format for our graph db

0:30 cemerick: I wrote my own serialization mechanism for clojure objects a while back that worked out to be pretty darn fast. It'd be nice to not have to maintain that.

0:31 ninjudd: open source?

0:31 cemerick: should be, never got around to it

0:32 ninjudd: have you looked at clj-serializer?

0:32 cemerick: it's part of an in-process database I wrote...a thick layer on top of jdbm

0:33 ninjudd: nice

0:33 that's what we're using protobufs for

0:33 cemerick: yup, very similar to that, though no java component

0:34 hrm, and we do support more object types

0:34 ninjudd: than protobuf?

0:35 cemerick: than clj-serializer

0:35 ninjudd: ah

0:35 cemerick: ...and we support using Java Serialization for arbitrary java objects, and arbitrarily-deep nesting of composite objects

0:35 so, same concept, we went a little farther

0:36 there's nothing special about it though, of course

0:36 ninjudd: you should open source it

0:36 cemerick: Yeah, it's on the list

0:36 I've got about 6 projects that I keep meaning to get on github.

0:37 ninjudd: part of the reason i like protobufs so much is that they do a really good job of keeping the serialization size small

0:37 cemerick: we'd probably have a helluva time packing arbitrary java objects in them, though?

0:38 ninjudd: well

0:38 you could store them as binary

0:39 i should support that automatically actually

0:39 cemerick: right, but could we configure the protobuf library to transparently serialize them, or would we have to walk our object graphs, serialize to byte[], and then pass to protobufs?

0:39 ninjudd: if you have a protobuf field of type bytes, i could use java serialization to dump the object

0:41 if there is an easy way to dump an object and all objects it contains, then i could do it automatically

0:41 not sure if java-serialization does that

0:42 cemerick: yeah, it serializes full object graphs

0:42 ninjudd: so clojure protobuf could automatically serialize a java object if you assign it to a field of type bytes

0:42 wouldn't be too hard

0:43 cemerick: we'll have to see how motivated I get in that direction :-)

0:43 I wouldn't look forward to converting the existing databases. :-P

0:43 ninjudd: yeah

0:44 may be a good exercise though

0:46 but it would only be useful if you use those java objects inside of clojure objects really

0:50 MadWombat: Hello

0:56 sids: ,(:arglists ^str)

0:56 clojurebot: nil

0:56 sids: ,(:arglists ^(var str))

0:56 clojurebot: ([] [x] [x & ys])

0:56 sids: I really don't understand the difference between the above two

0:59 ninjudd: from what i understand, one is the metadata on the fn referenced by str, the other is the metadata on the var str itself (the reader metadata)

1:00 cemerick: yup, that's right

1:00 there's some sugar for the latter

1:00 ,#'str

1:00 clojurebot: #'clojure.core/str

1:00 cemerick: and

1:01 ,(meta #'var)

1:01 clojurebot: java.lang.Exception: Unable to resolve var: var in this context

1:01 cemerick: ,(meta #'str)

1:01 clojurebot: {:ns #<Namespace clojure.core>, :name str, :file "clojure/core.clj", :line 356, :arglists ([] [x] [x & ys]), :tag java.lang.String, :doc "With no args, returns the empty string. With one arg x, returns\n x.toString(). (str nil) returns the empty string. With more than\n one arg, returns the concatenation of the str values of the args."}

1:07 sids: ninjudd, cemerick: thanks, I think I understand

1:08 so defn associates the metadata with the var, not the function? but why so?

1:10 nathanmarz: sids: http://www.assembla.com/spaces/clojure/tickets/94-GC--Issue-90---%09-Support-metadata-on-fns

1:10 sexpbot: "#94 - GC Issue 90: Support metadata on fns (Fixed) | Clojure | Assembla"

1:12 replaca: hiredman: great, glad to see it's working again

1:12 ,(doc pprint)

1:12 clojurebot: "clojure.contrib.pprint/pprint;[[object] [object writer]]; Pretty print object to the optional output writer. If the writer is not provided, print the object to the currently bound value of *out*."

1:13 sids: nathanmarz: oh, nice. thanks

1:15 MadWombat: is there any way to disconnect from slime/clojure-swank without losing an ability to reconnect?

1:19 sids: MadWombat: when at the repl, type , (comma) followed by 'quit'

1:20 MadWombat: sids: lemme try

1:21 sids: I get "open-network-stream: make client process failed: connection refused, :name, SLIME Lisp, :buffer, nil, :host,, :service, 4005"

1:21 sids: when I try to reconnect

1:22 sids: I am using lein swank plugin to start swank

1:22 sids: MadWombat: this will quit swank itself

1:23 MadWombat: you'll have to restart swank again (using lein swank)

1:23 MadWombat: sids: yes, my question was, how do I reconnect to swank without restarting it

1:24 sids: MadWombat: if you don't want to have to do that, use M-X slime-disconnect instead

1:25 MadWombat: I get the same error on slime-disconnect

1:28 sids: MadWombat: may I ask, what is the purpose of disconnecting?

1:32 MadWombat: sids: changing code on a remote system, restarting emacs or logging out

1:44 sids: MadWombat: I can't figure it out; if you do please let me know!

1:45 MadWombat: sids: sure

2:59 gerryxiao: hello

2:59 where is add-watcher?

3:00 hamza: AFAIK its removed.

3:01 gerryxiao: my old code use it, how to change to add-watch?

3:02 what does the key arg of addwatch do?

3:03 hoeck: gerryxiao: just for referencing the watch

3:03 through remove-watch

3:04 gerryxiao: my old code: (add-watcher a :send-off b f) how to change to add-watch?

3:05 hoeck: to use watches should be sth like : (add-watch <ref> :key (fn [k the-ref old new] (send-off <your-watcher-agent> <your-action-fn> old new)))

3:12 gerryxiao: i'm abit confused about change add-watcher to add-watch

3:14 cemerick: ~max

3:14 clojurebot: max people is 283

3:15 cemerick: gerryxiao: add-watch is more general-purpose than add-watcher was. You can generally just ignore the key value in the fn you pass to add-watch, although there are ways you can use it to simplify certain patterns.

3:19 gerryxiao: ok,thx

3:34 (add-watch a :key (fn [k r old new] (send-off b action-fn new)))

3:37 it seems working

3:47 what's the difference between send and send-off?

3:48 hoeck: gerryxiao: send-off spawns a new thread

3:49 so that it doesn't block existing threads in the agents thread pool

3:49 gerryxiao: hoeck: which is suit for sync?

3:49 hoeck: its used of you do blocking stuff in your agent

3:49 like (send-off *state* read-from-socket)

3:50 and read-from-socket may wait until there is something readable in the socket

3:50 gerryxiao: hoeck: ok

3:50 hoeck: send is for non-blocking stuff, like (send *state* update-in [:counter] inc)

3:51 gerryxiao: hoeck: so send is suit for sync

3:51 hoeck: what do you mean by "sync" ?

3:52 gerryxiao: i mean "at the same time" both agent action and main action

3:52 _ato: gerryxiao: send is also in a seperate thread, but it doesn't spawn a new thread for each call, instead it uses a thread pool

3:53 ,(doc send)

3:53 clojurebot: "([a f & args]); Dispatch an action to an agent. Returns the agent immediately. Subsequently, in a thread from a thread pool, the state of the agent will be set to the value of: (apply action-fn state-of-agent args)"

3:55 gerryxiao: i have a agent watching chesses on board , when chess is dead, agent will remove the chess from board, which one is better?

3:56 _ato: send

3:56 gerryxiao: ok,thx

3:57 _ato: use send-off for actions that block (like reading from a socket, or waiting for user input)

4:16 gerryxiao: when will 1.2 be out

4:17 Licenser: good morning

4:19 somnium: salut

4:22 gerryxiao: afternoon

4:48 Licenser: gerryxiao: nobody knows

5:08 gerryxiao: why?

5:08 clojurebot: why not?

5:08 gerryxiao: ,*clojure-version*

5:08 clojurebot: {:interim true, :major 1, :minor 1, :incremental 0, :qualifier "master"}

5:12 bsteuber: why do people always use *clojure-version* although the corresponding function is much more readable?

5:12 ,(clojure-version)

5:12 clojurebot: "1.1.0-master-SNAPSHOT"

5:30 gerryxiao: ,(doc seq-contains?)

5:30 clojurebot: Titim gan éirí ort.

5:32 gerryxiao: is defrecord faster than defstruct when using :field as accessor?

5:32 and defrecord support all defstruct ops ?

5:32 hamza: ~def sorted-set

5:33 carkh: gerryxiao: as far as i know yes and yes

5:33 tho it will only be faster for "declared" fields

5:35 gerryxiao: ok,great

5:38 Chousuke: defstruct is pretty much obsoleted by defrecord

5:46 hamza: what does sorted-map uses to sort if i give vector of numbers as keys?

5:49 Chousuke: no idea. you probably want sorted-map-by

5:52 hamza: no I meant which pred is used to keep it sorted I am not trying to resort the map, cause (> [1 2] [3 4]) kind of thing does not work for vectors.

5:53 Chousuke: it probably compares the hashcodes

5:53 so essentially, it's a random order

5:55 though I suppose you need to check the code to be sure.

5:55 hamza: kk thanks will check..

5:55 ,(sorted-map [3 4] :b [1 2] :a)

5:55 clojurebot: {[1 2] :a, [3 4] :b}

5:55 hamza: this is the behaviour i am after, but i can't decide if I should count on it or not

5:59 _ato: ,(compare [1 2] [2 3])

5:59 clojurebot: -1

5:59 _ato: ,(compare [5 2] [2 3])

5:59 clojurebot: 1

6:00 _ato: vector comparison is well defined

6:01 http://github.com/richhickey/clojure/blob/master/src/jvm/clojure/lang/APersistentVector.java#L392

6:02 < <= >= and friends are only defined on numbers

6:02 use 'compare for other objects

6:02 hamza: _ato: ok great, so i can safely count on it for vectors of the same size.

6:02 _ato: yep

6:02 hamza: thanks.

6:03 mmarczyk: would it be (easily) possible in Clojure to create a sequence type which, when asked for "rest", wouldn't calculate "first"?

6:04 something which would make it possible to do (take-nth 4 (map (partial print " ")) input-seq) and have only the elements picked by take-nth printed out

6:10 _ato: mmarczyk: yeah, with proxy or reify on clojure.lang.ISeq

6:12 mmarczyk: _ato: right, I'm trying to write a deftype for this, but apparently I'm doing something completely wrong :-(

6:13 getting AbstractMethodErrors

6:13 ooooh, I haven't implemented Seqable

6:14 ...oh bother, now I have and still no go

6:15 Chousuke: mmarczyk: you can only make such a sequence if the rests in no way depend on what was before them.

6:15 mmarczyk: they don't

6:15 http://gist.github.com/386218

6:17 Chousuke: you probably need to implement cons too. but I'm not sure about that :P

6:19 mmarczyk: Chousuke: not really, cons just calls clojure.lang.RT/cons, which only cares about ISeq / Seqable

6:20 huh!???

6:20 wait

6:20 it works now

6:20 oh come on

6:20 what a macro failure

6:21 corrected now :-)

6:24 and now map doesn't work :-(

8:41 hoeck: gerryxiao: setting *dynamic-vars* works only on the repl, cause the repl runs in a context where *warn-on-reflection* is bound, like (binding [*warn-on-reflection* false] (clojure-repl))

8:41 gerryxiao: try using (alter-var-root #'warn-on-reflection (constantly true))

8:41 but you don't have to set it during compilation or in compiled production code

8:42 its really only used to find reflection usages while developing an application

8:42 Licenser: good day my friends

8:43 hoeck: hi Licenser!

8:43 gerryxiao: hoeck,thx, and lein clojure 1.2.0-snapshot don't know flatten func

8:45 hoeck: isn't flatten in clojure.contrib.seq? maybe it has been moved to clojure.core

8:45 Licenser: gerryxiao: I thinik it is in the c.c.seq namespace

8:45 yea it's in clojure core

8:45 hoeck is right again :P

8:46 gerryxiao: Exception in thread "main" java.lang.Exception: Unable to resolve symbol: flatten in this context

8:46 Licenser: gerryxiao: are you running lein repl?

8:47 gerryxiao: Licenser: no, repl compile

8:47 s/repl/lein

8:47 Licenser: ah I see

8:47 hm hmm I kind of don't trust lein with the 1.2 branch, at least in the repl it still lods the olds stuff

8:48 but I think it's different with the compile

8:48 gerryxiao: in my namespace, i have :use c.c.seq

8:48 Licenser: geramuk: in 1.2 you should not need

8:49 gerryxiao: how to make lein use clojure.jar and contrib.jar located in my box?

8:50 Licenser: for compiling I'm not sure but in theory copy them in your lib directory

8:53 gerryxiao: but the jar in lib have timestamp in the file name

8:55 clojure-1.2.0-master-20100501.080553-61.jar clojure-contrib-1.2.0-20100501.080834-94.jar

8:56 whynot know flattern?

8:56 Raynes: It's supposed to.

8:56 Because they are snapshots.

8:56 And flatten is in core now.

8:57 gerryxiao: Raynes: so it should be in clojure-1.2.0-master.xxx.jar

8:58 Raynes: flatten? Yes, if you have the latest snapshot, and if you did lein deps recently, you should, flatten will be there.

8:58 gerryxiao: Raynes: i just do lein deps now

9:01 how to update lein itself?

9:01 Licenser: lein upgrade

9:01 gerryxiao: ok

9:03 lein upgrade

9:03 Exception in thread "main" java.io.FileNotFoundException: Could not locate leiningen/upgrade__init.class or leiningen/upgrade.clj on classpath:

9:05 patrkris: gerryxiao: download the new lein script from github.com/technomancy/

9:06 gerryxiao: ok,thx

9:07 patrkris: gerryxiao: (and run lein self-install afterwards)

9:10 Licenser: hmm were did re-split go to?

9:15 gerryxiao: after update lein, still not work for flatten

9:19 Exception in thread "main" org.apache.tools.ant.ExitException: Permission (java.lang.RuntimePermission exitVM) was not granted.

9:19 what's it?

9:19 Licenser: wow gerryxiao you have some seriouse oddities there

9:19 can you explain your setup?

9:20 gerryxiao: project.clj?

9:20 Licenser: type lein version

9:20 start with that

9:21 gerryxiao: Leiningen 1.1.0 on Java 1.6.0_20 Java HotSpot(TM) 64-Bit Server VM

9:21 Chousuke: you're not starting java with a security policy defined, are you?

9:21 gerryxiao: yes

9:22 Chousuke: i just do lein clean, and got that error msg

9:22 Chousuke: hmmh :/

9:23 gerryxiao: before do lein clean, i got not find flatten symbol error msg :)

9:23 Licenser: oh you had multiple clojure jars in your lib then

9:23 lein does not remove old jars when you do lein deps, a evil thing kind of but adly that is how it works

9:24 Raynes: lein clean && lein deps should work. :<

9:24 Licenser: and when did you got that exception?

9:24 gerryxiao: lein compile

9:25 Licenser: do you happen to have an exit or something like that in your code?

9:26 I hate compiler errors, they so much don#t tell you what goes on ...

9:28 gerryxiao: no

9:29 Licenser: hmm hmmm

9:29 very odd

9:29 gerryxiao: Licenser: i have one line call (-main)

9:29 Licenser: you don't need that call

9:30 you need to define -main but don't call it

9:30 gerryxiao: after comment it, it seems working, weird

9:30 Licenser: the line was the problem

9:30 gerryxiao: but works on repl

9:30 Licenser: when compiling all top level code gets executed

9:31 so when you have (-main) in there it tries to start the program while compiling

9:31 think you'd do that in C or something, of cause that gives you odd errors )

9:31 when you start it with the jvm it will call main for you

9:31 gerryxiao: oic,thx

11:05 Licenser: hmm is there a easy way to find the index of a certain element in a seq?

11:06 Chousuke: contrib has an "indexed" function. that's probably the easiest

11:07 hamza: positions in c.c.seq-utils

11:07 Licenser: *nods* thanks :)

11:15 hmm can I monitor changes to a ref?

11:18 Chousuke: add-watch

11:18 Licenser: ah thank you!

11:28 another silly question how do I remove soething from a set

11:28 I know remove works but it makes a seq from the set

11:28 rhudson: disj

11:29 Licenser: way too easy, thank you rhudson

12:35 rsh: if I wanted to include a custom java file with some static methods to import into a clojure file, how can I do this using leiningen? compiling it and adding it to /classes doesn't seem to work nor does adding it to a jar and putting it in /lib

12:37 stilkov: rsh: you could put the source into src/main/java, do a lein pom and then let maven handle it

12:38 alternatively, you could build your Java stuff using a separate mvn project and then require it as a depencency from your project.clj

12:47 rsh: in the first case, what do you mean exactly by let maven handle it? sorry, never used maven before

12:47 Raynes: companion_cube: Were you asking about the sexpbot/clojurebot source code a while back?

12:53 maravillas: rsh: there's a lein-javac plugin you can use to do that

12:53 http://github.com/antoniogarrote/lein-javac

13:11 Licenser: hmm curiose fact: get does not work on lists

13:13 rhudson: Licenser: you need to use nth for lists

13:14 Licenser: thanks rhudson :)

13:14 and oh my I actually used contains on a seq now o.O

13:15 next question for the smart people, can I extend a proxy with more methods?

13:15 situation is I've an interface X which is statisfied by a proxy pX and an interface Y which also statisfies X so if I write pY I would like to 'reuse' the stuff of pX

13:17 replaca: Licenser: nope, because proxies are anonymous

13:17 Licenser: okay

13:18 then it's time for more macro majo

13:18 vu3rdd: given a key like :foo, how can I get the name "foo"?

13:18 replaca: ,(name :foo)

13:18 clojurebot: "foo"

13:18 hamza: ,(name :key)

13:18 clojurebot: "key"

13:18 vu3rdd: ah.. ok.

13:18 thanks

13:18 replaca: the answer was in the question :-)

13:19 remleduff: What does the coding standard mean by "prefer updating over setting?"

13:19 vu3rdd: yes. :) Only that my memory is too small to hold the names of all these functions

13:21 rhudson: remleduff: for e.g. a ref, prefer alter to ref-set

13:23 hamza: when you ref-set it implies you don't care about refs prev state.

13:25 remleduff: Gotcha, I thought it was still talking about collections at that point, but it's kind of just a big bag o' tips :)

13:26 Licenser: hmm more dumb questions, to add an element in a sequience at a certaion position is there already some code?

13:27 defn: position in what context?

13:27 like after the 5th element add "foo" to the vector?

13:27 hamza: AFAIK no, if its a vector use subvec to split it then rebuild for sequences concat.

13:27 Licenser: defn: yap

13:27 well I don't know the type sadly

13:28 might be any kind of sequence, so I guess I roll my own code

13:29 remleduff: ,(assoc (vec (seq [1 2 3 4 5])) 0 99)

13:29 clojurebot: [99 2 3 4 5]

13:29 defn: hmmm

13:29 remleduff: Oh, you want to insert?

13:29 hamza: (concat (take some sequence) [thing_to_insert] (drop some sequence))

13:29 Licenser: yea insert

13:29 hamza: replace some with a number and sequence with your sequence

13:29 Licenser: hamza: that is nice!

13:31 hamza: ,(concat (take 2 [1 2 3 4]) [99] (drop 3 [1 2 3 4]))

13:31 clojurebot: (1 2 99 4)

13:31 Licenser: actually drop 2?

13:31 I want to insert not to add

13:32 defn: ,(rotations [1 2 3])

13:32 clojurebot: java.lang.Exception: Unable to resolve symbol: rotations in this context

13:32 defn: ,(use 'clojure.contrib.seq)

13:32 clojurebot: java.io.FileNotFoundException: Could not locate clojure/contrib/seq__init.class or clojure/contrib/seq.clj on classpath:

13:32 hamza: yeap drop two

13:32 defn: ,(use 'clojure.contrib.seq-utils)

13:32 clojurebot: nil

13:32 defn: ,(rotations [1 2 3])

13:32 clojurebot: ((1 2 3) (2 3 1) (3 1 2))

13:33 Raynes: $(rotations [1 2 3])

13:33 sexpbot: Unable to resolve symbol: rotations in this context

13:33 defn: manning still hasn't emailed me with the updated JoC

13:33 $(use 'clojure.contrib.seq)

13:33 sexpbot: clojure.contrib.seq

13:33 defn: $(rotations [1 2 3])

13:33 sexpbot: Unable to resolve symbol: rotations in this context

13:33 Raynes: Licenser: ^ is that a bug.

13:33 defn: $(clojure.contrib.seq/rotations [1 2 3])

13:33 sexpbot: clojure.contrib.seq

13:34 Raynes: I think that is a bug.

13:34 ;o

13:34 defn: looks that way :)

13:34 Raynes: He is also printing stuff wrong...

13:34 $(+ 3 3)

13:34 sexpbot: result: 6

13:34 Raynes: It should always put result: behind it, except in the event of an error.

13:34 Licenser: hmm odd

13:35 did you allow use?

13:35 Raynes: But that probably isn't clj-sandboxes fault.

13:35 Licenser: You whitelisted c.c.seq, right?

13:35 Licenser: Raynes: do you really think I know all the whitelisted ns's?

13:35 Raynes: Licenser: Yes. :p

13:36 No.

13:36 Licenser: heh

13:36 Raynes: You only whitelisted seq-utils.

13:36 But it doesn't exist.

13:36 In 1.2

13:36 Licenser: ah see

13:36 well just whitelist seq too :P

13:36 no harm in whitelisting non existing stuff

13:36 Raynes: Actually never mind.

13:36 Licenser: You do have it whitelisted.

13:36 So, bugtime.

13:37 Licenser: heh

13:37 I finish my seq-ref-combobox-model you find a bug

13:37 DavideAngelocola: there is a way to automatically execute code at slime-repl startup?

13:39 remleduff: DavideAngelocola: If you have a user.clj in your classpath, it gets executed

13:40 DavideAngelocola: cool, thanks :)

13:41 remleduff: I kind of wonder how that isn't a security problem, sometimes

13:42 I guess stuff you put in your classpath can do anything it wants in static initializers, etc, so it's not like you're safe just downloading random jars

13:46 DavideAngelocola: what about hardcoding some code in my .emacs? at least to load repl-utils and setting print limit

13:46 remleduff: Did user.clj not work for that?

13:47 DavideAngelocola: no, it worked :)

13:58 Licenser: Raynes: look at this: http://github.com/Licenser/clj-swing/blob/master/src/clj_swing/example.clj#L28

13:59 Raynes: Awesome.

13:59 Licenser: very slim definition of the gui and the combo box content backed by a seq that sits in a ref, all changes are auomatically populated to the gui

14:00 so I guess soon you'll write a swing gui for sexpbot :P

14:03 rhickey: (=? 42) for #(= 42 %) ?

14:03 Licenser: hmm nice ida

14:04 (some (=? 42) (range 100))

14:04 looks good to me

14:04 Chousuke: hm, how would you read that?

14:04 cemerick: rhickey: thanks for the clarification on the field access

14:05 rhickey: cemerick: you're welcome. I might make that work under reflection, but more work than what is there

14:05 Licenser: Raynes: big question, list is - obviousely taken, so how do I call the macro for jlist?

14:05 rhickey: no path to flow the keyword-ness to where it's needed

14:05 cemerick: rhickey: surely a good idea before it becomes a supported feature.

14:06 rhickey: cemerick: if ever

14:06 Chousuke: Licenser: namespaces are good. just call it list? :P

14:06 cemerick: rhickey: people suss these things out :-)

14:06 Licenser: Chousuke: I wasn't sure if that'd be bad tase

14:06 rhickey: cemerick: any opinion on =?

14:06 cemerick: rhickey: I haven't been following -- in the logs?

14:06 rhickey: cemerick: (=? 42) for #(= 42 %

14:06 )

14:07 equality predicate maker

14:08 * rhickey is ripping out seq-contains?

14:08 Chousuke: I'm not sure I like the name. it breaks the ? convention for predicates and I don't know how it's meant to be pronounced :P

14:08 cemerick: I'll have to think about =?

14:08 Licenser: rhickey: the suggestion of got? isntead of contains? was quite good :P

14:09 cemerick: rhickey: in favor of?

14:09 rhickey: Chousuke: agreed, but I don't know of better

14:09 cemerick: (some (=? 42) (range 100))

14:09 cemerick: ah

14:09 Chousuke: rhickey: =fn or something? too weird?

14:09 rhickey: =? would work everywhere predicates do

14:09 LauJensen: Good evening

14:09 Licenser: that reads quite nice I think

14:09 hi lau

14:10 rhickey: Licenser: no it wasn't imo

14:11 Licenser: so rhickey there is one upside to this whole discussion, at least I got used to reading contains? in palces I'd not expect it :P

14:11 cemerick: The thing about =? that his me right away is the surprise that it's returning a fn.

14:11 * rhickey is not going to discuss contains? right now, please

14:12 rhickey: cemerick: yes, but what else could it do?

14:12 * Licenser wasn't going to discuss it, sorry

14:12 cemerick: Seeing = as the first char in fn position makes me think it's a cousin of =, which it's not. I wonder if that's muscle memory or something that'd be a constant source of friction.

14:12 rhickey: cemerick: I agree it's the naming convention for preds, OTOH, I don't think it implies anything itself

14:13 there are of course more verbose and descriptive ways to do this, but will lose to #(= x %) for brevity

14:14 Licenser: but #(= x %) is quite short too so while =? is kind of neat there is no urgent need for it

14:14 rhickey: some shorthand for partial would work pretty well too

14:14 cemerick: rhickey: you and chouser were riffing on simpler/cleaner syntaxes for simple anon fns a while back. Is there anything leftover from that that applies here, or was that only for hosty things?

14:14 Licenser: if you'd had to write (partial =) or (fn [e] (= x e)) every time then yes

14:14 remleduff: What's wrong with equal?

14:14 (equal? 1 1 1 1 1) -> true

14:15 rhickey: cemerick: only hosty, I can;t think of anything simpler or smaller than #() and it's worked out extremely well

14:15 Licenser: remleduff: nothing wring, just disucssing to make a shortcut for #(= x %)

14:15 * technomancy likes the sound of shorthand for partial

14:15 technomancy: as well as =?

14:15 cemerick: rhickey: there's a whole tradition of sigils for partial and comp

14:15 rhickey: technomancy: got one?

14:15 Licenser: the shorthand of partial would be cool

14:15 cemerick: More line-noise-esque stuff though.

14:15 technomancy: though the former may make the latter unnecessary

14:15 Licenser: p?

14:15 clojurebot: I'm sorry, Licenser. I'm afraid I can't do that.

14:15 Chousuke: maybe make #{x} return a set that's optimised for checking for that one element instead? :P

14:15 Licenser: (p =)

14:15 rhickey: cemerick: dot for comp conflicts with host syntax

14:15 Licenser: that'd be prtty nice :P

14:16 (doc p)

14:16 clojurebot: Huh?

14:16 cemerick: rhickey: right; devlinsf has a convention he uses....

14:16 Licenser: p seems not taken too

14:16 rhickey: (app = 42) == app is partial apply

14:16 cemerick: lol

14:16 Licenser: (doc app)

14:16 clojurebot: It's greek to me.

14:16 arohner: rhickey: I like (=? 42)

14:16 cemerick: fn names as humor

14:17 technomancy: don't have any suggestions, no

14:17 rhickey: app for partial wasn't a joke

14:17 cemerick: someone find a haskeller

14:17 rhickey: oh, I know

14:17 I like it quite a bit right off

14:17 It's just also a pun.

14:17 sids: rhickey: why not make some test for equality if the first arg isn't a predicate?

14:17 rhickey: (some (app = 42) (range 100)) is only one character more

14:17 cemerick: which is a plus, IMO

14:18 Chousuke: why not shorten it to just ap?

14:18 I think that's haskell apply though :P

14:18 cemerick: we're all going to be writing in APL shortly. :-P

14:18 remleduff: Can you do something like just have = return itself instead of true?

14:19 Chousuke: ,(= 1)

14:19 clojurebot: true

14:19 rhickey: Chousuke: Haskell has currying and doesn't really need partial

14:19 remleduff: Yeah, but if = returned itself, you could continue to call it until it returned false

14:19 ((= 1) 1)

14:19 Chousuke: remleduff: but that would break applying =

14:19 remleduff: since you'd have to special case single-element collections

14:20 Licenser: would it?

14:20 remleduff: Why? The fn = is still a true value

14:20 rhickey: not changing =

14:21 cemerick: I'll say +1 on app == partial apply

14:21 rhickey: sids: Clojure doesn't do that sort of thing in general

14:22 cemerick: app is nicer than ap IMO FWIW

14:22 rhickey: cemerick: yes, ap is awkward looking

14:22 cemerick: There's some kind of slight phonetic connection that's stronger between apply and the former than the latter

14:23 remleduff: Could also call it curry?

14:24 rhickey: still, even given app, (=? 42) seems clearer than (app = 42)

14:24 remleduff: that's not currying

14:24 cemerick: rhickey: Not sure about that -- and app is generally useful.

14:25 =? still screams "returns boolean" to me

14:25 rhickey: cemerick: yes, app is general, and might win out over use of #(foo arg %)

14:26 remleduff: app is kind of likely to already be a used name somewhere

14:26 cemerick: remleduff: for top-level fns?

14:26 rhickey: cemerick: but in context? (some (=? 42) ...) , (filter (=? 42) ...)

14:26 remleduff: Top level def, I think it's the name of my web-app's top level var

14:27 cemerick: rhickey: yeah, better in context. Still uncomfortable tho.

14:28 remleduff: By the time you've found the "some" function, you already should know the #{42} idiom though, it's right there in the docstring?

14:29 cemerick: In any case, I want app. :-)

14:29 rhickey: cemerick: name conflict issue for app are real

14:29 (some (=to 42) (range 100))

14:29 ?

14:29 * cemerick grumbles something about :excludes ;-)

14:30 mmarczyk: 99% of the time, #{foo} is good enough for me -- and (remove identity ...) for removing falsey values

14:30 rhickey: cemerick: yes, and :as-of etc

14:30 remleduff: papp instead of app?

14:30 cemerick: bbl

14:31 LauJensen: Coming in a little late, what was the purpose of app/=? other than currying?

14:32 rhickey: LauJensen: it's not currying, app == partial

14:33 rhudson: (=_ 42) maybe?

14:34 sids: how about (=% 42)?

14:35 mmarczyk: how about, say, %foo (&foo? $foo?) in operator position expanding to partial foo

14:35 or maybe %* for partial, %. for comp (%:, %% ?)

14:35 LauJensen: rhickey: Ah - Would be great if that could be implemented in a similar way to #()

14:35 Licenser: I think we're getting too perly here

14:36 LauJensen: Would make sense though #() for anonymous !() for anonymous partial for instance

14:36 Licenser: I'd rather write (partial foo 42) then (&foo? 42)

14:37 at least everyone knows what I mean, and seriousely partial isn't that long

14:37 LauJensen: Yes, but what about !(f 42) ?

14:37 mmarczyk: or #!() or sth

14:37 Licenser: #!() = (not #())?

14:37 rhickey: LauJensen: that's not going to happen, #() is sufficient magic

14:37 LauJensen: shot down :)

14:38 rhickey: shorter name for partial is all that's in play, and app is really good

14:38 remleduff: I kind of like papply, app is fine too, I can :exclude, you're right. Not sure what the point of =? is, doesn't seem to buy much.

14:38 LauJensen: cgrand will have to rename his app then, in moustache

14:38 Licenser: app sounds lind of like application to me

14:39 rhickey: Licenser: it is partial application

14:39 Licenser: ahh sneaky then application even makes sense :)

14:40 to toss in something else, pa?

14:40 LauJensen: app is good though, think it will sit well with most people quite fast

14:41 remleduff: Why can't apply just be partial if too few args are supplied?

14:42 mmarczyk: remleduff: how'd you tell if too few args were supplied?

14:42 Licenser: but yes app is fine

14:43 remleduff: mmarczy: should probably have thought more before I asked, but was thinking you could use reflection or something

14:44 mmarczyk: I mean

14:44 LauJensen: remleduff: Doesnt hurt to throw it out there, you never know what comes back

14:47 patrkris: "app" is partially the word "apply" - so it makes sense :) But maybe that was the whole reason for the suggestion :)

14:47 mmarczyk: remleduff: that *would* be nice, but can't be sure in general

14:47 Licenser: hmm I can't call a namespace list it seems meh :P

14:47 rhickey: patrkris: yes

14:48 Chousuke: Licenser: hm, you can't?

14:48 Licenser: I called it clj-swing.list and it tells me

14:48 Name conflict, can't def list because namespace: clj-swing.list refers to:#'clojure.core/list

14:48 ah wait no I can't cal the function list o.O?

14:48 Chousuke: huh

14:49 remleduff: appl is also partially apply, and it sounds tasty ;)

14:49 Chousuke: Licenser: ah, right, you need to rename clojure.core/list or (def your.namespace/list ...)

14:49 Licenser: nope def my.namespace/list does not work

14:49 and rename core/list sounds evil o.O

14:50 Chousuke: Licenser: though using this name means people using your namespace will not be able to :use it

14:50 but in my opinion that's just a positive thing :)

14:50 Licenser: Chousuke: but it does not let me def my.namespace/list :P

14:50 and I can't write around in clojure.core just to rename a function so I can get the name

14:50 Chousuke: well I guess you can add a :refer-clojure to your ns declaration :P

14:50 Licenser: a

14:50 nd

14:50 I

14:50 '

14:50 rhudson: Licenser: might be better to stick with jlist for this one

14:50 Licenser: oops sorry

14:51 * Licenser thinks so too

14:51 Licenser: but then all components should be j*

14:53 rhudson: Licenser: that wouldn't be so bad. But I think folks would understand why jlist is a special case

14:53 Licenser: hmm true

14:53 or I convince rhickey to rename list to clist :P

14:53 Chousuke: :P

15:08 Licenser: hmm is there a reason contains does not work on lists?

15:09 and no I don't want to start an argument again

15:10 remleduff: ,(get '(a b c d) 2)

15:10 clojurebot: nil

15:10 remleduff: The explanation on the group is that contains works with get, if get will return a value, then contains returns true

15:11 mmarczyk: get and contains? both return nil when they have no better idea

15:11 in the case of lists, they do in fact have no better idea

15:11 Licenser: ,(contains [1 2 3] 2)

15:11 clojurebot: java.lang.Exception: Unable to resolve symbol: contains in this context

15:11 Licenser: ,(contains? [1 2 3] 2)

15:11 clojurebot: true

15:12 Licenser: ,(gat [1 2 3] 2)

15:12 clojurebot: java.lang.Exception: Unable to resolve symbol: gat in this context

15:12 Licenser: ,(get [1 2 3] 2)

15:12 clojurebot: 3

15:12 Licenser: ah I see

15:12 opqdonut: mmarczyk: why?

15:12 (get (seq '(1 2 3 4)) 2)

15:12 gah

15:12 ,(get (seq '(1 2 3 4)) 2)

15:12 clojurebot: nil

15:13 opqdonut: ,(get (seq [1 2 3]) 2)

15:13 clojurebot: nil

15:13 opqdonut: hmm

15:13 mmarczyk: opqdonut: well I certainly see why get wouldn't work with sequences; it's what nth is for

15:14 opqdonut: ,(nth 3 [1 2 3])

15:14 clojurebot: java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number

15:14 opqdonut: ,(nth [1 2 3] 2)

15:14 clojurebot: 3

15:14 opqdonut: that

15:14 's not a reason :)

15:14 remleduff: It would almost be better for get and contains to throw assertions if they were used on the wrong structures

15:14 mmarczyk: get is supposed to query 'mappings', so it works for sets/maps and also vectors/strings when given a number as key

15:14 Licenser: (nth '(1 2 3) 2)

15:14 ,(nth '(1 2 3) 2)

15:14 clojurebot: 3

15:15 mmarczyk: remleduff: I feel that perhaps it would be better to remove the word 'almost' from your last sentence :-)

15:15 Licenser: (inc remleduff)

15:18 remleduff: remledufg

15:18 rhudson: :)

15:19 Licenser: hah first logical problem with the swing stuff, panels :(

15:19 defn: anyone else having issues with enlive-html and null point exceptions when using deftemplate?

15:20 remleduff: defn: You get those if your path to the html file is wrong

15:20 Also maybe for other reasons, but always been that for me ;)

15:22 defn: remleduff: yeah ive tried a few paths, not sure why it's not shoing up on the CP

15:22 rhudson: What's the panel problem?

15:22 remleduff: defn: It's boiling down to calling (html-resource "thePathYouGive") if you want to experiment

15:23 defn: I had problems at one time because I had my templates in a "resources" directory but the swank version I was using didn't add "resources" to the classpath

15:23 LauJensen: remleduff: Had the same problem, describe-function swank-clojure-project, added the line, C-c C-c, done :)

15:25 defn: remleduff: im using lein swank

15:25 so it shouldn't be a problem

15:26 is it possible to turn a string "(foo (bar (baz)))" into '(foo (bar (baz)))?

15:26 patrkris: LauJensen: what is your secret to get Clojure jobs in Denmark? :)

15:27 LauJensen: patrkris: Well if I told you it wouldnt be a secret - But as everything else its hard work and putting in the hours

15:28 rhudson: ,(read-string "(foo (bar (baz)))")

15:28 clojurebot: (foo (bar (baz)))

15:28 patrkris: LauJensen: :) Everyone that offers me anything wants .NET programming. Which I'm capable of. But it's not fun in the same way. :)

15:29 LauJensen: patrkris: Then the trick might be to start saying no :)

15:29 patrkris: LauJensen: well... you know... the money :)

15:30 remleduff: patrkris: ClojureCLR? ;)

15:30 wlangstroth: patrkris: tried F#?

15:30 patrkris: remleduff: yeah - what's the current state of that?

15:31 wlangstroth: nope, I haven't

15:31 LauJensen: F# is the greatest thing to hit IT since burnt toast

15:31 patrkris: wlangstroth: the ML-stuff never appealed to me - but maybe I should give it a try

15:31 LauJensen: oops, value judgement :)

15:31 patrkris: LauJensen: haha, I guess you're not a fan

15:32 wlangstroth: aw, F# is okay. If someone just has to have .NET, F# is more fun than C#

15:32 LauJensen: patrkris: I did a blogpost a while back, which ran through some news groups counting words. I had 2 separate guys email. first saying "I solved this in F#, but unfortunately it dies halfway through, dunno why", the other guy "I solved this in f#, for some reason it crashes when I try to run it" - So that kinda tainted my image a little bit

15:34 wlangstroth: ... but then, I haven't tried out ClojureCLR yet

15:34 patrkris: LauJensen: hmm... that *does* leave a bad impression

15:35 wlangstroth: ClojureJVM is really easy to get working, and last time I looked at ClojureCLR it looked still half-baked.

15:35 but that's a while ago

15:35 LauJensen: patrkris: I think CLR has come to a grinding halt, because once clojure is implemented in clojure, they basically have to start over in a different way as I understood it

15:36 patrkris: LauJensen: right, didn't think of that

15:36 besides, i really like running a *nix OS

15:36 defn: (with-out-str (pprint (java.io.PushbackReader. (java.io.StringReader. "(foo (bar (baz)))"))))

15:37 is that correct? it's not giving me the pprint version

15:38 patrkris: LauJensen: know of any companies employing clojure in Denmark?

15:38 LauJensen: besides yours ;)

15:39 LauJensen: patrkris: Well, first you have to check out http://conj-labs.eu to get your black-belt, then we'll talk :)

15:39 sexpbot: "conjLabs - Now accepting registrations!"

15:41 chessguy: can someone remind me, what's the expect way within a clojure project to include other files in the project?

15:41 mmarczyk: http://www.paullegato.com/blog/dtd-validation-malformed-xml-clojure/

15:41 sexpbot: "XML DTD Validation in Clojure: Turning It Off, Parsing Malformed XML | Paul Legato"

15:41 mmarczyk: this has to be one of the very best rants I've ever read :-)

15:42 (I'm totally on the side of the author, by the way, lest the word 'rant' implies otherwise)

15:44 chessguy: i'm confused about use, require, and refer

15:44 mmarczyk: use = require + refer

15:45 chessguy: and what's the difference betwen require and refer?

15:45 mmarczyk: ,(doc refer)

15:45 clojurebot: "([ns-sym & filters]); refers to all public vars of ns, subject to filters. filters can include at most one each of: :exclude list-of-symbols :only list-of-symbols :rename map-of-fromsymbol-tosymbol For each public interned var in the namespace named by the symbol, adds a mapping from the name of the var to the var to the current namespace. Throws an exception if name is already mapped to something else in the current name

15:46 mmarczyk: so that's what refer does, while require goes out and searches for a namespace with the given name on the classpath

15:46 chessguy: yeah, i read that, but i don't understand the difference

15:47 mmarczyk: well refer does not go out and search for the ns on the classpath

15:47 chessguy: so it's just for within your project?

15:47 mmarczyk: no, it's just for namespaces which already exist when it's called

15:47 remleduff: refer won't actually cause anything to get loaded, it just takes another name and brings it into the current namespace

15:47 mmarczyk: and require does not do what refer does, i.e. add any mapping to the current namespace

15:48 well actually it might add an alias

15:48 that's properly the job of alias, but require can call that when used with :as

15:48 chessguy: so....if i want to use something from another namespace, i need to require it

15:48 mmarczyk: or use it, though don't forget :only in that case

15:49 chessguy: so that readers of the code can tell what you're pulling in?

15:49 mmarczyk: yes, and so that you can avoid name clashes which might be introduced by updates to libs that you're using

15:50 chessguy: so when would i 'use' instead of just 'require'

15:51 mmarczyk: if you need just a couple of names from a namespace and want to reference those directly

15:51 I tend to use clojure.contrib.monads, as I can't see publics from there clashing with anything else

15:51 chessguy: ok, cool. thanks

15:51 mmarczyk: except another impl of monads maybe :-)

15:51 remleduff: I consider use fine within your own codebase when you're pulling in another file that you control. It's also fine with :only if you want to say (symbol) rather than (alias/symbol)

16:03 rhudson: mmarczyk: Re the Paul Legato rant -- I couldn't help but notice that his workaround is a lot of .setFeature calls that, ah, use URLs as identifiers.

16:06 remleduff: Anyone know where to find leiningen-1.1.0.jar ?

16:07 Nevermind, right there on github

16:10 mmarczyk: rhudson: I got the impression that he wasn't particularly happy with that feature of the API

16:10 nor any other for that matter

16:10 I'm entirely in agreement :-)

16:12 rhudson: Yeah, I spent some painful hours this very week lost in the bowels of javax.xml

16:13 Raynes: rhudson: Was it hot down there? I hear it's hot down there.

16:13 rhudson: I got pretty hot around the collar.

16:13 And it's very dark

16:15 mmarczyk: isn't that the inspiration for "A dungeon horrible, on all sides round, / As one great furnace flamed, yet from those flames / No light, but rather darkness visible / Served only to discover sights of woe" ?

16:16 Licenser: Raynes: if you want check out the new clj-swing stuff :) nicer now! Soon you can start making your swing apps :P

16:17 rhudson: Paradise Lost? With XML I'm not sure we ever had it

16:18 mmarczyk: true

16:19 and yet every moment spent with XML makes one pine for it more

16:20 rhudson: What gets me (to bring it back to Clojure) is that a lot of folks perturbed by "all those parentheses" seem fine with XML in ant, maven, Spring, ...

16:23 mmarczyk: yes

16:23 that is so... unfathomable

16:24 uncanny even

16:24 wlangstroth: "abandon hope all ye who enter here"

16:24 mmarczyk: the work of XML demons

16:24 remleduff: <invoke><function>inc</function><arg>rhudson</arg></invoke>

16:26 rhudson: <emoticon>:)</emoticon>

16:28 mmarczyk: you mean <emoticon sentiment='positive' nose='false' />

16:29 rhudson: Do you have an XSLT for that?

16:29 mmarczyk: yeah, I'm sure it is there somewhere... oh, where is it now...

16:31 remleduff: Is there any way to "validate" a sexp though? There are some advantages to schemas at least.

16:32 mmarczyk: remleduff: what's an invalid sexp? :-)

16:33 rhudson: Well, the repl tells me when I have the wrong number of arguments...

16:33 mmarczyk: {:schema "my funky schema" :data {:foo "bar" :quux "baz"}}

16:34 then "my funky schema" can decide which keys :data should / may contain etc.

16:35 but anyway, what can be done with XML that can't be with a protobuf and/or json (possibly with the constraint that it is worth doing)

16:36 chouser: a protobuf *require* a schema (actually the happily named Descriptors$Descriptor) before you can interpret it.

16:36 remleduff: xsd is defined in a standard enough way that I can take your xsd and tell you where you use an xml element with the wrong number or type of args. In IntelliJ if I open an xml file with a schema, IntelliJ can offer context-sensitive completions automatically.

16:36 chouser: xml is nicely namespaced in a way the json is not.

16:37 xml is awkward and verbose in many cases where json and protobufs are not.

16:38 rhudson: It's not XML per se that bothers me so much as inappropriate uses of it. It's inappropriate syntax for a DSL for instance -- anything humans would write.

16:39 XML is machine-readable; let machines write it.

16:39 chouser: clojure s-exprs are namespacable, provide a nice variety of collection types, are compact, do not require a schema (though there's a handy language for validating/manipulating them)

16:40 mmarczyk: chouser: I mentioned protobufs *because* they use schemas

16:40 as an example of a nicer technology which can be used in place of XML where schemas are useful

16:40 rhudson: XSD is a case in point -- to my mind it's inferior to Relax NG, which has a non-XML Compact Syntax that's very readable.

16:40 chouser: but not everyone is comfortable consuming/producing clojure s-exprs (yet) so still often not the best choice. :-)

16:41 mmarczyk: agreed on "let machines write it"

16:41 as soon as I won't have to deal with build scripts written with XML

16:42 and the like

16:42 * rsynnott quite likes protocol buffers/facebook thrift

16:42 rsynnott: though it is worth noting that they're not suitable for communication with an untrusted client/server, as currently implemented

16:42 mmarczyk: I'll only dislike and not hate XML :-P

16:42 rsynnott: if the client says that, say, a string is 4GB, current implementations will happily allocate that

16:43 AMAZINGLY faster than XML, though, of course :)

16:44 bmason: what happened to the compojure documentation?

16:44 wasn't there a reference page for the request/response maps?

16:45 remleduff: Google has more than 12,000 .proto files!

16:56 bmason: nevermind, compojure's Request is in the RING documentation

17:04 defn: how do you turn "(foo (bar (baz 42)))" into (foo (bar (baz 42)))?

17:05 Chousuke: read-string

17:05 defn: Chousuke: thanks

17:39 remleduff: Anyone know if compojure has some helper for making "links" with method="delete"?

17:41 defn: [null] Caused by: java.lang.Exception: Unreadable form

17:41 clojurebot: http://clojure.org/java_interop#toc46

17:50 chessguy: ok, i have this declaration:

17:50 (ns generic_operators.complex-numbers-operations

17:50 (:require [generic_operators.real-imaginary-complex :as complex]))

17:50 and it gives this error:

17:50 Could not locate generic_operators/real_imaginary_complex__init.class or generic_operators/real_imaginary_complex.clj on classpath: (complex-numbers-operations.clj:1)

17:51 what gives?

17:53 arbscht: chessguy: what's generic_operators and is it in your classpath?

17:53 chessguy: it's just part of the namespace

17:54 (i'm new at clojure projects)

17:54 remleduff: Anyone know how to do the equivalent of Rail's link_to function in compojure or enlive?

17:56 arbscht: remleduff: hiccup.page-helpers/link-to

17:56 quizme: hi, does anybody here use Counterclockwise in Eclipse?

17:57 arbscht: remleduff: that's if you're using hiccup with compojure; compojure itself doesn't do it

17:57 chessguy: arbscht, can i not have something like that as part of my namespace?

17:57 quizme: I am trying to get a lein-generated clojure project to be viewable in Eclipse.

17:57 remleduff: arbscht: That can't seem to do method="delete" though :\

17:58 licoresse: isn't there an issue with using _ and - in namespace-names?

17:58 arbscht: chessguy: you can, you've probably structured your file tree inappropriately. can you pastebin a view of it?

17:58 chessguy: oh, it's dependent on the diretories?

17:59 licoresse: chessguy: sure is

17:59 chessguy: bummer

17:59 stilkov: chessguy: Java platform shining through

17:59 clojurebot: hmm… sounds like your out of heap space

17:59 arbscht: remleduff: right, I think you'll have to roll your own for a perfect equivalent

18:01 chessguy: what does this channel prefer for a pastebin?

18:01 arbscht: paste.lisp.org or gist.github.com

18:04 chessguy: ok, so here's the directory structure and what i'm trying to do (it's changed since what i pasted in the channel earlier)

18:04 http://paste.lisp.org/display/98651

18:08 the error i'm getting now is: Could not locate real_imaginary_complex__init.class or real_imaginary_complex.clj on classpath: (complex-numbers-operations.clj:1)

18:10 ugh, i got booted

18:11 stilkov: chessguy: how do you run your code? from the command line?

18:11 raek: you should use the full namespace names

18:11 stilkov: and what's in your classpath?

18:11 chessguy: stilkov, i launch a REPL and load it there

18:11 raek: (ns generic_operators.complex-numbers-operations (:require [generic_operators.real-imaginary-complex :as complex]))

18:12 chessguy: from what directory?

18:12 stilkov: and you launch the REPL how?

18:12 chessguy: raek, that's what i had originally

18:12 i right-click on one of the files and select 'launch repl'

18:12 raek: I'm not familiar with how that script works

18:13 chessguy: i'm in eclipse

18:14 raek: anyway, you have to decide what directory is the source root

18:14 maybe eclipse has it's own opinion about that

18:15 stilkov: the directory your code is in needs to be a source path in you build path settings

18:15 *sigh* I guess the Eclipse way is hard to explain in an IRC chat

18:15 raek: you can look at the classpath with (map println (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))))

18:16 chessguy: that gives:

18:16 (#<URL file:/C:/eclipse/workspaces/generic_operators/bin/>

18:16 #<URL file:/C:/eclipse/workspaces/generic_operators/>

18:16 nil #<URL file:/C:/eclipse/workspaces/generic_operators/clojure.jar>

18:16 nil #<URL file:/C:/eclipse/workspaces/generic_operators/clojure-contrib.jar>

18:16 nil #<URL file:/C:/eclipse/workspaces/generic_operators/classes/>

18:16 nil nil)

18:16 raek: ah, ok

18:16 chessguy: so i guess that's right

18:17 raek: then "generic_operators" should not be a component of your namespace names

18:17 ah, now I see it...

18:17 chessguy: it shouldn't be in the namespace name, or in the :require

18:17 or both

18:18 raek: hyphens in namespace names should be underscores in file names

18:18 both.

18:18 chessguy: oh, ugh

18:18 raek: the namespace name reflecs the path to the source file, relative the classpath

18:18 so segments in the classpath should not be in namespace names

18:19 chessguy: ah, fixing the filenames seems to have fixed it

18:19 raek: "Could not locate (...) real_imaginary_complex.clj on classpath"

18:20 I've been hit by this some times myself

18:20 licoresse: as I said

18:21 chessguy: thanks raek, i got it now

18:35 remleduff: Another 1.2 feature I might request, deprecate underscores in namespaces :)

18:36 I mean hyphens

18:36 1.2 is going to be great already though :)

18:43 Raynes: $mail LauJensen Eric implemented the s/this/that/ behavior you wanted.

18:43 sexpbot: Message saved.

18:53 licoresse: Clojure on LLVM? Why not?

18:55 remleduff: Lack of inifinite Rich Hickey's ;)

18:58 tomoj: remleduff: you want no hyphens allowed in namespaces?

18:59 remleduff: Would be one less thing for newbies to trip on

19:02 Most of the time, when you use a hyphen in a namespace, could just as easily add another segment to the package

19:03 joshua-choi: I have an integer "n" and a lazy sequence "s" that may be infinite. What is the best way to determine if (> (count s) n)?

19:03 I'm using drop right now, but I'm wondering if there's a better way

19:06 Namely, is there a better way than (seq (drop n s))?

19:08 remleduff: joshua-choi: You could do (when (instance? Counted s) (count s))

19:08 hiredman: ,(doc counted?)

19:08 clojurebot: "([coll]); Returns true if coll implements count in constant time"

19:09 joshua-choi: That seems a little fragile. Will it always work?

19:10 remleduff: Actually, count will work on its own if you look at the implementation

19:10 hiredman: remleduff: no, count will try and force the infinite lazy-seq

19:11 remleduff: Oh right, forgot where I was starting from

19:12 ,(count (increment inc 0))

19:12 clojurebot: java.lang.Exception: Unable to resolve symbol: increment in this context

19:12 remleduff: ,(count (repeatedly inc 0))

19:12 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$repeatedly

19:13 rhudson: remleduff: I think you want 'iterate

19:14 remleduff: ,(count (iterate inc 0))

19:14 clojurebot: Execution Timed Out

19:14 joshua-choi: Oh good, I was afraid it would blow up

19:14 rhudson: smart bot

19:14 remleduff: No, did it here instead of my repl because I knew it would timeout and not break my own repl :)

19:15 rhudson: smart remleduff

19:15 chouser: repl-utils has set-break-thread! so you can manually timeout such things

19:16 joshua-choi: remleduff, (when (counted? s) (count s)) doesn't do the same thing as (seq (drop n s)). I want to know if n is within the seq's bounds.

19:16 remleduff: Well, you still have to do the drop if is isn't Counted

19:17 joshua-choi: Even if it's not Counted, it may be lazy, right? (Or are all lazy sequences non-Counted?)

19:18 Oh, right, of course they aren't.

19:18 remleduff: Was just suggesting a way to optimize the non-lazy case

19:19 joshua-choi: I see; you mean then (if (counted? s) (< n (count s)) (seq (drop n s))).

19:19 remleduff: Yep

19:20 * joshua-choi wishes for a general (within-count? n s) function

19:20 rhudson: But I would think if s is counted, then drop's pretty efficient

19:21 joshua-choi: Hmm

19:21 drhodes: (def $/ "foo") is there a way to escape the / so that it becomes a valid name ?

19:22 rhudson: It's already a valid name

19:22 drhodes: ,(def $/ "foo")

19:22 clojurebot: Invalid token: $/

19:22 joshua-choi: No, there is not.

19:23 http://www.clojure.org/reader

19:23 drhodes: okay, thanks joshua-choi

19:23 remleduff: If you (map f <something-counted>) is the result counted?

19:23 chouser: no

19:23 map returns a lazy seq, which is not counted

19:23 hiredman: you can map over an infinite sequence

19:24 remleduff: Yeah, it could easily return a lazy seq that is counted too though

19:24 hiredman: nope

19:24 rhudson: ,(count? [])

19:24 clojurebot: java.lang.Exception: Unable to resolve symbol: count? in this context

19:24 rhudson: ,(counted? [])

19:24 clojurebot: true

19:24 rhudson: ,(counted? (seq []))

19:24 clojurebot: false

19:26 remleduff: The seq of something counted also be counted though

19:26 Probably be way easier with protocols

19:27 rhudson: ,(counted? (seq [1]))

19:27 clojurebot: false

19:27 remleduff: I see you're saying that it currently isn't, but I don't see why it couldn't be

19:28 rhudson: I see what you're saying

19:34 chouser: ,(counted? (seq (into-array [1 2 3])))

19:34 clojurebot: true

19:35 rhudson: ha

19:35 remleduff: I think seq of arrays makes an ArraySeq

19:35 ,(class (seq (into-array [1 2 3])))

19:35 clojurebot: clojure.lang.ArraySeq

19:46 remleduff: Any emacs users no how to deal with a C-x C-f that takes something like 3 seconds every time before it starts showing files?

19:46 man, my spelling is horrible. s/no/know/

20:13 If I do something like (defn page [id] ({:home "/home", :user "/user"} id)) is the map evaluated every time I call the function?

20:16 qbg: So Rich removed seq-contains?

20:17 * qbg realizes ending a sentence with a predicate function can be confusing

20:37 chessguy: for a multi-method, are you guaranteed the methods you define will be tried in order?

20:39 qbg: What do you mean by tried in order?

20:42 chessguy: e.g., if i do (defmulti action dispatch) (defmethod action v1 [] ...) (defmethod action v2 []), if v1 and v2 can both potentially match the value return from dispatch, v1 will always be used

20:43 it seems like that's the case, given the idiomatic way of using :default

20:45 oh, i guess the only matching done is equality and isa

20:46 i mis-understood that

20:53 defn: every time i use (with-out-str (pprint (read-string "(letfn [(without [s n] (concat (take n s) (drop (inc n) s)))] (without (range 10) 4))"))) in my repl it works as expected, adding newlines where needed

20:53 once I put that into my application I get "unreadable form" java exceptions

20:54 zkim: hey all, anybody here using lein 1.2.0/master

20:59 chessguy: it does seem like multimethods could be more powerful

21:02 mmarczyk: defn: works for me, both from the REPL and the file

21:02 defn: are you absolutely sure you're using the same string both places?

21:02 chessguy: e.g., if http://www.brool.com/index.php/pattern-matching-in-clojure got pulled into multi-methods, that would be cool

21:03 sexpbot: "brool » Pattern Matching In Clojure"

21:03 mmarczyk: chessguy: with multimethods, the more derived type is preferred

21:03 defn: mmarczyk: tough to say, might be the syntaxhighliter screwing everything up

21:03 mmarczyk: see derive / underive functions

21:03 defn: well in Emacs you could use C-M-k at the REPL to kill the string

21:03 chessguy: mmarczyk, yeah, still seems pretty simplistic though

21:03 mmarczyk: then yank it back inside your app

21:04 chessguy: it never occurred to me to think of this as simplistic :-)

21:04 chessguy: what useful extra complexity would you like to add?

21:05 zkim: why?

21:05 chessguy: mmarczyk, dispatch based on more than equality/hierarchy

21:05 mmarczyk: chessguy: well you can dispatch on whatever you want

21:05 chessguy: that's the point of the dispatch function

21:05 chessguy: mmarczyk, err, sorry, i'm talking about matching the result of the dispatch function

21:06 not the dispatch itself

21:06 mmarczyk: chessguy: well, to be honest, I see no point

21:07 that would be like building an infinite tower of polymorphic dispatches

21:07 chessguy: e.g. (defmethod foo {:Shape :Rect :wd 2} ...)

21:07 mmarczyk: we've just dispatched on our args, so let's take the "dispatch key" and process it further

21:07 then why not take the result of that and dispatch again etc.

21:08 chessguy: why not indeed

21:08 Associat0r: wlangstroth: I do F#

21:08 mmarczyk: the answer to 'why not' is that it's hard to see the answer to 'why' ;-)

21:09 and you don't want to have multimethods be slower without great reason

21:10 chessguy: hm. fair enough

21:10 mmarczyk: if you care for pattern matching in your dispatch, then use it in your dispatch function, returning some keyword codes

21:10 presumably you'll only have finitely many methods

21:10 chessguy: yuck

21:10 that's kind of ugly

21:11 and what if i want to add more methods later?

21:11 mmarczyk: if you want "open pattern matching"

21:12 then maybe return the most general pattern you're able to match

21:12 um, sorry, I mean the most *specific* pattern

21:13 or actually, return whatever makes sense for your multimethod, coming to think of it, it's not obvious which would be correct :-)

21:13 languages with built-in support for pattern matching, afaik, all use a closed model

21:14 chessguy: yeah, exactly :)

21:14 mmarczyk: so now you have a problem of how to open it up

21:14 allow appending patterns to the list or sth?

21:14 maybe implement an alternative flexible dispatch scheme, say with

21:15 chessguy: ok, so imagine a wumpus world

21:15 mmarczyk: (let [patterns (atom [])] (def ^{:add-pattern (fn [...] ...)} foo [...] ...))

21:15 chessguy: i may really want to dispatch on a lot of things

21:15 mmarczyk: um, what's a wumpus?

21:15 :-)

21:16 chessguy: lol

21:16 classic AI problem

21:16 umm, ok, tic-tac-toe

21:16 there are a lot of patterns, even in that simple game

21:16 mmarczyk: ok, looked it up :-)

21:16 zkim: mmarczyk: sorry, stepped out for a sec, trying to get lein HEAD to work, but I'm getting a stack overflow when running ./bin/lein. Was wondering if anybody else has gotten it to work

21:17 chessguy: what i want to do is dispatch based on a destructuring of the board

21:17 mmarczyk: zkim: works for me, never saw it overflow stack

21:17 zkim: are you sure you've got updated deps etc.

21:18 zkim: yeah, maybe I'll nuke my .m2 and try again

21:18 mmarczyk: maybe try rm -rf deps

21:18 & lein-stable deps

21:18 first

21:18 :-)

21:18 zkim: ah good idea

21:19 gerryxiao: hello

21:20 mmarczyk: chessguy: without wanting to go into what would work for any particular problem, if you really feel that pattern matching could help you, you can maintain an atom of pattern / function pairs (a vector of vectors, most likely)

21:20 chessguy: have the function which would be your "pattern-based multimethod" close over that atom

21:20 gerryxiao: how to make lein uberjar includes images or sound resource files

21:21 mmarczyk: chessguy: with functions to manipulate the list of pattern hidden a way in the metadata on the Var, maybe?

21:21 gerryxiao: which is not in src dir

21:21 mmarczyk: chessguy: see if it works better for you than a multimethod-based approach

21:22 chessguy: not saying that it would, but who knows, and if you miss your pattern matching...

21:22 gerryxiao: I believe stuff in resources/ should be included in the uberjar

21:22 gerryxiao: it's certainly included on the classpath with lein swank

21:24 chessguy: multimethods certainly can't do the same thing, but they're meant to be a flexible polymorphism solution, not an open cond

21:24 chessguy: mmarczyk, fair enough

21:26 mmarczyk: chessguy: but going back to the wumpuses, is the challenge to code up a wumpus or a wumpus hunter? :-)

21:26 (or both?)

21:27 chessguy: mmarczyk, typically, it's phrased so that the problem is to code the wumpus hunter

21:27 gerryxiao: mmarczyk: i have to move stuff to resources dir?

21:27 mmarczyk: gerryxiao: that's the place lein expects to find resources

21:28 gerryxiao: there's probably a project.clj switch to change that location, but I can't say I remember the name

21:28 gerryxiao: anyway, I'd expect uberjar to pull in stuff from there, so maybe give it a shot

21:29 chessguy: and the wumpuses don't move, do they? cool puzzle :-)

21:30 gerryxiao: ok,i'll try that

21:30 chessguy: mmarczyk, there are different formulations of the game

21:38 mmarczyk: I see... now I want to go wumpus hunting :-)

21:39 chessguy: hehe

21:43 rfg: How does one set Java options when using lein?

21:49 joshua-choi: I am having difficulty with Leiningen after self-installing; is there another room I can ask Leiningen help in?

21:50 chessguy: mmarczyk, i'm kind of thinking about re-implementing ruby-warrior in clojure for similar fun

21:50 hiredman: 2009:Mar:17:14:25:44 hiredman : http://github.com/ryanb/ruby-warrior/tree/master <-- this is way cute, it needs porting to clojure

21:51 chessguy: do it!

21:51 chessguy: hiredman, what, you mean you saw that it needs to be done, and didn't do it??

21:51 for shame!

21:52 hiredman: ~hiredman

21:52 clojurebot: hiredman <3 XeLaTeX

21:52 hiredman: ~hiredman

21:52 clojurebot: hiredman is an evil genius.

21:52 hiredman: hmmm

21:53 mmarczyk: this... is... amazing 8-O

21:53 remleduff: rfg: I think it's JAVA_OPTS

21:53 mmarczyk: ruby-warrior, I mean

21:53 definitely needs porting :-)

21:54 rfg: remleduff: Yeah, I've just found that, cheers.

21:55 gerryxiao: hmm,where is seq-contains? i have just changed includes? to seq-contains?

21:55 mmarczyk: actually I might go through it first, I was going to learn some Ruby to see where all the Ruby people in the Clojure community come from :-)

21:55 joshua-choi: gerryxiao: In the clojure.core.

21:55 mmarczyk: gerryxiao: got axed yesterday

21:55 joshua-choi: Ah!

21:55 Really? Was it renamed?

21:55 zkim: mmarczyk: hey, just thought you'd like to know, turns out the stack overflow only happens when you run lein w/o arguments

21:56 gerryxiao: mmarczyk: now use what for seq-contains?

21:56 mmarczyk: zkim: right, I don't think lein makes any effort to be useful without an explicit arg

21:56 gerryxiao: whatever you used before, I guess

21:56 remleduff: ,(some #{42} (seq [3 63 42]))

21:56 clojurebot: 42

21:56 mmarczyk: (some #{false true} [1 2 false 3])

21:56 ,(some #{false true} [1 2 false 3])

21:56 clojurebot: nil

21:57 mmarczyk: ouch, I mean

21:57 ,(some {false true} [1 2 false 3])

21:57 clojurebot: true

21:57 mmarczyk: ,(some #(= % 3) [1 2 3])

21:57 clojurebot: true

21:57 gerryxiao: mmarczyk: i used includes? before

21:57 remleduff: Oh, hah, so it'll have to go back to contrib I guess

21:58 mmarczyk: gerryxiao: never used that one, so wouldn't know if it's still in contrib

21:58 remleduff: Better off learning the some idiom though :)

21:58 chessguy: (#(= % 3) 3)

21:58 ,(#(= % 3) 3)

21:58 clojurebot: true

21:58 chessguy: ,(#(= % 2) 3)

21:58 clojurebot: false

22:01 technomancy: joshua-choi: what's the issue with lein?

22:01 gerryxiao: ,(some #("hello") [1 3 "hello"])

22:01 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--13672$fn

22:01 technomancy: man, CL sure had some lousy function names

22:01 * technomancy glances at some

22:01 chessguy: ,(some #(= % "hello") [1 3 "hello"])

22:01 clojurebot: true

22:01 joshua-choi: technomancy: It actually disappeared for some reason.

22:01 I do have an Autodoc question: I included [autodoc "0.7.0"] in :dev-dependencies in my project.clj, but I can't do "lein autodoc". Do I have to do something else?

22:02 technomancy: joshua-choi: you did lein deps after adding it to dev-dependencies?

22:02 remleduff: ,(some #{"hello"} [1 3 "hello"])

22:02 clojurebot: "hello"

22:02 gerryxiao: ,(some #(= % "hello") '(1 2 "hello"))

22:02 clojurebot: true

22:03 chessguy: ,(some #{"hello"} [1 3])

22:03 clojurebot: nil

22:03 chessguy: hm

22:03 is the #{foo} construct the same as #(= % foo) ?

22:04 err, no, clearly, it's not

22:04 joshua-choi: technomancy: Yes, I did. Actually, I'm running into a different problem now when I type "lein autodoc".

22:04 rhudson: It's a set with one element

22:04 remleduff: No, #{foo} is a set containing foo, when used as a function it returns the value or nil

22:04 joshua-choi: technomancy: I get, "[null] #<CompilerException java.lang.ExceptionInInitializerError (autodoc.clj:1)>

22:04 [null] Make sure autodoc is added as a dev-dependency in your project.clj."

22:04 (I'm using [autodoc "0.7.0"].)

22:04 rhudson: As a function, it says whether the arg is in the set

22:05 chessguy: ,({"hello"} "hello")

22:05 clojurebot: java.lang.ArrayIndexOutOfBoundsException: 1

22:05 chessguy: ,(#{"hello"} "hello)

22:05 clojurebot: EOF while reading string

22:05 chessguy: ,(#{"hello"} "hello")

22:05 clojurebot: "hello"

22:05 remleduff: Pesky characters

22:05 chessguy: ,(#{"hello"} "bye")

22:05 clojurebot: nil

22:05 chessguy: gotcha

22:06 mmarczyk: ,(#{false} false)

22:06 clojurebot: false

22:06 mmarczyk: :-)

22:06 chessguy: ,(#{nil} nil)

22:06 clojurebot: nil

22:07 chessguy: ,(= nil nil)

22:07 clojurebot: true

22:08 chessguy: ,so, what is this syntax called? #(= % foo)

22:08 clojurebot: java.lang.Exception: Unable to resolve symbol: so in this context

22:08 chessguy: oops

22:08 mmarczyk: chessguy: 'anonymous function literal', I guess :-)

22:09 chessguy: mm, it's more tnan that, with the parameter naming

22:09 mmarczyk: hm?

22:10 chessguy: oh, i see, never mind

22:10 mmarczyk: :-)

22:11 chessguy: kind of a silly name, but ok

22:12 rhudson: I suppose it's an "anonymous function reader macro", or "reader macro anonymous function"

22:13 remleduff: It's basically shorthand for lambda

22:16 Does anyone have an example of a sizable project using enlive?

22:28 chessguy: this ruby-warrior codebase is actually really nice

22:31 seths: chessguy: hola! what's the context of the ruby-warrior codebase?

22:31 chessguy: context?

22:31 clojurebot: context is the essence of humor

22:31 chessguy: ha. thanks clojurebot

22:32 seths: chessguy: I just joined the channel, so just curious what I missed

22:32 chessguy: seths, ah, we were just saying that someone should port it to clojure

23:05 technomancy: joshua-choi: replaca would be your guy for that

23:07 joshua-choi: Thanks

23:07 replaca: May I ask a question on Autodoc?

23:29 gerryxiao: hello

23:30 why remove seq-contains?

23:32 _ato: gerryxiao: probably because rich is sick of the discussion it triggered

23:32 see the google group

23:33 gerryxiao: ok

23:41 ok, i have to define it by myself

23:43 _ato: ,(some #{2} [1 2 3 4])

23:43 clojurebot: 2

23:43 _ato: gerryxiao: ^ or you can do it like that

23:43 (as long as you're not looking for false or nil)

23:47 gerryxiao: _ato: i'm using filter with it, but #() not support nested

23:47 mmarczyk: ,(some {false true} [1 2 false :foo])

23:47 clojurebot: true

23:47 _ato: good one

23:48 mmarczyk: cgrand's :-)

23:48 gerryxiao: ,(some #{"hell"} ["hell" 2])

23:48 clojurebot: "hell"

23:48 gerryxiao: ,(some {"hell"} ["hello" 2])

23:48 clojurebot: 1

23:49 _ato: ,(filter #(some #{"hell"} %) [["summer" "autumn"] ["winter" "hell" "spring"]])

23:49 clojurebot: (["winter" "hell" "spring"])

23:49 mmarczyk: _ato: out of curiosity, do you have a preference w.r.t. the naming issue? unless you're sick and tired of it yourself

23:50 ,(let [=? (fn [& args] (fn [x] ((zipmap args (repeat true)) x)))] (some (=? 1 2 3) (range 10)))

23:50 clojurebot: true

23:50 mmarczyk: ,(let [=? (fn [& args] (fn [x] ((zipmap args (repeat true)) x)))] (some (=? 1 2 3) (range 0 10 4)))

23:50 clojurebot: nil

23:51 mmarczyk: maybe call that oneof?

23:53 _ato: mmarczyk: I think contains? was a bad choice (even if it is supposed to parallel get), seq-contains? just confuses things even more so. contains-key? and contains-val? are at least clearer. I don't tend to use either contains? or includes? in my own code

23:54 usually use (get) with a default instead

23:54 and some

23:56 rhudson: I like contains-key? and contains-val?

23:57 mmarczyk: _ato: same by me

23:58 rhudson: mmarczyk: the advantage of your (=? x y z) over {x y z} is that it works where say x is nil or false?

23:58 mmarczyk: I actually think contains? totally makes sense as a name for the current clojure.core/contains?, mind you

23:58 rhudson: right

23:58 it also totally makes sense as a name for what seq-contains? was to be

23:59 and that is precisely the reason why I'd maybe prefer not to have such a name in the core at all

Logging service provided by n01se.net