#clojure log - Jun 08 2011

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

0:21 konr: Anybody using sexpbot? While trying to generate the uberjar, I get an exception, saying that 'irclj/irclj.clj' is not on classpath.

0:39 Raynes: konr: That's odd.

0:39 konr: Is irclj in lib/?

0:39 konr: Raynes: yup

0:39 Raynes: konr: Also, we have a channel for sexpbot: #sexpbot

0:45 technomancy: are there any operating systems in which (System/getenv "HOME") will return nil?

0:53 amalloy: technomancy: the set of operating systems is open; one of them, somewhere, will get it "wrong". best to decide what you're supporting and make sure HOME is defined on those?

0:54 technomancy: amalloy: keep talking like that and you might get me to drop windows support =)

0:54 considering windows actually gets (System/getProperty "user.home") wrong

0:54 just wondering if preferring $HOME and falling back to user.home is better

0:55 amalloy: technomancy: really? i think user.home is a property the jvm is supposed to set

0:56 ie, i thought it wasn't possible for windows to get it wrong

0:56 offby1: technomancy: plenty, if someone deliberately removed HOME from the environment :)

0:57 technomancy: I guess it's technically cygwin that's screwing it up

0:58 amalloy: that i can believe

0:59 technomancy: what is cygwin returning for user.home?

0:59 (out of idle curiosity)

1:02 technomancy: amalloy: good question; the issue has been reported three times, but nobody has actually thought to include that info in a bug report

1:03 one of them is something ridiculous like /Documents and Settings/Administrator and one of them is /home/admin or whatever IIRC

1:03 amalloy: expected: property will be set incorrectly. actual: property is not set correctly. please fix by: setting property correctly

1:04 scgilardi: it returns C:\\Documents and Settings\\<username>

1:04 amalloy: that's the right thing to return, so...

1:04 scgilardi: well... single \ but they're escaped. yes, it's right from a windows perspective (which is all java knows about)

1:04 technomancy: the problem is bin/lein looks for plugins using $HOME

1:04 so I suppose if $HOME isn't set it's screwed anyway

1:05 amalloy: technomancy: i bet lein.bat doesn't look in $HOME

1:06 technomancy: looks like it's USERPROFILE

1:06 I wonder if preferring HOME to USERPROFILE will screw with the bat?

1:06 amalloy: technomancy: probably, because $HOME will exist, and be wrong, in a cygwin context

1:07 (or, possibly be wrong)

1:07 scgilardi: getenv USERPROFILE returns the same dir as user.home

1:08 technomancy: amalloy: I think in cygwin $HOME is actually what we want?

1:08 amalloy: technomancy: it might be, but i wouldn't treat it as canonical because cygwin does a lot of fudging

1:08 scgilardi: it is possible for a cygwin user to reset their home dir to /cygdrive/c/Documents and Settings/<username> . (I saw it recommended because it keeps c:\cygwin free of the user's data and eligible to be blown away)

1:08 amalloy: eg, it might have / instead of \

1:09 technomancy: the only requirement is that it match bin/lein or bin/lein.bat

1:09 and the only way they are going to get it is via env vars

1:09 so I think checking both env vars and preferring HOME is OK as long as non-cygwin doesn't set $HOME

1:10 scgilardi: but in that case bin/lein will still match it as long as the environment var is considered the ground truth, right?

1:10 scgilardi: that's right

1:11 technomancy: ok, cool

1:13 * technomancy reserves the right to be grumpy about windows every so often

1:13 scgilardi: HOME is set on my windows box. it returns the same path as above. however when running under cygwin (at its command prompt), HOME is set to cygwin's notion of home.

1:13 technomancy: scgilardi: HOME is set to the same as USERPROFILE you mean?

1:13 scgilardi: right

1:14 technomancy: should lein.bat use HOME instead?

1:14 scgilardi: I think a cygwin user will prefer lein bash script

1:14 and if some exclusively uses lien.bat, I think everything will still work

1:14 some becomes someone

1:15 technomancy: the thing about windows users is they usually let you know if you've screwed something up

1:20 "Madness? Madness? This is WINDERRRRRRS!"

1:20 *kick*

1:44 robink: Is the Sattvik (com.sattvik.clojure_repl) Clojure environment/repl the best one for Android currently?

1:45 ieure: Huh. "Invalid memory access of location 0x0 rip=0x0"

1:51 amalloy: robink: i think it's the only one

1:52 robink: amalloy: Gotcha.

5:02 Keptn: where can I report a "bug" with clojure.core, and by bug I mean a shoddy function

5:46 ilyak: Hi *

5:47 I do (for [foo (make-some-potentially-huge-lazy-seq)] (do-work-on foo))

5:47 and it seems that the head of huge-lazy-seq doesn't get released until I exit foo

5:47 which leads to OOM

5:48 what's the correct way to make a lazy sequence and iterate on it without meltdown?

5:48 Chousuke: ilyak: for returns a lazy seq. you're probably misusing it

5:49 use doseq if you need to iterate over seqs with side-effecty things and not create a new seq

5:49 ilyak: Chousuke: I doseq printing it to file

5:49 it's like (doseq [a (for [foo (make-some-potentially-huge-lazy-seq)] (do-work-on foo))] (print-to-file a)

5:50 except in two defns

5:50 Chousuke: hmmh

5:50 that should not be a problem

5:50 ilyak: Or maybe I'm leaking somewhere else

5:50 Chousuke: make sure you're not accidentally making another reference to the huge seq

5:50 or the seq that for returns

5:51 ilyak: does one in doseq counts?

5:51 clojurebot: doseq is like for, but for side effects instead of values

7:00 drguildo: i downloaded clojure 1.2.1 from http://clojure.org/downloads but there's no jar file. am i missing something?

7:00 there's a jar in the "Clojure 1.3 Alpha 8" download

7:02 manutter: Might be an error

7:03 I haven't downloaded from the downloads site, but if you're just getting a bunch of java files, you can probably build it by typing "ant" at the command line

7:03 the best way to install clojure, though, is to use leiningen

7:04 http://github.com/technomancy/leiningen

7:07 clgv: wow clojure 1.2.1 finally made it on the downloads page :)

7:08 drguildo: ok. thanks.

7:28 clgv: I have a tree structure consisting of maps that contain vectors as values and I want to build a lazy sequence where the tree structure remains but instead of the vectors there is a single value from the vector. two trees of the lazy sequence shall differ in that one entry is replaced by the next element in the vector

7:29 what is the easiest way to accomplish this with built-in clojure functions?

7:34 example {:n [1 2 3] :subconfig {:a [1] :b [7 10]}} -> ({:n 1 :subconfig {:a 1 :b 7}}, {:n 1 :subconfig {:a 1 :b 10}}, {:n 2 :subconfig {:a 1 :b 7}}, {:n 2 :subconfig {:a 1 :b 10}}, {:n 3 :subconfig {:a 1 :b 7}}, {:n 3 :subconfig {:a 1 :b 10}} )

7:39 hoeck: clgv: maybe clojure.walk, but it looks you need some kind of short circuiting after finding the first vector, and then continue from there

7:39 which clojure.walk doesn't provide

7:39 clgv: hoeck: yeah I thought about clojure.walk as well. are there any examples on how to use that one?

7:40 I could use it to get all "option" paths and use assoc-in in the lazy-seq definition then

7:41 hoeck: clgv: right, good idea

7:42 clgv: so you know any examples on clojure.walk except from macroexpand-all?

7:42 hoeck: maybe https://github.com/search?type=Everything&language=&q=clojure.walk+prewalk&repo=&langOverride=&x=0&y=0&start_value=1 helps for finding useful examples

7:42 clgv: hoeck: interesting approach - didnt think of searching github like that :)

