#clojure log - May 29 2012

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

0:00 jblomo: so i substituted partition

0:00 (defn pfn [afn arange awindow](into [] (flatten (pmap #(map afn %) (partition awindow (range 1 arange) )))))

0:00 #'user/pfn

0:00 user=> (let [_ (time (pfn inc 20000 100))] (println "done"))

0:00 "Elapsed time: 110.872863 msecs"

0:00 you're measuring a lot of things there

0:00 into will do a reduce over the sequence and build up a new datastructure

0:01 johnmn3: and without par: (defn non-pfn [afn arange awindow](into [] (flatten (map #(map afn %) (chunkify (range 1 arange) awindow)))))

0:01 jblomo: what is your end goal?

0:02 johnmn3: to test pmap

0:02 jblomo: to see when it is faster than map?

0:02 johnmn3: do you get better results from pmap with larger chunk sizes?

0:02 yea

0:03 emezeske: johnmn3: The pastebin typically used in here is refheap.com

0:03 jblomo: i don't think you're going to see a big different with inc

0:04 johnmn3: jblomo: I had that guess, but I'm not understanding why 8 threads each inc'ing chunks in parallel won't get things done any faster.

0:04 emezeske: johnmn3: Overhead?

0:04 johnmn3: for sufficiently long running chunks

0:04 jblomo: they are not sufficiently long running

0:05 johnmn3: well, if it takes 5 seconds to inc a chunk

0:05 where's the overhead in inc'ing two chunks?

0:05 why should it be 10 seconds?

0:05 5 seconds of overhead?

0:07 jblomo: https://github.com/jblomo/clojure/blob/pmap-chunking-862/test/clojure/test_clojure/parallel.clj

0:07 johnmn3: or with 8 chunks, should that really take 40 seconds on an 8 core machine?

0:07 emezeske: I ran two expressions on my machine

0:07 (do (time (let [r 20000 w 1000] (pmap #(map inc %) (partition w (range 1 r))))) nil)

0:08 "Elapsed time: 1.091082 msecs"

0:08 (do (time (let [r 20000 w 1] (pmap #(map inc %) (partition w (range 1 r))))) nil)

0:08 "Elapsed time: 0.246553 msecs"

0:09 jblomo: so with a function that takes 50 msec to run, you can see the difference in completion time

0:10 emezeske: Oh, I am not realizing the seqs

0:10 There we go

0:11 johnmn3: Vast speedups with large windows on my machine: https://www.refheap.com/paste/2904

0:13 johnmn3: try w 10

0:13 also, try it without pmap

0:16 emezeske: yea, you'll notice that map doesn't doo much difference

0:16 *do

0:20 emezeske: I assume that the lazy sequences are not being fully realized

0:20 johnmn3: even very large r and w: (do (time (let [r 8000000 w 1000000] (doall (map #(map inc %) (partition w (range r)))))) nil)

0:21 '(do (time (let [r 8000000 w 1000000] (doall (map #(map inc %) (partition w (range r)))))) nil)

0:21 ,(do (time (let [r 8000000 w 1000000] (doall (map #(map inc %) (partition w (range r)))))) nil)

0:21 emezeske: I shouldn't even be talking about pmap, I'm no expert.

0:21 * emezeske leaves.

0:21 clojurebot: Execution Timed Out

0:21 johnmn3: ,(do (time (let [r 800000 w 100000] (doall (map #(map inc %) (partition w (range r)))))) nil)

0:22 clojurebot: Execution Timed Out

0:22 johnmn3: ,(do (time (let [r 80000 w 10000] (doall (map #(map inc %) (partition w (range r)))))) nil)

0:22 clojurebot: "Elapsed time: 185.699 msecs"

0:22 johnmn3: ,(do (time (let [r 80000 w 10000] (doall (map #(pmap inc %) (partition w (range r)))))) nil)

0:22 clojurebot: "Elapsed time: 212.916 msecs"

0:22 johnmn3: ,(do (time (let [r 80000 w 10000] (doall (map #(pmap inc %) (partition w (range r)))))) nil)

0:22 clojurebot: "Elapsed time: 206.695 msecs"

0:23 johnmn3: oh

0:23 clojure is parallelizing map automatically

0:24 ,(java.util.concurrent.ForkJoinPool.)

0:24 clojurebot: #<CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: java.util.concurrent.ForkJoinPool, compiling:(NO_SOURCE_PATH:0)>

0:25 johnmn3: this revs all eight threads on my i7:

0:25 ,(do (time (let [r 80000 w 10000] (doall (map #(map inc %) (partition w (range r)))))) nil)

0:25 clojurebot: "Elapsed time: 204.183 msecs"

1:07 gf3: _ato: Yay

1:07 _ato: hah :)

1:08 gf3: _ato: I suppose that's a "go for it"

1:09 _ato: yeah... just a sec, replying to email. :p

1:11 amalloy: johnmn3: you're timing almost nothing

1:12 johnmn3: well, if it takes 10 seconds

1:12 amalloy: (map #(map inc %) xs) returns a lazy seq of lazy seqs

1:12 doall forces the outer one

1:12 but you never force any of the arithmetic ot happen

1:13 johnmn3: so how do I parallelize inc over a large collection?

1:13 amalloy: well, use fold

1:13 assuming you have reducers available

1:13 johnmn3: with pmap

1:14 would (r/map #(map inc %) xs) constitute a reducer in this case?

1:14 amalloy: wellll

1:15 yes, but by using lazy-seqs for the second level you're not getting nearly as much benefit from reducers

1:15 but why would you map map-inc? if you just have a single collection

1:16 johnmn3: well, its firist a matter of partitioning the collection into chunks

1:16 but I was doing that for pmap

1:16 amalloy: don't partition it for reducers. they do that themselves when folding, if possible

1:17 johnmn3: for my own needs, I need to chunkify, because I need to prepend and append values to the coll prior to processing and reassembling

1:17 amalloy: but also if your input is a lazy-seq, rather than something foldable, r/map won't fold

1:17 johnmn3: oh

1:18 isn't [1 2 3 4] a lazy-seq?

1:19 but I see what you're saying about not partitioning for reducers

1:20 _ato: gf3: email sent. So yes indeed, feel free to go for it. You should be able to just git clone clojars, create a database with the sqlite command in the readme and run it with "lein run". :-)

1:21 if you'd like to talk through any of your ideas first, happy to do that too

1:21 gf3: _ato: Woohoo, thanks

1:23 xeqi: gf3, _ato: looks better to me

1:23 I'm all for a facelift

1:24 amalloy: [1 2 3 4] is certainly not lazy. it's a vector

1:24 johnmn3: wait, I think I found the secret sauce

1:25 I was thinking about what you said

1:26 I still need to partition, because of my own needs, but by bringing down the chunk size and jacking up the coll size, r/map is now pulling in large numbers of chunks to process

1:26 and times are getting better

1:27 gf3: xeqi: Awesome, I'll get to work

1:33 johnmn3: mmmaybe not.. benefits are marginal

1:38 amalloy: I don't know.. when I use just map.. rather than pmap or r/map, all 8 of my threads on my quad-core i7 are running at 80%

1:38 could map be doing some parallelization?

1:38 amalloy: no

1:39 johnmn3: ,(do (time (let [r 10000000 w 20] (into [] (map #(map inc %) (range r))))) nil)

1:39 clojurebot: Execution Timed Out

1:40 amalloy: you're still not actually timing anything. the inner sequences never get realized

1:40 johnmn3: on my machine: "Elapsed time: 2785.63046 msecs"

1:40 amalloy: switch it to #(doall (map ...)) if you want to use the same timing

1:40 johnmn3: what's taking 3 seconds then?

1:40 amalloy: just allocating memory for all those lazy sequences

1:42 also you're calling (map inc 0), (map inc 1)... so this should crash as soon as you make my change

1:42 johnmn3: well, for r/map: (doall (into [] (r/map ... ?

1:43 amalloy: no, because dumping it into a vector is already doing all the work

1:43 johnmn3: test=> (do (time (let [r 10000000 w 20] (doall (map #(map inc %) (range r))))) nil) "Elapsed time: 2936.540497 msecs"

1:44 amalloy: no, you need the doall inside the lambda

1:44 johnmn3: oh

1:44 (and I guess w is not being used their)

1:44 amalloy: and then it will break, because you'll *actually* be calling (map inc 1), instead of just telling the computer to get ready for it - you're timing an algorithm that isn't even correct

1:49 johnmn3: so, is there a better way to parallelize inc across a collection?

1:49 amalloy: inc is not expensive. don't parallelize it

1:51 arohner: so I have clojure 1.4 in my project.clj, and clojure 1.3 in my lib directory. mvn dependency:tree lists 1.4. Any ideas where I should look?

1:51 but I do have 1.4 in my lib/dev directory. strange.

2:07 johnmn3: amalloy: I was spending all my time chunkifying

4:01 kilon: anyone knows how to install leiningen in windows 7, the main instructions fail

4:01 $ lein install

4:01 ls: /c/Users/exloupis/leiningen/leininge

4:01 Leiningen is missing its dependencies.

4:01 Please see "Building" in the README.

4:02 michaelr525: looks like you are running it in cygwin?

4:02 isn't it lein self-install?

4:03 kilon: i am running it in git bash

4:03 the official git terminal

4:04 here it says lein install ---> https://github.com/technomancy/leiningen

4:04 lein self-install fails with the same error

4:04 michaelr525: you are reading the building instructions

4:04 kilon: same error when i do just lein

4:05 michaelr525: kilon: read from the top of the page under 'Installation'

4:05 kilon: oh , i missed wget

4:07 michaelr525: i have added leiningen to my paths and install curl inside leiningen, will that be a problem ?

4:07 michaelr525: i think it's ok

4:08 kilon: michaelr525: should i assume wget setup wizards adds it to my paths ?

4:08 michaelr525: i don't know

4:08 kilon: ok thanks for yor help

4:08 michaelr525: you can test it by running wget from the command line

4:09 np

4:09 kilon: no its not :(

4:12 ivan: did you open a new shell?

4:12 (if the installer did indeed change the Path)

4:14 kilon: ivan: yeap opened new shell after i installed wget after i added to my paths, still getting the same error :(

4:15 i am using git bash terminal

4:15 standrad git gui

4:15 ivan: try using the normal cmd and putting wget into the same directory

4:15 kilon: i got also latest jdk installed

4:15 ok

4:16 normal command , reports the same error diffirently

4:16 it still complains that lein is missing its dependencies

4:17 michaelr525: kilon: you should run 'lein self-install'

4:17 not lein install

4:17 kilon: another problem

4:17 for some reason command does not let me cd into the leiningen directory

4:18 michaelr525: i should not need to install in the first place, building is unecessary for 1.x

4:19 i only tried just "lein" in command

4:19 i cannot try lein install or self-install as it does not let me get in the directory

4:19 maybe a git problem i dont know

4:19 I love windoom its so fun :D

4:20 michaelr525: kilon: why don't you just follow the instructions?

4:21 kilon: michaelr525: thats what i did , it does not work

4:21 ivan: why can't you cd into the directory?

4:21 do you know how msys and cmd treat paths differently?

4:22 kilon: michaelr525: i am stupid, it works now

4:22 sorry guys

4:23 michaelr525: oh cool, i'm glad it works for you :)

4:23 kilon: hmm still problems

4:24 it seem self-install worked

4:24 it downloaded a leiningen standalone.jar

4:24 but when i try lein repl, it still complains for missing dependencies

4:27 michaelr525: can you paste it here?

4:27 kilon: i think i know what is wrong

4:28 it create a .lein which i need to add to my paths

4:30 i am confused

4:30 :D

4:31 ok i give up , path adding did not work

4:31 michaelr525: what you want me to paste ? the result of self-install ?

4:32 michaelr525: kilon: I think you should either use Windows or Cygwin, this will make it easier for you.

4:32 kilon: michaelr525: by windows you mean command terminal ?

4:33 michaelr525: cmd.exe

4:33 kilon: i dont use git terminal , just cmd.exe

4:33 michaelr525: ah, ok

4:33 kilon: after your recomendation

4:33 michaelr525: so you are running lein.bat?

4:33 kilon: i got cygwin as well, but it got problems with git so

4:33 yes lein.bat comes with the leiningen repo

4:34 i have added the repo to my path

4:34 it can see the bat that is why it complains for missing deps

4:34 or else it wont run at all

4:35 michaelr525: ^

4:36 michaelr525: what does it print when you run lein.bat?

4:37 kilon: leiningen is missing its dependencies. Please see "Building" in README

4:37 michaelr525: did you clone the whole repository?

4:38 if so I think you are trying to run version 2.0

4:38 maybe you should try version 1.7

4:39 (which is linked from the installation instructions)

4:39 kilon: michaelr525: i dont know what "whole" means i just did "git clone https://github.com/technomancy/leiningen.git"

4:39 i am nooby with git so excuse my ignorance

4:39 ivan: why are you cloning the repo?

4:39 kilon: and lein / clj of course

4:39 ivan: it workes in macos so i assumed it will work in windows as well

4:40 had no issues there installing lein and clojure and even setuping it for emacs with its swank

4:40 do i need to delete everything and just keep the bat ?

4:41 ivan: I have success using just the bat

4:41 kilon: ok

4:41 ivan: and wget

4:41 kilon: trying

4:46 bingo

4:46 it works

4:47 lein repl works

4:47 thanks ivan

4:47 any idea how to exit repl ?

4:48 thanks michaelr525 too of course

4:48 ivan: ctrl-c or ctrl-d

4:48 kilon: ctrl-d work, ctrl-c did not, nice

4:49 KIMAvcrp: ctrl-c ctrl-c does word too

4:49 ivan: on Windows EOF is ctrl-z enter

4:49 kilon: may i ask something ? so its not necessary to clone either clojure or lein repos

4:49 all i need is the lein.bat

4:49 correct ?

4:49 ivan: right

4:49 kilon: ok , my bad, i made my life way more difficult than it needed to be

4:49 :D

5:39 tomoj: why isn't Associative a protocol?

6:44 raek: marmalade is up again!

7:32 kilon: when i try in emacs with clojure-mode installed and lein 2 to do a M-x clojure-jack-in it complains that lein has no such task (jack-in) which is kinda true because lein does not report such a task

7:32 is this a bug in clojure-mode ?

7:33 gfredericks: kilon: you have the swank-clojure plugin installed?

7:33 kilon: good question

7:34 i think i dont

7:34 any idea how to install it with lein 2 ?

7:34 I am confused with the install instructions i am reading

7:34 apparently lein 2 has changed the plugin system

7:35 babilen: kilon: See https://github.com/technomancy/swank-clojure for details.

7:35 kilon: and i must insert the dependency in somewhere in the user profile plugins

7:35 babilen: tried that one, did not work

7:36 one sec to paste the error

7:36 babilen: kilon: You end up with something like "{:user {:plugins [[lein-swank "1.4.4"]]}" in ~/.lein/profiles.clj -- What did you do that "did not work" ?

7:37 kilon: damn

7:37 me being stupid again

7:37 it must go inside {}

7:38 borkdude: kilon you can also just put in in the project.clj instead of profiles.clj

7:39 :plugins [[lein-swank "1.4.4"]] in project.clj

7:39 kilon: ok sec because i am confused

7:39 this is my project.clj

7:39 (defproject test "0.1.0-SNAPSHOT"

7:39 :description "FIXME: write description"

7:39 :url "http://example.com/FIXME"

7:39 :license {:name "Eclipse Public License"

7:39 :url "http://www.eclipse.org/legal/epl-v10.html"

7:39 }

7:39 :dependencies [[org.clojure/clojure "1.3.0"]])

7:40 where will i put {:user {:plugins [[lein-swank "1.4.4"]]} ?

7:40 coventry`: In swank-clojure, when I try to compile a file with C-c C-k, it reports compilation errors without line numbers, just saying "unknown location." Is there a way to fix this?

7:40 borkdude: if you didn't add it to profiles.clj, you can add the line :plugins [[lein-swank "1.4.4"]] after the dependencies

7:40 babilen: borkdude: Why would one want to do that? I think it is not unreasonable to assume that one want to use that plugin in all projects.

7:40 kilon: i tried it that before and did not work borkdude

7:41 borkdude: kilon but then swank will only work for that project, not automatically for all

7:41 kilon: babilen: where should i put it then ?

7:41 borkdude: babilen there are reasons why you would want that, for example the leiningen plugin in eclipse currently doesn't work good with profiles.clj

7:41 kilon: oh sorry

7:41 babilen: borkdude: Ah, ok. I don't use eclipse and are therefore not familiar with its brokenness.

7:41 kilon: you said profile.clj

7:42 babilen: kilon: As I said earlier: In ~/.lein/profiles.clj

7:42 kilon: babilen: i got no such file in my .lein dire

7:43 how i create it ?

7:43 borkdude: kilon creat it using a text editor (emacs??) and put this in it: {:user {:plugins [[lein-swank "1.4.4"]]}

7:44 kilon: ok and profiles.clj will contain only that line ?

7:44 borkdude: kilon you can add more later

7:45 babilen: kilon: A discussion of profiles for leiningen2 can be found in the upgrade guide on https://github.com/technomancy/leiningen/wiki/Upgrading btw

7:45 kilon: still getting the error

7:46 babilen: kilon: Could you paste it to a pastebin (such as http://refheap.com) please?

7:46 kilon: i have created profiles.clj and added that line

7:46 rebooted emacs, M-x clojure-jack-in gives me the error

7:46 one sec to pastebin it

7:47 babilen: kilon: What does "lein2 help" give you when you run it on the command line? Did you install the plugin already?

7:48 kilon: babilen: http://pastebin.com/K5XezsEg

7:48 borkdude: babilen no need to install in lein2

7:48 kilon: i have no lein2

7:48 babilen: kilon: Err -- That assumes that you use lein2 as the script name. Make that "lein" if your "lein" is, in fact, lein2

7:48 borkdude: Yeah, just realised my mistake.

7:48 kilon: my leiningen 2 is just "lein"

7:48 ah ok

7:49 where do i find the error to correct this ?

7:49 borkdude: ah wait… kilon can you try to start a swank server manually in the project?

7:49 kilon so from the project dir type in a cmd prompt: "lein swank"

7:49 babilen: kilon: Did you download/install the plugin already? What does "lein help" give you?

7:50 borkdude: babilen I think clojure-jack-in does not force the deps to be downloaded

7:50 kilon: borkdude: it gives me an error , lein swnk

7:50 borkdude: babilen but just "lein swank" will

7:50 kilon: *lein swank

7:50 borkdude: kilon what error?

7:50 babilen: borkdude: Yeah, that is my suspicion as well. ("lein help" should download it too)

7:50 borkdude: kilon also: what is your leiningen version? (type "lein version")

7:50 kilon: its leiningen 2 borkdude

7:51 i have checked it with lein version

7:51 borkdude: good. so what error does "lein swank" give

7:51 babilen: kilon: Please, may we actually see the output of "lein help", "lein version" and "lein swank" ?

7:51 kilon: oh what the hell

7:51 oh oh

7:51 babilen: Hmm?

7:52 kilon: i think your profiles.clj broke my lein :D

7:52 babilen: kilon: Ok, please run "cat ~/.lein/profiles.clj" and the commands that have been mentioned earlier and show us the output of http://refheap.com

7:53 kilon: one sec guys , this is the error i am getting for any lein command i try

7:54 http://pastebin.com/p0tepmVP

7:54 babilen: cat will work with win 7 command tool ?

7:54 borkdude: kilon no

7:55 kilon "type" will

7:55 kilon cmd prompt>type %USERPROFILE%/.lein/profiles.clj

7:56 kilon: {:user {:plugins [[lein-swank "1.4.4"]]}

7:56 which is what you told me to paste

7:56 babilen: kilon: That should have been "{:user {:plugins [[lein-swank "1.4.4"]]}}" (note the two }} at the end)

7:56 kilon: damn

7:57 another stupid mistake

7:57 i admire your patience :D

7:57 babilen: kilon: Sorry, should have seen that earlier and checked twice.

7:57 borkdude: :-)

7:58 kilon: i suck you apologize, man this community rocks !!!

7:58 babilen: kilon: Is it working now?

7:59 kilon: yes yes YEEEEESSSSS

7:59 trying emacs

7:59 aaaaaaahhhh

7:59 still reports an error

7:59 well typing "lein" did downloaded swang

8:00 hmm

8:00 borkdude: type "%USERPROFILE%/.lein/profiles.clj" was actually the correct cmd, but not needed anymore

8:00 kilon: typing "lein swang" it asks me for a project.clj is that normal ?

8:00 borkdude: kilon can you start lein swank (with a k) IN a project?

8:01 kilon: how i do that

8:01 borkdude: kilon yes, that is normal, because you can only start it from a project

8:01 kilon: you mean from inside emacs ?

8:01 borkdude: kilon make a new project somewhere

8:01 kilon: yes i got already a project

8:01 let me try from emacs

8:02 borkdude: kilon for example: cmd>mkdir \temp, followed by cd \temp, followed by "lein new foo", then cd \temp\foo, then lein swank ;)

8:02 kilon: oh you mean swank from inside my project folder

8:02 WAIT

8:02 WAIT

8:02 emacs WORKS!!!

8:02 borkdude: no!!!!

8:02 kilon: YEAAAAHHHHHH

8:02 borkdude: it works?

8:02 kilon: yeap

8:03 borkdude: YEAHS!

8:03 ;)

8:03 ro_st: well done :)

8:03 kilon: it just needed to load the project.clh

8:03 ro_st: the easy part is over

8:03 kilon: :D

8:03 i am confused

8:03 ro_st: i'm about 3 weeks in, now. i almost never refer to my 5 hand-written keybinding post-it notes, now

8:03 borkdude: kilon you need to start clojure-jack-in from a buffer that is visiting a file in your project

8:03 kilon: should it not the profiles.clj made the whole procedure non dependant on project.clj ?

8:03 borkdude: kilon else it doesn't know which project you want to connect to

8:04 kilon: or am i missing something here ?

8:04 borkdude: kilon if you have the plugin specified in profiles.clj you don't have to specify it in project.clj anymore

8:04 kilon: ok

8:04 but i still need a project.clj , right ?

8:04 babilen: kilon: You can get a clojure REPL by running "lein repl" anywhere, but you need a project if you want to connect to/run a swank server.

8:05 borkdude: kilon yes, for every project

8:05 kilon: babilen: yes i know, i have tried it , but i meant in emacs for slime

8:05 ok project.clj required is no problem for me

8:05 a huge thank you to all of you guys

8:06 ro_st: kilon

8:06 kilon: i habe no idea why it was dead easy for me to do all these things in macos and so difficult on windows :D

8:06 ro_st: check this out: https://github.com/overtone/live-coding-emacs

8:06 babilen: kilon: You mean: How to get a clojure repl (like the nrepl "lein repl" gives you) in emacs?

8:06 kilon: babilen: no i mean how to get a slime repl in emacs

8:06 borkdude: kilon it's not so different in windows and mac osx

8:07 babilen: kilon: Windows might not be an optimal development platform ;)

8:07 kilon: borkdude: its not but i failed because a) failed to read instructions carefully b) i assumed its diffirent

8:07 ro_st: i redid my emacs config with this as a starting point. this, plus: clojure-swank, linum (line numbers, markdown-mode, maxframe (for maximising the window)

8:07 babilen: kilon: I honestly have no idea how to get a slime repl in emacs that is not connected to a project.

8:08 kilon: ro_st: my emacs setup folder contain loads and loads of fancy too including live codie, browsers, colored parentheses and many more

8:08 coventry`: I'm pretty sure C-c C-k is reporting compilation errors without source files/line numbers in my case because of a problem with my project.clj. I just cargo-culted it from noir and made some superficial changes to it. Did I do anything in there which might be confusing swank about the project location somehow? http://pastebin.com/RNTFkukC

8:08 kilon: babilen: no probemo mate, i am 100% satisfied with your help

8:09 ro_st: oh dear. they refactored it. i'm going to have to redo my config again. https://github.com/overtone/emacs-live

8:09 kilon: ro_st: not that i know how to ues live-coding yet :D

8:09 borkdude: kilon I have a project called "my-repl" or so with a bunch of useful libraries, for when I just want a repl to connect to

8:10 kilon that is in emacs

8:10 ro_st: kilon: it's just a bundled set of emacs addons that constitute a great clojure dev env

8:10 borkdude: kilon with lein repl you can just spin up a repl from wherever

8:10 kilon: borkdude: inferior-clojure or superior ?

8:10 borkdude: kilon slime

8:10 kilon it's just a nonsense project, but good for starting a slime repl only ;)

8:11 kilon: ro_st: this is my setup -> http://www.mediafire.com/?ao6fd9zdmcfndnx , care to share yours ?

8:12 borkdude: excellent

8:12 ro_st: i hope you dont hate dark themes, the emacs whit hurted my eyes :D but it containly loads of els you may find useful

8:13 i used it for common lisp coding

8:13 ro_st: kilon: i'm going to re do it using emacs-live. i use solarized-dark

8:13 i'd be happy to share mine once i've got it redone :-)

8:14 i recently switched to PT Mono for my coding font. it's awesome

8:14 kilon: ro_st: ah my setup is based on emacs-live i think

8:15 ro_st: i'll grab yours, then Kilon. reading through the emacs-live-coding was most instructive

8:15 kilon: yeah that must be the one

8:15 even our colors are the same

8:15 i have not changed much, only made it work

8:15 ro_st: i really love using ace-jump. amazing how quickly i became dependent on it

8:16 kilon: what i love is the quick find of files

8:16 you just backspace and take you to the paren folder

8:16 and autocompletes all paths

8:16 extremely handy

8:16 ro_st: yup. it all takes a bit of getting used to, but it's worth it

8:16 kilon: it took me zero time to get used to it

8:17 its even better than using a gui browser

8:17 its awesome

8:17 hmm no mine has alot more files in it

8:18 i suspect i fetched from a dude that use emacs-live as a template for his setup

8:18 yeap now i remember

8:18 so its not just emacs-live it contains a lot more

8:18 borkdude: emacs setups spread like virusses, you don't know where they came from? ;)

8:22 kral: hola

8:22 kilon: ro_st: oh wait my setup is this https://github.com/overtone/live-coding-emacs

8:22 ro_st: yup, mine too

8:22 kilon: that means i need to upgrade to emacs-live ?

8:22 ro_st: nope, you don't need to

8:23 kilon: is it better in some way ?

8:23 coventry`: OK, problem solved. It helps to create projects with "lein new." :-)

8:23 ro_st: i am because i want the improved organisation that emacs-live provides

8:23 kilon: please do tell

8:23 :D

8:23 i love improvements :D

8:23 borkdude: I hate improvements

8:24 kral: I forked my emacs setup from overtone too

8:24 but I changed it a little

8:24 for my daily work

8:25 kilon: ok i think i will learn a bit more emacs because i realised how nooby i am with it anyway

8:25 and change anything

8:25 *and then

8:25 kral: https://github.com/mdallastella/kral-emacs

8:25 kilon: i am quite happy with my setup as it is

8:26 kraft: watched ;)

8:27 next question should i assume the same clojure-swank will work for clojurescript as well ?

8:36 solussd: just switched to leiningen 2 and upgraded one of my projects- does anyone know how I can get clojure-jack-in to use lein2 to start swank?

8:45 vijaykiran: solussd: in your ~/.lein/profiles.clj add lein-swank 1.4.4 as user plugins

8:45 solussd: and start clojure-jack-in as usual

8:45 solussd: thanks

8:45 vijaykiran: solussd: see : https://github.com/technomancy/swank-clojure

8:46 solussd: thanks- got it working. emacs live is pretty

8:56 kilon: is it correct to assume that compiled clojure libraries will be just normal java compiled libraries since they compile to java bytecode anyway, thus i will be able to use clojure with jython with zero problems ? or i missing something here ?

8:57 ejackson: kilon: sadly its not as easy as that

8:57 kilon: ejackson: what am i missing ?

8:57 ejackson: quite a bit of pain, unfortunately

8:58 bobry: argh, google style of documenting thing is driving me nuts %)

8:58 ejackson: you either have to AOT your classes, which is helluva tricky

8:58 or use the RT.* interop, which can be messy

8:58 bobry: not sure it's even possible to write a client side app using 'goog.ui' in cljs :/

8:58 ejackson: bobry: yes you can

8:58 spjt: I was watching one of Rich Hickey's podcasts last night. Two things I noticed he didn't use were SLIME and Paredit mode

8:59 ejackson: bobry: here's a basic example: http://boss-level.com/?p=102

8:59 bobry: ejackson: yup, seen that one -- the bad thing is, it's too basic for what I'm after

8:59 ejackson: kilon: I suggest you cemerick's book, the chapter on interop is great

9:00 kilon: ejackson: no idea what you just talked about about, but that book is noted

9:00 ejackson: bobry: i must confess, more more complex UI, I just jayq and the 'normal' stuff

9:00 bobry: ejackson: normal stuff? jquery.ui and the like you mean?

9:00 spjt: ejackson: have you used seesaw

9:00 ejackson: yeah, I use kendo, but whatever

9:01 spjt: oh nevermind

9:01 ejackson: nope, not tried it out yet

9:01 bobry: i ended up wrapping 'goog.ui' in seesaw-like api

9:01 but it's still horrible :/

9:01 ejackson: alas !

9:01 kilon: ejackson: your link is clojurescript , i did not mention clojurescript

9:01 oh sorry

9:01 it was for bobry

9:01 :D

9:02 * ejackson embraces the mux

9:02 bobry: ejackson: do you have an open source example of a more complex UI with cljs?

9:02 ejackson: not on hand

9:02 and I'm only starting out with this stuff myself

9:02 bobry: ah, good examples is what's missing in cljs world, that's for sure

9:03 TimMc: kilon: Yes, they'll just be class files. But you may have to throw in some gen-class or deftype stuff to make it palatable for another JVM consumer.

9:03 bobry: anyone can write a hello world in cljs in no time, but doing something less trivial is hard to figure out

9:04 kilon: TimMc: so that means their types wont agree .... strange because AFAIK jython wraps python types to java types

9:04 and since clojure can use java types , i assumed it should be a no problem

9:05 foxdonut: bobry: does clojurescript one help? http://clojurescriptone.com/

9:06 bobry: foxdonut: not really, it only confused me more -- I wish I've started from scratch :)

9:06 ejackson: bobry - have you seen the UI that granger made for overtone ?

9:06 using his stack - its nice

9:07 foxdonut: that was jquery as well

9:07 ejackson: yup

9:07 bobry: yup, I've tried using 'waltz', but again, it doesn't fit well for my case

9:07 foxdonut: bobry: why would it not be possible to use goog.ui with cljs?

9:08 bobry: it *is* possible, but goog.ui is poorly documented and enforces a very Java-ish style of doing things

9:08 which is hard to do in cljs

9:09 foxdonut: bobry: so it's possible, but painful from an api point of view?

9:09 bobry: try writing your own widget :)

9:09 uhuh

9:10 foxdonut: I see

9:10 well, what can we do, goog.ui doesn't care to be cljs-friendly :(

9:10 bobry: for instance you can't use clojure protocols or types, because clojure doesn't allow any custom logic in the type constructor, while 'goog.ui' actually requires you to do stuff there

9:25 Chiron_: Hi! any difference between moustache and compojure?

9:26 foxdonut: yes

9:27 kilon: so clj and java dont mix so well :| thats weird

9:27 foxdonut: Chiron_: see https://github.com/cgrand/moustache and https://github.com/weavejester/compojure for details.

9:28 Chiron_: foxdonut: I did. both are DSL

9:28 kilon: and its left up to the clj coder to map and create the java type in his clj code

9:28 *types

9:29 if i am understanding this correctly http://clojure.org/java_interop

9:29 certainly does not look as automagical as jython

9:30 but i guess i would not mind doing some "cooking" around

9:30 foxdonut: Chiron_: I'd venture that compojure is more widely used. Other than that, it's a matter of your preference on how they solve the problem, I guess. :-)

9:30 duck1123: A lot of the clojure types are also the standard java type (eg. string, regex) the rest are pretty compatible

9:30 kilon: ah good to know

9:30 I dont mind some extra coding

9:31 but i want to use both clojure and jython side by side

9:40 spjt: kilon: It is, it's just that the syntax of Java and Lisp are so much more different that they look nothing alike.

9:41 kilon: spjt: i dont mind that, what i would do mind if i cannot mix clojure with jython

9:43 TimMc: kilon: You can certainly use them side by side, you just may need to do a little bit of API fixup.

9:43 duck1123: kilon: as long as you have an Object, you should be able to interact with it from clojure. The conceptual styles might make it a bit difficult, but it can certainly be done

9:44 kilon: TimMc: Api Fixup, i hope you dont suggesting me fixing Clojure :D

9:45 duck1123: What he's saying is that the jython object's arguments might feel unnatural from clojure, and you might need to write some wrappers to make it easier, but that'll be about it

9:45 kilon: duck1123: sounds great, python is all OO, so everything is objects including functions and classes, and as i said , i dont mind some extra coding in a reasoble amount

9:45 ah ok

9:45 for a minute i was worried

9:46 TimMc: You may end up with some awkward calls to clojure.lang.RT.

9:46 kilon: yeah sure dont mind wrapping so both jython and clojure feel natural

9:46 ejackson: Clojure was designed to play well with Java, and does, so it should also with Jython, but its not free

9:48 kilon: what i am trying to avoid is wrapping everything , that could increase the complexity of my code and make it look ugly

9:48 if i can get jython and clojure functions to call each other i am fine

9:48 i dont need any big sophistication here

9:49 ejackson: kilon: you wouldn't happen to know the status of NumPy/SciPy etc on Jython would you ?

9:49 S11001001: kilon: a basic understanding of how to write HOFs in both should be sufficient to scrap most of your boilerplate

9:49 too bad HOFs are annoying to write in python, but there you go

9:49 kilon: ejackson: not rally, but i do no that ctypes do work okish on jython so you may be able to use numpy this way

9:50 ejackson: tnx

9:50 duck1123: I'm assuming that clojure's fns and jythons fns don't share the same base type. (except for maybe Runnable)

9:54 kilon: ejackson: from my search it appears that numpy is not yet ported to jython

9:55 ejackson: oh thanks, I was just curious

9:56 kilon: duck1123: i would suprised if they are, python function are not true functions they are objects , in theory python is capable of procedural and OOP but in practice its all OOP , not quite smalltalk but close :D

9:56 coventry: I've got sldb giving me line numbers into the source code after a fashion, but neither sldb-step nor sldb-next are working as I would expect. They both result in the emacs message "Evaluation aborted." Hitting the "Continue" button in the sldb window does continue execution, though.

9:56 kilon: in python you can even reference function objects

9:56 b = a()

9:56 b()

9:57 sorry my bad i meant , b = a , b()

9:57 assuming a()

9:57 S11001001: kilon: function is as function does. if it looks like a function...

9:58 foxdonut: python has nothing on clojure when it comes to FP. ;)

9:58 kilon: S11001001: cant say i know how fucntions work in lisp in low level

9:58 duck1123: kilon: clojure functions are also objects, but a big plus for clojure's fns is that they implement a bunch of really nice interfaces, jython's does not

9:58 kilon: actually my claim is that python function are not functions at all :D

9:58 S11001001: kilon: low-level is irrelevant; it just so happens that clojure functions are also instances of classes, but they are, in the only important respects, functions, not pseudo-function objects

9:59 and the same is true for python

9:59 I feel silly about this debate now, so thanks

9:59 kilon: ok

9:59 but its not implied, i think java methods are just functions , they are not objects

9:59 duck1123: for reference: http://www.jython.org/javadoc/org/python/modules/jffi/Function.html

10:00 coventry: Do sldb-step or sldb-next ("s" and "x" in the sldb buffer) do the right thing for anyone else?

10:00 kilon: yeah jython follows the same model as cpython

10:01 i did not know that in clojure functions are also objects

10:02 and it was not my intention to debate anything, i am too new to clojure to start an debate :D

10:03 coventry: (use 'clojure.contrib.trace)

10:03 Oops, wrong buffer. :-)

10:04 S11001001: np

10:04 kilon: lets ban erc :D

10:05 S11001001: haven't seen an xb from coventry yet, let's wait on that

10:06 pepijndevos: S11001001: xb?

10:06 S11001001: pepijndevos: the telltale sign of an erc user is the occasional

10:06 xb

10:06 pepijndevos: why?

10:06 clojurebot: why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone

10:07 S11001001: pepijndevos: because C-x b is the switch-buffer keybinding

10:07 pepijndevos: ah

10:07 coventry: Does (use 'clojure.tools.trace) as shown in the example usage at https://github.com/clojure/tools.trace work for anyone else? I get "could not locate on classpath."

10:07 S11001001: certainly we randomly write shell commands and such into erc buffers too, but xb is the most common symptom

10:08 coventry: how did you add tools.trace?

10:08 kilon: hehe

10:08 pepijndevos: Do any VIM users have IRC plugins, or is it just the emacsOS peeps who do that?

10:09 coventry: Oh, I assumed it would be in the standard distribution. I guess I should add it with lein...

10:10 S11001001: coventry: search.maven.org is useful

10:13 matthavener: pepijndevos: there's a swank vim plugin for running the repl

10:14 coventry: S11001001: thanks, very handy

10:14 pepijndevos: matthavener: huh? IRC repl? There is vimclojure as well...

10:15 S11001001: matthavener: I think pepijndevos is looking for an IRC client unrelated to clojure

10:15 matthavener: ohh, sorry pepijndevos

10:15 pepijndevos: S11001001: not even that, just wondering... I'm fine with a GUI.

10:15 matthavener: misread your line

10:15 pepijndevos: if you like "console" irc you might enjoy irssi

10:17 ejackson: pepijndevos: have you tried LimeChat ?

10:18 pepijndevos: ejackson: Hi! Yea, that's what I'm using.

10:18 ejackson: heya :)

10:18 michaelr525: i'm using emacs just for the ERC client :)

10:18 pepijndevos: michaelr525: And what do you use for Clojure?

10:20 ordnungswidrig: michaelr525: +1

10:21 pepijndevos: ejackson: Did you ever manage to get the logic goal working?

10:21 llasram: If anyone is using Ragel in a Clojure project: git@github.com:llasram/inet.data.git

10:21 er

10:21 ejackson: no, I gave up. I'm assuming that because its not relational its not possible

10:22 llasram: https://github.com/llasram/lein-ragel

10:22 THere we go

10:22 ejackson: i guess you didn't either ?

10:22 llasram: Stupid clipboard vs selection buffer....

10:22 pepijndevos: ejackson: I'm retty sure it's possible with ckanren, but I can't even remember what we where making.

10:22 ejackson: yeah, I'm pretty sure it'll work there

10:22 i dunno the state of cKanren though

10:23 i see there isa branch of GH

10:23 pepijndevos: oh, right, like minfd, right?

10:23 ejackson: yeah, exactly

10:23 duck1123: didn't it become core.logic ?

10:23 pepijndevos: duck1123: No, ckanren is an extension to minikanren for expressing constraints over finite domains

10:23 borkdude: Raynes tnx for Textual I'm happy with it so far

10:24 ejackson: duck1123: i don't think its done yet

10:24 coventry: So I added [org.clojure/tools "0.7.3"] to the :dependencies clause in project.clj and re-ran "lein deps." It attempts to download org/clojure/tools/0.7.3/tools-0.7.3.jar from a bunch of repositories, but fails. How should I fix this?

10:25 (I got 0.7.3 from the clojure.tools.trace page at search.maven.org.

10:26 ejackson: i see FD-like stuff around https://github.com/clojure/core.logic/blob/cKanren/src/main/clojure/clojure/core/logic.clj#L2057

10:26 duck1123: try [org.clojure/tools.trace "0.7.3"]

10:26 ordnungswidrig: is core.logic appropriate to the following domain? I have a list of values and need determine every position where a new given value can be inserted such that certain constraints over the list hold true.

10:27 coventry: Thanks, duck1123. That works.

10:27 ejackson: ordnungswidrig: depends on the constraints,

10:27 ordnungswidrig: the constraints may involve long running calls to remote systems, though.

10:27 ejackson: if they're non-numerical constraints then you should be able to get it to work (I think), with numerical, its gets more complicated

10:28 ordnungswidrig: ejackson: incremental building of delivery tours. i have a list of time-boxed spots with locations and need to check wether and when to instert a stop for another location.

10:28 so the numeric issue compiles down to a boolean: i can reach the next stop in time.

10:28 ejackson: seems like you're in with a shot

10:29 ordnungswidrig: supposed that I constrain the problem space to slots, say like 15-min-intervalls, right?

10:29 michaelr525: pepijndevos: sublime text

10:30 ordnungswidrig: hmm, or would the "insert position" be a possible result of the goals?

10:31 pepijndevos: ordnungswidrig: Like in functional programming, bind a var to the new list with the position inserted.

10:33 ordnungswidrig: pepijndevos: how would I check that the (numerical) relation between two stops is satisfied? Let's say I have a list of [1 4 6 10] and I'd look for every position where I can insert "3" such that the difference to the item before and the item after it is less than 2.

10:34 pepijndevos: thus, how would I "lift" (fn [x y] (< (abs (- x y)) 2)) into core.logic?

10:34 pepijndevos: ordnungswidrig: *that* os constraint programming over finite domains. So you can't currently express numerical differences with core.logic.

10:34 ejackson: ordnungswidrig: that's numerical, so its not really yet supported

10:34 spjt: How long does it take to learn clojure? It's doing a good job of making me feel dumb.

10:35 ordnungswidrig: so one can only reason over sequences and maps?

10:35 ejackson: spjt: welcome to the club :)

10:35 duck1123: spjt: Learning Clojure is a series of "A-ha" moments

10:35 ejackson: duck1123: interopsed with infinite seqs of DOHs

10:36 pepijndevos: ordnungswidrig: over logical relations really. saying "1 is not 3" is fine, but saying "x is between 1 and 3" is not.

10:37 ordnungswidrig: pepijndevos: that's fine for my case, I think. I wonder if there is a way to use custom logical relations like, say "<"

10:37 spjt: I think part of the problem is that every clojure book I've seen gets to a point where it just starts throwing in functions with no explanation of what they do, and the docs seem not to make any sense unless you already know what it does.

10:38 ordnungswidrig: spjt: that's called "recursion" and is a key property of functional programming. *g*

10:38 jsabeaudry: spjt, How long does it take to learn spanish?

10:38 ejackson: ordnungswidrig: again is an fd concept

10:38 < is an fd concept, that is

10:39 in fact.... https://github.com/clojure/core.logic/blob/cKanren/src/main/clojure/clojure/core/logic.clj#L2119

10:39 here is her defn

10:39 ordnungswidrig: ejackson: in your talk at euroclojure I thought you mentioned to call out to "webservices" and like that. Or did I mix it up with datalog?

10:40 ejackson: honestly, I was so nervous I might have said any damn thing :)

10:40 spjt: jsabeaudry: I probably should have qualified it more. As in, enough to be able to put it on a resume.

10:40 ejackson: but I don't think I said that :)

10:40 ordnungswidrig: ejackson: nevertheless it was the most entertaining talk for me. And I want this shirt!

10:41 ejackson: thanks, all I wanted to do was communicate the abstraction, which I think went well enough

10:41 ordnungswidrig: ejackson: what should <=fd-c say to me? Have I to dig into karen?

10:41 pepijndevos: ordnungswidrig: so say you have a logical variable a which is less than 4, that has an infinite number of solutions. So you need to give it a domain.

10:41 coventry: So, I've installed clojure.tools.trace according to "lein deps", but running (use 'clojure.tools.trace) in swank-clojure is still failing with "Could not locate."

10:42 uvtc: Do Clojure and Leiningen run ok on OpenJDK 7 ? (I've only thus far tried them with openjdk-6.) This is on Debian/Ubuntu.

10:42 ejackson: ordnungswidrig: the fd is "finite domain"

10:42 ordnungswidrig: pepijndevos: I understand. However, I think the domain of sorting elements of a list according to a given relation is finite, isn't it?

10:43 jsabeaudry: spjt, I would guess that depends on your standards, once I interviewed a candidate who had smalltalk on his resume, only to learn that he had only used it once during a school assignment 4 years prior...

10:43 ordnungswidrig: jsabeaudry: *g*

10:43 pepijndevos: ordnungswidrig: I think the zebrao goal defines a goal for relatuve positions in a list, like lefto

10:43 uvtc: Maybe better to ask: has anyone had any problems with Clojure or Lein running on openjdk-7 ?

10:44 coventry: "Enough to put it on your resume without losing sleep over it."

10:44 ejackson: pepijndevos: that's right, by using the position in the vector

10:44 jsabeaudry: uvtc, I've used them on openjdk-7 and could not tell the diff with 6 openjdk-6

10:44 spjt: jsabeaudry: Oh, I do that. I put Perl on my resume. I don't actually know it anymore, but I did know it at one time, so I at least know I could learn it again. Unlike Clojure, where I find myself needing to lie down for a minute after trying to read the documentation.

10:45 uvtc: jsabeaudry, great. Will give it a shot. Thanks!

10:46 jsabeaudry: uvtc, and that was on ARM, not sure which platform you are on

10:46 ejackson: pepijndevos: that's right, by using the position in the vector

10:46 uvtc: jsabeaudry, x86_64

10:46 jsabeaudry, so, 64-bit

10:46 spjt: I'm reading the Emerick book, about halfway through Chapter 3 I seem to have completely lost any ability to understand what's going on

10:47 I think I'm just going to have to read the rest and come back to it at the end. The problem is that Chapter 3 seems to be the most important thing in the book.

10:47 coventry: spjt: programmed exercises are helpful. I started with the clojure koans, and moved on to 4clojure problems, and it's definitely improved my fluency. Also, I found Holloway's book very clear.

10:47 spjt: coventry: I hit a wall on 4clojure

10:47 jsabeaudry: I'm not a big fan of learning programming languages by reading books, I love books for advanced topics but for the basis of the language what works best for me is simply to code

10:48 coventry: spjt: Where'd you hit the wall?

10:48 spjt: jsabeaudry: I've been doing that too. The problem I run into is that I eventually need to do something, I can't figure out how to do it, and when I find code that does it, I can't understand how it works. :)

10:49 ejackson: spjt, i understand, for me its just continual iteration

10:49 pepijndevos: ejackson: Did you meet that guy wearing a capful at 20°? He has plans to implement another logic language in Clojure.

10:49 ejackson: pepijndevos: what is a capful ?

10:49 the knitted hat ?

10:49 spjt: coventry: Finding the maximum value without using max

10:50 coventry: spjt: It's possible you've gotten further than me (I'm at problem 79) in which case this advice won't apply, but I found the clojure cheat sheet at clojure.org very helpful.

10:50 jsabeaudry: spjt, ah then that's when you come here! People are extra helpful, I myselft have probably asked over 100 questions here most of which have been answered in less than 15 secs

10:50 spjt: hehe, minor thing about that. All of the versions of the clojure cheat sheet PDF i've found print out 3 pages, the last page is like four lines, and there is a bunch of empty space on the 2nd page.

10:51 foxdonut: coming from an OO background, sometimes I feel like I'm trying to open a milk carton with a can opener.. I can manage to get it to work, but it's an ugly mess.. just need to get used to seeing the much cleaner and elegant FP solution.

10:51 Bronsa: ,(reduce > '(1 2 3))

10:51 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Number>

10:51 coventry: I seem to be having bad luck with my questions. If there's anything I can do to clarify them, please let me know.

10:51 Bronsa: ,(reduce #(if (> % %2) % %2) '(1 2 3))

10:51 clojurebot: 3

10:52 pepijndevos: ejackson: yea, knitted had, we have a propper word for it. it seems the only english word that does not also identifies things about cars and summer.

10:52 S11001001: ,(doc max)

10:52 spjt: coventry: It doesn't seem like the problem numbers go in any sort of logical order?

10:52 clojurebot: "([x] [x y] [x y & more]); Returns the greatest of the nums."

10:52 ejackson: pepijndevos: i did meet him, he seemed nice, but I didn't catch his name :(

10:52 coventry: spjt: they are disordered, but they do generally get more difficult further on.

10:52 jsabeaudry: ,(last (sort [3 2 1])

10:52 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

10:52 jsabeaudry: ,(last (sort [3 2 1]))

10:52 clojurebot: 3

10:53 duck1123: ,(first (sort > [1 2 3]))

10:53 clojurebot: 3

10:53 pepijndevos: ejackson: Gabriel, I believe. I didn't catch *any* name, other than IRC peeps.

10:54 S11001001: no matter, sort is eager

10:54 ejackson: hehe, know the feeling, *so* many ppl

10:54 pepijndevos: S11001001: hazy sort is cool

10:54 *lazy

10:55 S11001001: well, kind of

10:55 coventry: spjt: one thing I found very useful on the 4clojure website is to go to the "top users" page, follow the top 10 or 15, and dissect their answers for the problems after I'd solved them. You can progressively learn a lot of tricks that way.

10:55 TimMc: lazy... sort?

10:55 Can't be properly lazy.

10:56 pepijndevos: TimMc: not on the input, but on the output: http://pepijndevos.nl/lazy-sorting/index.html

10:56 S11001001: TimMc: a heap yields a straightforward lazy sort, though as you say it is still strict on input

10:56 jsabeaudry: coventry, indeed, also a good way to learn some black magic sometimes ;)

10:56 coventry: TimMc: Function programming is passe. The world's moving on to clairvoyant programming.

10:56 TimMc: argh animated background

10:57 ordnungswidrig: re

10:57 duck1123: coventry: "Can you halp me debug this. I don't know what I want"

10:57 ordnungswidrig: sorry, bluescreen. *cough*

10:58 pepijndevos: TimMc: heh, try IE, it doesn't move there. Does my beautiful wheel bother you? :(

10:58 spjt: The hard part of the problem was the way the arguments were passed: (= (__ 1 8 3 4) 8) They're not in any sequence.

10:58 TimMc: pepijndevos: Yes, I have ADHD.

10:58 I can't block out background stimuli very easily.

10:58 ordnungswidrig: so, back to the problem. can core.logic sort a list of elements according to a relation?

10:59 coventry: spjt: Was the solution Bronsa sent a little while ago clear?

11:00 uvtc: Regarding the Clojure cheatsheet, some of the ones linked to from http://jafingerhut.github.com/ have tooltips as well. Which is nice.

11:00 ejackson: ordnungswidrig: i wouldn't think so

11:00 spjt: coventry: It helped.

11:00 ejackson: although if the cKanren stuff is further than I think, then yes

11:00 spjt: ,((fn [& s] (last (sort s))) 1 8 3 4)

11:00 clojurebot: 8

11:00 pepijndevos: TimMc: I had it blurred before, but people said they liked it better sharp. Maybe I should add a kill switch or readability button.

11:00 foxdonut: pepijndevos: your page feels like a test to see if I can read code despite a bunch of noise and distraction.. :/

11:01 uvtc: clojurebot cheatsheet?

11:01 ordnungswidrig: ejackson: so I need to understand the Kanren stuff, right *g*

11:01 ejackson: there is no escape!

11:01 foxdonut: conclusion: like TimMc, I cannot.

11:01 ordnungswidrig: poor little me!

11:01 coventry: spjt: Yeah, that one's not so good, though, because sort is n*log(n). Bronsa's was better (the one using reduce.

11:02 S11001001: pepijndevos: sorry, gotta agree with the majority here; for me, the sidebar even spills unscrollably off the right side

11:02 pepijndevos: S11001001: what?

11:02 uvtc: ~cheatsheet

11:02 clojurebot: Cool story bro.

11:03 foxdonut: coventry: manager: "Team, start coding! Meanwhile, I'll go ask the customer what they want."

11:03 uvtc: clojurebot should know about http://jafingerhut.github.com/

11:03 pepijndevos: S11001001: can you screenshot what you mean?

11:03 ejackson: foxdonut: aah yes...

11:03 coventry: uvtc: Thanks, that'll be handy.

11:04 uvtc: coventry, yw. Though, I don't know how to teach clojurebot things.

11:04 foxdonut: ejackson: an all-too-familiar scene? :)

11:04 pepijndevos: ordnungswidrig: I think you *can* sort a list, but not based on a numerical relation.

11:05 ejackson: oh yes, surely *an* answer is always superior to the correct one, right.... right ?

11:05 ordnungswidrig: pepijndevos: hmmm, which kind of relation then?

11:06 spjt: coventry: I can't figure out how to do it in the form of the problem.

11:06 uvtc: ~cheatsheet is <reply> Cheatsheets with tooltips can be found at http://jafingerhut.github.com/ .

11:06 clojurebot: 'Sea, mhuise.

11:06 uvtc: ~cheatsheet

11:06 clojurebot: Cheatsheets with tooltips can be found at http://jafingerhut.github.com/ .

11:06 spjt: ,((fn [& s](reduce #(if (% > %2) % %2) s)) 1 8 3 4)

11:06 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

11:07 pepijndevos: ordnungswidrig: dunno, can't think of anything that you could sort by.

11:07 spjt: 90% of the code I write ends up with that exact error :)

11:07 ordnungswidrig: spjt: it's (< 1 2) not (1 < 2)

11:07 spjt: ha

11:07 so close.

11:08 ordnungswidrig: pepijndevos: that means, core.logic can only make use of a special set of relations which are encoded as goeals.

11:08 ejackson: ordnungswidrig: sorting implies <

11:09 you can partition, or filter or such

11:09 Chiron_: clojurebot: do you like Java?

11:09 clojurebot:

11:09 uvtc: hahaha

11:09 ordnungswidrig: ejackson: I got the empression that core.logic can work with relations (of any kind)

11:09 ejackson: over a finite domain of values

11:10 ejackson: aaah, that's the catch here - cKanren is the extension to finite domains

11:10 ordnungswidrig: and without ckanren what is the domain?

11:10 ejackson: you can specify it (in my slides I was using membero)

11:11 as an expensivish hack

11:11 but its not the real deal

11:11 as you can't define a < relation, AFAIK,

11:11 ordnungswidrig: hmm, < is a relation.

11:13 ejackson: yes, but its one that's not supported in Kanren

11:13 ordnungswidrig: ah, now I see.

11:13 ejackson: but is in cKanren

11:13 over defined finite domains

11:15 * ordnungswidrig feels dump

11:15 * ordnungswidrig feels dumb

11:15 ordnungswidrig: this one.

11:15 * ejackson always feels dumb

11:16 ordnungswidrig: So what would miniKanren then be good for?

11:16 * samaaron just took a dump

11:16 ejackson: well that's delightful

11:16 ordnungswidrig: anything non-numerical

11:16 samaaron: actually, I didn't - but said it anyway with poetic motivations

11:17 ejackson: the sort of puzzle like a timetable, or sudoku or zebra etc

11:17 arrangements of stuff

11:17 not based on numerics

11:18 ordnungswidrig: but I have an arrangement puzzle! *g*

11:18 pepijndevos: there are a lot of things like timetables, but if you make them about slots rather than time, it work fine, as long as your constraints are not based on time either.

11:18 foxdonut: poetic motivations or not, that's just TMI.

11:18 ordnungswidrig: pepijndevos: so what are possible constraints? only list relations?

11:18 pepijndevos: foxdonut: tmi?

11:20 ordnungswidrig: basically just if something equals something else or not.

11:20 TimMc: pepijndevos: Presumably "Too Much Information"

11:20 pepijndevos: The only way it deals with a list is to say the car or cdr of a list are equal or not to something else

11:22 ordnungswidrig: pepijndevos: I wanted to avoid encoding the constraints as church numerals.

11:22 pepijndevos: ordnungswidrig: umph, don't do that, unless you want to sit around for days.

11:23 ordnungswidrig: ok, so is the some brain food on ckanren then which points me into the right direction?

11:23 foxdonut: pepijndevos: too much information.

11:24 ordnungswidrig: http://dosync.posterous.com/another-taste-of-ckanren

11:24 is this supported in core.logic?

11:25 pepijndevos: ordnungswidrig: not as far as I know, though the link ejackson shared seems to suggest it's being implemented.

11:25 ejackson: yeah, I think Dave is on it, but even he has to sleep every 3rd night

11:26 ordnungswidrig: ejackson: damn!

11:26 *g*

11:26 so the reasonable schemer is the canonical information on kanren?

11:27 TimMc: *reasoned, surely

11:27 I've never met a reasonable schemer.

11:27 samaaron: I quite like the idea of a reasonable schemer

11:27 ordnungswidrig: *doh*

11:27 coventry: Is there a repl-style debugger for clojure? I know you can start a repl in the current execution context, but it would be nice to have the ability to jump up and down the stack and step in/step forward as well.

11:28 (Something like pdb or gdb.)

11:28 TimMc: coventry: I've seen it done in Slime, I think...

11:28 It was some Emacs thingy.

11:29 coventry: Do you mean sldb? sldb would work, but I can't seem to get step in/step forward to work. I keep getting an "Execution aborted" message from emacs whenever I try them, even though I can continue execution to the end without problems.

11:29 TimMc: Whatever it was didn't have return value inspection, so I wasn't too impressed.

11:30 THat's annoying for imperative languages but inexcusable for functional langs.

11:31 coventry: Yeah, I'm finding the whole debugging story pretty annoying, though in my case it's probably just my own cluelessness about the whole ecosystem.

11:32 * TimMc buys another Economy Size pack of printlns at the local convenjence store.

11:32 duck1123: I've tried several times to get debugging working for me, and always end up going back to my logging statements and repl

11:33 coventry: lambdebug and stepl look like they might do what I want.

11:34 Is this a massive pain point for other people or just me? I'm kind of surprised at how little interest there seems to be in debugging tools.

11:35 ordnungswidrig: coventry: I think due to the functional nature of clojure there is lower pressure on an interactive debugger. I try to reproduce the error at the repl and to narrow it down from there.

11:35 S11001001: coventry: writing little functions and repling them takes away most of the need

11:36 ordnungswidrig: coventry: and as most functions a free from side effect, you do not need to test in a "live environment"

11:36 TimMc: It's still a pain in the ass.

11:37 I'd much rather be able to set a brakpoint, step around, inspect values... *and* have a REPL, etc. :-)

11:37 ordnungswidrig: TimMc: some times, yes.

11:37 coventry: When I was learning python, my learning rate improved tremendously after I discovered the debugger. It really helps when reading confusing code.

11:38 Particularly when you're learning an entirely different way of expressing code (imperative vs functional)

11:39 agriffis: I'm using lein repl and I want to reload modified sources. Is there an easy way to do that?

11:39 duck1123: when I see the videos of clojure debugging working, it looks great. I just can't get it to do the same for me.

11:40 ordnungswidrig: ejackson: can't I solve the "sort" problem by using pred or project?

11:41 agriffis: looks like (use :reload-all 'module.name) works

11:41 pepijndevos: ordnungswidrig: you can project, if your values are already bound, but you lose the reversible property.

11:42 ordnungswidrig: pepijndevos: what is the reversible property?

11:43 pepijndevos: ordnungswidrig: (+fd 1 2 y) y = 3, but (+fd x 2 3) x = 1 also works

11:43 when projecting, the latter fails because x is unbound

11:43 ordnungswidrig: pepijndevos: is it related to fd?

11:44 pepijndevos: because there is project / pred in the master branch

11:45 pepijndevos: ordnungswidrig: yea, there is even an arithmetic ns which does things the prolog way.

11:45 https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic/arithmetic.clj

11:45 ordnungswidrig: pepijndevos: I see.

11:46 pepijndevos: ordnungswidrig: so they walk the argument, and if it is a concrete value, passes it to the fn, but if it's fresh...

11:46 ordnungswidrig: pepijndevos: so using pred, the question where 3 is insertable in [1 2 3 4 5] such that the difference to the neighbor is < 2 could be solved?

11:47 pepijndevos: ordnungswidrig: yea, you just can't ask for a list such that r is insertible

11:47 ordnungswidrig: pepijndevos: seams reasonable

11:48 pepijndevos: so, pragmatic answer: yes, purist answer: not really

11:48 ordnungswidrig: is this the difference between datalog and core.logic? I mean, core.logic is generative[sic?] where datalog is constraining?

11:48 pepijndevos: yes

11:49 and datalog is more efficient at that, i've been told.

11:49 coventry: Meh. lambdebug can't handle loop/recur, binding, ->, ->>. http://lambdebug.github.com/ and stepl is an earlier program by the same author which he doesn't feature on his github page, so presumably it has similar limitations.

11:49 ordnungswidrig: that's due to the missing magic that's included in datomic

11:52 pepijndevos: it seems to me that with some extra macro sauce, defining projected goals would eb quite a bit easier.

11:54 ForSpareParts: Are any of you guys in Chicago and going to the ClojureScript Meetup thing tomorrow?

11:56 nDuff: ForSpareParts: ...if you don't mind the question, is there a job market for folks who do Clojure in Chicago? My significant other and I are considering places to move; Chicago's her first choice (UofC alumni), but I don't know how it'd work for me in terms of career.

11:57 ForSpareParts: nDuff, I don't mind the question, but unfortunately I don't have a clue. I only just started learning Clojure, mostly as a hobby thing. I'm still a student.

11:57 * nDuff has no shortage of employment options here in austin.tx.us, and has friends trying to recruit him in sf.ca.us, but doesn't know how much tech there is in Chicago.

11:58 nDuff: Ahh.

11:58 ForSpareParts: I was able to get a summer programming job as a student, if that tells you anything?

11:59 nDuff: ...tells me there's more than nothing, but I kinda' like the perks that come with having a robust job market.

11:59 karchie: nDuff: I don't know anything personally, but @abedra just moved to Chicago to work for Groupon, which suggests there's at least something.

11:59 nDuff: Heh.

11:59 * nDuff used to be with Tippr, one of Groupon's competitors.

12:00 nDuff: ...so yes, that's something.

12:01 karchie: (also, I don't know specifically what's going on in Chicago, but if it's anything like St. Louis, *everyone* is hiring. something's going on in here in flyover country.)

12:01 ForSpareParts: karchie, is it not like that where you are?

12:01 Er.

12:02 I read that wrong.

12:02 To your knowledge, are things more active here in the midwest?

12:04 karchie: No scientific surveys. :) I just know that I've been getting pestered by headhunters on the west coast rather less over the last couple years, and that everyone I know in StL is hiring. Not that that necessarily translates into good clojure opportunities (and I should probably stop being quite so off topic).

12:07 ForSpareParts: no complaints here on the off-topic...ness. Opportunities are opportunities, and I'm not (and don't see myself becoming) a one-technology dude, so you were actually answering my particular question.

12:08 That is, I was wondering about opportunities for programming folk in general.

12:13 coventry: Could someone try the running swank.cdt snippet at http://pastebin.com/zc1mHBFc in swank-clojure for me, and let me know whether it drops you into the debugger? It's just giving me a printout of the breakpoint and the result of executing the function it was supposed to break on.

12:14 devn: more clojure opportunities are coming

12:14 it is our destiny...

12:17 tesmar: hmm I just installed emacs and am following this guide http://unschooled.org/2011/10/how-to-setup-emacs-for-clojure-on-mac-os-x-lion/

12:17 but when I try to type package-install clojure-mode

12:18 if I put a space, emacs replaces it with a dash

12:18 uvtc: devn, you are prescient and mysterious. I wish to subscribe to your newsletter.

12:18 tesmar: any idea on how to get emacs to let me type a space?

12:18 while in M-x mode?

12:19 coventry: C-q SPACE

12:19 tesmar: coventry: thank you

12:19 now it says 'no match'

12:20 I have already done the package update

12:20 ordnungswidrig: hmm, what is wrong? (defne sortedo [l] ([(pred l #(= % (sort %)))]))

12:20 tesmar: will continue on

12:20 thanks

12:20 technoma`: tesmar: it means do M-x package-install followed by entering the string "clojure-mode"

12:20 ordnungswidrig: (run* [q] (== q [1 2 3]) (sortedo q)) returns ()

12:20 technoma`: M-x package-install is a single command

12:20 uvtc: tesmar, after typing M-x, Emacs is expecting you to type a command without spaces in it. commands-like-this.

12:21 tesmar, as technoma` alluded to, if you're trying to use package-install, it's "M-x package-install RET package-name RET".

12:21 tesmar: uvtc: thank you sir

12:21 and you too technoma`


12:22 uvtc: tesmar, yw

12:25 ordnungswidrig: pepijndevos: still online?

12:25 pepijndevos: yea

12:26 ordnungswidrig: can you have a look why above definition of "sortedo" does not work?

12:27 pepijndevos: ordnungswidrig: because pred is for... predicates... wait... what are you trying to do?

12:27 ordnungswidrig: check if a given list is sorted

12:29 SurlyFrog: Does Clojure have anything equivalent or similar to Common Lisp's :before, :after, and :around method qualifiers?

12:29 pepijndevos: ordnungswidrig: trying....

12:29 TimMc: ordnungswidrig: By the way, that might not work for unstable sorts...

12:30 ordnungswidrig: TimMc: i see

12:30 TimMc: but I have distinct values in my case

12:33 pepijndevos: ordnungswidrig: (defn sorted [l] (is l l sort))

12:33 I'm not sure the o postfix should be used, since it's not relational.

12:33 ordnungswidrig: I see

12:33 pepijndevos: but I'm also not sure it should not be used :)

12:36 ordnungswidrig: is there a way of using is/pred on multiple values?

12:36 daviddpark: I am trying to eval a string as a symbol. (= :p1 :p1) => true, but (= :p1 (symbol ":p1")) => false. Anyone with insight?

12:36 ordnungswidrig: say I have q is [a b c] and I want to check (pred a b) to be true

12:37 karchie: SurlyFrog: I think the short answer is no, though I suspect (without really thinking through the details) you can get similar effects by being a little clever with multimethods.

12:39 SurlyFrog: the method qualifiers are really closely tied to inheritance, and I think inheritance is sort of deprecated in Clojure.

12:40 pepijndevos: ordnungswidrig: using the level below it, project: https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic.clj#L1060

12:41 It's macros al the way down

12:41 ordnungswidrig: pepijndevos: I will try. Thanks for your assistence.

12:41 cu all

12:42 SurlyFrog: karchie: thanks, I think I can probably get what I need by getting creative with metadata.

12:55 dnolen: raph_amiard: ping

13:28 chmllr: Hello all! I'm trying to get the browser window height in CLJS. goog.dom.getViewportSize returns an object with two fields height and width. However, this code doesn't work: (.height (gdom/getViewportSize)).

13:29 It fails with an error like TypeError: '1055' is not a function (evaluating 'goog.dom.getViewportSize.call(null).height()') — where 1055 *is* the actual height...

13:29 dnolen: chmllr: .foo is always a method call, you want .-height

13:32 chmllr: dnolen: thank you so much! Is it different to Java or did I get wrong the clojure.org/java_interop?

13:32 dnolen: chmllr: it's impossible to differentiate methods and properties in JS, thus the difference.

13:33 chmllr: Clojure on the JVM supports the syntax as well.

13:34 chmllr: dnolen: ok, I got it, thanks again!

13:36 tommy123454321: list

13:37 dnolen: core.logic CLJS zebrao now below 20ms on V8 ... getting tricky to get faster

13:44 eggsby: :D

13:44 awesome dnolen

13:47 dnolen: eggsby: yeah, faster than many early versions of core.logic for Clojure on the JVM - I'll be very happy if we can get it down to 10-13ms.

13:48 tommy123454321: any online interactive tutorial for clojure?

13:48 dnolen: eggsby: at that point any further gains would probably come from PersistentHashMap

13:48 eggsby: does cljs leverage js workers yet dnolen ?

13:50 dnolen: eggsby: no, and I don't imagine it will

13:53 brainproxy: cemerick:

13:53 whoops, nvm

14:22 gfredericks: Michael Feathers just spent 45 minutes trolling clojure

14:23 S11001001: cool

14:23 Raynes: Cool.

14:23 S11001001: Hahaha.

14:23 borkdude: gfredericks his friend object martin seems to like it though

14:24 technoma`: heh

14:24 borkdude: feather is more into legacy code right? ;)

14:24 gfredericks: he even said he thinks it'd be cool to make a haskell->clojure compiler

14:24 antares_: I've just announced Quartzite on the mailing list but lets just plug it in here, too: http://clojurequartz.info. Docs are pretty good already, 1.0 is a week or two away.

14:26 borkdude: gfredericks did he say why he thinks that is cool?

14:30 Raynes: antares_: Do you get paid to work on all of those projects?

14:31 antares_: Raynes: well, I developed them all for my work needs

14:31 so the answer is technically "no"

14:39 gfredericks: borkdude: just because he really likes haskell syntax

14:41 solussd_: can you specify an interface in a defprotocol? e.g. If I have a couple record types and I want them to implement MyProtocol, but also the java Comparable interface, can I add the Comparable requirement to my protocol?


14:41 dnolen: solussd_: no but deftype & defrecord can implement interfaces

14:43 solussd_: dnolen: hmm, i have two record types, say they're A and B and they both implement protocol P, I want to be able to compare anything that implements P- seems there is no way to enforce that they're comparable

14:45 dnolen: solussd_: make a shared fn they both call out.

14:45 solussd_: or just duplicate the logic if it's trivial.

14:46 solussd_: dnolen: yeah, but if someone else implements P there is no guarantee their records implements compareable. :/

14:48 hiredman: *shrug* you don't own java.lang.Comparable, so you cannot dictate how people use it

14:48 if you want to dictate the comparison, then roll your own

14:50 dnolen: solussd_: even in CLJS everyone still has to implement IComparable. Tying that to a particular protocol doesn't make much sense to me.

14:50 liftdeadtrees: Anyone know who runs 4clojure.com? The site is down.

14:50 solussd_: dnolen: k.. i'll rethink this.. :)

14:51 TimMc: Raynes: I know you're watching, go restart 4clojure.

14:51 You can't hide.

14:51 tmciver: liftdeadtrees: works for me

14:52 liftdeadtrees: Back up now. Thanks!

14:52 tmciver: well, maybe not. Homepage came up but it's VERY slow.

14:54 liftdeadtrees: Whoops, I spoke too soon. It's still running slow.

14:55 dnolen: gfredericks: so any actual good tidbits from mfeathers presentation?

15:16 gfredericks: dnolen: it was a decent intro to haskell syntax

15:16 zamaterian: llpo

15:16 gfredericks: he emphasized how easy and natural it is to use function composition and currying together

15:17 which are both syntactic strong points over clojure

15:17 borkdude: maybe 4clojure is slow because my class is exercising for their test tomorrow

15:17 :P

15:22 simple examples read probably nicer in haskell, but overall.. I don't know https://gist.github.com/2830131

15:26 amalloy: whaaat, 4clojure is running perfectly fast for me, and the cpu usage is at like 5%

15:26 so i dunno how all of you dudes think it's really slow

15:27 tmciver: amalloy: it was slow for me earlier but seems to be fine now.

15:27 gfredericks: maybe the interwebs were slow

15:27 matthavener: i was looking at it this morning and it was nice and fast

15:27 liftdeadtrees: It seems to be working fine at the moment. But it was linked to on the front page of hacker news so there was probably a bunch of traffic earlier.

15:27 amalloy: i was realizing this morning that i haven't had to restart 4clojure for like *weeks*. don't ruin this for me, people

15:28 tmciver: your record shall remain untarnished.

15:28 amalloy: liftdeadtrees: link?

15:28 liftdeadtrees: http://news.ycombinator.com/item?id=4037799 both in the blogpost and the comments

15:31 amalloy: thanks

15:32 traffic is up by 400% or so, but nowhere near the machine's capacity. i think there's some weird new phenomenon that causes temporary cpu/network spikes every two hours, judging by the recent graphs

16:14 technoma`: how is redis as a message queue? I've only used redis briefly, but people seem to like it.

16:15 duck1123: We were using it at my previous job as a queue for some things, it held up pretty well against ~16M messages a day, YMMV

16:15 technoma`: not bad

16:16 I get the impression it's a bit less robust than rabbit, (no guaranteed delivery) but rabbit is baroque.

16:17 duck1123: We were also using rabbit as our main queue. I would probably look to rabbit for general queue needs, but redis works too.

16:17 technoma`: I see there's a redis-mq library for Clojure, but it's brand-new

16:18 duck1123: Aleph has a pretty good client built in

16:18 technoma`: the heroku rabbitmq addon is in perpetual beta, probably because rabbit is developed by a competitor to heroku =(

16:31 XPherior: Can't find this one in the docs.. In Noir, how do you get the params of an AJAX request inside a defpage?

16:34 Oh, I can do this without AJAX. Nevermind!

17:10 rplevy: This is pretty weird: (let [a (Double/NaN)] (= a a))

17:10 false!

17:10 borkdude: rplevy NaN is never equal to itself

17:10 rplevy: why is that?

17:11 TimMc: rplevy: So sayeth the IEEE spec.

17:11 borkdude: rplevy by definition: http://en.wikipedia.org/wiki/NaN

17:12 S11001001: though it does hilariously prevent generic = from being reflexive

17:12 TimMc: &(let [nan (Double/NaN)] [(> 5 nan) (= 5 nan) (< 5 nan)])

17:12 lazybot: ⇒ [false false false]

17:12 rplevy: S11001001: that is funny

17:13 S11001001: better than not being transitive on strings with the digit 0 anyway

17:13 TimMc: You can get some weird non-excluded-middle bugs due to that.

17:15 ordnungswidrig: I genereally treat NaN like an exception. Stop here.

17:16 S11001001: double space is actually the either nan monad

17:17 TimMc: S11001001: Pretty sure you're just trollin'.

17:17 borkdude: this is also funny:

17:17 ,(= #"foo" #"foo")

17:18 clojurebot: false

17:18 rplevy: wtf?

17:18 TimMc: S11001001: s/space/equals/ ?

17:19 S11001001: the value space

17:19 Bronsa: ,(.hashCode #"")

17:19 clojurebot: 16023875

17:19 Bronsa: ,(.hashCode #"")

17:19 clojurebot: 12396906

17:19 gfredericks: do java regexes only match regular languages?

17:19 S11001001: category, whatever, where the various operators are morphisms

17:20 rplevy: &[(not= Double/NaN Double/NaN) (#(not= % %) Double/NaN)]

17:20 lazybot: ⇒ [true false]

17:20 TimMc: S11001001: Oh, space, not \space.

17:20 rplevy: can someone explain the above result?

17:21 amalloy: rplevy: you pass two identical? pointers to the second function

17:21 the first gets two different boxes around the value Double/NaN

17:21 TimMc: aha

17:21 boxing

17:21 rplevy: interesting

17:21 amalloy: &(.equals Double/NaN Double/NaN)

17:21 lazybot: ⇒ true

17:22 amalloy: fascinating. whose idea was that

17:22 TimMc: &[(not= 123456 123456) (#(not= % %) 123456)]

17:22 lazybot: ⇒ [false false]

17:22 borkdude: amalloy wth..

17:22 ,(doc =)

17:22 clojurebot: "([x] [x y] [x y & more]); Equality. Returns true if x equals y, false if not. Same as Java x.equals(y) except it also works for nil, and compares numbers and collections in a type-independent manner. Clojure's immutable data structures define equals() (and thus =) as a value, not an identity, comparison."

17:23 amalloy: clojure's = probably has a special case for Number objects that's not correct for NaN

17:24 yeah, it calls x.longValue() == y.longValue() rather than x.equals(y)

17:26 TimMc: &(.longValue Double/NaN)

17:26 lazybot: ⇒ 0

17:27 TimMc: welp

17:28 gfredericks: wait how does .longValue() work for doubles?

17:28 ,(.longValue 3.14)

17:28 clojurebot: 3

17:28 gfredericks: ,(= 3.14 3.15)

17:28 clojurebot: false

17:29 hiredman: ,(.longValue Double/NaN)

17:29 clojurebot: 0

17:29 hiredman: :|

17:29 gfredericks: ,(= Double/NaN 0.73)

17:29 clojurebot: false

17:30 jonaskoelker: wth

17:30 o_O

17:30 gfredericks: why does Double/NaN get dealt with as .longValue but other doubles don't?

17:30 ,(= Double/NaN 0)

17:30 clojurebot: false

17:30 metellus: ,(.doubleValue 0.234)

17:30 clojurebot: 0.234

17:30 metellus: ,(.doubleValue Double/NaN)

17:30 clojurebot: NaN

17:30 jonaskoelker: ,(= Double/NaN 0N)

17:30 clojurebot: false

17:30 chuck_: are there any large open source example projects using noir? i'm unsure of how I should structure my project's directories

17:31 it gives me folders for models and views, but where should I put misc helper libraries that I write?

17:35 jcrossley3: chuck_: why not src/ ?

17:38 amalloy: oh sorry, it calls doubleValue, not longValue. it calls whatever is appropriate for the type it's checking

17:39 chuck_: you could try refheap

17:39 i dunno how large it is but i'm pretty sure Raynes is using noir for it

17:44 jonaskoelker: (= 1000 1000.0)

17:44 ,(= 1000 1000.0)

17:44 clojurebot: false

17:44 jonaskoelker: ,(= 1024 1024.0)

17:44 clojurebot: false

17:44 jonaskoelker: ,(= 1024.0 1024.0)

17:44 clojurebot: true

17:45 gfredericks: ,(apply = (repeat 1000000 42))

17:45 clojurebot: true

17:48 devijvers: greetings, I have a question on enlive, it this the right place for that?

18:00 Dvyjones: How do I get from [{:cn "foo"} {:cn "bar"}] to [[:li "foo"] [:li "bar"]]? I tried (map #([:li (:cn %)]) my-map), but that got me a "ArityException Wrong number of args (0) passed to: PersistentVector clojure.lang.AFn.throwArity (AFn.java:437)".

18:01 amalloy: ~anyone

18:01 clojurebot: Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."

18:01 amalloy: devijvers: ^

18:02 dnolen: Dvyjones: fn literals do not have an implicit do. You are invoking the vector as a function.

18:03 Dvyjones: dnolen: Ah, so "(map (fn [s] [:li (:cn s)]) my-map)", then? Or is there a better way?

18:04 dreish: Dvyjones: That's good, or you could do (map #(do [:li (:cn %)]) my-map)

18:13 * devn prefers (map #([:li (:cn %)]) my-map)

18:14 devn: but i also prefer to not read the previous comments

18:14 (map (fn [s] ...) my-map)

18:14 amalloy: it'd be nicer with a for than a map, which is often the case when you use an anonymous function for map

18:15 devn: yeah it reminded me of when I've needed to make li elements in the past i guess ive always used a for

18:15 amalloy: (for [x xs] [:li (:cn x)])

18:15 devn: ^-much preferred

18:18 Dvyjones: amalloy: Thanks :)

18:19 devijvers: amalloy: I have a deftemplate, works fine, but now I want to define a snippet which takes that template as a source to return only only element from the template. How do I do that?

18:19 amalloy: (map #(...) ...) is a warning sign that you should probably have used for

18:19 devijvers: dunno why you're asking me specifically; i don't know jack about noir

18:20 devijvers: amalloy: my bad

18:20 technoma`: amalloy: or partial =)

18:20 borkdude: methinks deftemplate is smth of enlive not noir

18:21 amalloy: technomancy: juxt!

18:21 (map (juxt (constantly :li) :cn) m)

18:21 devn: i see your juxt, and raise you a comp with an fnil

18:21 gfredericks: can't we all just get along?

18:21 amalloy: (map (comp (partial vector :li) :cn) m)

18:21 devn: gfredericks: 1upsmanship is important

18:23 gfredericks: devn: 2upsmanship is important

18:24 devijvers: borkdude: indeed, it's enlive

18:27 Dvyjones: Ok, stupid question of the day #2: How do I get from {:foo "bar" :baz "foobar"} to (([:strong "foo: "] "bar") ([:strong "baz: "] "foobar"))?

18:28 (Feel free to just point me at a function. I have no idea where to look right now)

18:29 amalloy: Dvyjones: probably just do the same thing with for?

18:31 &(for [[k v] {:foo "bar" :baz "foobar"}] (list [:strong (str (:name k) ": ")] v))

18:31 lazybot: ⇒ (([:strong ": "] "bar") ([:strong ": "] "foobar"))

18:31 Dvyjones: amalloy: Yeah, working on getting the output I want.

18:31 Oh duh.

18:31 Silly me.

18:31 amalloy: Thanks :)

18:32 amalloy: &(for [[k v] {:foo "bar" :baz "foobar"}] (list [:strong (str (name k) ": ")] v))

18:32 lazybot: ⇒ (([:strong "foo: "] "bar") ([:strong "baz: "] "foobar"))

18:32 amalloy: stupid : characters always sneaking in

18:33 y3di: does anyone know if prismatic uses noir

18:41 ForSpareParts: Hey, are any of you guys in Chicago? And if so, are you going to the ClojureScript One meetup tomorrow?

18:42 devn: im in the general chicago area

18:43 but i cant make their meetings when they have them during the week

18:43 ForSpareParts: Cool.

18:43 devn: wish they'd do a saturday meetup

18:44 ForSpareParts: This will be my first one.

18:44 devn: cool!

18:44 (welcome)

18:44 ForSpareParts: Yep! Hopefully it will be fun and educational!

18:44 devn: im sure both will be true

18:50 davidwongca: Hi, sorry, this is a noob question. In Eclipse, how do you just run a Clojure file instead of starting a REPL?

18:58 pbostrom_: devijvers: what you could probably do is take the html string is returned from your template and convert it to a java.io.InputStream

18:59 devijvers: pbostrom_: gotcha, thx

19:00 pbostrom_: any idea how to get flash messages to work in compojure?

19:01 pbostrom_: devijvers: no, don't know what a flash message is

19:37 sandbox: hi guys, are there preferred or standard libraries in clojure for parsing csv files and json? I mean it looks like there are a lot of libraries but i'm not sure if i should prefer say clj-json over cheshire over data.json or something like that

19:40 xeqi: I've seen movement towards chesire over the others for json

19:42 devn: the benchmarks are pretty convincing

19:42 sandbox: interesting

19:43 devn: (to make me want to switch)

19:43 hiredman: cheshire is the way and the light

19:43 sandbox: what is the light mean?

19:44 Raynes: He was being dramatic.

19:44 Cheshire is the library you want to use for parsing JSON.

19:44 sandbox: okay that makes sense

19:44 what about for csvs?

19:44 Raynes: $google dsantiago clojure-csv

19:44 sandbox: or generally other data formats?

19:44 lazybot: [davidsantiago/clojure-csv · GitHub] https://github.com/davidsantiago/clojure-csv

19:44 devn: https://github.com/clojure/data.csv

19:45 Raynes: Or that, I guess.

19:45 TimMc: sandbox: You're probably not going to find a good library that purports to cover arbitrary data formats.

19:45 sandbox: those are the first ones that show up in a google search for clojure csv parsing

19:45 hiredman: I used data.csv one time, it seemed to work

19:46 sandbox: is there a webpage that has which library is preferred listed? i feel like looking at number of watchers on the github page is a poor metric for this

19:47 dsantiago: Nope, you're just gonna have to think.

19:48 sandbox: alright or i suppose come back here and ask you all again :). thanks for your help

19:52 wei_: i have `(def ^:dynamic *some-symbol* true) in my macro. why does ^:dynamic get dropped?

20:04 devijvers: finally figured out how wrap-flash works: http://clojuredocs.org/ring/ring.middleware.flash/wrap-flash

20:08 technoma`: sandbox: http://clojuresphere.herokuapp.com will tell you what is most widely used by oss code

20:08 TimMc: wei_: I'm going to guess that instead of *some-symbol* you have ~(...)

20:08 wei_: yup

20:08 TimMc: There's your problem. The (unquote ...) is getting the meta.

20:08 technoma`: sandbox: but that's not always helpful since you want something that's biased towards new code

20:08 clojuresphere ranks cheshire 4th for json =(

20:09 wei_: oh! should I use with-meta then?

20:10 TimMc: wei_: vary-meta might suit you better.

20:12 wei_: ~(vary-meta ... assoc :dynamic true)

20:13 wei_: nice. would (with-meta .. {:dynamic true}) work as well?

20:16 JorgeB: hmm, how would I create a lazy seq from HTTP calls to a data API that I need to paginate through? Any examples? I am testing a number of things, but without lots of success.

20:17 TimMc: wei_: Only if it's OK to overwrite any existing metadata.

20:17 (Such as when there isn't any!)

20:18 vary-meta on a user-provided symbol (as opposed to a gensym) gives the user more flexibility.

20:18 sandbox: technoma`: thanks that is still helpful

20:19 arohner: JorgeB: https://github.com/Raynes/tentacles/blob/master/src/tentacles/core.clj

20:19 make-request

20:19 wei_: ah, right. thanks for your help

20:19 arohner: it's a little gnarly, but it's a real-world use

20:19 JorgeB: arohner, awesome, I'll take a look in a moment

21:00 johnmn3: hi

21:00 what is the clojure paste bin?

21:00 TimMc: johnmn3: refheap.com

21:00 johnmn3: thanks

21:01 TimMc: It's not official, but it was made by a member of the community with Clojure in mind...

21:02 dnolen: whoa awesome http://www.50ply.com/cljs-bench/

21:02 johnmn3: TimMc: good enough for me

21:03 TimMc: dnolen: I wish those graphs were rooted at 0.

21:03 The 4th one is impossible to read properly.

21:03 dnolen: TimMc: yeah it's a start tho.

21:04 TimMc: Ooh, I guess it is open source...

21:05 dnolen: TimMc: yep

21:16 TimMc: actually I think it's better if there's some minimum height - otherwise the benchmarks that aren't really changing are just noisy.

21:16 TimMc: Both anchored to zero and minimum range.

21:16 I kind of don't feel like figuring out gnuplot syntax right now.

21:18 johnmn3: https://www.refheap.com/paste/2922

21:18 dnolen: TimMc: yeah agree with that.

21:18 johnmn3: ;; Is there a way to do this as a partition?

21:18 ;; Really, I'm looking for the most efficient implementation.

21:23 TimMc: dnolen: https://github.com/netguy204/cljs-bench/issues/1

21:25 johnmn3: are those different build numbers at the bottom of the graphs?

21:25 amalloy: git commits, i assume

21:31 coventry: Is there a manual for the parts of swank-clojure which are implemented? I'm going through the slime manual, and a lot of it still seems to be providing CL support.

21:32 TimMc: johnmn3: Do you know about subvec?

21:33 mdeboard: Is clj-plaza the recommended tool for mucking about with RDF data

21:34 looks very dated

21:34 e.g. https://github.com/duck1123/clj-plaza/blob/1.3/src/plaza/utils.clj

21:35 xeqi: johnmn3: or cycle?

21:36 &(take 8 (drop 72 (cycle [0 1 2 3 4 5 6 7 8 9])))

21:36 lazybot: ⇒ (2 3 4 5 6 7 8 9)

21:38 amalloy: coventry: a manual? i doubt it

21:39 coventry: It's OK, the git log makes it pretty clear.

21:43 johnmn3: TimMc: xeqi: I'll look into both of those

21:43 I'm trying to find the most efficient implementation

21:44 coventry: How come (macroexpand '(quux (clojure.core/-> (foo bar) (baz)) doucu)) results in (quux (clojure.core/-> (foo bar) (baz)) doucu)? Shouldn't the inner -> be expanded as well?

21:44 johnmn3: I'm guessing subvec will be the most efficient?

21:45 oh, I'm not sure if subvec will work, because I need wrap-around behavior

21:46 though I suppose using subvec in conjunction with conj'ing on tail items as necessary would still be the most efficient impl.

21:47 TimMc: Oh I see, you want wrapping. Yeah, cycle is good for that.

21:47 johnmn3: but my intuition is that subvec would be faster than cycle

21:48 TimMc: johnmn3: A couple suggestions: 1) Use mod to handle negative indices, 2) specify a radius instead of a window size.

21:48 johnmn3: I'm dealing with collections 10,000,000 wide

21:49 how is that different than rem?

21:51 I'll try both, as one may be faster than the other.

21:52 TimMc: Ah, I see that now.

21:54 johnmn3: how 'bout this... if relative index is less that 0 or greater than coll size, use current scheme (or cycle). otherwise, use subvec

21:57 TimMc: johnmn3: You could also split your window into two parts and concat them.

21:57 johnmn3: TimMc: Why?

21:57 TimMc: johnmn3: You should know that subvec retains a pointer to the original vector, so there's potential for gradual memory leaks.

21:58 (Just like substring!)

21:58 johnmn3: hmm

21:58 how do I avoid that?

21:58 TimMc: (into vec ...) or something

21:58 Oh, will your window size ever exceed the size of the collection?

21:59 johnmn3: the window will wrap around on the right side when it gets to the end

21:59 TimMc: No, I mean... will the size of the output collection ever exceed the size of the input collection?

21:59 johnmn3: but generally, no, the window will always be < size of collection

22:00 TimMc: By the way, are you doing some kind of audio processing?

22:00 johnmn3: oh, no, generally, the output is the same as the input, in size... well.. no, a cellular automaton.

22:00 TimMc: nice

22:01 johnmn3: basic two cell, 1d CA

22:01 two color, I mean

22:01 TimMc: Toroidal, hence the wrapping?

22:01 johnmn3: I've got an old blog post on it, but I'm trying to do a follow up blog post on it with a parallelized version

22:02 TimMc: since its one dimensional, more like a cylinder

22:02 TimMc: sure

22:05 johnmn3: heck yea, this is going to be a lot faster.. going to use subvec whenever not dealing with wrapping cases.

22:05 (which is most of the time)

22:06 TimMc: johnmn3: These subvecs are shortlived, yeah?

22:06 If they are, no worries.

22:06 johnmn3: Yea, they're fairly quickly dumped into another vec

22:06 in fact, no

22:07 they're fed into the rule machine, which spits out a new element that gets populated into a new vec

22:07 so, the old subvec should be thrown away

22:07 (I'm guessing... garbage is a black box to me)

22:08 (I have little insight into whether something will or will not be garbage collected)

22:09 TimMc: johnmn3: It's a directed graph with nodes that are marked as "reachable". Once something is no longer reachable from a running program, it is eligible for garbage collection.

22:11 johnmn3: right, but how does it know if I don't want to use the results of the subvec at a later time? I guess I don't have it stored in a variable... but it just seems like there could be edge cases that I don't know about, that are referencing things.

22:14 so I end up just trusting that everything is going to work ;)

22:14 TimMc: That usually works.

22:15 johnmn3: I'm still get bit by "holding on the the head" sometimes. Haven't fully wrapped my head around it.

22:19 TimMc: johnmn3: It's just a big linked list, a chain of nodes and arrows.

22:20 If the only inbound arrow points to the "head", once you drop that... the whole thing unravels.

22:21 johnmn3: yea, and I'm guessing "don't hold on to the head" means don't store the previous elements in the collection you've processed, otherwise you'll run out of memory

22:26 got another one for you: a function where param: 4, out: [-2 2], param: 5, out: [-2 3], param 6: out: [-3 3], param: 7, out: [-3 4], etc.

22:27 the most efficient function, that is.

22:30 amalloy: {4 [-2 2], 5 [-2 4], etc}

22:31 xumingmingv: we can't use function repl related function doc, source in clojure-jack-in?

22:32 xeqi: xumingmingv: (use 'clojure.repl)

22:32 xumingmingv: oh, thanks!

22:32 xeqi: or the keybindings.. I don't remember them offhand

22:33 amalloy: C-c C-d d and M-. respectively

22:51 coventry: Is there a convenience function for #(apply concat %)?

23:02 eighty: what's a good style guide for clojure?

23:02 this is ok: http://dev.clojure.org/display/design/Library+Coding+Standards

23:05 amalloy: coventry: no

23:12 johnmn3: amalloy: that's almost good enough, but the input needs to be any given number

23:21 I'm thinking: (let [x (int (/ n 2))] (if (even? n) [(- x) x] [(- (- x 1)) x]))

23:21 does that do it?

23:21 * johnmn3 tests

23:22 tmciver: johnmn3: or maybe something like: ##(let [x 5 l (- (int (/ 5 2))) r (+ l x) ] [l r])

23:22 lazybot: ⇒ [-2 3]

23:22 tmciver: err, ##(let [x 5 l (- (int (/ x 2))) r (+ l x) ] [l r])

23:22 lazybot: ⇒ [-2 3]

23:25 johnmn3: tmciver: oooh

23:25 I like that better

23:34 hah... looks like that's what I already had... my newer version just complicated it.

23:37 coventry: amalloy: thanks

23:44 digcon9: hi! can lein bind to eclipse, so I can execute lein commands from eclipse?

23:46 amalloy: tmciver, johnmn3: (int (/ x 2)) is just (quot x 2)

23:47 johnmn3: ok

23:55 getting rid of the cruft in the chunkerator has helped dramatically in focussing on the performance of the various parallelization schemes

Logging service provided by n01se.net