#clojure logs

2012-05-29

00:00jblomoso i substituted partition
00:00jblomo(defn pfn [afn arange awindow](into [] (flatten (pmap #(map afn %) (partition awindow (range 1 arange) )))))
00:00jblomo#'user/pfn
00:00jblomouser=> (let [_ (time (pfn inc 20000 100))] (println "done"))
00:00jblomo"Elapsed time: 110.872863 msecs"
00:00jblomoyou're measuring a lot of things there
00:00jblomointo will do a reduce over the sequence and build up a new datastructure
00:01johnmn3and without par: (defn non-pfn [afn arange awindow](into [] (flatten (map #(map afn %) (chunkify (range 1 arange) awindow)))))
00:01jblomowhat is your end goal?
00:02johnmn3to test pmap
00:02jblomoto see when it is faster than map?
00:02johnmn3do you get better results from pmap with larger chunk sizes?
00:02johnmn3yea
00:03emezeskejohnmn3: The pastebin typically used in here is refheap.com
00:03jblomoi don't think you're going to see a big different with inc
00:04johnmn3jblomo: 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.
00:04emezeskejohnmn3: Overhead?
00:04johnmn3for sufficiently long running chunks
00:04jblomothey are not sufficiently long running
00:05johnmn3well, if it takes 5 seconds to inc a chunk
00:05johnmn3where's the overhead in inc'ing two chunks?
00:05johnmn3why should it be 10 seconds?
00:05johnmn35 seconds of overhead?
00:07jblomohttps://github.com/jblomo/clojure/blob/pmap-chunking-862/test/clojure/test_clojure/parallel.clj
00:07johnmn3or with 8 chunks, should that really take 40 seconds on an 8 core machine?
00:07emezeskeI ran two expressions on my machine
00:07emezeske(do (time (let [r 20000 w 1000] (pmap #(map inc %) (partition w (range 1 r))))) nil)
00:08emezeske"Elapsed time: 1.091082 msecs"
00:08emezeske(do (time (let [r 20000 w 1] (pmap #(map inc %) (partition w (range 1 r))))) nil)
00:08emezeske"Elapsed time: 0.246553 msecs"
00:09jblomoso with a function that takes 50 msec to run, you can see the difference in completion time
00:10emezeskeOh, I am not realizing the seqs
00:10emezeskeThere we go
00:11emezeskejohnmn3: Vast speedups with large windows on my machine: https://www.refheap.com/paste/2904
00:13johnmn3try w 10
00:13johnmn3also, try it without pmap
00:16johnmn3emezeske: yea, you'll notice that map doesn't doo much difference
00:16johnmn3*do
00:20emezeskeI assume that the lazy sequences are not being fully realized
00:20johnmn3even very large r and w: (do (time (let [r 8000000 w 1000000] (doall (map #(map inc %) (partition w (range r)))))) nil)
00:21johnmn3'(do (time (let [r 8000000 w 1000000] (doall (map #(map inc %) (partition w (range r)))))) nil)
00:21johnmn3,(do (time (let [r 8000000 w 1000000] (doall (map #(map inc %) (partition w (range r)))))) nil)
00:21emezeskeI shouldn't even be talking about pmap, I'm no expert.
00:21clojurebotExecution Timed Out
00:21johnmn3,(do (time (let [r 800000 w 100000] (doall (map #(map inc %) (partition w (range r)))))) nil)
00:22clojurebotExecution Timed Out
00:22johnmn3,(do (time (let [r 80000 w 10000] (doall (map #(map inc %) (partition w (range r)))))) nil)
00:22clojurebot"Elapsed time: 185.699 msecs"
00:22johnmn3,(do (time (let [r 80000 w 10000] (doall (map #(pmap inc %) (partition w (range r)))))) nil)
00:22clojurebot"Elapsed time: 212.916 msecs"
00:22johnmn3,(do (time (let [r 80000 w 10000] (doall (map #(pmap inc %) (partition w (range r)))))) nil)
00:22clojurebot"Elapsed time: 206.695 msecs"
00:23johnmn3oh
00:23johnmn3clojure is parallelizing map automatically
00:24johnmn3,(java.util.concurrent.ForkJoinPool.)
00:24clojurebot#<CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: java.util.concurrent.ForkJoinPool, compiling:(NO_SOURCE_PATH:0)>
00:25johnmn3this revs all eight threads on my i7:
00:25johnmn3,(do (time (let [r 80000 w 10000] (doall (map #(map inc %) (partition w (range r)))))) nil)
00:25clojurebot"Elapsed time: 204.183 msecs"
01:07gf3_ato: Yay
01:07_atohah :)
01:08gf3_ato: I suppose that's a "go for it"
01:09_atoyeah... just a sec, replying to email. :p
01:11amalloyjohnmn3: you're timing almost nothing
01:12johnmn3well, if it takes 10 seconds
01:12amalloy(map #(map inc %) xs) returns a lazy seq of lazy seqs
01:12amalloydoall forces the outer one
01:12amalloybut you never force any of the arithmetic ot happen
01:13johnmn3so how do I parallelize inc over a large collection?
01:13amalloywell, use fold
01:13amalloyassuming you have reducers available
01:13johnmn3with pmap
01:14johnmn3would (r/map #(map inc %) xs) constitute a reducer in this case?
01:14amalloywellll
01:15amalloyyes, but by using lazy-seqs for the second level you're not getting nearly as much benefit from reducers
01:15amalloybut why would you map map-inc? if you just have a single collection
01:16johnmn3well, its firist a matter of partitioning the collection into chunks
01:16johnmn3but I was doing that for pmap
01:16amalloydon't partition it for reducers. they do that themselves when folding, if possible
01:17johnmn3for my own needs, I need to chunkify, because I need to prepend and append values to the coll prior to processing and reassembling
01:17amalloybut also if your input is a lazy-seq, rather than something foldable, r/map won't fold
01:17johnmn3oh
01:18johnmn3isn't [1 2 3 4] a lazy-seq?
01:19johnmn3but I see what you're saying about not partitioning for reducers
01:20_atogf3: 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". :-)
01:21_atoif you'd like to talk through any of your ideas first, happy to do that too
01:21gf3_ato: Woohoo, thanks
01:23xeqigf3, _ato: looks better to me
01:23xeqiI'm all for a facelift
01:24amalloy[1 2 3 4] is certainly not lazy. it's a vector
01:24johnmn3wait, I think I found the secret sauce
01:25johnmn3I was thinking about what you said
01:26johnmn3I 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
01:26johnmn3and times are getting better
01:27gf3xeqi: Awesome, I'll get to work
01:33johnmn3mmmaybe not.. benefits are marginal
01:38johnmn3amalloy: 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%
01:38johnmn3could map be doing some parallelization?
01:38amalloyno
01:39johnmn3,(do (time (let [r 10000000 w 20] (into [] (map #(map inc %) (range r))))) nil)
01:39clojurebotExecution Timed Out
01:40amalloyyou're still not actually timing anything. the inner sequences never get realized
01:40johnmn3on my machine: "Elapsed time: 2785.63046 msecs"
01:40amalloyswitch it to #(doall (map ...)) if you want to use the same timing
01:40johnmn3what's taking 3 seconds then?
01:40amalloyjust allocating memory for all those lazy sequences
01:42amalloyalso you're calling (map inc 0), (map inc 1)... so this should crash as soon as you make my change
01:42johnmn3well, for r/map: (doall (into [] (r/map ... ?
01:43amalloyno, because dumping it into a vector is already doing all the work
01:43johnmn3test=> (do (time (let [r 10000000 w 20] (doall (map #(map inc %) (range r))))) nil) "Elapsed time: 2936.540497 msecs"
01:44amalloyno, you need the doall inside the lambda
01:44johnmn3oh
01:44johnmn3(and I guess w is not being used their)
01:44amalloyand 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
01:49johnmn3so, is there a better way to parallelize inc across a collection?
01:49amalloyinc is not expensive. don't parallelize it
01:51arohnerso 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?
01:51arohnerbut I do have 1.4 in my lib/dev directory. strange.
02:07johnmn3amalloy: I was spending all my time chunkifying
04:01kilonanyone knows how to install leiningen in windows 7, the main instructions fail
04:01kilon$ lein install
04:01kilonls: /c/Users/exloupis/leiningen/leininge
04:01kilonLeiningen is missing its dependencies.
04:01kilonPlease see "Building" in the README.
04:02michaelr525looks like you are running it in cygwin?
04:02michaelr525isn't it lein self-install?
04:03kiloni am running it in git bash
04:03kilonthe official git terminal
04:04kilonhere it says lein install ---> https://github.com/technomancy/leiningen
04:04kilonlein self-install fails with the same error
04:04michaelr525you are reading the building instructions
04:04kilonsame error when i do just lein
04:05michaelr525kilon: read from the top of the page under 'Installation'
04:05kilonoh , i missed wget
04:07kilonmichaelr525: i have added leiningen to my paths and install curl inside leiningen, will that be a problem ?
04:07michaelr525i think it's ok
04:08kilonmichaelr525: should i assume wget setup wizards adds it to my paths ?
04:08michaelr525i don't know
04:08kilonok thanks for yor help
04:08michaelr525you can test it by running wget from the command line
04:09michaelr525np
04:09kilonno its not :(
04:12ivandid you open a new shell?
04:12ivan(if the installer did indeed change the Path)
04:14kilonivan: yeap opened new shell after i installed wget after i added to my paths, still getting the same error :(
04:15kiloni am using git bash terminal
04:15kilonstandrad git gui
04:15ivantry using the normal cmd and putting wget into the same directory
04:15kiloni got also latest jdk installed
04:15kilonok
04:16kilonnormal command , reports the same error diffirently
04:16kilonit still complains that lein is missing its dependencies
04:17michaelr525kilon: you should run 'lein self-install'
04:17michaelr525not lein install
04:17kilonanother problem
04:17kilonfor some reason command does not let me cd into the leiningen directory
04:18kilonmichaelr525: i should not need to install in the first place, building is unecessary for 1.x
04:19kiloni only tried just "lein" in command
04:19kiloni cannot try lein install or self-install as it does not let me get in the directory
04:19kilonmaybe a git problem i dont know
04:19kilonI love windoom its so fun :D
04:20michaelr525kilon: why don't you just follow the instructions?
04:21kilonmichaelr525: thats what i did , it does not work
04:21ivanwhy can't you cd into the directory?
04:21ivando you know how msys and cmd treat paths differently?
04:22kilonmichaelr525: i am stupid, it works now
04:22kilonsorry guys
04:23michaelr525oh cool, i'm glad it works for you :)
04:23kilonhmm still problems
04:24kilonit seem self-install worked
04:24kilonit downloaded a leiningen standalone.jar
04:24kilonbut when i try lein repl, it still complains for missing dependencies
04:27michaelr525can you paste it here?
04:27kiloni think i know what is wrong
04:28kilonit create a .lein which i need to add to my paths
04:30kiloni am confused
04:30kilon:D
04:31kilonok i give up , path adding did not work
04:31kilonmichaelr525: what you want me to paste ? the result of self-install ?
04:32michaelr525kilon: I think you should either use Windows or Cygwin, this will make it easier for you.
04:32kilonmichaelr525: by windows you mean command terminal ?
04:33michaelr525cmd.exe
04:33kiloni dont use git terminal , just cmd.exe
04:33michaelr525ah, ok
04:33kilonafter your recomendation
04:33michaelr525so you are running lein.bat?
04:33kiloni got cygwin as well, but it got problems with git so
04:33kilonyes lein.bat comes with the leiningen repo
04:34kiloni have added the repo to my path
04:34kilonit can see the bat that is why it complains for missing deps
04:34kilonor else it wont run at all
04:35kilonmichaelr525: ^
04:36michaelr525what does it print when you run lein.bat?
04:37kilonleiningen is missing its dependencies. Please see "Building" in README
04:37michaelr525did you clone the whole repository?
04:38michaelr525if so I think you are trying to run version 2.0
04:38michaelr525maybe you should try version 1.7
04:39michaelr525(which is linked from the installation instructions)
04:39kilonmichaelr525: i dont know what "whole" means i just did "git clone https://github.com/technomancy/leiningen.git&quot;
04:39kiloni am nooby with git so excuse my ignorance
04:39ivanwhy are you cloning the repo?
04:39kilonand lein / clj of course
04:39kilonivan: it workes in macos so i assumed it will work in windows as well
04:40kilonhad no issues there installing lein and clojure and even setuping it for emacs with its swank
04:40kilondo i need to delete everything and just keep the bat ?
04:41ivanI have success using just the bat
04:41kilonok
04:41ivanand wget
04:41kilontrying
04:46kilonbingo
04:46kilonit works
04:47kilonlein repl works
04:47kilonthanks ivan
04:47kilonany idea how to exit repl ?
04:48kilonthanks michaelr525 too of course
04:48ivanctrl-c or ctrl-d
04:48kilonctrl-d work, ctrl-c did not, nice
04:49KIMAvcrpctrl-c ctrl-c does word too
04:49ivanon Windows EOF is ctrl-z enter
04:49kilonmay i ask something ? so its not necessary to clone either clojure or lein repos
04:49kilonall i need is the lein.bat
04:49kiloncorrect ?
04:49ivanright
04:49kilonok , my bad, i made my life way more difficult than it needed to be
04:49kilon:D
05:39tomojwhy isn't Associative a protocol?
06:44raekmarmalade is up again!
07:32kilonwhen 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
07:32kilonis this a bug in clojure-mode ?
07:33gfrederickskilon: you have the swank-clojure plugin installed?
07:33kilongood question
07:34kiloni think i dont
07:34kilonany idea how to install it with lein 2 ?
07:34kilonI am confused with the install instructions i am reading
07:34kilonapparently lein 2 has changed the plugin system
07:35babilenkilon: See https://github.com/technomancy/swank-clojure for details.
07:35kilonand i must insert the dependency in somewhere in the user profile plugins
07:35kilonbabilen: tried that one, did not work
07:36kilonone sec to paste the error
07:36babilenkilon: 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" ?
07:37kilondamn
07:37kilonme being stupid again
07:37kilonit must go inside {}
07:38borkdudekilon you can also just put in in the project.clj instead of profiles.clj
07:39borkdude:plugins [[lein-swank "1.4.4"]] in project.clj
07:39kilonok sec because i am confused
07:39kilonthis is my project.clj
07:39kilon(defproject test "0.1.0-SNAPSHOT"
07:39kilon :description "FIXME: write description"
07:39kilon :url "http://example.com/FIXME&quot;
07:39kilon :license {:name "Eclipse Public License"
07:39kilon :url "http://www.eclipse.org/legal/epl-v10.html&quot;
07:39kilon }
07:39kilon :dependencies [[org.clojure/clojure "1.3.0"]])
07:40kilonwhere will i put {:user {:plugins [[lein-swank "1.4.4"]]} ?
07:40coventry`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?
07:40borkdudeif you didn't add it to profiles.clj, you can add the line :plugins [[lein-swank "1.4.4"]] after the dependencies
07:40babilenborkdude: 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.
07:40kiloni tried it that before and did not work borkdude
07:41borkdudekilon but then swank will only work for that project, not automatically for all
07:41kilonbabilen: where should i put it then ?
07:41borkdudebabilen there are reasons why you would want that, for example the leiningen plugin in eclipse currently doesn't work good with profiles.clj
07:41kilonoh sorry
07:41babilenborkdude: Ah, ok. I don't use eclipse and are therefore not familiar with its brokenness.
07:41kilonyou said profile.clj
07:42babilenkilon: As I said earlier: In ~/.lein/profiles.clj
07:42kilonbabilen: i got no such file in my .lein dire
07:43kilonhow i create it ?
07:43borkdudekilon creat it using a text editor (emacs??) and put this in it: {:user {:plugins [[lein-swank "1.4.4"]]}
07:44kilonok and profiles.clj will contain only that line ?
07:44borkdudekilon you can add more later
07:45babilenkilon: A discussion of profiles for leiningen2 can be found in the upgrade guide on https://github.com/technomancy/leiningen/wiki/Upgrading btw
07:45kilonstill getting the error
07:46babilenkilon: Could you paste it to a pastebin (such as http://refheap.com) please?
07:46kiloni have created profiles.clj and added that line
07:46kilonrebooted emacs, M-x clojure-jack-in gives me the error
07:46kilonone sec to pastebin it
07:47babilenkilon: What does "lein2 help" give you when you run it on the command line? Did you install the plugin already?
07:48kilonbabilen: http://pastebin.com/K5XezsEg
07:48borkdudebabilen no need to install in lein2
07:48kiloni have no lein2
07:48babilenkilon: Err -- That assumes that you use lein2 as the script name. Make that "lein" if your "lein" is, in fact, lein2
07:48babilenborkdude: Yeah, just realised my mistake.
07:48kilonmy leiningen 2 is just "lein"
07:48kilonah ok
07:49kilonwhere do i find the error to correct this ?
07:49borkdudeah wait… kilon can you try to start a swank server manually in the project?
07:49borkdudekilon so from the project dir type in a cmd prompt: "lein swank"
07:49babilenkilon: Did you download/install the plugin already? What does "lein help" give you?
07:50borkdudebabilen I think clojure-jack-in does not force the deps to be downloaded
07:50kilonborkdude: it gives me an error , lein swnk
07:50borkdudebabilen but just "lein swank" will
07:50kilon*lein swank
07:50borkdudekilon what error?
07:50babilenborkdude: Yeah, that is my suspicion as well. ("lein help" should download it too)
07:50borkdudekilon also: what is your leiningen version? (type "lein version")
07:50kilonits leiningen 2 borkdude
07:51kiloni have checked it with lein version
07:51borkdudegood. so what error does "lein swank" give
07:51babilenkilon: Please, may we actually see the output of "lein help", "lein version" and "lein swank" ?
07:51kilonoh what the hell
07:51kilonoh oh
07:51babilenHmm?
07:52kiloni think your profiles.clj broke my lein :D
07:52babilenkilon: Ok, please run "cat ~/.lein/profiles.clj" and the commands that have been mentioned earlier and show us the output of http://refheap.com
07:53kilonone sec guys , this is the error i am getting for any lein command i try
07:54kilonhttp://pastebin.com/p0tepmVP
07:54kilonbabilen: cat will work with win 7 command tool ?
07:54borkdudekilon no
07:55borkdudekilon "type" will
07:55borkdudekilon cmd prompt>type %USERPROFILE%/.lein/profiles.clj
07:56kilon{:user {:plugins [[lein-swank "1.4.4"]]}
07:56kilonwhich is what you told me to paste
07:56babilenkilon: That should have been "{:user {:plugins [[lein-swank "1.4.4"]]}}" (note the two }} at the end)
07:56kilondamn
07:57kilonanother stupid mistake
07:57kiloni admire your patience :D
07:57babilenkilon: Sorry, should have seen that earlier and checked twice.
07:57borkdude:-)
07:58kiloni suck you apologize, man this community rocks !!!
07:58babilenkilon: Is it working now?
07:59kilonyes yes YEEEEESSSSS
07:59kilontrying emacs
07:59kilonaaaaaaahhhh
07:59kilonstill reports an error
07:59kilonwell typing "lein" did downloaded swang
08:00kilonhmm
08:00borkdudetype "%USERPROFILE%/.lein/profiles.clj" was actually the correct cmd, but not needed anymore
08:00kilontyping "lein swang" it asks me for a project.clj is that normal ?
08:00borkdudekilon can you start lein swank (with a k) IN a project?
08:01kilonhow i do that
08:01borkdudekilon yes, that is normal, because you can only start it from a project
08:01kilonyou mean from inside emacs ?
08:01borkdudekilon make a new project somewhere
08:01kilonyes i got already a project
08:01kilonlet me try from emacs
08:02borkdudekilon for example: cmd>mkdir \temp, followed by cd \temp, followed by "lein new foo", then cd \temp\foo, then lein swank ;)
08:02kilonoh you mean swank from inside my project folder
08:02kilonWAIT
08:02kilonWAIT
08:02kilonemacs WORKS!!!
08:02borkdudeno!!!!
08:02kilonYEAAAAHHHHHH
08:02borkdudeit works?
08:02kilonyeap
08:03borkdudeYEAHS!
08:03borkdude;)
08:03ro_stwell done :)
08:03kilonit just needed to load the project.clh
08:03ro_stthe easy part is over
08:03kilon:D
08:03kiloni am confused
08:03ro_sti'm about 3 weeks in, now. i almost never refer to my 5 hand-written keybinding post-it notes, now
08:03borkdudekilon you need to start clojure-jack-in from a buffer that is visiting a file in your project
08:03kilonshould it not the profiles.clj made the whole procedure non dependant on project.clj ?
08:03borkdudekilon else it doesn't know which project you want to connect to
08:04kilonor am i missing something here ?
08:04borkdudekilon if you have the plugin specified in profiles.clj you don't have to specify it in project.clj anymore
08:04kilonok
08:04kilonbut i still need a project.clj , right ?
08:04babilenkilon: 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.
08:05borkdudekilon yes, for every project
08:05kilonbabilen: yes i know, i have tried it , but i meant in emacs for slime
08:05kilonok project.clj required is no problem for me
08:05kilona huge thank you to all of you guys
08:06ro_stkilon
08:06kiloni habe no idea why it was dead easy for me to do all these things in macos and so difficult on windows :D
08:06ro_stcheck this out: https://github.com/overtone/live-coding-emacs
08:06babilenkilon: You mean: How to get a clojure repl (like the nrepl "lein repl" gives you) in emacs?
08:06kilonbabilen: no i mean how to get a slime repl in emacs
08:06borkdudekilon it's not so different in windows and mac osx
08:07babilenkilon: Windows might not be an optimal development platform ;)
08:07kilonborkdude: its not but i failed because a) failed to read instructions carefully b) i assumed its diffirent
08:07ro_sti redid my emacs config with this as a starting point. this, plus: clojure-swank, linum (line numbers, markdown-mode, maxframe (for maximising the window)
08:07babilenkilon: I honestly have no idea how to get a slime repl in emacs that is not connected to a project.
08:08kilonro_st: my emacs setup folder contain loads and loads of fancy too including live codie, browsers, colored parentheses and many more
08:08coventry`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
08:08kilonbabilen: no probemo mate, i am 100% satisfied with your help
08:09ro_stoh dear. they refactored it. i'm going to have to redo my config again. https://github.com/overtone/emacs-live
08:09kilonro_st: not that i know how to ues live-coding yet :D
08:09borkdudekilon 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
08:10borkdudekilon that is in emacs
08:10ro_stkilon: it's just a bundled set of emacs addons that constitute a great clojure dev env
08:10borkdudekilon with lein repl you can just spin up a repl from wherever
08:10kilonborkdude: inferior-clojure or superior ?
08:10borkdudekilon slime
08:10borkdudekilon it's just a nonsense project, but good for starting a slime repl only ;)
08:11kilonro_st: this is my setup -> http://www.mediafire.com/?ao6fd9zdmcfndnx , care to share yours ?
08:12kilonborkdude: excellent
08:12kilonro_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
08:13kiloni used it for common lisp coding
08:13ro_stkilon: i'm going to re do it using emacs-live. i use solarized-dark
08:13ro_sti'd be happy to share mine once i've got it redone :-)
08:14ro_sti recently switched to PT Mono for my coding font. it's awesome
08:14kilonro_st: ah my setup is based on emacs-live i think
08:15ro_sti'll grab yours, then Kilon. reading through the emacs-live-coding was most instructive
08:15kilonyeah that must be the one
08:15kiloneven our colors are the same
08:15kiloni have not changed much, only made it work
08:15ro_sti really love using ace-jump. amazing how quickly i became dependent on it
08:16kilonwhat i love is the quick find of files
08:16kilonyou just backspace and take you to the paren folder
08:16kilonand autocompletes all paths
08:16kilonextremely handy
08:16ro_styup. it all takes a bit of getting used to, but it's worth it
08:16kilonit took me zero time to get used to it
08:17kilonits even better than using a gui browser
08:17kilonits awesome
08:17kilonhmm no mine has alot more files in it
08:18kiloni suspect i fetched from a dude that use emacs-live as a template for his setup
08:18kilonyeap now i remember
08:18kilonso its not just emacs-live it contains a lot more
08:18borkdudeemacs setups spread like virusses, you don't know where they came from? ;)
08:22kralhola
08:22kilonro_st: oh wait my setup is this https://github.com/overtone/live-coding-emacs
08:22ro_styup, mine too
08:22kilonthat means i need to upgrade to emacs-live ?
08:22ro_stnope, you don't need to
08:23kilonis it better in some way ?
08:23coventry`OK, problem solved. It helps to create projects with "lein new." :-)
08:23ro_sti am because i want the improved organisation that emacs-live provides
08:23kilonplease do tell
08:23kilon:D
08:23kiloni love improvements :D
08:23borkdudeI hate improvements
08:24kralI forked my emacs setup from overtone too
08:24kralbut I changed it a little
08:24kralfor my daily work
08:25kilonok i think i will learn a bit more emacs because i realised how nooby i am with it anyway
08:25kilonand change anything
08:25kilon*and then
08:25kralhttps://github.com/mdallastella/kral-emacs
08:25kiloni am quite happy with my setup as it is
08:26kilonkraft: watched ;)
08:27kilonnext question should i assume the same clojure-swank will work for clojurescript as well ?
08:36solussdjust 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?
08:45vijaykiransolussd: in your ~/.lein/profiles.clj add lein-swank 1.4.4 as user plugins
08:45vijaykiransolussd: and start clojure-jack-in as usual
08:45solussdthanks
08:45vijaykiransolussd: see : https://github.com/technomancy/swank-clojure
08:46solussdthanks- got it working. emacs live is pretty
08:56kilonis 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 ?
08:57ejacksonkilon: sadly its not as easy as that
08:57kilonejackson: what am i missing ?
08:57ejacksonquite a bit of pain, unfortunately
08:58bobryargh, google style of documenting thing is driving me nuts %)
08:58ejacksonyou either have to AOT your classes, which is helluva tricky
08:58ejacksonor use the RT.* interop, which can be messy
08:58bobrynot sure it's even possible to write a client side app using 'goog.ui' in cljs :/
08:58ejacksonbobry: yes you can
08:58spjtI was watching one of Rich Hickey's podcasts last night. Two things I noticed he didn't use were SLIME and Paredit mode
08:59ejacksonbobry: here's a basic example: http://boss-level.com/?p=102
08:59bobryejackson: yup, seen that one -- the bad thing is, it's too basic for what I'm after
08:59ejacksonkilon: I suggest you cemerick's book, the chapter on interop is great
09:00kilonejackson: no idea what you just talked about about, but that book is noted
09:00ejacksonbobry: i must confess, more more complex UI, I just jayq and the 'normal' stuff
09:00bobryejackson: normal stuff? jquery.ui and the like you mean?
09:00spjtejackson: have you used seesaw
09:00ejacksonyeah, I use kendo, but whatever
09:01spjtoh nevermind
09:01ejacksonnope, not tried it out yet
09:01bobryi ended up wrapping 'goog.ui' in seesaw-like api
09:01bobrybut it's still horrible :/
09:01ejacksonalas !
09:01kilonejackson: your link is clojurescript , i did not mention clojurescript
09:01kilonoh sorry
09:01kilonit was for bobry
09:01kilon:D
09:02bobryejackson: do you have an open source example of a more complex UI with cljs?
09:02ejacksonnot on hand
09:02ejacksonand I'm only starting out with this stuff myself
09:02bobryah, good examples is what's missing in cljs world, that's for sure
09:03TimMckilon: 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.
09:03bobryanyone can write a hello world in cljs in no time, but doing something less trivial is hard to figure out
09:04kilonTimMc: so that means their types wont agree .... strange because AFAIK jython wraps python types to java types
09:04kilonand since clojure can use java types , i assumed it should be a no problem
09:05foxdonutbobry: does clojurescript one help? http://clojurescriptone.com/
09:06bobryfoxdonut: not really, it only confused me more -- I wish I've started from scratch :)
09:06ejacksonbobry - have you seen the UI that granger made for overtone ?
09:06ejacksonusing his stack - its nice
09:07foxdonutthat was jquery as well
09:07ejacksonyup
09:07bobryyup, I've tried using 'waltz', but again, it doesn't fit well for my case
09:07foxdonutbobry: why would it not be possible to use goog.ui with cljs?
09:08bobryit *is* possible, but goog.ui is poorly documented and enforces a very Java-ish style of doing things
09:08bobrywhich is hard to do in cljs
09:09foxdonutbobry: so it's possible, but painful from an api point of view?
09:09bobrytry writing your own widget :)
09:09bobryuhuh
09:10foxdonutI see
09:10foxdonutwell, what can we do, goog.ui doesn't care to be cljs-friendly :(
09:10bobryfor 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
09:25Chiron_Hi! any difference between moustache and compojure?
09:26foxdonutyes
09:27kilonso clj and java dont mix so well :| thats weird
09:27foxdonutChiron_: see https://github.com/cgrand/moustache and https://github.com/weavejester/compojure for details.
09:28Chiron_foxdonut: I did. both are DSL
09:28kilonand its left up to the clj coder to map and create the java type in his clj code
09:28kilon*types
09:29kilonif i am understanding this correctly http://clojure.org/java_interop
09:29kiloncertainly does not look as automagical as jython
09:30kilonbut i guess i would not mind doing some "cooking" around
09:30foxdonutChiron_: 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. :-)
09:30duck1123A lot of the clojure types are also the standard java type (eg. string, regex) the rest are pretty compatible
09:30kilonah good to know
09:30kilonI dont mind some extra coding
09:31kilonbut i want to use both clojure and jython side by side
09:40spjtkilon: It is, it's just that the syntax of Java and Lisp are so much more different that they look nothing alike.
09:41kilonspjt: i dont mind that, what i would do mind if i cannot mix clojure with jython
09:43TimMckilon: You can certainly use them side by side, you just may need to do a little bit of API fixup.
09:43duck1123kilon: 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
09:44kilonTimMc: Api Fixup, i hope you dont suggesting me fixing Clojure :D
09:45duck1123What 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
09:45kilonduck1123: 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
09:45kilonah ok
09:45kilonfor a minute i was worried
09:46TimMcYou may end up with some awkward calls to clojure.lang.RT.
09:46kilonyeah sure dont mind wrapping so both jython and clojure feel natural
09:46ejacksonClojure was designed to play well with Java, and does, so it should also with Jython, but its not free
09:48kilonwhat i am trying to avoid is wrapping everything , that could increase the complexity of my code and make it look ugly
09:48kilonif i can get jython and clojure functions to call each other i am fine
09:48kiloni dont need any big sophistication here
09:49ejacksonkilon: you wouldn't happen to know the status of NumPy/SciPy etc on Jython would you ?
09:49S11001001kilon: a basic understanding of how to write HOFs in both should be sufficient to scrap most of your boilerplate
09:49S11001001too bad HOFs are annoying to write in python, but there you go
09:49kilonejackson: not rally, but i do no that ctypes do work okish on jython so you may be able to use numpy this way
09:50ejacksontnx
09:50duck1123I'm assuming that clojure's fns and jythons fns don't share the same base type. (except for maybe Runnable)
09:54kilonejackson: from my search it appears that numpy is not yet ported to jython
09:55ejacksonoh thanks, I was just curious
09:56kilonduck1123: 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
09:56coventryI'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.
09:56kilonin python you can even reference function objects
09:56kilonb = a()
09:56kilonb()
09:57kilonsorry my bad i meant , b = a , b()
09:57kilonassuming a()
09:57S11001001kilon: function is as function does. if it looks like a function...
09:58foxdonutpython has nothing on clojure when it comes to FP. ;)
09:58kilonS11001001: cant say i know how fucntions work in lisp in low level
09:58duck1123kilon: 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
09:58kilonactually my claim is that python function are not functions at all :D
09:58S11001001kilon: 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
09:59S11001001and the same is true for python
09:59S11001001I feel silly about this debate now, so thanks
09:59kilonok
09:59kilonbut its not implied, i think java methods are just functions , they are not objects
09:59duck1123for reference: http://www.jython.org/javadoc/org/python/modules/jffi/Function.html
10:00coventryDo sldb-step or sldb-next ("s" and "x" in the sldb buffer) do the right thing for anyone else?
10:00kilonyeah jython follows the same model as cpython
10:01kiloni did not know that in clojure functions are also objects
10:02kilonand it was not my intention to debate anything, i am too new to clojure to start an debate :D
10:03coventry(use 'clojure.contrib.trace)
10:03coventryOops, wrong buffer. :-)
10:04S11001001np
10:04kilonlets ban erc :D
10:05S11001001haven't seen an xb from coventry yet, let's wait on that
10:06pepijndevosS11001001: xb?
10:06S11001001pepijndevos: the telltale sign of an erc user is the occasional
10:06S11001001xb
10:06pepijndevoswhy?
10:06clojurebotwhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone
10:07S11001001pepijndevos: because C-x b is the switch-buffer keybinding
10:07pepijndevosah
10:07coventryDoes (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:07S11001001certainly we randomly write shell commands and such into erc buffers too, but xb is the most common symptom
10:08S11001001coventry: how did you add tools.trace?
10:08kilonhehe
10:08pepijndevosDo any VIM users have IRC plugins, or is it just the emacsOS peeps who do that?
10:09coventryOh, I assumed it would be in the standard distribution. I guess I should add it with lein...
10:10S11001001coventry: search.maven.org is useful
10:13matthavenerpepijndevos: there's a swank vim plugin for running the repl
10:14coventryS11001001: thanks, very handy
10:14pepijndevosmatthavener: huh? IRC repl? There is vimclojure as well...
10:15S11001001matthavener: I think pepijndevos is looking for an IRC client unrelated to clojure
10:15matthavenerohh, sorry pepijndevos
10:15pepijndevosS11001001: not even that, just wondering... I'm fine with a GUI.
10:15matthavenermisread your line
10:15matthavenerpepijndevos: if you like "console" irc you might enjoy irssi
10:17ejacksonpepijndevos: have you tried LimeChat ?
10:18pepijndevosejackson: Hi! Yea, that's what I'm using.
10:18ejacksonheya :)
10:18michaelr525i'm using emacs just for the ERC client :)
10:18pepijndevosmichaelr525: And what do you use for Clojure?
10:20ordnungswidrigmichaelr525: +1
10:21pepijndevosejackson: Did you ever manage to get the logic goal working?
10:21llasramIf anyone is using Ragel in a Clojure project: git@github.com:llasram/inet.data.git
10:21llasramer
10:21ejacksonno, I gave up. I'm assuming that because its not relational its not possible
10:22llasramhttps://github.com/llasram/lein-ragel
10:22llasramTHere we go
10:22ejacksoni guess you didn't either ?
10:22llasramStupid clipboard vs selection buffer....
10:22pepijndevosejackson: I'm retty sure it's possible with ckanren, but I can't even remember what we where making.
10:22ejacksonyeah, I'm pretty sure it'll work there
10:22ejacksoni dunno the state of cKanren though
10:23ejacksoni see there isa branch of GH
10:23pepijndevosoh, right, like minfd, right?
10:23ejacksonyeah, exactly
10:23duck1123didn't it become core.logic ?
10:23pepijndevosduck1123: No, ckanren is an extension to minikanren for expressing constraints over finite domains
10:23borkdudeRaynes tnx for Textual I'm happy with it so far
10:24ejacksonduck1123: i don't think its done yet
10:24coventrySo 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:25coventry(I got 0.7.3 from the clojure.tools.trace page at search.maven.org.
10:26ejacksoni see FD-like stuff around https://github.com/clojure/core.logic/blob/cKanren/src/main/clojure/clojure/core/logic.clj#L2057
10:26duck1123try [org.clojure/tools.trace "0.7.3"]
10:26ordnungswidrigis 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:27coventryThanks, duck1123. That works.
10:27ejacksonordnungswidrig: depends on the constraints,
10:27ordnungswidrigthe constraints may involve long running calls to remote systems, though.
10:27ejacksonif they're non-numerical constraints then you should be able to get it to work (I think), with numerical, its gets more complicated
10:28ordnungswidrigejackson: 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:28ordnungswidrigso the numeric issue compiles down to a boolean: i can reach the next stop in time.
10:28ejacksonseems like you're in with a shot
10:29ordnungswidrigsupposed that I constrain the problem space to slots, say like 15-min-intervalls, right?
10:29michaelr525pepijndevos: sublime text
10:30ordnungswidrighmm, or would the "insert position" be a possible result of the goals?
10:31pepijndevosordnungswidrig: Like in functional programming, bind a var to the new list with the position inserted.
10:33ordnungswidrigpepijndevos: 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:34ordnungswidrigpepijndevos: thus, how would I "lift" (fn [x y] (< (abs (- x y)) 2)) into core.logic?
10:34pepijndevosordnungswidrig: *that* os constraint programming over finite domains. So you can't currently express numerical differences with core.logic.
10:34ejacksonordnungswidrig: that's numerical, so its not really yet supported
10:34spjtHow long does it take to learn clojure? It's doing a good job of making me feel dumb.
10:35ordnungswidrigso one can only reason over sequences and maps?
10:35ejacksonspjt: welcome to the club :)
10:35duck1123spjt: Learning Clojure is a series of "A-ha" moments
10:35ejacksonduck1123: interopsed with infinite seqs of DOHs
10:36pepijndevosordnungswidrig: over logical relations really. saying "1 is not 3" is fine, but saying "x is between 1 and 3" is not.
10:37ordnungswidrigpepijndevos: that's fine for my case, I think. I wonder if there is a way to use custom logical relations like, say "<"
10:37spjtI 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:38ordnungswidrigspjt: that's called "recursion" and is a key property of functional programming. *g*
10:38jsabeaudryspjt, How long does it take to learn spanish?
10:38ejacksonordnungswidrig: again is an fd concept
10:38ejackson< is an fd concept, that is
10:39ejacksonin fact.... https://github.com/clojure/core.logic/blob/cKanren/src/main/clojure/clojure/core/logic.clj#L2119
10:39ejacksonhere is her defn
10:39ordnungswidrigejackson: 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:40ejacksonhonestly, I was so nervous I might have said any damn thing :)
10:40spjtjsabeaudry: I probably should have qualified it more. As in, enough to be able to put it on a resume.
10:40ejacksonbut I don't think I said that :)
10:40ordnungswidrigejackson: nevertheless it was the most entertaining talk for me. And I want this shirt!
10:41ejacksonthanks, all I wanted to do was communicate the abstraction, which I think went well enough
10:41ordnungswidrigejackson: what should <=fd-c say to me? Have I to dig into karen?
10:41pepijndevosordnungswidrig: 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:41coventrySo, 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:42uvtcDo Clojure and Leiningen run ok on OpenJDK 7 ? (I've only thus far tried them with openjdk-6.) This is on Debian/Ubuntu.
10:42ejacksonordnungswidrig: the fd is "finite domain"
10:42ordnungswidrigpepijndevos: I understand. However, I think the domain of sorting elements of a list according to a given relation is finite, isn't it?
10:43jsabeaudryspjt, 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:43ordnungswidrigjsabeaudry: *g*
10:43pepijndevosordnungswidrig: I think the zebrao goal defines a goal for relatuve positions in a list, like lefto
10:43uvtcMaybe better to ask: has anyone had any problems with Clojure or Lein running on openjdk-7 ?
10:44coventry"Enough to put it on your resume without losing sleep over it."
10:44ejacksonpepijndevos: that's right, by using the position in the vector
10:44jsabeaudryuvtc, I've used them on openjdk-7 and could not tell the diff with 6 openjdk-6
10:44spjtjsabeaudry: 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:45uvtcjsabeaudry, great. Will give it a shot. Thanks!
10:46jsabeaudryuvtc, and that was on ARM, not sure which platform you are on
10:46ejacksonpepijndevos: that's right, by using the position in the vector
10:46uvtcjsabeaudry, x86_64
10:46uvtcjsabeaudry, so, 64-bit
10:46spjtI'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:47spjtI 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:47coventryspjt: 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:47spjtcoventry: I hit a wall on 4clojure
10:47jsabeaudryI'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:48coventryspjt: Where'd you hit the wall?
10:48spjtjsabeaudry: 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:49ejacksonspjt, i understand, for me its just continual iteration
10:49pepijndevosejackson: Did you meet that guy wearing a capful at 20°? He has plans to implement another logic language in Clojure.
10:49ejacksonpepijndevos: what is a capful ?
10:49ejacksonthe knitted hat ?
10:49spjtcoventry: Finding the maximum value without using max
10:50coventryspjt: 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:50jsabeaudryspjt, 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:50spjthehe, 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:51foxdonutcoming 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:51Bronsa,(reduce > '(1 2 3))
10:51clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Number>
10:51coventryI seem to be having bad luck with my questions. If there's anything I can do to clarify them, please let me know.
10:51Bronsa,(reduce #(if (> % %2) % %2) '(1 2 3))
10:51clojurebot3
10:52pepijndevosejackson: 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:52S11001001,(doc max)
10:52spjtcoventry: It doesn't seem like the problem numbers go in any sort of logical order?
10:52clojurebot"([x] [x y] [x y & more]); Returns the greatest of the nums."
10:52ejacksonpepijndevos: i did meet him, he seemed nice, but I didn't catch his name :(
10:52coventryspjt: they are disordered, but they do generally get more difficult further on.
10:52jsabeaudry,(last (sort [3 2 1])
10:52clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
10:52jsabeaudry,(last (sort [3 2 1]))
10:52clojurebot3
10:53duck1123,(first (sort > [1 2 3]))
10:53clojurebot3
10:53pepijndevosejackson: Gabriel, I believe. I didn't catch *any* name, other than IRC peeps.
10:54S11001001no matter, sort is eager
10:54ejacksonhehe, know the feeling, *so* many ppl
10:54pepijndevosS11001001: hazy sort is cool
10:54pepijndevos*lazy
10:55S11001001well, kind of
10:55coventryspjt: 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:55TimMclazy... sort?
10:55TimMcCan't be properly lazy.
10:56pepijndevosTimMc: not on the input, but on the output: http://pepijndevos.nl/lazy-sorting/index.html
10:56S11001001TimMc: a heap yields a straightforward lazy sort, though as you say it is still strict on input
10:56jsabeaudrycoventry, indeed, also a good way to learn some black magic sometimes ;)
10:56coventryTimMc: Function programming is passe. The world's moving on to clairvoyant programming.
10:56TimMcargh animated background
10:57ordnungswidrigre
10:57duck1123coventry: "Can you halp me debug this. I don't know what I want"
10:57ordnungswidrigsorry, bluescreen. *cough*
10:58pepijndevosTimMc: heh, try IE, it doesn't move there. Does my beautiful wheel bother you? :(
10:58spjtThe hard part of the problem was the way the arguments were passed: (= (__ 1 8 3 4) 8) They're not in any sequence.
10:58TimMcpepijndevos: Yes, I have ADHD.
10:58TimMcI can't block out background stimuli very easily.
10:58ordnungswidrigso, back to the problem. can core.logic sort a list of elements according to a relation?
10:59coventryspjt: Was the solution Bronsa sent a little while ago clear?
11:00uvtcRegarding the Clojure cheatsheet, some of the ones linked to from http://jafingerhut.github.com/ have tooltips as well. Which is nice.
11:00ejacksonordnungswidrig: i wouldn't think so
11:00spjtcoventry: It helped.
11:00ejacksonalthough if the cKanren stuff is further than I think, then yes
11:00spjt,((fn [& s] (last (sort s))) 1 8 3 4)
11:00clojurebot8
11:00pepijndevosTimMc: I had it blurred before, but people said they liked it better sharp. Maybe I should add a kill switch or readability button.
11:00foxdonutpepijndevos: your page feels like a test to see if I can read code despite a bunch of noise and distraction.. :/
11:01uvtcclojurebot cheatsheet?
11:01ordnungswidrigejackson: so I need to understand the Kanren stuff, right *g*
11:01ejacksonthere is no escape!
11:01foxdonutconclusion: like TimMc, I cannot.
11:01ordnungswidrigpoor little me!
11:01coventryspjt: Yeah, that one's not so good, though, because sort is n*log(n). Bronsa's was better (the one using reduce.
11:02S11001001pepijndevos: sorry, gotta agree with the majority here; for me, the sidebar even spills unscrollably off the right side
11:02pepijndevosS11001001: what?
11:02uvtc~cheatsheet
11:02clojurebotCool story bro.
11:03foxdonutcoventry: manager: "Team, start coding! Meanwhile, I'll go ask the customer what they want."
11:03uvtcclojurebot should know about http://jafingerhut.github.com/
11:03pepijndevosS11001001: can you screenshot what you mean?
11:03ejacksonfoxdonut: aah yes...
11:03coventryuvtc: Thanks, that'll be handy.
11:04uvtccoventry, yw. Though, I don't know how to teach clojurebot things.
11:04foxdonutejackson: an all-too-familiar scene? :)
11:04pepijndevosordnungswidrig: I think you *can* sort a list, but not based on a numerical relation.
11:05ejacksonoh yes, surely *an* answer is always superior to the correct one, right.... right ?
11:05ordnungswidrigpepijndevos: hmmm, which kind of relation then?
11:06spjtcoventry: I can't figure out how to do it in the form of the problem.
11:06uvtc~cheatsheet is <reply> Cheatsheets with tooltips can be found at http://jafingerhut.github.com/ .
11:06clojurebot'Sea, mhuise.
11:06uvtc~cheatsheet
11:06clojurebotCheatsheets with tooltips can be found at http://jafingerhut.github.com/ .
11:06spjt,((fn [& s](reduce #(if (% > %2) % %2) s)) 1 8 3 4)
11:06clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
11:07pepijndevosordnungswidrig: dunno, can't think of anything that you could sort by.
11:07spjt90% of the code I write ends up with that exact error :)
11:07ordnungswidrigspjt: it's (< 1 2) not (1 < 2)
11:07spjtha
11:07spjtso close.
11:08ordnungswidrigpepijndevos: that means, core.logic can only make use of a special set of relations which are encoded as goeals.
11:08ejacksonordnungswidrig: sorting implies <
11:09ejacksonyou can partition, or filter or such
11:09Chiron_clojurebot: do you like Java?
11:09clojurebot
11:09uvtchahaha
11:09ordnungswidrigejackson: I got the empression that core.logic can work with relations (of any kind)
11:09ordnungswidrigejackson: over a finite domain of values
11:10ejacksonaaah, that's the catch here - cKanren is the extension to finite domains
11:10ordnungswidrigand without ckanren what is the domain?
11:10ejacksonyou can specify it (in my slides I was using membero)
11:11ejacksonas an expensivish hack
11:11ejacksonbut its not the real deal
11:11ejacksonas you can't define a < relation, AFAIK,
11:11ordnungswidrighmm, < is a relation.
11:13ejacksonyes, but its one that's not supported in Kanren
11:13ordnungswidrigah, now I see.
11:13ejacksonbut is in cKanren
11:13ejacksonover defined finite domains
11:15ordnungswidrigthis one.
11:16ordnungswidrigSo what would miniKanren then be good for?
11:16ejacksonwell that's delightful
11:16ejacksonordnungswidrig: anything non-numerical
11:16samaaronactually, I didn't - but said it anyway with poetic motivations
11:17ejacksonthe sort of puzzle like a timetable, or sudoku or zebra etc
11:17ejacksonarrangements of stuff
11:17ejacksonnot based on numerics
11:18ordnungswidrigbut I have an arrangement puzzle! *g*
11:18pepijndevosthere 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:18foxdonutpoetic motivations or not, that's just TMI.
11:18ordnungswidrigpepijndevos: so what are possible constraints? only list relations?
11:18pepijndevosfoxdonut: tmi?
11:20pepijndevosordnungswidrig: basically just if something equals something else or not.
11:20TimMcpepijndevos: Presumably "Too Much Information"
11:20pepijndevosThe 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:22ordnungswidrigpepijndevos: I wanted to avoid encoding the constraints as church numerals.
11:22pepijndevosordnungswidrig: umph, don't do that, unless you want to sit around for days.
11:23ordnungswidrigok, so is the some brain food on ckanren then which points me into the right direction?
11:23foxdonutpepijndevos: too much information.
11:24ordnungswidrighttp://dosync.posterous.com/another-taste-of-ckanren
11:24ordnungswidrigis this supported in core.logic?
11:25pepijndevosordnungswidrig: not as far as I know, though the link ejackson shared seems to suggest it's being implemented.
11:25ejacksonyeah, I think Dave is on it, but even he has to sleep every 3rd night
11:26ordnungswidrigejackson: damn!
11:26ordnungswidrig*g*
11:26ordnungswidrigso the reasonable schemer is the canonical information on kanren?
11:27TimMc*reasoned, surely
11:27TimMcI've never met a reasonable schemer.
11:27samaaronI quite like the idea of a reasonable schemer
11:27ordnungswidrig*doh*
11:27coventryIs 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:28coventry(Something like pdb or gdb.)
11:28TimMccoventry: I've seen it done in Slime, I think...
11:28TimMcIt was some Emacs thingy.
11:29coventryDo 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:29TimMcWhatever it was didn't have return value inspection, so I wasn't too impressed.
11:30TimMcTHat's annoying for imperative languages but inexcusable for functional langs.
11:31coventryYeah, 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:32duck1123I've tried several times to get debugging working for me, and always end up going back to my logging statements and repl
11:33coventrylambdebug and stepl look like they might do what I want.
11:34coventryIs 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:35ordnungswidrigcoventry: 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:35S11001001coventry: writing little functions and repling them takes away most of the need
11:36ordnungswidrigcoventry: and as most functions a free from side effect, you do not need to test in a "live environment"
11:36TimMcIt's still a pain in the ass.
11:37TimMcI'd much rather be able to set a brakpoint, step around, inspect values... *and* have a REPL, etc. :-)
11:37ordnungswidrigTimMc: some times, yes.
11:37coventryWhen I was learning python, my learning rate improved tremendously after I discovered the debugger. It really helps when reading confusing code.
11:38coventryParticularly when you're learning an entirely different way of expressing code (imperative vs functional)
11:39agriffisI'm using lein repl and I want to reload modified sources. Is there an easy way to do that?
11:39duck1123when I see the videos of clojure debugging working, it looks great. I just can't get it to do the same for me.
11:40ordnungswidrigejackson: can't I solve the "sort" problem by using pred or project?
11:41agriffislooks like (use :reload-all 'module.name) works
11:41pepijndevosordnungswidrig: you can project, if your values are already bound, but you lose the reversible property.
11:42ordnungswidrigpepijndevos: what is the reversible property?
11:43pepijndevosordnungswidrig: (+fd 1 2 y) y = 3, but (+fd x 2 3) x = 1 also works
11:43pepijndevoswhen projecting, the latter fails because x is unbound
11:43ordnungswidrigpepijndevos: is it related to fd?
11:44ordnungswidrigpepijndevos: because there is project / pred in the master branch
11:45pepijndevosordnungswidrig: yea, there is even an arithmetic ns which does things the prolog way.
11:45pepijndevoshttps://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic/arithmetic.clj
11:45ordnungswidrigpepijndevos: I see.
11:46pepijndevosordnungswidrig: so they walk the argument, and if it is a concrete value, passes it to the fn, but if it's fresh...
11:46ordnungswidrigpepijndevos: 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:47pepijndevosordnungswidrig: yea, you just can't ask for a list such that r is insertible
11:47ordnungswidrigpepijndevos: seams reasonable
11:48pepijndevosso, pragmatic answer: yes, purist answer: not really
11:48ordnungswidrigis this the difference between datalog and core.logic? I mean, core.logic is generative[sic?] where datalog is constraining?
11:48pepijndevosyes
11:49pepijndevosand datalog is more efficient at that, i've been told.
11:49coventryMeh. 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:49ordnungswidrigthat's due to the missing magic that's included in datomic
11:52pepijndevosit seems to me that with some extra macro sauce, defining projected goals would eb quite a bit easier.
11:54ForSparePartsAre any of you guys in Chicago and going to the ClojureScript Meetup thing tomorrow?
11:56nDuffForSpareParts: ...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:57ForSparePartsnDuff, 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:58nDuffAhh.
11:58ForSparePartsI was able to get a summer programming job as a student, if that tells you anything?
11:59nDuff...tells me there's more than nothing, but I kinda' like the perks that come with having a robust job market.
11:59karchienDuff: I don't know anything personally, but @abedra just moved to Chicago to work for Groupon, which suggests there's at least something.
11:59nDuffHeh.
12:00nDuff...so yes, that's something.
12:01karchie(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:01ForSparePartskarchie, is it not like that where you are?
12:01ForSparePartsEr.
12:02ForSparePartsI read that wrong.
12:02ForSparePartsTo your knowledge, are things more active here in the midwest?
12:04karchieNo 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:07ForSparePartsno 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:08ForSparePartsThat is, I was wondering about opportunities for programming folk in general.
12:13coventryCould 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:14devnmore clojure opportunities are coming
12:14devnit is our destiny...
12:17tesmarhmm 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:17tesmarbut when I try to type package-install clojure-mode
12:18tesmarif I put a space, emacs replaces it with a dash
12:18uvtcdevn, you are prescient and mysterious. I wish to subscribe to your newsletter.
12:18tesmarany idea on how to get emacs to let me type a space?
12:18tesmarwhile in M-x mode?
12:19coventryC-q SPACE
12:19tesmarcoventry: thank you
12:19tesmarnow it says 'no match'
12:20tesmarI have already done the package update
12:20ordnungswidrighmm, what is wrong? (defne sortedo [l] ([(pred l #(= % (sort %)))]))
12:20tesmarwill continue on
12:20tesmarthanks
12:20technoma`tesmar: it means do M-x package-install followed by entering the string "clojure-mode"
12:20ordnungswidrig(run* [q] (== q [1 2 3]) (sortedo q)) returns ()
12:20technoma`M-x package-install is a single command
12:20uvtctesmar, after typing M-x, Emacs is expecting you to type a command without spaces in it. commands-like-this.
12:21uvtctesmar, as technoma` alluded to, if you're trying to use package-install, it's "M-x package-install RET package-name RET".
12:21tesmaruvtc: thank you sir
12:21tesmarand you too technoma`
12:22tesmarTHAT DID IT
12:22uvtctesmar, yw
12:25ordnungswidrigpepijndevos: still online?
12:25pepijndevosyea
12:26ordnungswidrigcan you have a look why above definition of "sortedo" does not work?
12:27pepijndevosordnungswidrig: because pred is for... predicates... wait... what are you trying to do?
12:27ordnungswidrigcheck if a given list is sorted
12:29SurlyFrogDoes Clojure have anything equivalent or similar to Common Lisp's :before, :after, and :around method qualifiers?
12:29pepijndevosordnungswidrig: trying....
12:29TimMcordnungswidrig: By the way, that might not work for unstable sorts...
12:30ordnungswidrigTimMc: i see
12:30ordnungswidrigTimMc: but I have distinct values in my case
12:33pepijndevosordnungswidrig: (defn sorted [l] (is l l sort))
12:33pepijndevosI'm not sure the o postfix should be used, since it's not relational.
12:33ordnungswidrigI see
12:33pepijndevosbut I'm also not sure it should not be used :)
12:36ordnungswidrigis there a way of using is/pred on multiple values?
12:36daviddparkI am trying to eval a string as a symbol. (= :p1 :p1) => true, but (= :p1 (symbol ":p1")) => false. Anyone with insight?
12:36ordnungswidrigsay I have q is [a b c] and I want to check (pred a b) to be true
12:37karchieSurlyFrog: 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:39karchieSurlyFrog: the method qualifiers are really closely tied to inheritance, and I think inheritance is sort of deprecated in Clojure.
12:40pepijndevosordnungswidrig: using the level below it, project: https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic.clj#L1060
12:41pepijndevosIt's macros al the way down
12:41ordnungswidrigpepijndevos: I will try. Thanks for your assistence.
12:41ordnungswidrigcu all
12:42SurlyFrogkarchie: thanks, I think I can probably get what I need by getting creative with metadata.
12:55dnolenraph_amiard: ping
13:28chmllrHello 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:29chmllrIt 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:29dnolenchmllr: .foo is always a method call, you want .-height
13:32chmllrdnolen: thank you so much! Is it different to Java or did I get wrong the clojure.org/java_interop?
13:32dnolenchmllr: it's impossible to differentiate methods and properties in JS, thus the difference.
13:33dnolenchmllr: Clojure on the JVM supports the syntax as well.
13:34chmllrdnolen: ok, I got it, thanks again!
13:36tommy123454321list
13:37dnolencore.logic CLJS zebrao now below 20ms on V8 ... getting tricky to get faster
13:44eggsby:D
13:44eggsbyawesome dnolen
13:47dnoleneggsby: 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:48tommy123454321any online interactive tutorial for clojure?
13:48dnoleneggsby: at that point any further gains would probably come from PersistentHashMap
13:48eggsbydoes cljs leverage js workers yet dnolen ?
13:50dnoleneggsby: no, and I don't imagine it will
13:53brainproxycemerick:
13:53brainproxywhoops, nvm
14:22gfredericksMichael Feathers just spent 45 minutes trolling clojure
14:23S11001001cool
14:23RaynesCool.
14:23RaynesS11001001: Hahaha.
14:23borkdudegfredericks his friend object martin seems to like it though
14:24technoma`heh
14:24borkdudefeather is more into legacy code right? ;)
14:24gfrederickshe even said he thinks it'd be cool to make a haskell->clojure compiler
14:24antares_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:26borkdudegfredericks did he say why he thinks that is cool?
14:30Raynesantares_: Do you get paid to work on all of those projects?
14:31antares_Raynes: well, I developed them all for my work needs
14:31antares_so the answer is technically "no"
14:39gfredericksborkdude: just because he really likes haskell syntax
14:41solussd_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:41solussd_
14:41dnolensolussd_: no but deftype & defrecord can implement interfaces
14:43solussd_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:45dnolensolussd_: make a shared fn they both call out.
14:45dnolensolussd_: or just duplicate the logic if it's trivial.
14:46solussd_dnolen: yeah, but if someone else implements P there is no guarantee their records implements compareable. :/
14:48hiredman*shrug* you don't own java.lang.Comparable, so you cannot dictate how people use it
14:48hiredmanif you want to dictate the comparison, then roll your own
14:50dnolensolussd_: even in CLJS everyone still has to implement IComparable. Tying that to a particular protocol doesn't make much sense to me.
14:50liftdeadtreesAnyone know who runs 4clojure.com? The site is down.
14:50solussd_dnolen: k.. i'll rethink this.. :)
14:51TimMcRaynes: I know you're watching, go restart 4clojure.
14:51TimMcYou can't hide.
14:51tmciverliftdeadtrees: works for me
14:52liftdeadtreesBack up now. Thanks!
14:52tmciverwell, maybe not. Homepage came up but it's VERY slow.
14:54liftdeadtreesWhoops, I spoke too soon. It's still running slow.
14:55dnolengfredericks: so any actual good tidbits from mfeathers presentation?
15:16gfredericksdnolen: it was a decent intro to haskell syntax
15:16zamaterianllpo
15:16gfrederickshe emphasized how easy and natural it is to use function composition and currying together
15:17gfrederickswhich are both syntactic strong points over clojure
15:17borkdudemaybe 4clojure is slow because my class is exercising for their test tomorrow
15:17borkdude:P
15:22borkdudesimple examples read probably nicer in haskell, but overall.. I don't know https://gist.github.com/2830131
15:26amalloywhaaat, 4clojure is running perfectly fast for me, and the cpu usage is at like 5%
15:26amalloyso i dunno how all of you dudes think it's really slow
15:27tmciveramalloy: it was slow for me earlier but seems to be fine now.
15:27gfredericksmaybe the interwebs were slow
15:27matthaveneri was looking at it this morning and it was nice and fast
15:27liftdeadtreesIt 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:27amalloyi was realizing this morning that i haven't had to restart 4clojure for like *weeks*. don't ruin this for me, people
15:28tmciveryour record shall remain untarnished.
15:28amalloyliftdeadtrees: link?
15:28liftdeadtreeshttp://news.ycombinator.com/item?id=4037799 both in the blogpost and the comments
15:31amalloythanks
15:32amalloytraffic 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:14technoma`how is redis as a message queue? I've only used redis briefly, but people seem to like it.
16:15duck1123We 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:15technoma`not bad
16:16technoma`I get the impression it's a bit less robust than rabbit, (no guaranteed delivery) but rabbit is baroque.
16:17duck1123We were also using rabbit as our main queue. I would probably look to rabbit for general queue needs, but redis works too.
16:17technoma`I see there's a redis-mq library for Clojure, but it's brand-new
16:18duck1123Aleph has a pretty good client built in
16:18technoma`the heroku rabbitmq addon is in perpetual beta, probably because rabbit is developed by a competitor to heroku =(
16:31XPheriorCan't find this one in the docs.. In Noir, how do you get the params of an AJAX request inside a defpage?
16:34XPheriorOh, I can do this without AJAX. Nevermind!
17:10rplevyThis is pretty weird: (let [a (Double/NaN)] (= a a))
17:10rplevyfalse!
17:10borkduderplevy NaN is never equal to itself
17:10rplevywhy is that?
17:11TimMcrplevy: So sayeth the IEEE spec.
17:11borkduderplevy by definition: http://en.wikipedia.org/wiki/NaN
17:12S11001001though it does hilariously prevent generic = from being reflexive
17:12TimMc&(let [nan (Double/NaN)] [(> 5 nan) (= 5 nan) (< 5 nan)])
17:12lazybot⇒ [false false false]
17:12rplevyS11001001: that is funny
17:13S11001001better than not being transitive on strings with the digit 0 anyway
17:13TimMcYou can get some weird non-excluded-middle bugs due to that.
17:15ordnungswidrigI genereally treat NaN like an exception. Stop here.
17:16S11001001double space is actually the either nan monad
17:17TimMcS11001001: Pretty sure you're just trollin'.
17:17borkdudethis is also funny:
17:17borkdude,(= #"foo" #"foo")
17:18clojurebotfalse
17:18rplevywtf?
17:18TimMcS11001001: s/space/equals/ ?
17:19S11001001the value space
17:19Bronsa,(.hashCode #"")
17:19clojurebot16023875
17:19Bronsa,(.hashCode #"")
17:19clojurebot12396906
17:19gfredericksdo java regexes only match regular languages?
17:19S11001001category, whatever, where the various operators are morphisms
17:20rplevy&[(not= Double/NaN Double/NaN) (#(not= % %) Double/NaN)]
17:20lazybot⇒ [true false]
17:20TimMcS11001001: Oh, space, not \space.
17:20rplevycan someone explain the above result?
17:21amalloyrplevy: you pass two identical? pointers to the second function
17:21amalloythe first gets two different boxes around the value Double/NaN
17:21TimMcaha
17:21TimMcboxing
17:21rplevyinteresting
17:21amalloy&(.equals Double/NaN Double/NaN)
17:21lazybot⇒ true
17:22amalloyfascinating. whose idea was that
17:22TimMc&[(not= 123456 123456) (#(not= % %) 123456)]
17:22lazybot⇒ [false false]
17:22borkdudeamalloy wth..
17:22borkdude,(doc =)
17:22clojurebot"([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:23amalloyclojure's = probably has a special case for Number objects that's not correct for NaN
17:24amalloyyeah, it calls x.longValue() == y.longValue() rather than x.equals(y)
17:26TimMc&(.longValue Double/NaN)
17:26lazybot⇒ 0
17:27TimMcwelp
17:28gfrederickswait how does .longValue() work for doubles?
17:28gfredericks,(.longValue 3.14)
17:28clojurebot3
17:28gfredericks,(= 3.14 3.15)
17:28clojurebotfalse
17:29hiredman,(.longValue Double/NaN)
17:29clojurebot0
17:29hiredman:|
17:29gfredericks,(= Double/NaN 0.73)
17:29clojurebotfalse
17:30jonaskoelkerwth
17:30jonaskoelkero_O
17:30gfrederickswhy does Double/NaN get dealt with as .longValue but other doubles don't?
17:30gfredericks,(= Double/NaN 0)
17:30clojurebotfalse
17:30metellus,(.doubleValue 0.234)
17:30clojurebot0.234
17:30metellus,(.doubleValue Double/NaN)
17:30clojurebotNaN
17:30jonaskoelker,(= Double/NaN 0N)
17:30clojurebotfalse
17:30chuck_are there any large open source example projects using noir? i'm unsure of how I should structure my project's directories
17:31chuck_it gives me folders for models and views, but where should I put misc helper libraries that I write?
17:35jcrossley3chuck_: why not src/ ?
17:38amalloyoh sorry, it calls doubleValue, not longValue. it calls whatever is appropriate for the type it's checking
17:39amalloychuck_: you could try refheap
17:39amalloyi dunno how large it is but i'm pretty sure Raynes is using noir for it
17:44jonaskoelker(= 1000 1000.0)
17:44jonaskoelker,(= 1000 1000.0)
17:44clojurebotfalse
17:44jonaskoelker,(= 1024 1024.0)
17:44clojurebotfalse
17:44jonaskoelker,(= 1024.0 1024.0)
17:44clojurebottrue
17:45gfredericks,(apply = (repeat 1000000 42))
17:45clojurebottrue
17:48devijversgreetings, I have a question on enlive, it this the right place for that?
18:00DvyjonesHow 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:01amalloy~anyone
18:01clojurebotJust 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:01amalloydevijvers: ^
18:02dnolenDvyjones: fn literals do not have an implicit do. You are invoking the vector as a function.
18:03Dvyjonesdnolen: Ah, so "(map (fn [s] [:li (:cn s)]) my-map)", then? Or is there a better way?
18:04dreishDvyjones: That's good, or you could do (map #(do [:li (:cn %)]) my-map)
18:14devnbut i also prefer to not read the previous comments
18:14devn(map (fn [s] ...) my-map)
18:14amalloyit'd be nicer with a for than a map, which is often the case when you use an anonymous function for map
18:15devnyeah it reminded me of when I've needed to make li elements in the past i guess ive always used a for
18:15amalloy(for [x xs] [:li (:cn x)])
18:15devn^-much preferred
18:18Dvyjonesamalloy: Thanks :)
18:19devijversamalloy: 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:19amalloy(map #(...) ...) is a warning sign that you should probably have used for
18:19amalloydevijvers: dunno why you're asking me specifically; i don't know jack about noir
18:20devijversamalloy: my bad
18:20technoma`amalloy: or partial =)
18:20borkdudemethinks deftemplate is smth of enlive not noir
18:21amalloytechnomancy: juxt!
18:21amalloy(map (juxt (constantly :li) :cn) m)
18:21devni see your juxt, and raise you a comp with an fnil
18:21gfrederickscan't we all just get along?
18:21amalloy(map (comp (partial vector :li) :cn) m)
18:21devngfredericks: 1upsmanship is important
18:23gfredericksdevn: 2upsmanship is important
18:24devijversborkdude: indeed, it's enlive
18:27DvyjonesOk, stupid question of the day #2: How do I get from {:foo "bar" :baz "foobar"} to (([:strong "foo: "] "bar") ([:strong "baz: "] "foobar"))?
18:28Dvyjones(Feel free to just point me at a function. I have no idea where to look right now)
18:29amalloyDvyjones: probably just do the same thing with for?
18:31amalloy&(for [[k v] {:foo "bar" :baz "foobar"}] (list [:strong (str (:name k) ": ")] v))
18:31lazybot⇒ (([:strong ": "] "bar") ([:strong ": "] "foobar"))
18:31Dvyjonesamalloy: Yeah, working on getting the output I want.
18:31DvyjonesOh duh.
18:31DvyjonesSilly me.
18:31Dvyjonesamalloy: Thanks :)
18:32amalloy&(for [[k v] {:foo "bar" :baz "foobar"}] (list [:strong (str (name k) ": ")] v))
18:32lazybot⇒ (([:strong "foo: "] "bar") ([:strong "baz: "] "foobar"))
18:32amalloystupid : characters always sneaking in
18:33y3didoes anyone know if prismatic uses noir
18:41ForSparePartsHey, are any of you guys in Chicago? And if so, are you going to the ClojureScript One meetup tomorrow?
18:42devnim in the general chicago area
18:43devnbut i cant make their meetings when they have them during the week
18:43ForSparePartsCool.
18:43devnwish they'd do a saturday meetup
18:44ForSparePartsThis will be my first one.
18:44devncool!
18:44devn(welcome)
18:44ForSparePartsYep! Hopefully it will be fun and educational!
18:44devnim sure both will be true
18:50davidwongcaHi, sorry, this is a noob question. In Eclipse, how do you just run a Clojure file instead of starting a REPL?
18:58pbostrom_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:59devijverspbostrom_: gotcha, thx
19:00devijverspbostrom_: any idea how to get flash messages to work in compojure?
19:01pbostrom_devijvers: no, don't know what a flash message is
19:37sandboxhi 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:40xeqiI've seen movement towards chesire over the others for json
19:42devnthe benchmarks are pretty convincing
19:42sandboxinteresting
19:43devn(to make me want to switch)
19:43hiredmancheshire is the way and the light
19:43sandboxwhat is the light mean?
19:44RaynesHe was being dramatic.
19:44RaynesCheshire is the library you want to use for parsing JSON.
19:44sandboxokay that makes sense
19:44sandboxwhat about for csvs?
19:44Raynes$google dsantiago clojure-csv
19:44sandboxor generally other data formats?
19:44lazybot[davidsantiago/clojure-csv · GitHub] https://github.com/davidsantiago/clojure-csv
19:44devnhttps://github.com/clojure/data.csv
19:45RaynesOr that, I guess.
19:45TimMcsandbox: You're probably not going to find a good library that purports to cover arbitrary data formats.
19:45sandboxthose are the first ones that show up in a google search for clojure csv parsing
19:45hiredmanI used data.csv one time, it seemed to work
19:46sandboxis 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:47dsantiagoNope, you're just gonna have to think.
19:48sandboxalright or i suppose come back here and ask you all again :). thanks for your help
19:52wei_i have `(def ^:dynamic *some-symbol* true) in my macro. why does ^:dynamic get dropped?
20:04devijversfinally figured out how wrap-flash works: http://clojuredocs.org/ring/ring.middleware.flash/wrap-flash
20:08technoma`sandbox: http://clojuresphere.herokuapp.com will tell you what is most widely used by oss code
20:08TimMcwei_: I'm going to guess that instead of *some-symbol* you have ~(...)
20:08wei_yup
20:08TimMcThere's your problem. The (unquote ...) is getting the meta.
20:08technoma`sandbox: but that's not always helpful since you want something that's biased towards new code
20:08technoma`clojuresphere ranks cheshire 4th for json =(
20:09wei_oh! should I use with-meta then?
20:10TimMcwei_: vary-meta might suit you better.
20:12TimMcwei_: ~(vary-meta ... assoc :dynamic true)
20:13wei_nice. would (with-meta .. {:dynamic true}) work as well?
20:16JorgeBhmm, 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:17TimMcwei_: Only if it's OK to overwrite any existing metadata.
20:17TimMc(Such as when there isn't any!)
20:18TimMcvary-meta on a user-provided symbol (as opposed to a gensym) gives the user more flexibility.
20:18sandboxtechnoma`: thanks that is still helpful
20:19arohnerJorgeB: https://github.com/Raynes/tentacles/blob/master/src/tentacles/core.clj
20:19arohnermake-request
20:19wei_ah, right. thanks for your help
20:19arohnerit's a little gnarly, but it's a real-world use
20:19JorgeBarohner, awesome, I'll take a look in a moment
21:00johnmn3hi
21:00johnmn3what is the clojure paste bin?
21:00TimMcjohnmn3: refheap.com
21:00johnmn3thanks
21:01TimMcIt's not official, but it was made by a member of the community with Clojure in mind...
21:02dnolenwhoa awesome http://www.50ply.com/cljs-bench/
21:02johnmn3TimMc: good enough for me
21:03TimMcdnolen: I wish those graphs were rooted at 0.
21:03TimMcThe 4th one is impossible to read properly.
21:03dnolenTimMc: yeah it's a start tho.
21:04TimMcOoh, I guess it is open source...
21:05dnolenTimMc: yep
21:16dnolenTimMc: actually I think it's better if there's some minimum height - otherwise the benchmarks that aren't really changing are just noisy.
21:16TimMcBoth anchored to zero and minimum range.
21:16TimMcI kind of don't feel like figuring out gnuplot syntax right now.
21:18johnmn3https://www.refheap.com/paste/2922
21:18dnolenTimMc: yeah agree with that.
21:18johnmn3;; Is there a way to do this as a partition?
21:18johnmn3;; Really, I'm looking for the most efficient implementation.
21:23TimMcdnolen: https://github.com/netguy204/cljs-bench/issues/1
21:25johnmn3are those different build numbers at the bottom of the graphs?
21:25amalloygit commits, i assume
21:31coventryIs 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:32TimMcjohnmn3: Do you know about subvec?
21:33mdeboardIs clj-plaza the recommended tool for mucking about with RDF data
21:34mdeboardlooks very dated
21:34mdeboarde.g. https://github.com/duck1123/clj-plaza/blob/1.3/src/plaza/utils.clj
21:35xeqijohnmn3: or cycle?
21:36xeqi&(take 8 (drop 72 (cycle [0 1 2 3 4 5 6 7 8 9])))
21:36lazybot⇒ (2 3 4 5 6 7 8 9)
21:38amalloycoventry: a manual? i doubt it
21:39coventryIt's OK, the git log makes it pretty clear.
21:43johnmn3TimMc: xeqi: I'll look into both of those
21:43johnmn3I'm trying to find the most efficient implementation
21:44coventryHow 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:44johnmn3I'm guessing subvec will be the most efficient?
21:45johnmn3oh, I'm not sure if subvec will work, because I need wrap-around behavior
21:46johnmn3though I suppose using subvec in conjunction with conj'ing on tail items as necessary would still be the most efficient impl.
21:47TimMcOh I see, you want wrapping. Yeah, cycle is good for that.
21:47johnmn3but my intuition is that subvec would be faster than cycle
21:48TimMcjohnmn3: A couple suggestions: 1) Use mod to handle negative indices, 2) specify a radius instead of a window size.
21:48johnmn3I'm dealing with collections 10,000,000 wide
21:49johnmn3how is that different than rem?
21:51johnmn3I'll try both, as one may be faster than the other.
21:52TimMcAh, I see that now.
21:54johnmn3how 'bout this... if relative index is less that 0 or greater than coll size, use current scheme (or cycle). otherwise, use subvec
21:57TimMcjohnmn3: You could also split your window into two parts and concat them.
21:57johnmn3TimMc: Why?
21:57TimMcjohnmn3: You should know that subvec retains a pointer to the original vector, so there's potential for gradual memory leaks.
21:58TimMc(Just like substring!)
21:58johnmn3hmm
21:58johnmn3how do I avoid that?
21:58TimMc(into vec ...) or something
21:58TimMcOh, will your window size ever exceed the size of the collection?
21:59johnmn3the window will wrap around on the right side when it gets to the end
21:59TimMcNo, I mean... will the size of the output collection ever exceed the size of the input collection?
21:59johnmn3but generally, no, the window will always be < size of collection
22:00TimMcBy the way, are you doing some kind of audio processing?
22:00johnmn3oh, no, generally, the output is the same as the input, in size... well.. no, a cellular automaton.
22:00TimMcnice
22:01johnmn3basic two cell, 1d CA
22:01johnmn3two color, I mean
22:01TimMcToroidal, hence the wrapping?
22:01johnmn3I'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:02johnmn3TimMc: since its one dimensional, more like a cylinder
22:02TimMcsure
22:05johnmn3heck yea, this is going to be a lot faster.. going to use subvec whenever not dealing with wrapping cases.
22:05johnmn3(which is most of the time)
22:06TimMcjohnmn3: These subvecs are shortlived, yeah?
22:06TimMcIf they are, no worries.
22:06johnmn3Yea, they're fairly quickly dumped into another vec
22:06johnmn3in fact, no
22:07johnmn3they're fed into the rule machine, which spits out a new element that gets populated into a new vec
22:07johnmn3so, the old subvec should be thrown away
22:07johnmn3(I'm guessing... garbage is a black box to me)
22:08johnmn3(I have little insight into whether something will or will not be garbage collected)
22:09TimMcjohnmn3: 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:11johnmn3right, 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:14johnmn3so I end up just trusting that everything is going to work ;)
22:14TimMcThat usually works.
22:15johnmn3I'm still get bit by "holding on the the head" sometimes. Haven't fully wrapped my head around it.
22:19TimMcjohnmn3: It's just a big linked list, a chain of nodes and arrows.
22:20TimMcIf the only inbound arrow points to the "head", once you drop that... the whole thing unravels.
22:21johnmn3yea, 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:26johnmn3got 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:27johnmn3the most efficient function, that is.
22:30amalloy{4 [-2 2], 5 [-2 4], etc}
22:31xumingmingvwe can't use function repl related function doc, source in clojure-jack-in?
22:32xeqixumingmingv: (use 'clojure.repl)
22:32xumingmingvoh, thanks!
22:32xeqior the keybindings.. I don't remember them offhand
22:33amalloyC-c C-d d and M-. respectively
22:51coventryIs there a convenience function for #(apply concat %)?
23:02eightywhat's a good style guide for clojure?
23:02eightythis is ok: http://dev.clojure.org/display/design/Library+Coding+Standards
23:05amalloycoventry: no
23:12johnmn3amalloy: that's almost good enough, but the input needs to be any given number
23:21johnmn3I'm thinking: (let [x (int (/ n 2))] (if (even? n) [(- x) x] [(- (- x 1)) x]))
23:21johnmn3does that do it?
23:22tmciverjohnmn3: or maybe something like: ##(let [x 5 l (- (int (/ 5 2))) r (+ l x) ] [l r])
23:22lazybot⇒ [-2 3]
23:22tmcivererr, ##(let [x 5 l (- (int (/ x 2))) r (+ l x) ] [l r])
23:22lazybot⇒ [-2 3]
23:25johnmn3tmciver: oooh
23:25johnmn3I like that better
23:34johnmn3hah... looks like that's what I already had... my newer version just complicated it.
23:37coventryamalloy: thanks
23:44digcon9hi! can lein bind to eclipse, so I can execute lein commands from eclipse?
23:46amalloytmciver, johnmn3: (int (/ x 2)) is just (quot x 2)
23:47johnmn3ok
23:55johnmn3getting rid of the cruft in the chunkerator has helped dramatically in focussing on the performance of the various parallelization schemes