7:43 hoeck: discovered that only a few days ago, pretty exaustive and finds more than google codesearch (at least for clojure or python stuff)

7:44 btw, the macroexpand-all example in clojure.walk is broken, it also expands quoted forms

7:44 clgv: ah really? that sucks^^

7:46 ,(clojure.walk/macroexpand-all '(quote (let [a 1] a)))

7:46 clojurebot: (quote (let* [a 1] a))

7:46 clgv: hm yeah, I guess that's not always intended ;)

7:48 hoeck: right, you'll have to write a tree walker which takes a predicate fn to know where to stop walking

8:01 clgv: humm I'd also need to know when I am at a leaf^^

8:13 hoeck: clgv: aren't all your leaves vectors?

8:14 clgv: hoeck: almost - all the paths I have to find are vectors but they might not be leafs in some special cases. but that works

8:15 after reviewing clojure.walk implementation, I don't see a way to pass immutable state from function call to function call while traversing

8:15 hoeck: clgv: yep

8:15 clgv: is there already something similar to clojure.walk or do I have to implement that myself?

8:16 hoeck: clgv: walk is only helpful to modify a tree, not to return stuff

8:17 clgv: I think clojure needs some additional tree walking functions, just like it has all the functions for working with seqs

8:18 I had to write my own too, e.g. to create paths for assoc-in

8:18 clgv: you have that one lying around right now? ;)

8:22 hoeck: I have, but my trees were vectors of hashmaps

8:23 and I wanted to transform a tree structured address into a list of related nodes

8:24 chouser: have you considered clojure.zip ?

8:25 clgv: chouser: humm, what's your idea with zip?

8:27 you mean implementing a path enumeration in the tree with a zipper?

8:44 hmm I didnt learn anything from clojuredocs example on zipper :(

8:55 kephale: clgv: you can do path enumeration with zippers by using base 5 integers to represent sequences of zipper functions

8:56 manutter: There, it's not even 9:00AM (EST), and my mind is blown already...

8:56 clgv: kephale: I need paths that can be used with assoc-in

8:56 manutter: I really need to spend some time getting to know zippers

8:56 you guys are having too much fun

8:58 opqdonut: 1555.28 @opqdonut$ oh my

8:58 1555.31 @opqdonut$ from the clojure json library

8:58 1555.50 @opqdonut$ (let [c (char i)] (cond (= i -1) (handle-eof) ...))

8:58 bpr: opqdonut: yeah... i bumped into that yesterday

8:58 opqdonut: that is fixed in the new data.json lib on github

8:59 opqdonut: i simply changed my lein project file and all was well... yymv

8:59 lol... ymmv

9:00 opqdonut: :)

9:50 nickik: Hallo all, i have a wired dependency problem. I have all the dependencies in project.clj http://pastebin.com/R9Mm7jij and a very simple core.clj http://pastebin.com/skMqzSZW but when i trie to compiler it says: error: java.io.FileNotFoundException: Could not locate appengine_magic/core__init.class or appengine_magic/core.clj on classpath.

9:50 does happen with other librarys to not only with appenginemagic

9:51 mrBliss`: nickik: have you done "lein deps"?

9:52 nickik: mrBliss, sure

9:52 no errors there

9:56 manutter: I think maybe you want appengine-magic in your dependencies, not your dev-dependencies

9:56 bpr: no, dev-deps is right

9:57 nickik: Programs using appengine-magic just need to include appengine-magic as a Leiningen dev-dependency.

9:59 bpr: well, let's start simple lol: do you have appengine-magic-0.4.1.jar in lib/dev?

9:59 i can't see anything wrong with your project.clj or core.clj, that's why i suggest checking that

9:59 manutter: does lein add lib/dev to the classpath then?

10:00 bpr: yes

10:01 how are you trying to compile, btw? w/lein i assume?

10:01 manutter: hmm, so what happens when you build your uberjar and try to install it on appengine, and your code tries to load appengine-magic.core and it's not there?

10:01 bpr: manutter: that doesn't happen

10:01 manutter: the code will use the other appengine-api classes

10:02 manutter: appengine-magic is for helping you run a dev server locally. It sorta mocks the app engine environment, and other things

10:02 manutter: but the code as posted is making explicit calls to appengine-magic

10:02 nickik: all the deps are in lib/ or lib/dev

10:02 i compile in emacs

10:02 manutter: I'm probably just not understanding the model here

10:03 Do you do your development using appengine-magic, and then replace the calls to a-m with calls to the actual appengine api?

10:03 bpr: appengine-magic calls will use google app engine if it detects it's in an app engine environment

10:03 nickik: manutter, thats just macros when you deploy they will be replaced by the acctual app engine API

10:04 manutter: but if the appengine-magic jar isn't there when you deploy, then those macros are not defined

10:04 right?

10:04 bpr: aot-compile

10:04 manutter: ah, ok

10:04 So the jar is there at compile time, and then you don't need it after that

10:04 bpr: right

10:05 manutter: ok, sorry for the noise, carry on :)

10:05 bpr: appengine-magic also provides some lein tasks, so all that mucking around when trying to deploy is automated

10:05 it's quite nice

10:05 no worries

10:05 manutter: nickik: have you tried deleting your lib/dev dir and re-running lein-deps?

10:06 nickik: yeah

10:06 bpr: nickik: try running: lein appengine-prepare

10:06 at the command line in your project directory

10:06 nickik: k

10:08 ilyak: It seems that my code spends memory at O(n^3)

10:08 nickik: bpr, didn't help

10:08 bpr: O.o

10:09 you said this problem occurs with other libraries too?

10:09 nickik: maybe its something about swank i trie to compiler with line directly

10:09 manutter: can you load it into the REPL?

10:11 nickik: what version of swank/emacs?

10:12 nickik: i just newly instaled 1.3.1 i think it is

10:12 anycase ist surly the new one

10:12 i used the new line plugin feature

10:13 bpr: oh?

10:13 do ls ~/.lein/plugins

10:14 sometimes lein gets confused if there are libs in both its plugins dir and the project's lib/*

10:14 ilyak: I try to dig my memory heap using eclipse mat

10:14 bpr: err, to be more specific, diff versions of the same lib

10:15 ilyak: and it shows that the first and biggest-by-retained Cons is referred by <Java Local> Thread

10:15 nickik: there only one thing inthere

10:15 bpr: swank?

10:15 clojurebot: swank is try the readme. seriously.

10:15 nickik: swank 1.3.1

10:15 bpr: ok

10:15 ilyak: Why that? How and why would Thread hold Cons?

10:15 bpr: that's prob ok

10:16 nickik: lein is upto date to

10:16 bpr: nickik: at this point, i'm out of ideas :[

10:16 nickik: i just updated it

10:16 bpr: i don't really know enough about lein to know what else to suggest

10:17 manutter: nickik: latest version of appengine-magic too?

10:17 nickik: ja

10:17 i mean yeah

10:18 manutter: hmm, wonder if you print out the classpath at the repl

10:18 might tell you something interesting

10:18 bpr: nickik: are u using durendal to load slime?

10:19 that works very well for me

10:19 nickik: durendal ??

10:19 ilyak: Is <Java Local> something on the thread stack?

10:19 bpr: http://developers.facebook.com/docs/reference/fbml/iframe/

10:19 pfft

10:19 https://github.com/technomancy/durendal

10:20 that's an elisp file that makes loading a slime repl very easy

10:20 manutter: ilyak: sorry, don't mean to ignore you, but I know even less about Java thread internals than I do about appengine-magic

10:21 I tried durendal, but had bad results, then I found out it was because my emacs was only 22 and durendal expects 23 or later

10:21 bpr: oh

10:21 :(

10:22 how do you start your swank server then?

10:22 manutter: I've played with clojure-jack-in, works pretty well

10:22 bpr: yeah, i liked that too

10:22 manutter: I usually start swank with lein swank and slime connect

10:23 I followed some old instructions using package.el and stuff, it was a while ago

10:23 clojure-jack-in seems much easier than what I went thru

10:23 bpr: yeah, that works too. I'm to lazy though :p

10:23 manutter: I had to manually edit my .emacs file to get it to stick tho

10:23 bpr: i want to use one of those *-jack-in functions from emacs

10:24 i'm using technomancy's emacs starter package

10:24 nickik: I use the plugin and have an alias to start it so in a new project i just have to write "swank" and that starts the server

10:24 bpr: it's really nice

10:24 nickik: bpr, i do too

10:24 bpr: i wonder if maybe your alias is running lein swank in the wrong directory?

10:25 manutter: challenge for the day: try to talk about starting clojure from emacs for 10 min *without* mentioning technomancy...

10:25 can't be done :)

10:25 bpr: yeah lol

10:25 manutter: nickik: yeah, that sound plausible, try starting swank "manually" and see if that changes anything

10:26 ilyak: I have a loop like (for [x xs y ys], where xs and ys are rather large sequences

10:27 enough that [xs X ys] would not fit in memory

10:27 and for some reason that's exactly what I get, it seems that for some reason head of this bizzare sequence gets retained and I get out of memory

10:28 manutter: ilyak: where are you getting your xs and ys from?

10:28 Keptn: difference between bound-fn and bound-fn*?

10:28 manutter: ilyak are those function calls, or are you storing them in a var somewhere

10:29 ,(doc bound-fn)

10:29 clojurebot: "([& fntail]); Returns a function defined by the given fntail, which will install the same bindings in effect as in the thread at the time bound-fn was called. This may be used to define a helper function which runs on a different thread, but needs the same bindings in place."

10:29 manutter: ,(doc bound-fn*)

10:29 clojurebot: "([f]); Returns a function, which will install the same bindings in effect as in the thread at the time bound-fn* was called and then call f with any given arguments. This may be used to define a helper function which runs on a different thread, but needs the same bindings in place."

10:29 ilyak: manutter: Yeah, those are sequences I read from a file

10:29 but xs + ys is small

10:29 xs X ys is very large

10:30 mrBliss`: ilyak: you want xs X ys right?

