2012-05-29
| 00:00 | jblomo | so i substituted partition |
| 00:00 | jblomo | (defn pfn [afn arange awindow](into [] (flatten (pmap #(map afn %) (partition awindow (range 1 arange) ))))) |
| 00:00 | jblomo | #'user/pfn |
| 00:00 | jblomo | user=> (let [_ (time (pfn inc 20000 100))] (println "done")) |
| 00:00 | jblomo | "Elapsed time: 110.872863 msecs" |
| 00:00 | jblomo | you're measuring a lot of things there |
| 00:00 | jblomo | into will do a reduce over the sequence and build up a new datastructure |
| 00:01 | johnmn3 | and without par: (defn non-pfn [afn arange awindow](into [] (flatten (map #(map afn %) (chunkify (range 1 arange) awindow))))) |
| 00:01 | jblomo | what is your end goal? |
| 00:02 | johnmn3 | to test pmap |
| 00:02 | jblomo | to see when it is faster than map? |
| 00:02 | johnmn3 | do you get better results from pmap with larger chunk sizes? |
| 00:02 | johnmn3 | yea |
| 00:03 | emezeske | johnmn3: The pastebin typically used in here is refheap.com |
| 00:03 | jblomo | i don't think you're going to see a big different with inc |
| 00: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. |
| 00:04 | emezeske | johnmn3: Overhead? |
| 00:04 | johnmn3 | for sufficiently long running chunks |
| 00:04 | jblomo | they are not sufficiently long running |
| 00:05 | johnmn3 | well, if it takes 5 seconds to inc a chunk |
| 00:05 | johnmn3 | where's the overhead in inc'ing two chunks? |
| 00:05 | johnmn3 | why should it be 10 seconds? |
| 00:05 | johnmn3 | 5 seconds of overhead? |
| 00:07 | jblomo | https://github.com/jblomo/clojure/blob/pmap-chunking-862/test/clojure/test_clojure/parallel.clj |
| 00:07 | johnmn3 | or with 8 chunks, should that really take 40 seconds on an 8 core machine? |
| 00:07 | emezeske | I ran two expressions on my machine |
| 00:07 | emezeske | (do (time (let [r 20000 w 1000] (pmap #(map inc %) (partition w (range 1 r))))) nil) |
| 00:08 | emezeske | "Elapsed time: 1.091082 msecs" |
| 00:08 | emezeske | (do (time (let [r 20000 w 1] (pmap #(map inc %) (partition w (range 1 r))))) nil) |
| 00:08 | emezeske | "Elapsed time: 0.246553 msecs" |
| 00:09 | jblomo | so with a function that takes 50 msec to run, you can see the difference in completion time |
| 00:10 | emezeske | Oh, I am not realizing the seqs |
| 00:10 | emezeske | There we go |
| 00:11 | emezeske | johnmn3: Vast speedups with large windows on my machine: https://www.refheap.com/paste/2904 |
| 00:13 | johnmn3 | try w 10 |
| 00:13 | johnmn3 | also, try it without pmap |
| 00:16 | johnmn3 | emezeske: yea, you'll notice that map doesn't doo much difference |
| 00:16 | johnmn3 | *do |
| 00:20 | emezeske | I assume that the lazy sequences are not being fully realized |
| 00:20 | johnmn3 | even very large r and w: (do (time (let [r 8000000 w 1000000] (doall (map #(map inc %) (partition w (range r)))))) nil) |
| 00:21 | johnmn3 | '(do (time (let [r 8000000 w 1000000] (doall (map #(map inc %) (partition w (range r)))))) nil) |
| 00:21 | johnmn3 | ,(do (time (let [r 8000000 w 1000000] (doall (map #(map inc %) (partition w (range r)))))) nil) |
| 00:21 | emezeske | I shouldn't even be talking about pmap, I'm no expert. |
| 00:21 | clojurebot | Execution Timed Out |
| 00:21 | johnmn3 | ,(do (time (let [r 800000 w 100000] (doall (map #(map inc %) (partition w (range r)))))) nil) |
| 00:22 | clojurebot | Execution Timed Out |
| 00:22 | johnmn3 | ,(do (time (let [r 80000 w 10000] (doall (map #(map inc %) (partition w (range r)))))) nil) |
| 00:22 | clojurebot | "Elapsed time: 185.699 msecs" |
| 00:22 | johnmn3 | ,(do (time (let [r 80000 w 10000] (doall (map #(pmap inc %) (partition w (range r)))))) nil) |
| 00:22 | clojurebot | "Elapsed time: 212.916 msecs" |
| 00:22 | johnmn3 | ,(do (time (let [r 80000 w 10000] (doall (map #(pmap inc %) (partition w (range r)))))) nil) |
| 00:22 | clojurebot | "Elapsed time: 206.695 msecs" |
| 00:23 | johnmn3 | oh |
| 00:23 | johnmn3 | clojure is parallelizing map automatically |
| 00:24 | johnmn3 | ,(java.util.concurrent.ForkJoinPool.) |
| 00:24 | clojurebot | #<CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: java.util.concurrent.ForkJoinPool, compiling:(NO_SOURCE_PATH:0)> |
| 00:25 | johnmn3 | this revs all eight threads on my i7: |
| 00:25 | johnmn3 | ,(do (time (let [r 80000 w 10000] (doall (map #(map inc %) (partition w (range r)))))) nil) |
| 00:25 | clojurebot | "Elapsed time: 204.183 msecs" |
| 01:07 | gf3 | _ato: Yay |
| 01:07 | _ato | hah :) |
| 01:08 | gf3 | _ato: I suppose that's a "go for it" |
| 01:09 | _ato | yeah... just a sec, replying to email. :p |
| 01:11 | amalloy | johnmn3: you're timing almost nothing |
| 01:12 | johnmn3 | well, if it takes 10 seconds |
| 01:12 | amalloy | (map #(map inc %) xs) returns a lazy seq of lazy seqs |
| 01:12 | amalloy | doall forces the outer one |
| 01:12 | amalloy | but you never force any of the arithmetic ot happen |
| 01:13 | johnmn3 | so how do I parallelize inc over a large collection? |
| 01:13 | amalloy | well, use fold |
| 01:13 | amalloy | assuming you have reducers available |
| 01:13 | johnmn3 | with pmap |
| 01:14 | johnmn3 | would (r/map #(map inc %) xs) constitute a reducer in this case? |
| 01:14 | amalloy | wellll |
| 01:15 | amalloy | yes, but by using lazy-seqs for the second level you're not getting nearly as much benefit from reducers |
| 01:15 | amalloy | but why would you map map-inc? if you just have a single collection |
| 01:16 | johnmn3 | well, its firist a matter of partitioning the collection into chunks |
| 01:16 | johnmn3 | but I was doing that for pmap |
| 01:16 | amalloy | don't partition it for reducers. they do that themselves when folding, if possible |
| 01: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 |
| 01:17 | amalloy | but also if your input is a lazy-seq, rather than something foldable, r/map won't fold |
| 01:17 | johnmn3 | oh |
| 01:18 | johnmn3 | isn't [1 2 3 4] a lazy-seq? |
| 01:19 | johnmn3 | but I see what you're saying about not partitioning for reducers |
| 01: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". :-) |
| 01:21 | _ato | if you'd like to talk through any of your ideas first, happy to do that too |
| 01:21 | gf3 | _ato: Woohoo, thanks |
| 01:23 | xeqi | gf3, _ato: looks better to me |
| 01:23 | xeqi | I'm all for a facelift |
| 01:24 | amalloy | [1 2 3 4] is certainly not lazy. it's a vector |
| 01:24 | johnmn3 | wait, I think I found the secret sauce |
| 01:25 | johnmn3 | I was thinking about what you said |
| 01:26 | johnmn3 | 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 |
| 01:26 | johnmn3 | and times are getting better |
| 01:27 | gf3 | xeqi: Awesome, I'll get to work |
| 01:33 | johnmn3 | mmmaybe not.. benefits are marginal |
| 01:38 | johnmn3 | 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% |
| 01:38 | johnmn3 | could map be doing some parallelization? |
| 01:38 | amalloy | no |
| 01:39 | johnmn3 | ,(do (time (let [r 10000000 w 20] (into [] (map #(map inc %) (range r))))) nil) |
| 01:39 | clojurebot | Execution Timed Out |
| 01:40 | amalloy | you're still not actually timing anything. the inner sequences never get realized |
| 01:40 | johnmn3 | on my machine: "Elapsed time: 2785.63046 msecs" |
| 01:40 | amalloy | switch it to #(doall (map ...)) if you want to use the same timing |
| 01:40 | johnmn3 | what's taking 3 seconds then? |
| 01:40 | amalloy | just allocating memory for all those lazy sequences |
| 01:42 | amalloy | also you're calling (map inc 0), (map inc 1)... so this should crash as soon as you make my change |
| 01:42 | johnmn3 | well, for r/map: (doall (into [] (r/map ... ? |
| 01:43 | amalloy | no, because dumping it into a vector is already doing all the work |
| 01:43 | johnmn3 | test=> (do (time (let [r 10000000 w 20] (doall (map #(map inc %) (range r))))) nil) "Elapsed time: 2936.540497 msecs" |
| 01:44 | amalloy | no, you need the doall inside the lambda |
| 01:44 | johnmn3 | oh |
| 01:44 | johnmn3 | (and I guess w is not being used their) |
| 01: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 |
| 01:49 | johnmn3 | so, is there a better way to parallelize inc across a collection? |
| 01:49 | amalloy | inc is not expensive. don't parallelize it |
| 01: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? |
| 01:51 | arohner | but I do have 1.4 in my lib/dev directory. strange. |
| 02:07 | johnmn3 | amalloy: I was spending all my time chunkifying |
| 04:01 | kilon | anyone knows how to install leiningen in windows 7, the main instructions fail |
| 04:01 | kilon | $ lein install |
| 04:01 | kilon | ls: /c/Users/exloupis/leiningen/leininge |
| 04:01 | kilon | Leiningen is missing its dependencies. |
| 04:01 | kilon | Please see "Building" in the README. |
| 04:02 | michaelr525 | looks like you are running it in cygwin? |
| 04:02 | michaelr525 | isn't it lein self-install? |
| 04:03 | kilon | i am running it in git bash |
| 04:03 | kilon | the official git terminal |
| 04:04 | kilon | here it says lein install ---> https://github.com/technomancy/leiningen |
| 04:04 | kilon | lein self-install fails with the same error |
| 04:04 | michaelr525 | you are reading the building instructions |
| 04:04 | kilon | same error when i do just lein |
| 04:05 | michaelr525 | kilon: read from the top of the page under 'Installation' |
| 04:05 | kilon | oh , i missed wget |
| 04:07 | kilon | michaelr525: i have added leiningen to my paths and install curl inside leiningen, will that be a problem ? |
| 04:07 | michaelr525 | i think it's ok |
| 04:08 | kilon | michaelr525: should i assume wget setup wizards adds it to my paths ? |
| 04:08 | michaelr525 | i don't know |
| 04:08 | kilon | ok thanks for yor help |
| 04:08 | michaelr525 | you can test it by running wget from the command line |
| 04:09 | michaelr525 | np |
| 04:09 | kilon | no its not :( |
| 04:12 | ivan | did you open a new shell? |
| 04:12 | ivan | (if the installer did indeed change the Path) |
| 04:14 | kilon | ivan: yeap opened new shell after i installed wget after i added to my paths, still getting the same error :( |
| 04:15 | kilon | i am using git bash terminal |
| 04:15 | kilon | standrad git gui |
| 04:15 | ivan | try using the normal cmd and putting wget into the same directory |
| 04:15 | kilon | i got also latest jdk installed |
| 04:15 | kilon | ok |
| 04:16 | kilon | normal command , reports the same error diffirently |
| 04:16 | kilon | it still complains that lein is missing its dependencies |
| 04:17 | michaelr525 | kilon: you should run 'lein self-install' |
| 04:17 | michaelr525 | not lein install |
| 04:17 | kilon | another problem |
| 04:17 | kilon | for some reason command does not let me cd into the leiningen directory |
| 04:18 | kilon | michaelr525: i should not need to install in the first place, building is unecessary for 1.x |
| 04:19 | kilon | i only tried just "lein" in command |
| 04:19 | kilon | i cannot try lein install or self-install as it does not let me get in the directory |
| 04:19 | kilon | maybe a git problem i dont know |
| 04:19 | kilon | I love windoom its so fun :D |
| 04:20 | michaelr525 | kilon: why don't you just follow the instructions? |
| 04:21 | kilon | michaelr525: thats what i did , it does not work |
| 04:21 | ivan | why can't you cd into the directory? |
| 04:21 | ivan | do you know how msys and cmd treat paths differently? |
| 04:22 | kilon | michaelr525: i am stupid, it works now |
| 04:22 | kilon | sorry guys |
| 04:23 | michaelr525 | oh cool, i'm glad it works for you :) |
| 04:23 | kilon | hmm still problems |
| 04:24 | kilon | it seem self-install worked |
| 04:24 | kilon | it downloaded a leiningen standalone.jar |
| 04:24 | kilon | but when i try lein repl, it still complains for missing dependencies |
| 04:27 | michaelr525 | can you paste it here? |
| 04:27 | kilon | i think i know what is wrong |
| 04:28 | kilon | it create a .lein which i need to add to my paths |
| 04:30 | kilon | i am confused |
| 04:30 | kilon | :D |
| 04:31 | kilon | ok i give up , path adding did not work |
| 04:31 | kilon | michaelr525: what you want me to paste ? the result of self-install ? |
| 04:32 | michaelr525 | kilon: I think you should either use Windows or Cygwin, this will make it easier for you. |
| 04:32 | kilon | michaelr525: by windows you mean command terminal ? |
| 04:33 | michaelr525 | cmd.exe |
| 04:33 | kilon | i dont use git terminal , just cmd.exe |
| 04:33 | michaelr525 | ah, ok |
| 04:33 | kilon | after your recomendation |
| 04:33 | michaelr525 | so you are running lein.bat? |
| 04:33 | kilon | i got cygwin as well, but it got problems with git so |
| 04:33 | kilon | yes lein.bat comes with the leiningen repo |
| 04:34 | kilon | i have added the repo to my path |
| 04:34 | kilon | it can see the bat that is why it complains for missing deps |
| 04:34 | kilon | or else it wont run at all |
| 04:35 | kilon | michaelr525: ^ |
| 04:36 | michaelr525 | what does it print when you run lein.bat? |
| 04:37 | kilon | leiningen is missing its dependencies. Please see "Building" in README |
| 04:37 | michaelr525 | did you clone the whole repository? |
| 04:38 | michaelr525 | if so I think you are trying to run version 2.0 |
| 04:38 | michaelr525 | maybe you should try version 1.7 |
| 04:39 | michaelr525 | (which is linked from the installation instructions) |
| 04:39 | kilon | michaelr525: i dont know what "whole" means i just did "git clone https://github.com/technomancy/leiningen.git" |
| 04:39 | kilon | i am nooby with git so excuse my ignorance |
| 04:39 | ivan | why are you cloning the repo? |
| 04:39 | kilon | and lein / clj of course |
| 04:39 | kilon | ivan: it workes in macos so i assumed it will work in windows as well |
| 04:40 | kilon | had no issues there installing lein and clojure and even setuping it for emacs with its swank |
| 04:40 | kilon | do i need to delete everything and just keep the bat ? |
| 04:41 | ivan | I have success using just the bat |
| 04:41 | kilon | ok |
| 04:41 | ivan | and wget |
| 04:41 | kilon | trying |
| 04:46 | kilon | bingo |
| 04:46 | kilon | it works |
| 04:47 | kilon | lein repl works |
| 04:47 | kilon | thanks ivan |
| 04:47 | kilon | any idea how to exit repl ? |
| 04:48 | kilon | thanks michaelr525 too of course |
| 04:48 | ivan | ctrl-c or ctrl-d |
| 04:48 | kilon | ctrl-d work, ctrl-c did not, nice |
| 04:49 | KIMAvcrp | ctrl-c ctrl-c does word too |
| 04:49 | ivan | on Windows EOF is ctrl-z enter |
| 04:49 | kilon | may i ask something ? so its not necessary to clone either clojure or lein repos |
| 04:49 | kilon | all i need is the lein.bat |
| 04:49 | kilon | correct ? |
| 04:49 | ivan | right |
| 04:49 | kilon | ok , my bad, i made my life way more difficult than it needed to be |
| 04:49 | kilon | :D |
| 05:39 | tomoj | why isn't Associative a protocol? |
| 06:44 | raek | marmalade is up again! |
| 07: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 |
| 07:32 | kilon | is this a bug in clojure-mode ? |
| 07:33 | gfredericks | kilon: you have the swank-clojure plugin installed? |
| 07:33 | kilon | good question |
| 07:34 | kilon | i think i dont |
| 07:34 | kilon | any idea how to install it with lein 2 ? |
| 07:34 | kilon | I am confused with the install instructions i am reading |
| 07:34 | kilon | apparently lein 2 has changed the plugin system |
| 07:35 | babilen | kilon: See https://github.com/technomancy/swank-clojure for details. |
| 07:35 | kilon | and i must insert the dependency in somewhere in the user profile plugins |
| 07:35 | kilon | babilen: tried that one, did not work |
| 07:36 | kilon | one sec to paste the error |
| 07: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" ? |
| 07:37 | kilon | damn |
| 07:37 | kilon | me being stupid again |
| 07:37 | kilon | it must go inside {} |
| 07:38 | borkdude | kilon you can also just put in in the project.clj instead of profiles.clj |
| 07:39 | borkdude | :plugins [[lein-swank "1.4.4"]] in project.clj |
| 07:39 | kilon | ok sec because i am confused |
| 07:39 | kilon | this is my project.clj |
| 07:39 | kilon | (defproject test "0.1.0-SNAPSHOT" |
| 07:39 | kilon | :description "FIXME: write description" |
| 07:39 | kilon | :url "http://example.com/FIXME" |
| 07:39 | kilon | :license {:name "Eclipse Public License" |
| 07:39 | kilon | :url "http://www.eclipse.org/legal/epl-v10.html" |
| 07:39 | kilon | } |
| 07:39 | kilon | :dependencies [[org.clojure/clojure "1.3.0"]]) |
| 07:40 | kilon | where will i put {:user {:plugins [[lein-swank "1.4.4"]]} ? |
| 07: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? |
| 07: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 |
| 07: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. |
| 07:40 | kilon | i tried it that before and did not work borkdude |
| 07:41 | borkdude | kilon but then swank will only work for that project, not automatically for all |
| 07:41 | kilon | babilen: where should i put it then ? |
| 07: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 |
| 07:41 | kilon | oh sorry |
| 07:41 | babilen | borkdude: Ah, ok. I don't use eclipse and are therefore not familiar with its brokenness. |
| 07:41 | kilon | you said profile.clj |
| 07:42 | babilen | kilon: As I said earlier: In ~/.lein/profiles.clj |
| 07:42 | kilon | babilen: i got no such file in my .lein dire |
| 07:43 | kilon | how i create it ? |
| 07:43 | borkdude | kilon creat it using a text editor (emacs??) and put this in it: {:user {:plugins [[lein-swank "1.4.4"]]} |
| 07:44 | kilon | ok and profiles.clj will contain only that line ? |
| 07:44 | borkdude | kilon you can add more later |
| 07: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 |
| 07:45 | kilon | still getting the error |
| 07:46 | babilen | kilon: Could you paste it to a pastebin (such as http://refheap.com) please? |
| 07:46 | kilon | i have created profiles.clj and added that line |
| 07:46 | kilon | rebooted emacs, M-x clojure-jack-in gives me the error |
| 07:46 | kilon | one sec to pastebin it |
| 07:47 | babilen | kilon: What does "lein2 help" give you when you run it on the command line? Did you install the plugin already? |
| 07:48 | kilon | babilen: http://pastebin.com/K5XezsEg |
| 07:48 | borkdude | babilen no need to install in lein2 |
| 07:48 | kilon | i have no lein2 |
| 07:48 | babilen | kilon: Err -- That assumes that you use lein2 as the script name. Make that "lein" if your "lein" is, in fact, lein2 |
| 07:48 | babilen | borkdude: Yeah, just realised my mistake. |
| 07:48 | kilon | my leiningen 2 is just "lein" |
| 07:48 | kilon | ah ok |
| 07:49 | kilon | where do i find the error to correct this ? |
| 07:49 | borkdude | ah wait… kilon can you try to start a swank server manually in the project? |
| 07:49 | borkdude | kilon so from the project dir type in a cmd prompt: "lein swank" |
| 07:49 | babilen | kilon: Did you download/install the plugin already? What does "lein help" give you? |
| 07:50 | borkdude | babilen I think clojure-jack-in does not force the deps to be downloaded |
| 07:50 | kilon | borkdude: it gives me an error , lein swnk |
| 07:50 | borkdude | babilen but just "lein swank" will |
| 07:50 | kilon | *lein swank |
| 07:50 | borkdude | kilon what error? |
| 07:50 | babilen | borkdude: Yeah, that is my suspicion as well. ("lein help" should download it too) |
| 07:50 | borkdude | kilon also: what is your leiningen version? (type "lein version") |
| 07:50 | kilon | its leiningen 2 borkdude |
| 07:51 | kilon | i have checked it with lein version |
| 07:51 | borkdude | good. so what error does "lein swank" give |
| 07:51 | babilen | kilon: Please, may we actually see the output of "lein help", "lein version" and "lein swank" ? |
| 07:51 | kilon | oh what the hell |
| 07:51 | kilon | oh oh |
| 07:51 | babilen | Hmm? |
| 07:52 | kilon | i think your profiles.clj broke my lein :D |
| 07: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 |
| 07:53 | kilon | one sec guys , this is the error i am getting for any lein command i try |
| 07:54 | kilon | http://pastebin.com/p0tepmVP |
| 07:54 | kilon | babilen: cat will work with win 7 command tool ? |
| 07:54 | borkdude | kilon no |
| 07:55 | borkdude | kilon "type" will |
| 07:55 | borkdude | kilon cmd prompt>type %USERPROFILE%/.lein/profiles.clj |
| 07:56 | kilon | {:user {:plugins [[lein-swank "1.4.4"]]} |
| 07:56 | kilon | which is what you told me to paste |
| 07:56 | babilen | kilon: That should have been "{:user {:plugins [[lein-swank "1.4.4"]]}}" (note the two }} at the end) |
| 07:56 | kilon | damn |
| 07:57 | kilon | another stupid mistake |
| 07:57 | kilon | i admire your patience :D |
| 07:57 | babilen | kilon: Sorry, should have seen that earlier and checked twice. |
| 07:57 | borkdude | :-) |
| 07:58 | kilon | i suck you apologize, man this community rocks !!! |
| 07:58 | babilen | kilon: Is it working now? |
| 07:59 | kilon | yes yes YEEEEESSSSS |
| 07:59 | kilon | trying emacs |
| 07:59 | kilon | aaaaaaahhhh |
| 07:59 | kilon | still reports an error |
| 07:59 | kilon | well typing "lein" did downloaded swang |
| 08:00 | kilon | hmm |
| 08:00 | borkdude | type "%USERPROFILE%/.lein/profiles.clj" was actually the correct cmd, but not needed anymore |
| 08:00 | kilon | typing "lein swang" it asks me for a project.clj is that normal ? |
| 08:00 | borkdude | kilon can you start lein swank (with a k) IN a project? |
| 08:01 | kilon | how i do that |
| 08:01 | borkdude | kilon yes, that is normal, because you can only start it from a project |
| 08:01 | kilon | you mean from inside emacs ? |
| 08:01 | borkdude | kilon make a new project somewhere |
| 08:01 | kilon | yes i got already a project |
| 08:01 | kilon | let me try from emacs |
| 08:02 | borkdude | kilon for example: cmd>mkdir \temp, followed by cd \temp, followed by "lein new foo", then cd \temp\foo, then lein swank ;) |
| 08:02 | kilon | oh you mean swank from inside my project folder |
| 08:02 | kilon | WAIT |
| 08:02 | kilon | WAIT |
| 08:02 | kilon | emacs WORKS!!! |
| 08:02 | borkdude | no!!!! |
| 08:02 | kilon | YEAAAAHHHHHH |
| 08:02 | borkdude | it works? |
| 08:02 | kilon | yeap |
| 08:03 | borkdude | YEAHS! |
| 08:03 | borkdude | ;) |
| 08:03 | ro_st | well done :) |
| 08:03 | kilon | it just needed to load the project.clh |
| 08:03 | ro_st | the easy part is over |
| 08:03 | kilon | :D |
| 08:03 | kilon | i am confused |
| 08:03 | ro_st | i'm about 3 weeks in, now. i almost never refer to my 5 hand-written keybinding post-it notes, now |
| 08:03 | borkdude | kilon you need to start clojure-jack-in from a buffer that is visiting a file in your project |
| 08:03 | kilon | should it not the profiles.clj made the whole procedure non dependant on project.clj ? |
| 08:03 | borkdude | kilon else it doesn't know which project you want to connect to |
| 08:04 | kilon | or am i missing something here ? |
| 08:04 | borkdude | kilon if you have the plugin specified in profiles.clj you don't have to specify it in project.clj anymore |
| 08:04 | kilon | ok |
| 08:04 | kilon | but i still need a project.clj , right ? |
| 08: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. |
| 08:05 | borkdude | kilon yes, for every project |
| 08:05 | kilon | babilen: yes i know, i have tried it , but i meant in emacs for slime |
| 08:05 | kilon | ok project.clj required is no problem for me |
| 08:05 | kilon | a huge thank you to all of you guys |
| 08:06 | ro_st | kilon |
| 08: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 |
| 08:06 | ro_st | check this out: https://github.com/overtone/live-coding-emacs |
| 08:06 | babilen | kilon: You mean: How to get a clojure repl (like the nrepl "lein repl" gives you) in emacs? |
| 08:06 | kilon | babilen: no i mean how to get a slime repl in emacs |
| 08:06 | borkdude | kilon it's not so different in windows and mac osx |
| 08:07 | babilen | kilon: Windows might not be an optimal development platform ;) |
| 08:07 | kilon | borkdude: its not but i failed because a) failed to read instructions carefully b) i assumed its diffirent |
| 08: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) |
| 08:07 | babilen | kilon: I honestly have no idea how to get a slime repl in emacs that is not connected to a project. |
| 08:08 | kilon | ro_st: my emacs setup folder contain loads and loads of fancy too including live codie, browsers, colored parentheses and many more |
| 08: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 |
| 08:08 | kilon | babilen: no probemo mate, i am 100% satisfied with your help |
| 08:09 | ro_st | oh dear. they refactored it. i'm going to have to redo my config again. https://github.com/overtone/emacs-live |
| 08:09 | kilon | ro_st: not that i know how to ues live-coding yet :D |
| 08: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 |
| 08:10 | borkdude | kilon that is in emacs |
| 08:10 | ro_st | kilon: it's just a bundled set of emacs addons that constitute a great clojure dev env |
| 08:10 | borkdude | kilon with lein repl you can just spin up a repl from wherever |
| 08:10 | kilon | borkdude: inferior-clojure or superior ? |
| 08:10 | borkdude | kilon slime |
| 08:10 | borkdude | kilon it's just a nonsense project, but good for starting a slime repl only ;) |
| 08:11 | kilon | ro_st: this is my setup -> http://www.mediafire.com/?ao6fd9zdmcfndnx , care to share yours ? |
| 08:12 | kilon | borkdude: excellent |
| 08:12 | kilon | 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 |
| 08:13 | kilon | i used it for common lisp coding |
| 08:13 | ro_st | kilon: i'm going to re do it using emacs-live. i use solarized-dark |
| 08:13 | ro_st | i'd be happy to share mine once i've got it redone :-) |
| 08:14 | ro_st | i recently switched to PT Mono for my coding font. it's awesome |
| 08:14 | kilon | ro_st: ah my setup is based on emacs-live i think |
| 08:15 | ro_st | i'll grab yours, then Kilon. reading through the emacs-live-coding was most instructive |
| 08:15 | kilon | yeah that must be the one |
| 08:15 | kilon | even our colors are the same |
| 08:15 | kilon | i have not changed much, only made it work |
| 08:15 | ro_st | i really love using ace-jump. amazing how quickly i became dependent on it |
| 08:16 | kilon | what i love is the quick find of files |
| 08:16 | kilon | you just backspace and take you to the paren folder |
| 08:16 | kilon | and autocompletes all paths |
| 08:16 | kilon | extremely handy |
| 08:16 | ro_st | yup. it all takes a bit of getting used to, but it's worth it |
| 08:16 | kilon | it took me zero time to get used to it |
| 08:17 | kilon | its even better than using a gui browser |
| 08:17 | kilon | its awesome |
| 08:17 | kilon | hmm no mine has alot more files in it |
| 08:18 | kilon | i suspect i fetched from a dude that use emacs-live as a template for his setup |
| 08:18 | kilon | yeap now i remember |
| 08:18 | kilon | so its not just emacs-live it contains a lot more |
| 08:18 | borkdude | emacs setups spread like virusses, you don't know where they came from? ;) |
| 08:22 | kral | hola |
| 08:22 | kilon | ro_st: oh wait my setup is this https://github.com/overtone/live-coding-emacs |
| 08:22 | ro_st | yup, mine too |
| 08:22 | kilon | that means i need to upgrade to emacs-live ? |
| 08:22 | ro_st | nope, you don't need to |
| 08:23 | kilon | is it better in some way ? |
| 08:23 | coventry` | OK, problem solved. It helps to create projects with "lein new." :-) |
| 08:23 | ro_st | i am because i want the improved organisation that emacs-live provides |
| 08:23 | kilon | please do tell |
| 08:23 | kilon | :D |
| 08:23 | kilon | i love improvements :D |
| 08:23 | borkdude | I hate improvements |
| 08:24 | kral | I forked my emacs setup from overtone too |
| 08:24 | kral | but I changed it a little |
| 08:24 | kral | for my daily work |
| 08:25 | kilon | ok i think i will learn a bit more emacs because i realised how nooby i am with it anyway |
| 08:25 | kilon | and change anything |
| 08:25 | kilon | *and then |
| 08:25 | kral | https://github.com/mdallastella/kral-emacs |
| 08:25 | kilon | i am quite happy with my setup as it is |
| 08:26 | kilon | kraft: watched ;) |
| 08:27 | kilon | next question should i assume the same clojure-swank will work for clojurescript as well ? |
| 08: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? |
| 08:45 | vijaykiran | solussd: in your ~/.lein/profiles.clj add lein-swank 1.4.4 as user plugins |
| 08:45 | vijaykiran | solussd: and start clojure-jack-in as usual |
| 08:45 | solussd | thanks |
| 08:45 | vijaykiran | solussd: see : https://github.com/technomancy/swank-clojure |
| 08:46 | solussd | thanks- got it working. emacs live is pretty |
| 08: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 ? |
| 08:57 | ejackson | kilon: sadly its not as easy as that |
| 08:57 | kilon | ejackson: what am i missing ? |
| 08:57 | ejackson | quite a bit of pain, unfortunately |
| 08:58 | bobry | argh, google style of documenting thing is driving me nuts %) |
| 08:58 | ejackson | you either have to AOT your classes, which is helluva tricky |
| 08:58 | ejackson | or use the RT.* interop, which can be messy |
| 08:58 | bobry | not sure it's even possible to write a client side app using 'goog.ui' in cljs :/ |
| 08:58 | ejackson | bobry: yes you can |
| 08: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 |
| 08:59 | ejackson | bobry: here's a basic example: http://boss-level.com/?p=102 |
| 08:59 | bobry | ejackson: yup, seen that one -- the bad thing is, it's too basic for what I'm after |
| 08:59 | ejackson | kilon: I suggest you cemerick's book, the chapter on interop is great |
| 09:00 | kilon | ejackson: no idea what you just talked about about, but that book is noted |
| 09:00 | ejackson | bobry: i must confess, more more complex UI, I just jayq and the 'normal' stuff |
| 09:00 | bobry | ejackson: normal stuff? jquery.ui and the like you mean? |
| 09:00 | spjt | ejackson: have you used seesaw |
| 09:00 | ejackson | yeah, I use kendo, but whatever |
| 09:01 | spjt | oh nevermind |
| 09:01 | ejackson | nope, not tried it out yet |
| 09:01 | bobry | i ended up wrapping 'goog.ui' in seesaw-like api |
| 09:01 | bobry | but it's still horrible :/ |
| 09:01 | ejackson | alas ! |
| 09:01 | kilon | ejackson: your link is clojurescript , i did not mention clojurescript |
| 09:01 | kilon | oh sorry |
| 09:01 | kilon | it was for bobry |
| 09:01 | kilon | :D |
| 09:02 | bobry | ejackson: do you have an open source example of a more complex UI with cljs? |
| 09:02 | ejackson | not on hand |
| 09:02 | ejackson | and I'm only starting out with this stuff myself |
| 09:02 | bobry | ah, good examples is what's missing in cljs world, that's for sure |
| 09: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. |
| 09:03 | bobry | anyone can write a hello world in cljs in no time, but doing something less trivial is hard to figure out |
| 09:04 | kilon | TimMc: so that means their types wont agree .... strange because AFAIK jython wraps python types to java types |
| 09:04 | kilon | and since clojure can use java types , i assumed it should be a no problem |
| 09:05 | foxdonut | bobry: does clojurescript one help? http://clojurescriptone.com/ |
| 09:06 | bobry | foxdonut: not really, it only confused me more -- I wish I've started from scratch :) |
| 09:06 | ejackson | bobry - have you seen the UI that granger made for overtone ? |
| 09:06 | ejackson | using his stack - its nice |
| 09:07 | foxdonut | that was jquery as well |
| 09:07 | ejackson | yup |
| 09:07 | bobry | yup, I've tried using 'waltz', but again, it doesn't fit well for my case |
| 09:07 | foxdonut | bobry: why would it not be possible to use goog.ui with cljs? |
| 09:08 | bobry | it *is* possible, but goog.ui is poorly documented and enforces a very Java-ish style of doing things |
| 09:08 | bobry | which is hard to do in cljs |
| 09:09 | foxdonut | bobry: so it's possible, but painful from an api point of view? |
| 09:09 | bobry | try writing your own widget :) |
| 09:09 | bobry | uhuh |
| 09:10 | foxdonut | I see |
| 09:10 | foxdonut | well, what can we do, goog.ui doesn't care to be cljs-friendly :( |
| 09: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 |
| 09:25 | Chiron_ | Hi! any difference between moustache and compojure? |
| 09:26 | foxdonut | yes |
| 09:27 | kilon | so clj and java dont mix so well :| thats weird |
| 09:27 | foxdonut | Chiron_: see https://github.com/cgrand/moustache and https://github.com/weavejester/compojure for details. |
| 09:28 | Chiron_ | foxdonut: I did. both are DSL |
| 09:28 | kilon | and its left up to the clj coder to map and create the java type in his clj code |
| 09:28 | kilon | *types |
| 09:29 | kilon | if i am understanding this correctly http://clojure.org/java_interop |
| 09:29 | kilon | certainly does not look as automagical as jython |
| 09:30 | kilon | but i guess i would not mind doing some "cooking" around |
| 09: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. :-) |
| 09:30 | duck1123 | A lot of the clojure types are also the standard java type (eg. string, regex) the rest are pretty compatible |
| 09:30 | kilon | ah good to know |
| 09:30 | kilon | I dont mind some extra coding |
| 09:31 | kilon | but i want to use both clojure and jython side by side |
| 09: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. |
| 09:41 | kilon | spjt: i dont mind that, what i would do mind if i cannot mix clojure with jython |
| 09:43 | TimMc | kilon: You can certainly use them side by side, you just may need to do a little bit of API fixup. |
| 09: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 |
| 09:44 | kilon | TimMc: Api Fixup, i hope you dont suggesting me fixing Clojure :D |
| 09: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 |
| 09: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 |
| 09:45 | kilon | ah ok |
| 09:45 | kilon | for a minute i was worried |
| 09:46 | TimMc | You may end up with some awkward calls to clojure.lang.RT. |
| 09:46 | kilon | yeah sure dont mind wrapping so both jython and clojure feel natural |
| 09:46 | ejackson | Clojure was designed to play well with Java, and does, so it should also with Jython, but its not free |
| 09:48 | kilon | what i am trying to avoid is wrapping everything , that could increase the complexity of my code and make it look ugly |
| 09:48 | kilon | if i can get jython and clojure functions to call each other i am fine |
| 09:48 | kilon | i dont need any big sophistication here |
| 09:49 | ejackson | kilon: you wouldn't happen to know the status of NumPy/SciPy etc on Jython would you ? |
| 09:49 | S11001001 | kilon: a basic understanding of how to write HOFs in both should be sufficient to scrap most of your boilerplate |
| 09:49 | S11001001 | too bad HOFs are annoying to write in python, but there you go |
| 09: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 |
| 09:50 | ejackson | tnx |
| 09:50 | duck1123 | I'm assuming that clojure's fns and jythons fns don't share the same base type. (except for maybe Runnable) |
| 09:54 | kilon | ejackson: from my search it appears that numpy is not yet ported to jython |
| 09:55 | ejackson | oh thanks, I was just curious |
| 09: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 |
| 09: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. |
| 09:56 | kilon | in python you can even reference function objects |
| 09:56 | kilon | b = a() |
| 09:56 | kilon | b() |
| 09:57 | kilon | sorry my bad i meant , b = a , b() |
| 09:57 | kilon | assuming a() |
| 09:57 | S11001001 | kilon: function is as function does. if it looks like a function... |
| 09:58 | foxdonut | python has nothing on clojure when it comes to FP. ;) |
| 09:58 | kilon | S11001001: cant say i know how fucntions work in lisp in low level |
| 09: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 |
| 09:58 | kilon | actually my claim is that python function are not functions at all :D |
| 09: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 |
| 09:59 | S11001001 | and the same is true for python |
| 09:59 | S11001001 | I feel silly about this debate now, so thanks |
| 09:59 | kilon | ok |
| 09:59 | kilon | but its not implied, i think java methods are just functions , they are not objects |
| 09: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 | kilon | i did not know that in clojure functions are also objects |
| 10:02 | kilon | 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 | coventry | 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 | S11001001 | 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 | S11001001 | 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 | matthavener | 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 | llasram | 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 | llasram | 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 | ejackson | i dunno the state of cKanren though |
| 10:23 | ejackson | 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 | coventry | (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 | ordnungswidrig | 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 | ordnungswidrig | 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 | ejackson | < is an fd concept, that is |
| 10:39 | ejackson | in fact.... https://github.com/clojure/core.logic/blob/cKanren/src/main/clojure/clojure/core/logic.clj#L2119 |
| 10:39 | ejackson | 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 | uvtc | 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 | spjt | 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 | ejackson | 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 | pepijndevos | *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 | TimMc | 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 | TimMc | 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 | spjt | 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 | ejackson | 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 | ordnungswidrig | 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 | ejackson | as an expensivish hack |
| 11:11 | ejackson | but its not the real deal |
| 11:11 | ejackson | 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 | ejackson | over defined finite domains |
| 11:15 | ordnungswidrig | this one. |
| 11:16 | ordnungswidrig | So what would miniKanren then be good for? |
| 11:16 | ejackson | well that's delightful |
| 11:16 | ejackson | 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 | ejackson | arrangements of stuff |
| 11:17 | ejackson | 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 | pepijndevos | 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 | ordnungswidrig | 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 | ordnungswidrig | *g* |
| 11:26 | ordnungswidrig | so the reasonable schemer is the canonical information on kanren? |
| 11:27 | TimMc | *reasoned, surely |
| 11:27 | TimMc | 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 | coventry | (Something like pdb or gdb.) |
| 11:28 | TimMc | coventry: I've seen it done in Slime, I think... |
| 11:28 | TimMc | 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 | TimMc | 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 | 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 | coventry | 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 | TimMc | 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 | coventry | 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 | pepijndevos | when projecting, the latter fails because x is unbound |
| 11:43 | ordnungswidrig | pepijndevos: is it related to fd? |
| 11:44 | ordnungswidrig | 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 | pepijndevos | 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 | pepijndevos | 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: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. |
| 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 | ForSpareParts | Er. |
| 12:02 | ForSpareParts | I read that wrong. |
| 12:02 | ForSpareParts | 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 | ForSpareParts | 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 | devn | 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 | tesmar | but when I try to type package-install clojure-mode |
| 12:18 | tesmar | 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 | tesmar | while in M-x mode? |
| 12:19 | coventry | C-q SPACE |
| 12:19 | tesmar | coventry: thank you |
| 12:19 | tesmar | now it says 'no match' |
| 12:20 | tesmar | 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 | tesmar | 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 | uvtc | 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 | tesmar | and you too technoma` |
| 12:22 | tesmar | THAT DID IT |
| 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 | ordnungswidrig | TimMc: but I have distinct values in my case |
| 12:33 | pepijndevos | ordnungswidrig: (defn sorted [l] (is l l sort)) |
| 12:33 | pepijndevos | 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 | karchie | 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 | pepijndevos | It's macros al the way down |
| 12:41 | ordnungswidrig | pepijndevos: I will try. Thanks for your assistence. |
| 12:41 | ordnungswidrig | 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 | chmllr | 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 | dnolen | 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 | eggsby | 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 | brainproxy | whoops, nvm |
| 14:22 | gfredericks | Michael Feathers just spent 45 minutes trolling clojure |
| 14:23 | S11001001 | cool |
| 14:23 | Raynes | Cool. |
| 14:23 | Raynes | 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 | antares_ | 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 | solussd_ | |
| 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 | dnolen | 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 | hiredman | 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 | TimMc | 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 | gfredericks | 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 | borkdude | :P |
| 15:22 | borkdude | 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 | amalloy | 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 | amalloy | 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 | technoma` | 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 | XPherior | Oh, I can do this without AJAX. Nevermind! |
| 17:10 | rplevy | This is pretty weird: (let [a (Double/NaN)] (= a a)) |
| 17:10 | rplevy | 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 | borkdude | ,(= #"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 | amalloy | the first gets two different boxes around the value Double/NaN |
| 17:21 | TimMc | aha |
| 17:21 | TimMc | 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 | borkdude | ,(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 | amalloy | 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 | gfredericks | ,(.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 | jonaskoelker | o_O |
| 17:30 | gfredericks | why does Double/NaN get dealt with as .longValue but other doubles don't? |
| 17:30 | gfredericks | ,(= 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 | chuck_ | 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 | amalloy | chuck_: you could try refheap |
| 17:39 | amalloy | 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 | jonaskoelker | ,(= 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:14 | devn | but i also prefer to not read the previous comments |
| 18:14 | devn | (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 | amalloy | 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 | amalloy | (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 | Dvyjones | (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 | amalloy | &(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 | Dvyjones | Oh duh. |
| 18:31 | Dvyjones | Silly me. |
| 18:31 | Dvyjones | 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 | devn | 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 | devn | (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 | devijvers | 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 | Raynes | Cheshire is the library you want to use for parsing JSON. |
| 19:44 | sandbox | okay that makes sense |
| 19:44 | sandbox | 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 | technoma` | 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 | TimMc | 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 | TimMc | (Such as when there isn't any!) |
| 20:18 | TimMc | 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 | arohner | 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 | johnmn3 | 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 | TimMc | 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 | dnolen | 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 | TimMc | 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 | johnmn3 | ;; 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 | mdeboard | looks very dated |
| 21:34 | mdeboard | e.g. https://github.com/duck1123/clj-plaza/blob/1.3/src/plaza/utils.clj |
| 21:35 | xeqi | johnmn3: or cycle? |
| 21:36 | xeqi | &(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 | johnmn3 | 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 | johnmn3 | oh, I'm not sure if subvec will work, because I need wrap-around behavior |
| 21:46 | johnmn3 | 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 | johnmn3 | how is that different than rem? |
| 21:51 | johnmn3 | 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 | TimMc | (Just like substring!) |
| 21:58 | johnmn3 | hmm |
| 21:58 | johnmn3 | how do I avoid that? |
| 21:58 | TimMc | (into vec ...) or something |
| 21:58 | TimMc | 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 | johnmn3 | 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 | johnmn3 | 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 | johnmn3 | (which is most of the time) |
| 22:06 | TimMc | johnmn3: These subvecs are shortlived, yeah? |
| 22:06 | TimMc | If they are, no worries. |
| 22:06 | johnmn3 | Yea, they're fairly quickly dumped into another vec |
| 22:06 | johnmn3 | in fact, no |
| 22:07 | johnmn3 | they're fed into the rule machine, which spits out a new element that gets populated into a new vec |
| 22:07 | johnmn3 | so, the old subvec should be thrown away |
| 22:07 | johnmn3 | (I'm guessing... garbage is a black box to me) |
| 22:08 | johnmn3 | (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 | johnmn3 | 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 | TimMc | 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 | johnmn3 | 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 | johnmn3 | 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 | eighty | 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 | johnmn3 | I'm thinking: (let [x (int (/ n 2))] (if (even? n) [(- x) x] [(- (- x 1)) x])) |
| 23:21 | johnmn3 | does that do it? |
| 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 | johnmn3 | I like that better |
| 23:34 | johnmn3 | 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 | johnmn3 | getting rid of the cruft in the chunkerator has helped dramatically in focussing on the performance of the various parallelization schemes |