#clojure log - Jul 31 2009

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

0:15 Chouser: (def q (fill-queue #(loop [] (% (rand-int 100)) (recur))))

0:15 (take 10 q) ==> (40 53 75 66 52 8 63 73 72 8)

0:26 Work nicely if you're not in control of the loop -- somebody else is looping and wants to call your callback, but you want all that as a lazy seq.

0:26 clojure.contrib.seq-utils/fill-queue

1:01 Drakeson: how can I access/save/restore a memoized function's "cache"?

1:05 bradford: is there some clever way to fn-ify macros for composition such as passing them intop higher order functions?

1:29 oh..i just quote them :-)

1:29 ,(#(%1 %2 %3) 'and true false)

1:29 clojurebot: false

1:29 bradford: can't believe i did not realize that :-(

1:31 Fossi: ,(#(%1 %2 %3) 'or true false)

1:31 clojurebot: false

1:32 Fossi: :o ;)

1:34 durka42: ,('or true false)

1:34 clojurebot: false

1:34 durka42: ,(#(%1 %2 %3) 'fandango true false)

1:34 clojurebot: false

1:34 * durka42 thinks this trick does not work exactly

1:34 bradford: so that's not valid?

1:34 wtetzner: ,('or false true)

1:34 clojurebot: true

1:35 durka42: well you are calling the symbol

1:35 not the var which the symbol identifies

1:35 wtetzner: ,('x 'y 'z)

1:35 clojurebot: z

1:35 wtetzner: it just returns the value of the last thing in the list

1:35 bradford: indeed :-)

1:37 so no such trickery?

1:37 durka42: ,#'and

1:37 clojurebot: #'clojure.core/and

1:37 wtetzner: ,(#(eval '(%1 %2 %3)) 'or true false)

1:37 clojurebot: DENIED

1:37 wtetzner: hmm

1:38 durka42: not without eval, yeah

1:38 user=> (eval (#(%1 %2 %3) #'or true false))

1:38 true

1:38 wtetzner: what is #'or ?

1:39 ,#'or

1:39 clojurebot: #'clojure.core/or

1:39 durka42: ,(var or)

1:39 clojurebot: #'clojure.core/or

1:39 durka42: (type #'or)

1:39 ,(type #'or)

1:39 clojurebot: clojure.lang.Var

1:39 wtetzner: oh

1:39 durka42: (doc var)

1:39 clojurebot: "/;nil; "

1:39 durka42: ,(doc var)

1:39 clojurebot: "/;nil; "

1:40 durka42: interesting

1:40 informative, that

1:41 * durka42 needs some sleep

1:45 bradford: now suppose that little example's lambda takes x & xs where x is the var represetning a macro. would there be some equivalent to apply for the macro?

3:13 Drakeson: how can I dump and restore some data (e.g., nested maps) into a binary format (binary, in order to keep numerical data intact)

3:13 hiredman: ,(doc prn)

3:13 clojurebot: "([& more]); Same as pr followed by (newline). Observes *flush-on-newline*"

3:13 hiredman: ,(doc pr)

3:13 clojurebot: "([] [x] [x & more]); Prints the object(s) to the output stream that is the current value of *out*. Prints the object(s), separated by spaces if there is more than one. By default, pr and prn print in a way that objects can be read by the reader"

3:14 hiredman: ,(doc *print-dup*)

3:14 clojurebot: "; When set to logical true, objects will be printed in a way that preserves their type when read in later. Defaults to false."

3:15 Drakeson: thanks :)

3:20 ummm, binding *print-dup* and then pr'ing doesn't seem to print in a binary format. How can I pick the output format? does this depend on the output stream?

3:21 lbj: Top of the morning gents

3:21 hiredman: ,(binding [*print-dup* true] (prn-str '(1 2 3)))

3:21 clojurebot: "(1 2 3)\n"

3:21 hiredman: ,(binding [*print-dup* true] (pr-str '(1 2 3)))

3:21 clojurebot: "(1 2 3)"

3:21 hiredman: ,(.getBytes (binding [*print-dup* true] (pr-str '(1 2 3))))

3:21 clojurebot: #<byte[] [B@1f4cdd2>

3:21 hiredman: *tada*

3:23 ,(doc print-method)

3:23 clojurebot: "; "

3:23 lbj: What did you just accomplish hiredman ?

3:23 hiredman: bah

3:23 lbj: Drakeson wanted "a binary format"

3:23 lbj: aha

3:24 hiredman: actually, if you really want a binary format

3:24 ,(apply str (map (comp #(Integer/toBinaryString %) int) (.getBytes (binding [*print-dup* true] (pr-str '(1 2 3))))))

3:24 clojurebot: "101000110001100000110010100000110011101001"

3:25 lbj: Do we have anything like emacs-lisps (md5 "") in Clojure?

3:25 hiredman: the problem with that is toBinaryString doesn't pad the bits

3:25 lbj: Having which consequences?

3:26 hiredman: variable length binary figures are hard to read

3:29 lbj: k

3:35 ,(let [msg "foo bar baz"]

3:35 (.update (java.security.MessageDigest/getInstance "MD5")

3:35 (.getBytes msg) 0 (.length msg)))

3:35 clojurebot: EOF while reading

3:35 lbj: Why does that return nil ?

3:44 hiredman: ,,(let [msg "foo bar baz" foo (java.security.MessageDigest/getInstance "MD5")] (.update foo (.getBytes msg) 0 (.length msg)) (.digest foo))

3:44 clojurebot: #<byte[] [B@8d5a91>

3:44 hiredman: it returns nil because the update method on MessageDigest returns void

3:44 lbj: Ah, thanks

4:08 AWizzArd: What was the name of the function that takes a collection and lazily returns all elements, but each two elements from that returnd seq are pairwise different.

4:09 like putting all elements of a coll into a set, just lazily

4:10 maybe it was in contrib somewhere?

4:21 Drakeson: ,distinct

4:21 clojurebot: #<core$distinct__5417 clojure.core$distinct__5417@1484a8a>

4:21 Drakeson: ~distinct

4:21 clojurebot: It's greek to me.

4:22 Drakeson: anyways, AWizzArd: that would be `DISTINCT'

4:22 ,(doc distinct)

4:22 clojurebot: "([coll]); Returns a lazy sequence of the elements of coll with duplicates removed"

4:28 AWizzArd: Drakeson: yup that was it, thanks

4:29 Drakeson: AWizzArd: well, I just loaded all of contrib and used find-doc.

4:31 AWizzArd: Drakeson: i also used find-doc, but I had the word "unique" in mind.

4:32 I used distinct several times, just forgot its name :p

6:48 Chousuke: Anyone looked at the new Pro Git book yet? http://progit.org/book/

7:15 jdz: ,(do (defstruct bar :data) (read-string (binding [*print-dup* true] (with-out-str (pr (struct-map bar :data 42))))))

7:15 clojurebot: DENIED

7:16 jdz: ,(do (defstruct bar :data) (read-string (binding [*print-dup* true] (pr-str (struct-map bar :data 42)))))

7:16 clojurebot: DENIED

7:16 Fossi: it would be interesting to know what the bot doesn't like about a statement

7:18 jdz: my point is that there is no print method for clojure.lang.PersistentStructMap

7:18 i think i should go and learn how to open tickets

7:23 rhickey: jdz: all changes to structmaps are on hold

7:23 Raynes: If Clojurebot ever asks me to do something for it, I'm just going to reply: DENIED

7:24 jdz: rhickey: ok, nvm then.

7:25 rhickey: jdz: I want to reevaluate their implementation in light of new new, but I understand the use cases for print/read, and constants of struct types, as well as compilation

7:29 jdz: also

7:29 ,(binding [*print-dup* true] (pr-str (with-meta (array-map :x 17 :y 42) {:type :whatever})))

7:29 clojurebot: "#^#=(clojure.lang.PersistentArrayMap/create {:type :whatever}) #=(clojure.lang.PersistentArrayMap/create {:x 17, :y 42})"

7:30 jdz: ,(binding [*print-dup* true] (pr-str (with-meta (hash-map :x 17 :y 42) {:type :whatever})))

7:30 clojurebot: "{:y 42, :x 17}"

7:30 jdz: the only difference is array-map vs. hash-map

7:30 i.e., the :type meta tag is lost

7:30 rhickey: ,(doc print-dup)

7:30 clojurebot: "; "

7:32 rhickey: hrm, should put experimental

7:48 lbj: rhickey: Are you still using emacs + swank (no slime) ?

7:49 rhickey: emacs mode only, no swank/slime

7:49 lbj: rhickey: Ok - Why is that? I consider slime (in most cases) to be a help to me

7:50 rhickey: I like to keep things simple, plus, I'm working on Clojure itself

7:51 lbj: Ok

7:51 rhickey: note, I'm not much of an emacs guy

7:51 lbj: Youre more of a Lisp Works guy ? :)

7:52 I guess we'll all have to hold our breath until Enclojure is a bit farther up the road than it is now. I lack a better overview of the entire project with Emacs

7:52 (guess I should write the plugin)

7:52 rhickey: not much of an editor guy at all. But I switch around, use IntelliJ for Java and have used enclojure too

7:53 AWizzArd: Do you have (roughly) an ETA for newnew?

7:54 lbj: Ok - I dont care about the name on the door, but I do want every single feature I need in my daily work within the reach of one shortcut, thats why I use emacs + linux

7:55 y-combinator: Hello. I have problem using clojure.contrib.json.write. It references (:use [clojure.test :only (deftest- is)])) which Clojure cant find on classpath. Info about this lib states that it should actually use clojure.contrib.test-is. Is this a bug or im missing something?

7:55 rhickey: AWizzArd: you can start playing with it now, still more to come: http://github.com/richhickey/clojure/tree/new

7:57 lbj: By the way rhickey, are you yourself planning on putting out a book ?

7:57 rhickey: lbj: would you prefer I write a book or write Clojure?

7:58 lbj: Specificially I was wondering if you were cooking on something that was more philosophical than practical, regarding clojure, concurrency etc

7:58 rhickey: I see what youre saying :)

7:58 AWizzArd: I would vote for writing Clojure.

7:58 rhickey: there you go

7:58 someday perhaps

7:58 lbj: Ok

8:04 ttmrichter: rhinkey: You're the person behind Clojure?

8:04 If so, thank you for giving me the first Lisp dialect I didn't merely admire, but actively liked.

8:05 rhickey, even. :) Stupid fingers.

8:07 lbj: rhickey: Btw, I read a review of JAOO (you know, the event were you ditched your danish crowd), and all they had discussed that day was concurrency and related problems, and you were mentioned specificially as being missed :)

8:09 rhickey: ttmrichter: you're welcome

8:10 AWizzArd: btw, I am now looking into Drools to see how useable it is from Clojure. It works on POJOs, but then again our Clojure collections are nothing more under the hood. Some macro magic might be enough to get something nice.

8:10 rhickey: lbj: which JAOO? I'm speaking (twice) at JAOO Aarhus: http://jaoo.dk/aarhus-2009/

8:11 lbj: link to review?

8:11 lbj: rhickey: You told me you bailed on JAOO? Hang on Ill find the review, I caught it on dzone I think

8:11 rhickey: AWizzArd: last I looked they didn't support maps as facts, much to my chagrin. Everything based on beans

8:14 lbj: rhickey: http://danweinreb.org/blog/programming-with-concurrency

8:18 Chouser: y-combinator: did you get an answer?

8:18 rhickey: lbj: I wasn't invited to that one (2008)

8:18 Chouser: y-combinator: looks like you're using clojure 1.0.0 but contrib HEAD. You'll need to either get a newer clojure or an older contrib.

8:19 lbj: rhickey: Ok -Its very intersting that you're showing up for the 2009 event, I'll be looking forward to it. If theres anything you need help with while youre here dont hesitate to let me know. You can also catch a ride to Copenhagen after the event if need be.

8:20 rhickey: lbj: thanks

8:38 Fossi: lbj: where are you from? i might be going from hamburg

8:39 lbj: Fossi: Im from Ringsted, Denmark

8:46 Fossi: ah. guess we have about the same time to drive to arhus :D

9:00 y-combinator: Chouser: Clojure 1.1.0-alpha-SNAPSHOT, seems new

9:01 Chouser: and Contrib from HEAD

9:02 Chouser: other libs from contrib are working fine

9:03 Chouser: Clojure HEAD has test/clojure

9:04 y-combinator: ok, i will checkout and compile HEAD

9:11 alinp: hi

9:11 clojure have foldl/foldr ?

9:11 or reduce is the only way to do it ?

9:16 jdz: to do what?

9:29 y-combinator: Chouser: thank you, building HEAD helped

9:29 Chouser: good

9:32 y-combinator: Ive used some shell scripts from ineternet to install clojure and now i checked them and they use googlecode svn, it seems version in google code is not updated currently

9:32 that why i didnt had clojure.test

10:00 Chousuke: hmm.

10:01 I tried refactoring the Clojure reader to use an interface instead of PushBackReader directly, and it works. :o

10:02 Chouser: Chousuke: sweet!

10:05 Chousuke: I changed as little as possible, but I'm pretty certain there is something I broke.

10:05 there always is

10:08 lpetit: hi

10:09 Chousuke: hm

10:09 all tests pass in both Clojure and contrib.

10:09 * danlarkin cheers

10:11 lpetit: sorry for the question that has been asked again and again but ... does the function that creates a new map from an old by applying an fn to the values exist ? Or do I have to write my own (defn map-values [f m] (into {} (map (fn [[k v]] [k (f v)]) m))) ?

10:11 Chousuke: lpetit: there's something in contrib I think.

10:12 lpetit: not in map-utils

10:12 Chousuke: c.c.generic.functor or something

10:13 lpetit: ok, found the ApiDocIndex wiki page created by Tom,

10:14 -> map-utils in datalog.utils :-$

10:14 not the best place ...

10:17 cgrand: lpetit: if you only use the resulting map as a a function try (comp f my-map)

10:18 hiredman: ooo

10:18 cute

10:18 * Chousuke wonders which is a better name; IReader or IClojureReader... the problem is that with the latter I'd have to name the other interface IClojureLineNumberingReader :P

10:18 hiredman: well it's already in clojure.lang right?

10:18 drewr: ,(.replaceAll ":foo :bar :baz :foo" ":foo" "f$o")

10:18 clojurebot: java.lang.IllegalArgumentException: Illegal group reference

10:18 Chousuke: hmm, true.

10:19 drewr: is there a replaceAll that doesn't try to use backreferences?

10:22 cgrand: drewr: none that I'm aware of, you have to use http://java.sun.com/javase/6/docs/api/java/util/regex/Matcher.html#quoteReplacement(java.lang.String)

10:23 lpetit: cgrand: elegant, but no I'm working on datastructures

10:24 drewr: cgrand: thanks!

10:27 stuartsierra: off-topic, but anyone ever used Fedora Commons?

10:36 lbj: rhickey: This 'Concurrency experts panel', is that a joint presentation that youve prepared with Simon Peyton and the rest of the gang?

10:37 rhickey: lbj: oh, yes, I'm on that too. No idea, probably just a panel, moderator, questions etc

10:37 lbj: Quite interesting that you've in the same panel as the co-creator of Haskell... will need to prepare some questions :)

10:37 Are you taking off wednesday night, or staying till friday?

10:42 rhickey: I plan on spending most of my time with SPJ listening :)

10:42 leaving Thursday

10:43 lbj: k

11:46 drewr: http://brizzled.clapper.org/id/93

11:50 Chouser: foo.x += 1 ....mmm yummy

11:50 :-)

11:51 It wasn't too long ago that I would have meant that sincerely, instead of worrying about the mutation.

12:04 iBong: is there a built in join method for strings in clojure?

12:05 Chouser: clojure.contrib.str-util2 and str-utils both have a join

12:06 stuartsierra: That's like Perl's join. If you just want to concatenate strings, use "str".

12:06 Chouser: both just do this:

12:06 ,(apply str (interpose "," (range 5)))

12:06 clojurebot: "0,1,2,3,4"

12:08 iBong: like Perl's join, I've only been using the clojure core api, just found the github clojure doc project, hopefully it will be enlightening

12:08 lpetit: any plans on merging str-utils 1 & 2 ?

12:08 iBong: thanks, I just thought I'd ask before I started rolling my own versions

12:08 Chouser: I think str-utils2 is meant to supercede str-utils

12:08 stuartsierra: That was my plan. I haven't replaced str-utils because so many libs depend on it.

12:08 lpetit: or adding docs so that newcomers (as me today) know what to pick and where

12:08 ha ok

12:09 maybe a little "deprecated" note on the former, and a "new version of str-utils" on the latter ?

12:09 stuartsierra: str-utils2 was my attempt to make a complete string-manipulation library with a consistent API, rather than the random assortment of functions in str-utils

12:09 lpetit: I've switched back and forth both of them today, I guess other will in the future too

12:09 stuartsierra: but I never quite finished, so I never made a formal announcement

12:10 In general, str-utils2 should be faster. It also has copies of the core Clojure sequence functions, but optimized for operating on Strings.

12:10 lpetit: it's this "experimental" or "still under active development" indications that are missing from the docs I think. Transparency will help not having users come angry to us

12:10 ah ok

12:13 * stuartsierra realizes that str-utils2/drop has opposite argument order of core/drop

12:14 stuartsierra: although there was a reason for that -- I always put the String argument first, so that multiple str-utils2 fns can be chained with ->

12:15 but I should probably fix that

12:16 maybe I'll just rename them str-drop, str-take, etc.

12:17 hiredman: :(

12:17 what is the point of namespacing then?

12:18 lpetit: I must leave, cu

12:19 iBong: is it possible to chat with clojurebot?

12:20 ,(println (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))))

12:20 hiredman: ~a man of means by no means

12:20 clojurebot: java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)

12:20 da da king of the road

12:22 iBong: does he just have clojure.jar and clojure-contrib.jar? just wanted to see what libraries he can load

12:37 jwhitlark: Is anyone working on packaging clojure for ubuntu?

12:38 stuartsierra: It's still developing rapidly, OS packages would have a hard time keeping up..

12:39 jwhitlark: Do you think a stable package every six months is not enough to keep up?

12:39 stuartsierra: I actually don't see much need. It's just a JAR, after all.

12:39 iBong: ubuntu has a hard time keeping up with emacs

12:43 jwhitlark: I think it would depend more on the maintainer of the package. Once it's there, clojure-mode can be handled also, and I think it lowers the barriers to entry, as well as opening the possibility of having apps written in it in the repos.

12:43 weissj: how much of clojure's devices like agents, atoms, refs, make sense to use with db-backed data?

12:43 jwhitlark: I'm just trying to get a feel for people's opinion; I was considering doing it myself.

12:44 iBong: what would the package do? download the jar, export a few paths, and make a clj bash script?

12:45 a clojure mode for gedit would be nice

12:45 jwhitlark: it would have the 1.0 jar in it, or the latest bug fix, then yea, export paths, add some docs, and the bash script.

12:46 I'd also like a script to build a jar containing clojure, but I haven't looked into it yet. I expect there is a solution already out there.

12:46 Chouser: I think it'd be fantastic to have an ubuntu pkg that would let someone do: apt install clojure; clj ...and have a prompt.

12:46 iBong: is clojure on git?

12:46 jwhitlark: it is now.

12:46 iBong: could make a script that just clones the most recent version and sets up the pathsd

12:47 wouldn't be too much work

12:47 ieure: Chouser, There’s a Debian package for it already, dunno if it’s in Lenny though.

12:47 jwhitlark: http://groups.google.com/group/clojure/browse_thread/thread/a57be34382e047db

12:47 ah, I hadn't seen that.

12:47 ieure: Chouser, http://packages.debian.org/squeeze/clojure

12:48 iBong: getting slime to work was more effort than I thought it should be, would be nice if the script could manage that too

12:48 jwhitlark: It is *possible*

12:48 replaca: Chouser: fill-queue will be pressed into use immediately to replace custom java interop in my webhook processor. I was just too lazy to write it so cleanly.

12:49 jwhitlark: I'm not sure how much work it would be. I've not done a great deal of packaging, and the emacs packages are interesting.

12:50 Chouser: replaca: cool! It's a minor refactoring of code from lazy-xml that was written simultaneously with seque

12:50 I needed it for a 3rd time yesterday, so I took the time last night to clean it up.

12:50 iBong: the ides might be best left to readmes, setting up the basic clj script is pretty straightforward

12:51 Chouser: replaca: are the names ok? That's always the worst part for me...

12:52 replaca: Chouser: yeah, I was thinking I should write it when I was building my webhook, cause it's obviously a problem that comes up all the time and you want a "primitive" for it, but I've been a little scatterbrained lately so I procrastinated that part

12:52 Chouser: names look ok. after I throw it in the program, I'll give you feedback if it doesn't feel right

12:53 Chouser: great, thanks.

12:54 it probably needs more docs somewhere too -- a few features are undocumented, and at least one potential "gotcha" with the thread hanging around...

12:59 mebaran151: does clojur ehave a decimal type of any sort?

12:59 other than ratio?

12:59 Chouser: It has all the Java numbers: Integer, Double, BigInteger, etc.

12:59 ,(class 5M)

12:59 clojurebot: java.math.BigDecimal

12:59 mebaran151: no I meant in addition

12:59 iBong: are there any JSON rpc clojure projects?

13:00 Chouser: mebaran151: I think Ratio is the only extra number class Clojure provides.

13:00 mebaran151: okay thanks

13:01 iBong, I sort have some json rpc going on

13:01 I rolled by own using compojure: it wasn't too bad

13:01 iBong: yeah that's what I'm looking at doing

13:04 would be nice if there was one in contrib, if compojure could make an instant restful json rpc server (insert custom domain logic here) Im not sure if I would use rails anymore

13:07 mebaran151: your implementation isn't in a repo by any chance is it?

13:07 mebaran151: not yet

13:08 it's gotta be cleaned up

13:08 it's not very general either: it powers a javascript scripted webscraping proxy

13:08 so it works, but only for ONE thing

13:09 then again, writing a restful service in compojure was really easy, and reading the JSON was trivial

13:09 iBong: I want to make a generic json rpc backend for javascript ria frontends

13:10 if clojure could generate all the javascript too...

13:10 mebaran151: I mean how would you decide which function to call?

13:10 other than by stating the url etc etc

13:10 it's not ike clojure has classes that you dispatch against

13:10 iBong: could use a hashtable

13:11 the server can just register any functions they want to expose

13:11 mebaran151: that wuld work, but I don't think naive rpc is that big a win

13:11 but compojure lets you do that by letting you supply the callback for what url you hit

13:12 I guess the win would be not having to define the routes yourself, but I found that the quickest part of the job

13:12 getting Rhino to play nice on the other hand.

13:12 :|

13:12 iBong: if you have a big database you want to expose, it would be nice just to have everything in a hashmap, but youre right that its not so hard to roll your own

13:13 mebaran151: I'm actually working son something similar to that right now on top of berkeley db

13:13 trying to build a lazy hash

13:14 lazy sorted hash with look ahead

13:15 2 week project

13:16 iBong: it all sounds very interesting

13:32 alrex021: in clojure, how would I iterate over a list and print each item on a new line in repl output?

13:33 I see take function, iterate, etc...not to sure how to put it together.

13:33 stuartsierra: (doseq [x the-list] (println x))

13:35 alrex021: stuartsierra: thx, doseq macro was what I was after...learning bit by bit :)

14:00 clojure.contrib.test-is doesn't seem to be available in my emacs env but clojure.contrib.duck-strams is. I have installed the contrib jar via emacs elpa.

14:01 am I missing something?

14:01 stuartsierra: test-is moved to clojure.test recently

14:09 So either get the latest Clojure core sources with the latest contrib sources, or get Clojure 1.0 and the clojure-1.0-compatible branch of contrib.

14:11 alrex021: I installed clojure via emacs elpa which connected to github to get latest

14:11 funny enough doesn't seem to have clojure.test

14:12 stuartsierra: What does (clojure-version) report?

14:13 alrex021: "1.1.0-alpha-SNAPSHOT"

14:13 stuartsierra: ok, then you should be able to (require 'clojure.test)

14:13 alrex021: r you sure its not clojure.core.test?

14:13 stuartsierra: yes

14:13 ,(require 'clojure.test)

14:13 clojurebot: nil

14:13 stuartsierra: ,(the-ns 'clojure.test)

14:13 clojurebot: #<Namespace clojure.test>

14:13 alrex021: oh I see

14:14 ok, ot works

14:14 tomoj: I have clojure.contrib.test-is in my elpa-installed clojure

14:14 stuartsierra: Then you probably have an older copy of contrib.

14:15 tomoj: which is odd, since I just installed it a couple days ago

14:15 alrex021: member:stuartsierra: is there a way to view all functions within a package? (like dir() in python)

14:15 stuartsierra: yes

14:15 builtin core function is ns-interns

14:15 ,(ns-interns 'clojure.test)

14:15 clojurebot: {deftest- #'clojure.test/deftest-, join-fixtures #'clojure.test/join-fixtures, *initial-report-counters* #'clojure.test/*initial-report-counters*, assert-predicate #'clojure.test/assert-predicate, default-fixture #'clojure.test/default-fixture, testing-contexts-str #'clojure.test/testing-contexts-str, deftest #'clojure.test/deftest, *testing-vars* #'clojure.test/*testing-vars*, is #'clojure.test/is, testing-vars-str #'clo

14:16 stuartsierra: then in one of the contrib libraries, maybe it's c.c.repl-utils, there's a function that prints names & documentation

14:16 alrex021: thx, that'll help me navigate since I'm new to clojure

14:16 Chousuke: find-doc is useful too

14:16 tomoj: so if I want to upgrade, I just should go with the master branches of both repos?

14:16 stuartsierra: yes

14:16 tomoj: alright, thanks

14:19 alrex021: stuartsierra: clojure.test there is no 'is' function ...(is (= 5 (+ 2 2)))

14:22 hmm, sorry, pls ignore last comment of mine

14:27 iBong: if you have a collection of predicates like [#(< %1 10) #(> %1 5) ...] what's the most idiomatic way to apply them to some value x while it returns true ?

14:29 hiredman: ,(take-while true? (map #(% v) predicates))

14:29 clojurebot: java.lang.Exception: Unable to resolve symbol: v in this context

14:29 Chouser: also note you could write the two you showed as a single #(< 5 % 10)

14:30 iBong: ah, actually using regexes, but take-while seems to be what I'm after

14:30 merci

15:05 ,(empty? (filter #(false? %) (map #(< % 10) (range 20))))

15:05 clojurebot: false

15:05 iBong: more idiomatic way to do this?

15:06 hiredman: well

15:07 first off you can just say false?

15:08 iBong: ok, second off?

15:08 Chouser: ,(every? #(< % 10) (range 20))

15:08 clojurebot: false

15:08 iBong: ah, that's much better

15:39 replaca: Wow: http://github.com/richhickey/clojure-contrib/commit/2d2c2003325cb5e38a7a984d5d349c12d8dafa4d#L0R175

15:39 iBong: I think I'm beginning to understand the Matz (para)quote "Ruby is like Lisp for normal people"

15:40 replaca: Chouser combines Clojure-Fu and Java-Fu so you don't have to! I learn stuff every time I read your code, Chris.

15:40 (even when I thought I already knew it :-))

15:40 Chouser: replaca: heh, thanks. Rich was doing a lot of hand-holding as we hammered out the original forms of that.

15:41 Maybe I should have put his name in there too.

15:41 I was just afraid my changes were wrong and wouldn't want him blamed.

15:44 hm, yeah, I should definitely fix the attribution.

15:44 http://paste.lisp.org/display/63224

15:47 replaca: I looked at seque for what I was doing, but it didn't seem to fit together with Ring's model of the universe quite right.

15:47 Chouser: http://groups.google.com/group/clojure/browse_frm/thread/e7f4de566eddb6ea

15:49 wow, that's over a year old

15:51 replaca: we're all growing up here! :-)

15:51 Chouser: I guess I should have reviewed the old discussions before releasing this version.

15:52 passing in 'fill' like I do now is definitely better than binding *enqueue*

15:53 cemerick: rhickey: do you happen to know how dlw is planning on contributing to clojure?

15:53 Chouser: "rhickey: Chouser: I did a lot of testing and was frustrated by the unpredictability of weak-ref reclamation" -- http://clojure-log.n01se.net/date/2008-07-02.html#14:36

15:55 rhickey: cemerick: I wouldn't want to speak for him, because he's very busy, but I think he's interested in getting together a more formal definition of Clojure, starting with a glossary of well-defined terms

15:55 cemerick: well, he's certainly got a body of work in that area

15:56 replaca: Chouser: yeah, I think I like it that way too. When I have it hooked up with Ring, I'll post the code and we can discuss

15:56 cemerick: I was really happy to see him pop up on the assembla notification.

15:57 replaca: Chouser: I had some good luck with WeakRef stuff when I was using it a few years back, but that was under very high churn which probably pushed it to be more predicatble.

15:59 Chouser: replaca: if you consume the seq fully, the weakref never comes into play

16:00 replaca: Chouser: yeah, I see that. But it's good for an infinite seq, you can abandoned it and the thread will die on the next event.

16:00 Chouser: I think it's a sane use of weakref -- the thread and any resources its holding on to will all be gc'ed when/if the lazy seq itself is gc'ed.

16:00 replaca: Might be even better if the thread would die before that.

16:01 Chouser: The thread will die within 1 second of the seq being gc'ed

16:01 replaca: Yup, that's pretty much what WeakRef's are for. I'd say it's a very appropriate use.

16:03 Chouser: but if fill is unpredicatably slow (waiting for a request from the net, for instance), the thread won't get closed up until the next time that fill is called, right?

16:04 Chouser: oh, I see what you're saying. yes, that's right.

16:04 rhickey: Chouser: could scopes solve your cleanup problems?

16:05 Chouser: I just meant that once the thread is blocking on filling the queue, no further 'next's are required to get the thread to go away.

16:06 tomoj: what would be a good way to grab the n smallest elements of a lazy seq?

16:06 Chouser: rhickey: I think so. The filling thread could register a :finally or whatever it's called, and try to kill itself off. Still messy, but more predictable.

16:06 tomoj: (take n my-seq) ?

16:06 hiredman: tomoj: you're going to have to sort the list

16:06 rhickey: Chouser: finalizer?

16:06 Chouser: tomoj: oh, sorry, I understand...

16:07 tomoj: hiredman: but you don't have to sort the list to actually do it at a low level. you can just iterate through once keeping track of the n smallest

16:07 Chouser: tomoj: but what if all the smallest are at the far end?

16:08 rhickey: Chouser: also, is this interesting for this problem?: http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166ydocs/jsr166y/LinkedTransferQueue.html

16:08 hiredman: tomoj: I imagine you will find the lower bound of that operation to be exactly the same as sorting

16:08 tomoj: Chouser: the idea is that you only do the iteration once and you already know how much you'll want

16:09 hiredman: maybe, but it's too much to store in memory

16:09 hiredman: tomoj: I would start looking for "lazy" sorting algorithms

16:10 tomoj: thanks

16:10 Chouser: rhickey: I don't know what you mean by "finalizer". I was thinking of :exits http://paste.lisp.org/display/73838

16:10 hiredman: if you have the nth element of a list, how can you tell if it is one of the i smallest elements?

16:10 rhickey: Chouser: ok, fine

16:11 * rhickey needs to work on scopes in my spare time

16:11 hiredman: it seems like you have to walk through the whole list

16:11 tomoj: I don't mind walking through the whole list, I just don't want to have to store the whole sorted list in memory

16:11 Chouser: tomoj: ok, *now* I understand... :-) you're okay with walking the whole list, you just want to retain no more than n in memory at once

16:11 :-)

16:12 hiredman: actually

16:12 tomoj: I was thinking I could keep a sorted seq with the smallest n so far, then add to it, sort, and cut off whatever gets pushed out

16:12 hiredman: yeah

16:12 that makes sense

16:12 tomoj: which sounds inefficient but I suspect it won't matter since finding a new low will be very rare

16:13 hiredman: keep an n sized vector

16:13 Chouser: sorted-set

16:13 rhickey: yes, please

16:14 this sounds familiar though

16:14 hiredman: if finding a new low is rare, a sorted list maybe a better choice then a vector

16:15 tomoj: hrmm, I stated the problem a bit incorrectly

16:16 a sorted anything won't work because the values I'm keeping track of aren't the ones being compared for sorting

16:16 which means I'll need to keep track of both the n elements and their sort values :(

16:16 hiredman: :|

16:16 Chouser: rhickey: I think LinkedTransferQueue would work but not be better than using a LinkedBlockingQueue. I'm not sure though that I fully understand the purpose of LinkedTransferQueue

16:17 tomoj: sorted-map ?

16:17 or a sorted-set of vectors

16:18 tomoj: your input is a seq plus a fn for computing the sort value of each element?

16:18 tomoj: Chouser: sorted-map seems like a good idea

16:18 the more I think about it the more I realize that it's harder than I thought :)

16:19 but actually, yes, a seq plus a fn for computing the sort value

16:20 problem is I have to do that sort for every element in the seq. so O(n^2)

16:20 Chouser: what!?

16:20 which sort?

16:20 Neronus: tomoj: cache it. (map #([(f %) %]) list), and traverse that list

16:20 rhickey: tomoj: http://groups.google.com/group/clojure/msg/3101ff5ea37cd79b

16:22 tomoj: Chouser: the sort isn't O(n^2), the problem is I have to do this "find the top k" n times

16:22 rhickey: man, ggroup search doesn't even go back a month :(

16:22 tomoj: rhickey: thanks

16:22 will take me a while to figure out what the heck that function does, I imagine :)

16:32 looks like that does some dup tracking I don't need, it's a good start, thanks again

17:01 lbj: ~seen blackdog

17:01 clojurebot: no, I have not seen blackdog

17:03 hiredman: ~max people

17:03 clojurebot: max people is 149

17:04 jwhitlark: ~help

17:04 clojurebot: http://www.khanacademy.org/

17:04 iBong: ,(println 'woot!')

17:04 clojurebot: Unmatched delimiter: )

17:05 jwhitlark: er. that wasn't quite what I was expecting. interesting though.

17:06 hiredman: jwhitlark: no single quoted strings

17:06 ' is (quote …)

17:06 jwhitlark: I mean the link for ~help.

17:06 Chouser: that was iBong

17:06 jwhitlark: but thanks.

17:07 hiredman: it sure was

17:07 jwhitlark: ,(+ 2 2)

17:07 clojurebot: 4

17:08 jwhitlark: I think they've turned off some of the fun: http://clj.thelastcitadel.com/clojurebot

17:08 hiredman: (+ 2 2)

17:08 clojurebot: 4

17:08 iBong: ,(println ":x")

17:08 clojurebot: :x

17:08 hiredman: (+ 2 3)

17:08 clojurebot: *suffusion of yellow*

17:09 hiredman: I could have sworn I removed that

17:09 three or four times even

17:09 jwhitlark: oh, is clojurebot yours?

17:09 heh, sorry, I had your git repo open in a tab I hadn't looked at yet.

17:09 mrsolo: emacs 23..safe to upgrade as far as slime/clojure concern?

17:09 hiredman: :P

17:10 * jwhitlark looks abashed

17:10 Chousuke: mrsolo: works for me.

17:10 mrsolo: nice

17:10 * Chousuke should tweak his emacs.app to be a bit more maclike still.

17:11 Chousuke: Moved away from aquamacs because it was buggy :/

17:11 jwhitlark: hiredman: how much work do you think it would be to port clojurebot to jabber?

17:11 mrsolo: well

17:11 aquamacs habit is hard to kick

17:11 i am so used to apple-f-l-s ...

17:11 * jwhitlark moved away from Mac because aquamacs was buggy...

17:12 hiredman: jwhitlark: it depends

17:12 it would be great if I could find a pircbot equiv for xmpp

17:13 jwhitlark: hmmm.

17:14 Chousuke: jwhitlark: I might give Aquamacs 2.0 a go when it's ready. apparently it's based on emacs.app

17:14 hiredman: at one point I had the repl hooked up to twitter, but that never worked reliably for want of testing

17:14 Chouser: I'm looking forward to clojurebot on wave

17:14 jwhitlark: Chousuke: I tried a mac for 6 months at work, but in the end went back to linux on a thinkpad.

17:16 * mrsolo shrugs

17:16 mrsolo: either one is fine with me

17:17 hiredman: the only java xmpp lib people use seems to be smack, and I am not a huge fan

17:17 jwhitlark: long as it's *nix, I've no problems, really.

17:17 Chousuke: I'd probably use Debian or something but OS X still works somewhat better overall. Particulary the dictionary in Leopard is great.

17:17 jwhitlark: is that the one from the openfire people?

17:18 If the new machines had been out at the time, I might still be using it...

17:18 hiredman: yeah

17:19 jwhitlark: or if I could have gotten a newer air.

17:19 hiredman: I tried that a little bit, but I was doing most of my xmpp stuff in python.

17:21 clojurebot: def true?

17:21 nice.

17:21 hiredman: I think xmpp is the one place I feel let down by java libraries

17:22 jwhitlark: I could see that.

17:22 I've been working with zookeeper lately through the java libraries, and it's awesome.

17:22 once I figured out you need to specially import inner classes.

17:22 hiredman: heh

17:23 technomancy: jwhitlark: what are you using zookeeper for?

17:23 jwhitlark: I *really* like Stewart's book, but that wasn't in there, AFAIK.

17:23 baetis-fly: is there a way to do static imports of classes?

17:24 jwhitlark: technomancy: it's complicated, well, poorly defined at the moment.

17:24 basically ad-hoc group membership of machines and making services available.

17:25 hiredman: baetis-fly: I don't think so

17:25 "So when should you use static import? Very sparingly!"

17:26 baetis-fly: i agree, it's lame, but i'd like to sneak some clojure into work by using waitForState.sh

17:26 jwhitlark: I like zookeeper very much so far.

17:26 baetis-fly: err, http://watij.com/wiki:quick_start

17:26 can't seem to instantiate an IE

17:27 jwhitlark: I was thinking of doing a quick talk on it at the next ba-clojure meetup. I've not been using it long though...

17:31 hiredman: what's the deal with make 7-?

17:32 (looking at clojurebot's brain)

17:32 hiredman: its from a 7-UP tv ad

17:33 http://www.youtube.com/watch?v=WsMFZBDIcFs Make 7 … UP YOURS

17:33 jwhitlark: oh, I was wondering if it was an obscene emoticon I hadn't come across ;-)

17:33 put that way...

17:34 hiredman: you put some fun stuff in here...

17:34 hiredman: not all me

17:36 hugzbunny: hello i wanted to know if there is some way to get the full text of a function

17:36 hiredman: clojurebot: how can the common lisp hyperspec help us through these troubling times?

17:36 clojurebot: lisp is the red pill

17:36 hiredman: :/

17:37 clojurebot: how can the hyperspec of common lisp help us through these troubling times?

17:37 clojurebot: hyperspec is not applicable

17:37 hiredman: ~def source

17:37 (doc source)

17:37 clojurebot: "clojure.contrib.repl-utils/source;[[n]]; Prints the source code for the given symbol, if it can find it. This requires that the symbol resolve to a Var defined in a namespace for which the .clj is in the classpath. Example: (source filter)"

17:43 hugzbunny: hmmff.. CompilerException java.lang.ClassNotFoundException: clojure.contrib.repl-utils .. any ideas?

17:44 Chouser: (use 'clojure.contrib.repl-utils)

17:44 of course you have to have contrib in your classpath somewhere first

17:46 hugzbunny: btw im very new to clojure so please could explain to me where i add new paths to my classpath?

17:46 hiredman: hugzbunny: how are you launching clojure?

17:46 hugzbunny: netbeans

17:47 hiredman: :|

17:47 hugzbunny: hehe

17:48 hiredman: I imagine netbeans has some kind of project classpath setting

17:48 but I don't use netbeans

17:50 http://bits.netbeans.org/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/classpath.html#q-and-a "I need to add a library JAR from outside the NetBeans installation"

17:52 iBong: will enclojure become a standard netbeans plugin in the near future?

17:53 alrex021: I've had a look at enclojure, looks promising, but becoming a standard plugin in the near future, I don't think so.

17:54 hugzbunny: hiredman: thanks i will look into it

17:54 iBong: I couldn't get it to work

17:54 or rather, the repl didn't work at all

18:13 dnolen: hugzbunny: are you using enclojure? If so you can just add the clojure-contrib.jar to your project

18:13 you don't need to mess with your classpath at all.

18:24 hugzbunny: hello dnolen, how do i do that?

18:29 akhudek: I find that I'm often writing loops like this http://paste.lisp.org/+1T87

18:30 is this really a common pattern?

18:31 I dont' have a lot of experience actually writing lisp yet, so I'm concerned I'm doing things in the wrong way.

18:31 in other words, is there a more concise way to process over lists like that?

18:31 Chousuke: map?

18:31 redue?

18:31 reduce*

18:31 I can't quite figure out what that does.

18:32 akhudek: probably reduce would be closes

18:32 err closest

18:32 it just iterates over elements of the seq

18:32 hiredman: ,(doc reduce)

18:32 clojurebot: "([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val is supplied, returns the r

18:32 hiredman: ,(doc doseq)

18:32 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."

18:32 Chousuke: akhudek: iterates over them doing what?

18:32 akhudek: and does some processing on them that requires some state

18:32 hiredman: sounds like reduce

18:33 akhudek: in this case I'm converting a list like (1 sizeA) (2 sizeB) (1 sizeC)

18:33 hiredman: clear as mud

18:33 akhudek: to ranges that are ((0 sizeA-1) 1) (sizeA (sizeB-1 + sizeA) 2) ...

18:33 Chousuke: btw. instead of (if (empty? remaining) ...) the clojure idiom is (if (seq remaining) ...)

18:34 seq returns nil for empty sequences

18:34 akhudek: ah, ok

18:34 hiredman: sounds like reduce

18:34 actually

18:34 akhudek: yeah, I suppose that would be cleaner, although the result object would need to carry the stat with it

18:34 hiredman: you could do it with map

18:35 akhudek: how so?

18:35 since you need the sum of all previous sizes

18:35 hiredman: you just map over two lists

18:35 akhudek: and compute the sizes in a separate list

18:35 right

18:35 hiredman: the two lists identical except the second list has a dummy first entry

18:36 akhudek: hmm, maybe I'm not following then

18:36 hiredman: easier just to use reduce

18:37 Chousuke: ,(reduce (fn [[state acc] item] [(inc state) (str acc state item)]) [1 ""] '[foo bar zonk])

18:37 clojurebot: [4 "1foo2bar3zonk"]

18:38 akhudek: hm, ok thanks

18:38 that makes sense

18:38 Chousuke: reduce really is versatile :)

18:39 lpetit: akhudek: the definition you gave in your lisppasted code does not just "look like" reduce, to me it is reduce constrained to have its first accumulator value be an empty list

18:40 akhudek: ok, I figured I was doing something wrong

18:41 Chousuke: well, when learning a language pretty much everyone reinvents half of the wheels at first :P

18:41 akhudek: yeah, it takes a while moving from C++ to a functional language

18:41 but the amount of repetition in that loop construct I pasted had me suspicious, I guess for good reason

18:43 lpetit: welcome on a long journey !

18:44 akhudek: thanks :)

18:44 lpetit: you know, we're not that ahead in front of you, it's just that for you everything seems a little bit foggy right now, so you can't see ur just 2 steps from us ;-)

18:45 if at all

18:46 akhudek: I did think of using reduce, but what I didn't realize is that you can bind as Chousuke showed (fn [[state inc] item] ... )

18:46 I didn't want to be stuck in (first ..) (second .. ) land

18:47 lpetit: make first $(CLOJURE_HOME)/src/clj/clojure/core.clj your friend. Not because there is some lack in the documentation, but first because it is plain of functional wisdom :-)

18:47 oh yes

18:47 akhudek: ok, I'll take a look at some of the implementations :)

18:48 lpetit: ok, enough of me being pedant, and it's also time to go to bed for me, here in France ! (almost 1 am). cu

18:56 lisppaste8: iBong pasted "maintainable?" at http://paste.lisp.org/display/84536

18:57 iBong: trouble reading my own handwriting... hoping for suggestions on style, idioms

18:58 Chousuke: iBong: #(if % true) == identity

18:59 also (if foo bar nil) -> (when foo bar)

19:01 but hmm

19:03 ,(let [coll {"foo" 1 "bar" 2 "foobar" 3}] (map coll (filter #(re-matches % "foo") (keys coll)))

19:03 clojurebot: EOF while reading

19:03 Chousuke: ,(let [coll {"foo" 1 "bar" 2 "foobar" 3}] (map coll (filter #(re-matches % "foo") (keys coll))))

19:03 clojurebot: java.lang.RuntimeException: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.regex.Pattern

19:04 Chousuke: hmm

19:04 ,(let [coll {#"foo" 1 #"bar" 2 #"foobar" 3}] (map coll (filter #(re-matches % "foo") (keys coll))))

19:04 clojurebot: (1)

19:05 iBong: ah

19:05 Chousuke: clojure maps are functions, which is nice :)

19:06 iBong: yeah, its funny I was using that to return the value but it didnt occur to me use the map with map

19:06 that makes me very happy, thank you

19:41 uninverted: "(do (print "foo") (read))" reads before printing. WTF? I thought pascal showed us how confusing and limiting this was.

19:58 JAS415: ,(do (print "(+ 1 2)" (read))

19:58 clojurebot: EOF while reading

19:59 tomoj: pascal didn't show me anything

19:59 JAS415: ,(do (read (print "(+ 1 2)")))

19:59 clojurebot: java.lang.NullPointerException

19:59 Chousuke: print returns nil :P

19:59 JAS415: print returns nil

20:00 ,(do (print "foo") (read))

20:00 clojurebot: Execution Timed Out

20:00 JAS415: hmm

20:00 oh

20:00 duh

20:01 it prints foo and waits to read something

20:01 tomoj: no, that's the point

20:01 it waits to read something, then prints foo

20:02 JAS415: ,(print "foo")

20:02 clojurebot: foo

20:02 JAS415: hmm

20:02 that is really weird

20:05 Chousuke: ah, I know why it happens

20:05 it's buffered.

20:06 (do (print "foo") (flush) (read)) works as expected

20:07 tomoj: strangely it works in my slime repl

20:07 without flushing

20:08 speaking of, does anyone know why my minibuffer is displaying the value of variables?

20:10 like I do (count *foo*) where foo is a big map, and it takes forever because it tries to display the value of *foo* in the minibuffer

20:11 but only sometimes...

20:12 rhickey: ,(str (new [] (toString [] "hello")))

20:12 clojurebot: "hello"

20:13 tomoj: turning eldoc off seems to solve it, will investigate there

21:13 what's wrong with (sorted-map-by #(> (val %1) (val %2))) ?

21:13 hiredman: ,(doc sorted-map-by)

21:13 clojurebot: "([comparator & keyvals]); keyval => key val Returns a new sorted map with supplied mappings, using the supplied comparator."

21:14 hiredman: ,(sorted-map-by #(> (val %1) (val %2)))

21:14 clojurebot: {}

21:14 hiredman: ,(assoc (sorted-map-by #(> (val %1) (val %2))) :foo 1)

21:14 clojurebot: {:foo 1}

21:14 hiredman: ,(assoc (sorted-map-by #(> (val %1) (val %2))) :foo 1 :bar -1)

21:14 clojurebot: java.lang.RuntimeException: java.lang.ClassCastException

21:15 tomoj: same result here :(

21:15 hiredman: ,(assoc (sorted-map-by #(> (prn %1) (val %2))) :foo 1 :bar -1)

21:15 clojurebot: java.lang.RuntimeException: java.lang.ClassCastException

21:15 hiredman: ,(assoc (sorted-map-by #(do (pr %1) (pr %2) -1)) :foo 1 :bar -1)

21:15 clojurebot: {:bar -1, :foo 1}

21:15 :bar:foo

21:15 hiredman: so keys are what are passed to the comparator

21:16 tomoj: well crap

21:16 guess I will sort at the end

21:16 thanks

22:06 JAS415: is there a 'group' function in clojure?

22:07 mebaran151: like partition?

22:07 JAS415: like partition except by number of groups

22:08 i guess i can use partition and math but i seem to lose the last few with partition

22:10 mebaran151: you mean something like divide an array into 4 pieces or something?

22:14 hugzbunny: i have downloaded the clojure-contrib thing from github and added it to my classpath in enclojure, but to no avail - i can't use it. any suggestions?

22:15 JAS415: well what i'm doing is splitting a string into tokens, interleaving every x tokens with a "<br/>"

22:15 so is like that but I'm doing arbitrary number of chars in the string and a fixed chars per line

22:16 but i don't want to break the words up

22:19 _mst: in clojure.contrib.seq-utils there's a "partition-all" that doesn't drop the last few elements

22:19 JAS415: ah cool

22:19 thanks :-)

22:20 _mst: no worries :)

22:43 JAS415: bah

22:43 this makes no sense

22:43 my header is

22:43 (ns chickadee

22:43 (:require clojure.contrib.seq-utils))

22:44 however i load the file

22:44 nvm i know what it is

23:41 iBong: is there something like each-with-index?

23:43 (doc index)

23:43 clojurebot: "/;nil; "

23:44 Chouser: ,(indexed [:a :b :c])

23:44 clojurebot: ([0 :a] [1 :b] [2 :c])

23:46 iBong: ty

23:46 Chouser: ,(for [[i x] (indexed [4 4 4 10])] (+ i x))

23:46 clojurebot: (4 5 6 13)

23:46 iBong: was about to try

23:47 Chouser: oh, and that's from contrib

23:47 , #'indexed

23:48 clojurebot: #'clojure.contrib.seq-utils/indexed

Logging service provided by n01se.net