10:30 manutter: ,(for [x (range 3) y (range 3)] [x y])

10:30 clojurebot: ([0 0] [0 1] [0 2] [1 0] [1 1] [1 2] [2 0] [2 1] [2 2])

10:30 ilyak: mrBliss`: Yes, but I don't to hold it in memory at once

10:30 I just want to iterate it

10:30 bpr: yeah, for doesn't step the sequences in parallel

10:31 it gives you the cross-product essentially

10:31 manutter: hmm, but for should still return a lazy seq

10:31 ilyak: Oh

10:31 bpr: maybe you want map?

10:31 ilyak: I think that the result sequence is the thing that is large

10:31 Not input

10:31 manutter: It might need to hold onto the ys in order to re-start the y seq for each step of x

10:32 Yeah, the result seq should be a lazy seq, it shouldn't fill up your ram

10:32 What happens to the result seq after you generate it?

10:33 ilyak: manutter: I print it using doseq

10:33 (Still why would it reside in memory at once)

10:35 (filter identity) didn't help

10:35 nickik: hey it works know (don't know why just redid everything)

10:35 bpr: cool

10:38 alright, i gotta get back to work :-p enough #clojure for me for now

10:39 nickik: thx for the help anyway

10:40 manutter: ilyak: does your code look like (doseq [a (for [x xs y ys] ...)) or does it look like (let [a (for [x xs y ys] ...)] (doseq [b a] ...) ?

10:42 mrBliss`: btw: (doseq [a (for [x xs y ys] ..)] ..) can be written as (doseq [x xs y ys] ..)

10:43 ilyak: first one

10:43 nickik: Not really, it's in fact (doseq [a (for...) b a]

10:43 i.e. unnest

10:49 it seems that a combination of (doall (filter identity (for....))) fixed the problem

10:49 would try to drop doall

10:52 manutter: wait, doall or doseq?

10:52 doall returns nil, doesn't it?

10:53 (oh wait, so does doseq)

10:54 what's the point of adding the "(filter identity" part? Could you just do "(doall (for ..."

10:54 ilyak: (doseq (doall (filter (for

10:54 right now

10:55 (filter identity - i do not know why. Presumable so that sequence I doall on actually fits in memory

10:55 manutter: I think that's going to reduce down to (doseq nil) tho

10:55 ilyak: Because it seems that (doseq [a (foo) b a] - head of a sits in memory

10:56 opqdonut: of course

10:56 because a is bound to it (less surprisingly)

10:57 you might want (doseq [b (flatten (foo))] ...) or something like that

11:08 Kratoss`: hrm

12:16 void_: hi guys, a clojure beginner here. So let's say I have a set and I would like to add something to that set. What is the best way? Should I redefine it?

12:17 technomancy: void_: well, you can't add anything to it, you can only generate a new set that's based on it but with an additional entry.

12:17 manutter: grr, technomancy types too fast :)

12:17 technomancy: whether you do that through rebinding a local, recursion, or via a reference type depends on context

12:17 void_: (def *my-set* (conj *my-set* :something)) <-- like that?

12:17 manutter: ,(conj #{} :some-new-val)

12:17 clojurebot: #{:some-new-val}

12:18 technomancy: manutter: it's the dvorak.

12:18 manutter: doh

12:18 hiredman: redefing is never correct

12:18 manutter: void_: yeah, that's the general idea

12:18 void_: yeah that's the impression that I have from my two days with clojure

12:18 that I shouldn't redefine things

12:18 manutter: only if you get good at clojure you won't use def as much as in other, less functional languages

12:18 technomancy: the only reason redefining is allowed is to make interactive development possible

12:19 void_: I saw dosync + alter in peepcode cast, but I think I don't need that if I'm not multithreading, right?

12:19 manutter: true

12:19 technomancy: void_: atoms are the most basic reference type; that's probably what you want

12:19 swap! instead of alter

12:20 void_: by the way, I had C# last semester in school and I thought *that* was complicated ... ;)

12:20 technomancy: complexity and familiarity are orthogonal

12:21 manutter: C# *is* complicated, clojure isn't :)

12:21 void_: ok, let's say clojure's syntax is

12:21 but I'm enjoying it

12:21 didn't feel like this since learning Ruby

12:22 manutter: yeah, it's fun

12:22 clojure syntax isn't really complicated, it's just that it's *too* simple -- us C refugees get lost because we're so used to the complicated syntax

12:23 like technomancy said, familiarity is more a factor than actual complexity

12:23 of course, that's just fanboy-speak :)

12:23 (my remarks I mean, not technomancy's)

12:25 void_: yeah I think it's familiarity

12:26 manutter: especially it's a different way of thinking about problem solving

12:27 lists let you do weird stuff like ##(> 2 3 4 5 6)

12:27 sexpbot: ⟹ false

12:27 manutter: ##(< 2 3 4 5 6)

12:27 sexpbot: ⟹ true

12:27 mprentice: happy wednesday folks

12:27 technomancy: happy ipv6 day

12:27 manutter: oh boy, that's today isn't it

12:29 mprentice: i have a list of dependencies of the form A->B, B->C, B->D, etc, that i need to turn into a dependency tree

12:29 technomancy: namespace dependencies or library dependencies?

12:30 mprentice: technomancy: it's a type hierarchy for a knowledge rep system

12:30 technomancy: but i need to be able to define type A before type B, and B before C and D

12:30 technomancy: i get the types in an unordered XML file where each type points to its supertype

12:31 ieure: Does anyone know if Stu’s reflection patch ever made it into Clojure? http://clojure02.managed.contegix.com/display/design/Reflection+API

12:31 mprentice: technomancy: but that's not really relevant to my algorithmy question :P

12:31 ieure: I’m looking for a more pleasant way of inspecting Java objects.

12:32 mprentice: technomancy: leiningen is awesome!

12:32 technomancy: great! =)

12:34 mprentice: i'm looking for an algorithm that does said dependency ordering

12:34 or failing that, wondering if a zipper is a good way to create the tree, where for each node i edit the tree to add the subtypes to the node and remove those subtypes from the list, then continue with the child types, etc

12:37 dnolen_: mprentice: Clojure has code for managing hierarchies.

12:38 mprentice: derive, ancestors, descendants, make-hierarchy

12:38 isa? as well

12:39 fliebel: dnolen_: Wow, I mean, yea... I knew these existed, and even wondered why they take an optional hierarchy, but it never occurred to me to use it like that. Cool!

12:40 ieure: So, anyone? Handy Clojure wrapper around Java reflection API?

12:40 kephale: what is the proper way of changing a variable in an external namespace from within a function?

12:40 dnolen_: fliebel: yeah, Clojure's emphasis on a la carte is a lovely thing.

12:41 mprentice: dnolen_: thanks. that looks promising.

12:41 technomancy: kephale: clojure doesn't have variables

12:44 kephale: technomancy: a var that has been defined via def

12:45 technomancy: kephale: you shouldn't be changing those at runtime. look into the reference types (atom/agent/ref) instead

12:45 kephale: technomancy: however, that code is out of my jurisdiction

12:46 technomancy: you can use binding to give it a new thread-local value

12:48 kephale: aha… nice purist response ; P

12:48 nickik: what are the pro and cons between clojure-json and data.json

12:50 dnolen_: https://github.com/mmcgrana/clj-json sounds like it's the fastest.

12:54 * void_ I don't want to post noob questions, but I'm stuck here: Could not locate clojure/contrib__init.class or clojure/contrib.clj

12:54 void_: this is what I do:

12:54 (ns sib-clj.core

12:54 (:use [clojure.contrib]))

12:54 and in my project.clj

12:54 :dependencies [[org.clojure/clojure "1.2.1"]

12:54 [org.clojure/clojure-contrib "1.2.0"]]

12:55 mrBliss`: void_: the (:use [clojure.contrib]) clause is wrong in two ways

12:56 drop the []

12:56 void_: mrBliss`: still same error

12:56 mrBliss`: and you have to :use something in clojure.contrib like core or def

12:57 for example (:use clojure.contrib.core)

12:57 void_: oh ok

12:57 'core' is a namespace right?

12:57 mrBliss`: clojure.contrib.core is

12:58 scgilardi: yes, the target of :use must be a namespace. (and the [] around it is optional, including it allows you to specify more options within the [])

12:58 void_: so 'clojure.contrib' is not a namespace I understand

13:01 mrBliss`: void_: namespace segments (like "clojure", "contrib" and "core") map to files or directories. In this case clojure.contrib points to a directory (clojure/contrib). Only files (like clojure/contrib/core.clj) can contain definitions and can be ':use'd.

13:02 void_: thanks man

13:02 mrBliss`: you're welcome

13:02 void_: gotta go, bbl ;)

13:14 Kratoss`: I wonder if clojure will be able to collapse sequence allocations

13:19 dnolen_: Kratoss`: ?

13:19 Kratoss`: like if I do (filter (map

13:20 I clearly don't need all those allocations of seqence objects that map does

13:22 also why does clojure.core.map-indexed only take 1 sequence, not multiple like map?

13:24 dnolen_: Kratoss`: filter and map are lazy, not sure what you're getting at.

13:25 Kratoss`: well when filter tries to generate next element it consumes seq returned by map

13:26 each time it goes to next element a new sequence object is created

13:26 purpose (I guess) being that you can pass them around without any effect on the sequences already in use

13:27 dnolen_: Kratoss`: big plus

13:27 Kratoss`: all these new sequence objects are unneeded in this case as they get discarded

13:27 generates tons of constructor calls

13:27 allocations

13:27 just asking if there's some kind of compiler optimization in the works

13:28 dnolen_: Kratoss`: if you really care about allocations, arrays can't be beat.

13:28 Kratoss`: seems like an optimization with little benefit.

13:28 cemerick: Kratoss`: this is why we're all very thankful for the absurdly efficient GC in modern hotspot, etc.

13:29 Kratoss`: using (iterate inc 1) is twice as slow as loop recur on a counter

13:29 well I made a small library for java

13:29 microF, which allows using things like map, filter etc with object that implement the right interace...

13:30 they all return Iterable, and when you call next, these calls are chained... but no allocations of new sequences are done, of course these are mutable and can't be passed around

13:31 (well can be passed around if you know you mustn't change them)

13:31 in any case that's the kind of optimization I had in mind

13:31 but ok

13:31 what about the second thing?

13:31 why doesn't map-indexed support multiple collections?

13:32 seems like a reasonable feature

13:34 mprentice: dnolen_: derive &c are perfect. thanks!

13:36 fliebel: dnolen_: Why does tabling keep state across multiple runs? I'm okay with whatever storage complexity it has, but this counts as a memory leak in some cases, imo.

13:36 halfprogrammer: Why is (apply or '(true false true)) throwing an exception

13:36 cemerick: Kratoss`: it could, but you can trivially implement that on top of map-indexed if you care to do so.

13:36 amalloy: ieure: clojure.contrib.repl-utils/show

13:37 halfprogrammer: says "can't take value of a macro: #'clojure.core/or"

13:37 cemerick: halfprogrammer: because or is a macro, not a function

13:37 amalloy: halfprogrammer: or isn't a function

13:37 dnolen_: mprentice: cool!

13:37 Kratoss`: oversight?

13:38 fliebel: because I haven't gotten around to thinking of a good solution to that problem.

13:38 halfprogrammer: How can I find out if there is at least one true value?

13:38 ...in a list

13:38 cemerick: ,(some identity '[true false true]) ; halfprogrammer <<

13:38 clojurebot: true

13:39 dnolen_: fliebel: def'ed memoized fns have the same issue.

13:39 fliebel: if you got some ideas, I'm all ears, it's something I want to fix.

13:40 halfprogrammer: cemerick: thanks!

13:40 fliebel: dnolen_: I see. I have no idea how tabling works, but I imagine you could.. no, you couldn't use binding because run is lazy.

13:40 dnolen_: fliebel: I have strict variants of run (useful for debugging)

13:41 fliebel: dnolen_: Whee do you keep the state of a tabled goal?

13:41 dnolen_: fliebel: you don't need to know how tabling works, conceptually it's identical to memoized fns, I create a closure over an atom to store results.

13:42 bhenry: say i have a ns called project.version. if a function within it called (get-version) parses the project.clj and gets the version then i (def version (get-version)) can i have the version var available in my project with AOT compilation?

13:42 dnolen_: fliebel: laziness of run is not essential for many goals, laziness in core.logic is almost entirely about preventing stack overflow

13:43 in fact I'm almost convinced that run should default to strict, and run lazy should be be the variant

13:43 bhenry: *in my project jar

13:45 fliebel: dnolen_: In any case, the best trick would be to position the closure/binding in such a way that it goes out of scope when the goal is done.

13:46 Kratoss`: thanks, but I'd rather see clojure.core version updated in the next release

13:47 dnolen_: fliebel: ok so I have an idea, feel free to open a ticket :)

13:48 fliebel: dnolen_: erm, okay. Talking about tickets, what became of my rel ticket?

13:48 dnolen_: fliebel: still thinking about it, also haven't seen a good solution yet.

13:49 fliebel: dnolen_: okay.

13:49 void_: so what would be the easiest way to create a vector of letters from a string?

13:49 amalloy: &(seq "test")

13:50 sexpbot: ⟹ (\t \e \s \t)

13:50 dnolen_: ,(vec "foo")

13:50 clojurebot: [\f \o \o]

13:51 bhenry: dnolen_ ftw

13:52 dnolen_: Kratoss`: people push for the fixes they want to see, I'd send in yr CA, get on the dev list, submit patch

13:54 Kratoss`: yr CA?

13:55 void_: ,(seq "hmm")

13:55 ,(vec "hmm")

13:55 clojurebot doesn't like me

13:55 &(seq "hmm")

13:55 what

13:55 do I stink?

13:55 ,(vec "foo")

13:55 seriously

13:55 sexpbot: ⟹ (\h \m \m)

13:55 clojurebot: (\h \m \m)

13:55 [\h \m \m]

13:55 bhenry: Kratoss`: contributors agreement i believe

13:55 dnolen_: Kratoss`: Contributor Agreement http://clojure.org/contributing

13:55 amalloy: void_: given the mess of messages you sent all at once, i'm guessing your connection stinks

13:56 dnolen_: fliebel: what do you think about lazy-run as a name for the lazy run variant?

13:56 amalloy: clojurebot: ca?

13:56 clojurebot: CA is Contributor Agreement: http://clojure.org/contributing

13:56 fliebel: dnolen_: slouch seems more appropriate :P

13:57 dnolen_: But, sure, fine.

13:57 dnolen_: fliebel: heh

13:57 bhenry: fliebel: dnolen_ "jog"

13:57 : P

13:57 amalloy: saunter

13:57 * fliebel made a terrible spelling mistake, public and uneditable.

13:58 amalloy: fliebel: whenever i do that i just hack the internet to bring it all down before the packet makes it to anyone else's computer

13:59 void_: dnolen_: yeah that's the case ... sorry for the flood

13:59 fliebel: amalloy: Oh, so... you live in china? That explains a lot.

14:00 amalloy: don't tell google

14:00 fliebel: amalloy: Google does not index the logs of this channel, apparently, because we still don't rank for ad hoc, informally -specified, bug-ridden, slow implementation of half of whatever.

14:01 amalloy: fliebel: i don't think there are any links to specific dates

14:01 fliebel: ~logs

14:01 clojurebot: logs is http://clojure-log.n01se.net/

14:01 fliebel: http://clojure-log.n01se.net/date/2011-06-07.html

14:02 amalloy: well. the googlebot will get tired of clicking Previous long before it gets even a month in the past

14:02 fliebel: amalloy: only 2 clicks away: http://clojure-log.n01se.net/date/

14:03 Maybe I'll start linking to logs that contain ad hoc, informally -specified, bug-ridden, slow implementation of half of whatever on my blog for extra exposure.

14:03 amalloy: hm

14:03 fliebel: please stop making me wrong

14:04 fliebel: okay... tell your ego I like the word sounter ;)

14:04 -.- saunter

14:08 lawfulfalafel: does anyone know where I could find a good tutorial on clojure data structures?

14:08 amalloy: wow, you learn something new every day. i had no idea about ##(doc when-first)

14:08 sexpbot: ⟹ "Macro ([bindings & body]); bindings => x xs Same as (when (seq xs) (let [x (first xs)] body))"

14:09 lawfulfalafel: http://en.wikibooks.org/wiki/Learning_Clojure/Data_Structures seems incomplete, I can't find anything on lists

14:10 * technomancy recommends against treating wikibooks.org as an authoritative source

14:11 technomancy: I get the impression it's mostly neglected

14:11 bhenry: lawfulfalafel: http://clojure.org/data_structures

14:12 it's not a tutorial, but it's good

14:12 and complete

14:13 amalloy: yeah i haven't found anything worthwhile on wikibooks

14:15 gfrlog: amalloy: I propose collaborative book-writing github style. Then professors could have their personal forks and thus more control.

14:16 manutter: gitbooki?

14:16 gfrlog: sure

14:17 the grad students could do all the work and we'd finally have free high-quality textbooks

14:17 ...maybe :)

14:23 amalloy: manutter: gittybook

14:23 lawfulfalafel: I have a list of numbers that I am generating and trying to save, should I use a list or a hash-set?

14:24 gfrlog: lawfulfalafel: do you need order preserved? duplicates?

14:24 amalloy: lawfulfalafel: not enough information to solve the problem?

14:24 lawfulfalafel: I do not need order preserved

14:25 I am assuming I should a mutable structure like the hash-set; is that logic correct?

14:25 use*

14:25 gfrlog: hash-sets are not mutable

14:25 amalloy: nothing is mutable

14:26 manutter: odds are it would be possible to get your number generator to return a lazy seq, so it will already be in a usable format for you

14:27 void_: what's the difference between defn- and defn ?

14:27 clojurebot: Gabh mo leithscéal?

14:28 fliebel: &(repeatedly #(rand-int 10))

14:28 sexpbot: Execution Timed Out!

14:28 fliebel: void_: defn- is private

14:28 ieure: "Where are the mutable data structures?" "They’re immutable, Dave." "Who is?" "All of them, Dave." "What, hash-maps?" "Everything’s immutable, Dave."

14:28 "They’re all immutable. Everything’s immutable, Dave."

14:28 amalloy: ieure: wow, i was thinking of the wrong dave there for a bit

14:29 2001, not lister

14:29 ieure: "What, vectors?" "They’re immutable, Dave, everything’s immutable, everything is immutable Dave."

14:30 lawfulfalafel: could anyone reccommend a good example of using lazy-seq?

14:30 manutter: I just got an idea for a whole new clojure tutorial... :)

14:30 lawfulfalafel: I can find stuff on google, but I have trouble telling what advice is outdated

14:30 or should I not worry about that?

14:30 amalloy: lawfulfalafel: "everything" uses lazy-seq. do you mean using the raw form of lazy-seq, or just any lazy sequence?

14:31 manutter: lawfulfalafel: lazy-seq hasn't changed much

14:31 lawfulfalafel: uh, I was jus trying to follow manutter's advice

14:31 manutter: I suggested he look into writing his number generator as a lazy seq

14:31 amalloy: in that case, ##(take 4 (repeatedly #(rand-int 1000)))

14:31 sexpbot: ⟹ (279 176 94 628)

14:32 amalloy: uses two lazy seqs already!

14:32 manutter: yeah, a bunch of built-ins already return lazy seqs

14:32 lawfulfalafel: I guess I don't really understand

14:32 manutter: tell us how you're generating your numbers

14:32 we can show you how to turn it into a sequence you can use

14:33 lawfulfalafel: (dotimes [i 1000] (run-my-func i))

14:34 manutter: Ah, an easy one :)

14:34 lawfulfalafel: and then run-my-func will add the number to an existing list if the number is divisible by 3 or 5

14:34 manutter: (map run-my-func (range i 1001))

14:35 fliebel: lawfulfalafel: what, side effects?

14:35 manutter: The map function already returns a lazy seq (and so does range iirc)

14:35 void_: so here's something I don't understand at all: when you use a symbol, like foo, and it's not defined, you get an exception. But you can use (binding [foo bar]) ... How come it doesn't throw an exception when it's used inside binding?

14:36 I mean, foo is undefined when you use it inside that vector.

14:37 manutter: lawfulfalafel: sounds like you're working on one of the Project Euler problems :)

14:37 lawfulfalafel: yep, stuck on the first one :P

14:39 technomancy: void_: regular evaluation rules don't apply within macro calls

14:40 manutter: ,(doc filter)

14:40 clojurebot: "([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns true. pred must be free of side-effects."

14:40 void_: thanks technomancy

14:41 raek: lawfulfalafel: your 'run-my-func' does two things: calculate a number and add it to a collection. in Clojure you generally separate these two.

14:41 lawfulfalafel: and in most cases, you don't need the second step at all

14:41 simply let the code that calls the function put it into the right place

14:42 lawfulfalafel: raek: cool, I didn't know that

14:42 raek: to just get the numbers, you can use (for [i (range 1000)] (my-side-effect-free-func i))

14:43 or in this case, since the for body is so small: (map my-side-effect-free-func (range 1000))

14:44 manutter: however in this *specific* case I recommend you look at the docs for the filter function

14:44 Map will give you 1 result for each number in the input range

14:45 Filter lets you look at each number and decide whether or not to keep it

14:45 raek: also, with "add it to a collection" I meant destructive updates (which are unideomatic in Clojure for code that just does calculations)

14:45 lawfulfalafel: okay, well I have this function: (defn by3or5 [number] (or (= 0 (mod number 3)) (= 0 (mod number 5))))

14:46 and it returns "true" when number satisifies it, but how do I make it return the number instead?

14:46 manutter: ,(doc filter)

14:46 clojurebot: "([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns true. pred must be free of side-effects."

14:46 lawfulfalafel: or should I use filter and then add an if statement

14:46 manutter: The "pred" argument in filter stands for "predicate", i.e. a function that returns true or false

14:46 raek: lawfulfalafel: (filter by3or5 (range 100))

14:47 manutter: ,(filter odd? (range 1 10))

14:47 clojurebot: (1 3 5 7 9)

14:47 lawfulfalafel: so if filter does that, when would I want to use map?

14:48 amalloy: when you…don't want to remove things

14:48 bhenry: lawfulfalafel: when you want to call a function on everything in a collection

14:48 manutter: ,(map inc (range 1 10))

14:48 clojurebot: (2 3 4 5 6 7 8 9 10)

14:49 lawfulfalafel: so filter is really just a special version of map?

14:49 amalloy: no

14:49 manutter: Filter turns long seqs into shorter ones

14:49 amalloy: filter calls a function to decide which things in a map to throw away

14:49 manutter: map returns a seq that's the same size

14:49 amalloy: *in a sequence

14:49 map calls a function to generate a new element corresponding to each element in the input seq

14:51 lawfulfalafel: okay, I think i get it now. Thank you!

14:52 ieure: Ugh. Is there some way to increase my Java heap space in my lein-swank process?

14:52 For whatever reason, slurping a 7mb file is OOMing it.

14:53 raek: map takes function that takes an apple and returns a blueberry, and a sequence of apples, and returns a sequence of blueberries :-)

14:53 lawfulfalafel: also, one quick question, is there a way to clear the state of the cake repl?

14:53 besides just closing/opening it again?

14:53 amalloy: kill −9, baby

14:53 (don't do that)

14:53 raek: lawfulfalafel: you want to remove old defs and defns?

14:53 lawfulfalafel: raek: yup

14:55 bhenry: (ns-unmap 'namespace 'var)

14:55 lawfulfalafel: ^^^

14:55 raek: lawfulfalafel: (remove-ns 'user) (ns user)

15:05 bhenry: can i AOT compile a namespace that parses the version out of project.clj and have a var available with that string in my uberjar?

15:07 technomancy: bhenry: allowing unquoting of the version won't be possible until lein 1.6

15:07 everything else in defproject can be eval'd using ~

15:08 you could AOT a namespace that requires based on version at runtime using (System/getProperty "myproject.verison") in the mean time

15:09 raek: bhenry: do you want the code in the namespace to open the project.clj file and store the version of your project in a var?

15:09 bhenry: i just need the version string to be available in my uberjar

15:09 raek: so that it is available as a constant?

15:09 bhenry: as a var named version

15:09 or whatever

15:09 yes as a constant

15:10 raek: I don't see why it shouldn't be possible

15:10 as long as you can find a reliable way of extracting the version from the project.clj

15:13 but I'm uncertain whether the static initializer that is responsible for making (def x (foo)) "happen" does this by storing the result of (foo) at compile time or by calling (foo) at runtime

15:13 technomancy: yeah, just AOT an ns that includes (def version (System/getProperty "myproj.version)) and you should be good

15:14 bhenry: technomancy: that sounds good i will try it out

15:14 technomancy: misunderstood your original question

15:15 raek: technomancy: what code is responsible for setting the "myproj.version" value?

15:17 technomancy: raek: it's set in leiningen.compile/eval-in-project

15:29 bhenry: technomancy: weird. running from the standalone jar the aot compiled version ns gives me version as a blank string

15:30 (ns floyd.version)

15:30 (def version (System/getProperty "floyd.version"))

15:30 technomancy: can you confirm the AOT version is being loaded?

15:30 bhenry: how would i do that. it compiled it during the lein uberjar

15:30 but that's as far as i know it went

15:31 technomancy: maybe javap on the corresponding .class file to see if it's got the right value?

15:32 hiredman: no no

15:32 you need a macro that emits the string value of (System/getProperty ...)

15:34 technomancy: wait a minute

15:35 just load META-INF/maven/myproj/myproj/pom.properties

15:36 bhenry: i don't know what you mean.

15:37 technomancy: there's a file in the uberjar that includes the project version

15:38 hiredman: bhenry: I think technomancy is thinking that if you AOT the file, the value of the system property from compile time will be used in the def, which is incorrect

15:38 technomancy: what I mean is aot is a red herring; it's simpler just to use the properties file

15:41 bhenry: i guess i'm not familiar enough to be able to get this properties file from the jar

15:42 amalloy: $google java resourceAsStream

15:42 sexpbot: First out of 343 results is: ClassLoader.getResourceAsStream

15:42 http://www.velocityreviews.com/forums/t128421-classloader-getresourceasstream.html

15:43 amalloy: that link is not at all canonical, but might be useful

15:44 technomancy: (into {} (doto (java.util.Properties.) (.load (.openStream "META-INF/maven/myproj/myproj/pom.properties"))))

15:49 Kratoss`: what about classloader.getResource?

15:50 sorry... getResourceAsStream

15:50 raek: or clojure.java.io/resource

15:59 cemerick: Jeez, LMGTFU responses via twitter are extraordinarily irritating.

16:00 Kratoss`: LMGTFU?

16:00 amalloy: $lmgtfy lmgtfu

16:00 sexpbot: http://www.lmgtfy.com/?q=lmgtfu

16:00 Kratoss`: oh yes

16:00 who uses twitter anyway :PPPPP

16:01 cemerick: amalloy: bravo ;-)

16:01 amalloy: cemerick: learn by doing, that's my motto

16:08 TimMc: $lmgtfy does amalloy # remember to & check for = special chars?

16:08 sexpbot: http://www.lmgtfy.com/?q=does+amalloy+#+remember+to+&+check+for+=+special+chars?

16:08 clojurebot: make a note of http://scienceblogs.com/goodmath/2006/11/the_c_is_efficient_language_fa.php it is yet another article about picking c or c++ for performance being naive

16:11 Raynes: TimMc: That one is actually my doing.

16:11 amalloy: most of them are

16:11 Raynes: TimMc: I've known about that bug for a year, but haven't bothered fixing it.

16:11 kephale1: clojurebot: tragically the source article is from greythumb which has more or less ceased to exist

16:11 clojurebot: Ik begrijp

16:11 kephale1: clojurebot: me too, but on tuesdays

16:11 clojurebot: Huh?

16:28 bhenry: technomancy: turns out this doesn't even require aot compilation https://gist.github.com/14a8e9676ad1f090cfea

16:29 hiredman: bhenry: it does, infact

16:29 seancorfield: Q about resolve and classpaths...

16:29 bhenry: well then it's being done automatically somewhere, because it works off the jar

16:30 hiredman: other wise the macro while get re-expanded when you compile again

16:30 will

16:31 seancorfield: if i run a REPL in CCW/Eclipse and do (resolve 'controllers.main/default), it correctly resolves to src/controllers/main.clj:default

16:31 but if i run the REPL via lein at the command line, it gives me nil

16:31 so i'm assuming it's a classpath issue but i'm stuck at figuring out how to solve it :(

16:32 hmm, i guess i could (require 'controllers.main) dynamically first...

16:33 just a bit surprised that is needed for resolve?

16:33 raek: seancorfield: resolve returns the var named by the symbol. if the namespace has not been loaded, the var does not exist yet.

16:34 seancorfield: ah, so CCW is auto-loading the ns?

16:39 pjstadig: there has been discussion before about whether referencing a symbol should auto load it

16:41 it was assembla 461

16:41 not sure if it got moved to jira or not

16:43 hiredman: seems like it would make an ugly (uglier?) mess of the compiler

16:43 pjstadig: http://dev.clojure.org/jira/browse/CLJ-461

16:44 dnolen_: hiredman: what? compiler and ugly mess aren't synonyms?

16:44 pjstadig: it's analagous to the way java classes are autoloaded if you fully qualify a class name

16:44 hiredman: and depending how you did it (where you emitted the byte code to the load the required namespace) you could get very surprising behaviour

16:44 dnolen_: pjstadig: I think stuartsierra has a good point on that ticket.

16:45 hiredman: I think it would be fine, if you made some changes to clojure's namespace system

16:46 pjstadig: http://groups.google.com/group/clojure-dev/browse_frm/thread/69823ce63dd94a0c

16:46 hiredman: pjstadig: sure, but the current implementation of namespaces and the compiler's support of namespaces doesn't seem like it would play nicely with it

16:46 pjstadig: ok

16:47 i'm just giving historical context to the discussion, i'm not sure where i fall on it anymore

16:47 hiredman: I am not opposed to changing them to play nice, just more work than you would expect

16:47 and noone likes working on the compiler

16:47 pjstadig: i know technomancy has to do some tricks to work around the Gilardi Scenario

16:48 there were quite a few +1's in that thread...

16:53 devn: git rm --cached confienvs/c

16:53 gst

16:54 git reset HEAD confienvironments/config/environments/cucumber.rb

16:54 gst

16:54 cp confienvironscucu../

16:54 technomancy: fatal: Not a git repository (or any of the parent directories): .git

16:54 devn: git rm --cached confienvs/c

16:54 ls config/environs

16:55 gst

16:55 git add .giti

16:56 git commit -m "Updating gitignore"

16:57 gst

16:57 gem --version

16:57 seancorfield: raek: added (require 'controllers.main) to my app and it works fine now (i even have it running on heroku)

16:58 devn: cucumber

16:59 pjstadig: cucumber: command not found

17:00 devn: gst

17:00 git add .rvmr

17:00 ee .rvmr

17:00 c

17:00 git add .rvmr

17:01 git commit -m "Removing .rvmrc from gitignore"

17:01 gst

17:01 git add ..git

17:01 git commit -amend

17:01 git commit --amend

17:01 gst

17:01 git add db/sch

17:02 b rake db:migrate

17:02 hiredman: devn: cut it out

17:02 devn: gst

17:03 git commit -m "Checking in db/schema.rbC

17:03 gst

17:03 dakrone: now we're live-coding with devn!

17:03 devn: rm reru

17:03 ls

17:03 TimMc: *Someone* had better not have put any passwords in their command lines recently!

17:06 (I can just barely believe devn accidentally pasted the contents of .bash_history or whatever on a thrashing computer.)

17:07 devn: gst

17:08 b rake spec

17:08 technomancy: ops?

17:09 TimMc: $kick devn

17:09 sexpbot: TimMc: It is not the case that you don't not unhave insufficient privileges to do this.

17:09 TimMc: :-D

17:09 devn: sorry guys.

17:10 :X

17:10 TimMc: Well, do tell.

17:10 devn: No idea how that happened.

17:10 TimMc: Were you bit by a radioactive terminal multiplexer?

17:27 offby1: I always blame my cat

17:41 dakrone: http://i.imgur.com/ekWpn.png

17:42 * technomancy golf claps

17:42 TimMc: nice

18:21 devn: technomancy: haha i like your reply "not a git repository"

18:21 * devn puts on his clown shoes for the day

18:21 technomancy: I tell it like it is

18:23 hiredman: like what?

18:27 devn: seancorfield: you're running on heroku?

18:28 seancorfield: devn: yup

18:28 amalloy: technomancy: switched to a new computer, and "fontifying SLIME compilation" is taking forever. how do i turn that off?

18:29 seancorfield: i couldn't resist trying it after i'd seen several ppl tweet about clojure on heroku :)

18:30 and i'm porting my MVC framework FW/1 from CFML to Clojure so I figured it would be a good opportunity to play around with both!

18:30 devn: seancorfield: it's pretty cool eh?

18:31 i was surprised at how easy it was

18:31 seancorfield: i have a p.o.c. working but i'm wrestling with enlive to make it do my bidding... and it's mostly winning the battle unfortunately :(

18:31 * devn nods

18:31 devn: i have to run, but im thinking about padding out the skeleton that is described in the gist someone posted about cedar

18:31 so people have sort of a base set of libs and what not to make a basic brochure site

18:32 anyway im outta here, happy hacking

18:32 seancorfield: i followed that gist to get my first app up on heroku... it's accurate

18:32 laters devn

18:32 any bay area peeps here? (as in san francisco bay area)

18:32 clojure user group meetup tomorrow - on zippers and other such fun

18:33 technomancy: not sure what else is needed outside that gist

18:33 it should be pretty generic

18:34 seancorfield: it seems to be, yup

18:35 kinda cool that it recognizes leiningen and runs that after a git push to get all the dependencies in place

18:35 i guess non-clojure jvm stuff could also be run on heroku now with the right magic to fire it up...?

18:35 technomancy: ISTR people have reported go and erlang

18:36 seancorfield: interesting...

18:47 chojin: hey guys, question: I'm playing around with oauth and I need to save some data between sessions

18:47 namely, a map

18:47 what's a good way of doing this?

18:48 I probably need to chuck it out to a file, but I'm not sure how you write code out to a file

18:48 hiredman: ,(doc spit)

18:48 clojurebot: "([f content & options]); Opposite of slurp. Opens f with writer, writes content, then closes f. Options passed to clojure.java.io/writer."

18:50 chojin: that was my suspicion, thanks for confirming

18:54 best function names every, btw

18:54 spit & slurp

18:54 *ever

19:00 Kratoss``: how do you read it back?

19:01 hiredman: how do you read anything?

19:03 chojin: slurp will read it back in as a string

19:04 Kratoss``: that's what I mean

19:04 chojin: read-string turns that into an expression

19:04 Kratoss``: ,(doc read-string)

19:04 clojurebot: "([s]); Reads one object from the string s"

19:04 Kratoss``: ,(read-string "[1 2 3]")

19:04 clojurebot: [1 2 3]

19:04 Kratoss``: oh ok

20:38 seancorfield: is there any reason why you shouldn't have (set! *warn-on-reflection* true) in every clojure file?

20:39 technomancy: yes

20:39 seancorfield: and that reason would be...? :)

20:40 technomancy: because it would be annoying?

20:40 pdk: i always figured reflection was only a big deal writing applets

20:40 seancorfield: let's assume i don't want any reflection in my code :p

20:40 for performance reasons perhaps

20:41 technomancy: you should remove the reflection that actually causes performance problems

20:41 seancorfield: in other words, don't worry about performance until you have a proven problem... fair comment

20:42 technomancy: also: set it in project.clj instead

20:42 when you are doing profiling

20:42 seancorfield: ah, good to know...

20:44 scottj: technomancy: in sample.project.clj is non-code files the best description for :resources-path? I had to add :dev-resources-path "/usr/lib/jvm/java-6-sun/lib/tools.jar" and I was confused because I thought of a jar like that as code, though maybe the .class files are what's important and that's not code?

20:45 technomancy: pointing dev-resources-path to tools.jar seems odd to me

20:45 the JDK should put tools.jar on the classpath for you

20:45 according to gjahad, you can't mix and match tools.jar from one JDK to another

20:46 scottj: it should, wasn't for me though in ubuntu 10.04 and I found a chatlog in #cake.clj of another person having that problem

20:46 didn't for me with openjdk, sunjdk through apt, or sunjdk from oracle's website

20:46 technomancy: you sure you're not using a bare JRE?

20:48 seancorfield: whoa! putting (set! *warn-on-reflection* true) in project.clj triggers a slew of warnings from lancet, leiningen and so on...

20:48 i expected it to trigger warnings in my own code but it didn't seem to?

20:50 scottj: not entirely, all I know is I had jdk packages installed, if it was still running jre not sure how to change that update-java-alternatives didn't show separate jre/jdk options

20:50 technomancy: seancorfield: :warn-on-reflection true in defproject, rather

20:54 seancorfield: ah, sorry, misunderstood :)

20:56 scottj: + jdk_home and java_home weren't pointed at jre subdirs in jdk folder

20:57 seancorfield: nice technomancy thanx! highlights a lot of reflection warnings in clojure.java.jdbc which i probably ought to fix...

20:59 technomancy: sweet

21:00 gfrlog: lein stopped auto-including clojure contrib?

21:01 technomancy: gfrlog: in new project skeletons, yes

21:01 it's deprecated

21:01 lancepantz: seancorfield: we were talking in the office today bout clojure.java.jdbc

21:01 technomancy: just pull in what you need

21:01 gfrlog: technomancy: I thought contrib wasn't splintering until 1.3

21:02 lancepantz: seancorfield: how do you plan to handle threads inheriting parent bindings in 1.3

21:02 seancorfield: with the jdbc not being thread safe

21:02 technomancy: gfrlog: the split-up contrib libs generally should work with 1.2

21:02 gfrlog: technomancy: okay; thx

21:03 technomancy: it's still there if you need it; just not by default

21:03 gfrlog: right. Now I gotta figure out what the split up libs are...

21:04 technomancy: c.c.except is the only widely-used ns I know of that didn't get promoted.

21:04 fsvo widely-used

21:05 gfrlog: is each namespace now a separate project? how are they named?

21:05 technomancy: it varies

21:05 gfrlog: searching clojars for "combinatorics" yields nothing

21:05 technomancy: I think you still need monolithic-contrib for that one

21:05 gfrlog: oh okay

21:06 thanks

21:06 technomancy: all the promoted ones are listed in http://github.com/clojure

21:06 np

21:06 wow, there are an awful lot of them

21:07 oh, lots of dummy repos with only a readme though

21:07 heh: https://github.com/clojure/io.incubator

21:07 seriously?

21:07 seancorfield: lancepantz: i'd like input on that issue :)

21:08 hiredman: reminds me I need to TODO up a response for this http://dev.clojure.org/display/design/Contrib+Library+Names?focusedCommentId=2097200#comment-2097200

21:10 seancorfield: lancepantz: can you open JIRA tickets for specific use cases / problems that need to be addressed about the bindings issue? - or is it more systemic?

21:10 technomancy: hiredman: yeah, a whole repo for a single function strikes me as very process-happy

21:11 hiredman: just a tad

21:12 (and maven repos, omg)

21:12 er

21:12 maven projects

21:12 gfrlog: clojure is so powerful that a whole repo has been condensed into a single function

21:21 lancepantz: seancorfield: it's systemic, but i can come up with an example snippet if you like, are you using the clojure dev jira i assume?

21:22 seancorfield: lancepantz: yes, thanx!

21:23 i'm having a hard time visualizing the problem so an example will be very helpful

21:23 as i'm working with c.j.j more, i'm finding several problems with the API because it doesn't allow much manipulation of how things work under the hood

21:24 lancepantz: seancorfield: basically *connection* or whatever it is is going to be shared across multiple threads now

21:24 but jdbc isn't thread safe

21:24 seancorfield: for example, i'd like to be able to apply a function to the PreparedStatement during any SQL operation

21:25 ah, so the connection would really need to be passed in directly rather than relying on binding? ooh, that would be a big change...

21:25 lancepantz: exactly

21:25 atleast, thats one possible solution

21:26 but hopefully we can come up with something more elegant

21:26 seancorfield: that would also affect the naming strategy stuff i added too then...

21:26 hmm, well, maybe not... i guess it only rebinds per thread and its immutable

21:26 so it's really just *connection* or *db* or whatever?

21:29 lancepantz: yeah

22:06 gfrlog: man I just got bit by ##(< 2)

22:06 sexpbot: ⟹ true

22:40 dnolen: hmm how do you redef fn in clojure w/ binding?

22:40 in 1.2.0, I know about with-redefs in 1.3.0

23:08 dakrone: dnolen: alter-var-root

23:09 dnolen: dakrone: I'm realizing I don't want to do that, will be visible in other threads ...

23:09 dakrone: 'binding' will work then

23:10 ,(binding [map (fn [& _] (println :foo))] (map identity [1 2 3]))

23:10 clojurebot: :foo

23:11 dnolen: dakrone: not for fns in other fns.

23:12 dakrone: yea, it will work for fns that call fns that you mock, it should be thread-local rebinding

23:12 unless I misunderstand what you are trying to do

23:12 dnolen: dakrone: doesn't work in 1.2.0 or 1.3.0 as far as I can tell.

23:13 dakrone: I must be misunderstanding then, can you post what you're trying to do?

23:14 dnolen: dakrone: oh it does work in 1.2.0, but oddly not for fns like +, because those are inlined duh.

23:14 dakrone: oh, yea

23:20 dnolen: i wonder if it has problem w/ recursive definitions as well ...

23:22 it does

23:23 because lexical shadowing

23:26 justinko: can anyone explain why clojure code needs less tests than OOP languages?

23:27 because there is less state and more immutability?

23:29 dnolen: justinko: seems like a weird claim to me and trying to write unit tests for subtle concurrency bugs seems futile anyhow.

23:30 justinko: I've heard many times that functional languages need less tests

23:33 I don't see what concurrency has to do with my question

23:33 anyway, I'm sure I'll find out myself

23:37 scottj: ha, under rationale for fenrir: "To be honest, I don't have a good reason for creating Fenrir."

23:44 jtszzzzz: I have a macro question for anyone wise nice person. In my macro, I have the need resolve and deref a symbol from marco input to help build the output.

23:45 For instance, I need to get the count of a list of records so that I know how many gensyms to create for the output form.

23:46 Is it considered bad practice to be evaluating the forms passed into the macro as opposed to just changing the structure?

23:47 dnolen: jtszzzzz: (var-get (resolve symbol)), will give you the value.

23:48 jtszzzzz: its certainly necessary for some things. any reason your macro can't be an fn? are you def'ing something top level w/ this macro?

23:51 jtszzzzz: I have tried to do this what a func but i can't wrap my head around how. It really seems like a macro case. As far as the resolve goes.. I think I need to do a symbol? check before doing the resolve bit first because it could also be the case that my required value is passed in value a list. This is making me not like this :(

23:53 dnolen: what aspect of macros is required to solve the problem?

23:55 jtszzzzz: let me past an example.. on a gist

Logging service provided by n01se.net