2014-10-02
| 01:05 | zhaow | can any one help to explain why this does not work? |
| 01:05 | zhaow | (reduce #((if (even? %2) (* %1 2) (inc %1))) 1 (range 0 3)) |
| 01:06 | zhaow | but this works: (reduce (fn [number, index] (if (even? index) (* number 2) (inc number))) 1 (range 0 3)) |
| 01:08 | joshuafcole_ | parens |
| 01:08 | mdeboard | zhaow: You have extra parens |
| 01:08 | joshuafcole_ | look off there |
| 01:08 | dbasch | &(reduce #(if (even? %2) (* %1 2) (inc %1)) 1 (range 0 3)) |
| 01:08 | lazybot | ⇒ 6 |
| 01:09 | zhaow | I see |
| 01:09 | zhaow | Thank you all :) |
| 01:09 | joshuafcole_ | glad to help |
| 01:09 | joshuafcole_ | go team |
| 01:09 | mdeboard | lol |
| 01:10 | mdeboard | To answer your question, yes, someone can help to explain why it doesn't work |
| 01:10 | joshuafcole_ | (inc mdeboard) |
| 01:10 | lazybot | ⇒ 8 |
| 01:10 | zhaow | (thumbsup) :D |
| 02:22 | m00nlight | How can I run an exernal C program within clojure program? It seems the clojure.java.shell will cause an IOException error=2, No such file or directory |
| 02:23 | m00nlight | anyone can help? |
| 02:27 | dbasch | m00nlight: are you giving it an absolute path? |
| 02:27 | m00nlight | Yes |
| 02:28 | iamcyberbird | anyone worked all the way through SICP? |
| 02:28 | m00nlight | I find the reason, (shell/sh "ls -aux") will cause the errro, and (shell/sh "ls" "-aux") is fine, so I must seperate the program and the argument ? |
| 02:29 | luxbock | m00nlight: yes |
| 02:30 | m00nlight | dbasch: luxbock: Thanks solved |
| 02:30 | luxbock | m00nlight: if you need to lot of shell-calls you could check out https://github.com/Raynes/conch |
| 02:53 | wei | possibly a noob question, but what’s the difference between >!! and put! |
| 03:02 | dbasch | wei: >!! is blocking put |
| 03:02 | wei | so why does >! need to be in a go block but put! doesn't |
| 03:03 | wei | if they’re both async |
| 03:08 | dbasch | http://stackoverflow.com/questions/19538919/a-possible-solution-to-avoid-limitation-in-go-macro-must-be-called-inside-a-go |
| 04:02 | borkdude | so, how do you guys feel about racket as a sysadmin scripting language? |
| 04:08 | clgv | borkdude: probably depends on how well it interfaces with the tools available from os |
| 04:37 | m1dnight | I have created a class "counter" in my leiningen project. The class has package "demo". The path is /src/projectname/demo |
| 04:37 | m1dnight | (the core.clj file of the lein project is thus located at /src/projectname/ |
| 04:38 | m1dnight | If I want to import the java class in my core.clj I should thus write (:require [demo counter]), right? |
| 04:38 | m1dnight | I can't seem to import it, nor in the core.clj or in the repl |
| 04:38 | m1dnight | am I doing something wrong? I have compiled the .class file in the .demo folder as well |
| 04:39 | m1dnight | I keep getting ClassNotFound error |
| 04:40 | m1dnight | (btw, i'm talking about a java clas) |
| 04:41 | borkdude | m1dnight I think you need to configure java compilation in the leiningen project |
| 04:42 | borkdude | :java-source-paths |
| 04:42 | m1dnight | oh |
| 04:44 | daniel___ | borkdude: still here? |
| 04:44 | daniel___ | u work too hard |
| 04:45 | m1dnight | borkdude: Great :) That worked like a charm! |
| 04:45 | m1dnight | (inc borkdude) |
| 04:45 | lazybot | ⇒ 4 |
| 04:45 | m1dnight | \o/ |
| 04:50 | clgv | seesaw question: can I do a (select widget [:.some-class]) such that only direct children are selected? |
| 04:52 | clgv | since that is based on "enlive" . is that possible in enlive's selection mechanism? |
| 04:54 | borkdude | daniel___ what do you mean? :) |
| 04:55 | mercwithamouth | did the compojure-app template change as of recent? |
| 04:55 | mercwithamouth | i could have sworn it used to create routes/models/views folders? |
| 05:06 | daniel___ | borkdude: u helped me with some multimethods before i went to bed |
| 05:06 | daniel___ | over 12 hours ago |
| 05:06 | borkdude | daniel___ I also went to bed after that I think |
| 05:06 | daniel___ | ah ok :) |
| 05:07 | daniel___ | uk? |
| 05:07 | borkdude | Netherlands |
| 05:07 | daniel___ | u have a job that lets you write clojure? |
| 05:07 | joelkuiper | Say I have a function (fn [a b] ...) is it possible to get the arguments bindings as a map within that function? Such that {:a a :b b} ? |
| 05:08 | joelkuiper | without doing it manually that is? |
| 05:08 | borkdude | joelkuiper {:keys [a b]} ? |
| 05:08 | borkdude | joelkuiper ah wait, you want to create a map |
| 05:09 | borkdude | daniel___ yes |
| 05:09 | joelkuiper | borkdude: yes, I'm getting some arguments, but I need to pass them along as a key-worded map. |
| 05:09 | daniel___ | borkdude: interesting, good to hear |
| 05:10 | joelkuiper | borkdude: the equivalent of (fn x [a b] (y {:a a :b b})) but then automatically :p |
| 05:10 | borkdude | joelkuiper I dont think there is something baked in for that, you could however write a macro for it |
| 05:10 | borkdude | joelkuiper if you have only two keys I wouldn't bother though |
| 05:11 | borkdude | daniel___ not full time though, it depends |
| 05:12 | joelkuiper | borkdude: it was the example ;-) I'm using a library which api changed from (x a b c ...) to (x {:a a :b b :c c ...}), and I was hoping to avoid manual labour ;-) |
| 05:13 | borkdude | (defmacro to-map [& symbols] .... you'll figure it out) |
| 05:13 | joelkuiper | borkdude: yep ... I'll get to it ;-) thanks! |
| 05:33 | lvh | I'm writing a fake clock to test core.async/timeout. Someone must've written this before... |
| 05:35 | m1dnight | Do i have to add something specific in my core.clj when I import a class that has a lot of imports? I have copy pasted the code of LinkedBlockingQueue in my own file and compiled it by hand and that works but clj can't find it |
| 05:36 | m1dnight | however, it can find the class I tried before.. |
| 05:37 | lvh | m1dnight: uh? you should just be able to import it directly |
| 05:37 | lvh | m1dnight: (:import (java.java.util.concurrent LinkedBlockingQueue)) |
| 05:38 | m1dnight | lvh: Yeah, But i want to change it a bit to suit my own needs. So I wanted to start with the vanilla version first to make sure it worked |
| 05:38 | m1dnight | First i've tested a simple class counter.java, and I can import and use that one |
| 05:38 | lvh | m1dnight: Okay, then I don't understand your question. |
| 05:39 | m1dnight | So i added the source of LinkedBlockingQueue to that exact folder, so I could import that one |
| 05:39 | m1dnight | but I can import counter, but not LinkedBlockingQueue |
| 05:40 | m1dnight | I can compile both manually, which works fine. So in my clojure part I import the counter which works. But importing LinkedBlockingQueue class (my own) does not work |
| 05:40 | m1dnight | And I'm guessing it has something to do with the fact that it inherits and implements? |
| 05:40 | m1dnight | Not sure.. |
| 05:40 | lvh | m1dnight: Could you pastebin the error message? "Doesn't work" isn't very specific. |
| 05:40 | m1dnight | sure, hold on |
| 05:40 | lvh | m1dnight: That shouldn't affect anything. |
| 05:42 | m1dnight | oh, I see now. For completeness' sake I wanted to add the tree of my directories and I notice that there is no LinkedBlockingQueue.class in my target folder |
| 05:45 | m1dnight | Oh dear |
| 05:45 | m1dnight | it seems to work fine when I put some testcode in my core.clj, and "lein run", but in emacs it can't find it |
| 05:46 | m1dnight | let me find the error in emacs |
| 05:46 | m1dnight | aaaand restarting emacs worked |
| 05:46 | m1dnight | Perhaps emacs didn't notice the new compiled files in the target directory or something? |
| 05:50 | schmir | m1dnight: lein repl (or clojure-jack-in) will compile the java files when it starts.. |
| 05:53 | m1dnight | aah, that figures :) then the file was not compiled yet |
| 05:53 | m1dnight | Sorry, i'm all new to the entire ecosystem :) |
| 05:53 | m1dnight | thanks for the input guys |
| 05:56 | lvh | m1dnight: M-x cider-restart |
| 05:57 | lvh | m1dnight: (assuming you already have a cider) |
| 05:57 | lvh | m1dnight: you have to do that every time there's some stuff you're not compiling manually and throwing into the repl |
| 05:57 | lvh | m1dnight: e.g. deps or java code |
| 06:00 | m1dnight | aha :) |
| 06:01 | m1dnight | thanks a lot! :) |
| 06:26 | ucb | is there any way I can redef (ala with-redefs) Java static methods? |
| 06:26 | ucb | e.g. Thread/sleep |
| 06:34 | lvh | ucb: I'm assuming you've tried the obvious and it doesn't work? |
| 06:34 | ucb | yeah |
| 06:35 | ucb | wait, the obvious being (with-redefs [Thread/sleep identity] (Thread/sleep 10)) right? |
| 06:35 | lvh | yeah |
| 06:36 | ucb | yeah, that doesn't work because with-redefs is for vars |
| 06:36 | lvh | ucb: I guess maybe you could store it in a var? although that's tricky because e.g. Arrays/copyOfRange won't work because there's a ton of different signatures for it |
| 06:36 | ucb | the problem is that a third party lib I'm using calls Thread/sleep |
| 06:37 | ucb | and I want to avoid that in my tests ^_^ |
| 06:37 | lvh | ucb: ah, right |
| 06:38 | mercwithamouth | so i'm using cider and the repl that comes with it. i se in ciders documentation they discuss including the cider-nrepl plugin. is that not already active? |
| 06:38 | lvh | ucb: I'd say https://github.com/technomancy/robert-hooke, but I don't know if that does anything for java methods |
| 06:38 | mercwithamouth | is there added functionality? |
| 06:40 | ucb | lvh: thanks, but that doesn't deal with java static methods |
| 06:41 | ucb | I'm not sure there's a clear way or even if it's doable unfortunately :( |
| 06:41 | lvh | ucb: Yeah :( |
| 06:41 | lvh | ucb: Sorry :/ maybe try the ml? |
| 06:41 | ucb | no worries :) |
| 06:41 | ucb | yeah will do |
| 07:04 | gfredericks | ucb: release a clojure library called thread-slash-sleep and make a pull request |
| 07:05 | ucb | heh |
| 07:17 | clgv | lvh: ucb: robert-hooke works explicitely on clojure variables |
| 07:18 | ucb | yuppe, saw that :) |
| 07:18 | clgv | ucb: you'd need something like Java AOP |
| 07:18 | clgv | ucb: AspectJ I mean |
| 07:20 | clgv | usb: that stuff is essentially either rewriting bytecode or intercepting the compiler to add/modify bytecode |
| 07:20 | ucb | I feared as much |
| 07:21 | clgv | ucb: you can not mock out the third party lib? |
| 07:22 | ucb | not really. It's not really a lib either, it's more of an app which I'm using as a lib (bits of it). This is a long running thread that sleeps and does a thing in a loop. So I'm trying to get rid of that sleep in my tests. |
| 07:22 | ucb | (if that makes any sense) |
| 07:22 | clgv | ucb: open source license? |
| 07:22 | ucb | yuppe |
| 07:22 | clgv | fork+fix ;) |
| 07:23 | gfredericks | this kind of makes me want to create a lib called foo-slash-bar that jush has a huge collection of dynamic vars that call static jdk methods |
| 07:23 | ucb | but no worries, I'm initting that timeout to something bearable like 1s for the time being. |
| 07:23 | ucb | gfredericks: at some point there was a static-fn thing going on? |
| 07:23 | clgv | gfredericks: awesome would be a lib based on ASM to modify and redefine classes ;) |
| 07:23 | ucb | (it did exactly that) |
| 07:24 | gfredericks | #'foo-slash-bar.java.lang.Thread/sleep |
| 07:24 | clgv | ucb: why not 1ms? |
| 07:24 | ucb | clgv: I think the lib takes the timeout in seconds |
| 07:24 | ucb | let me check |
| 07:25 | clgv | damn ;) |
| 07:25 | clgv | does it fail on 0? |
| 07:25 | ucb | yuppe, it's in seconds |
| 07:25 | ucb | I've not tried 0 |
| 07:25 | ucb | I guess that it'd be fine for a test (even if it hammers the cpu while it runs) |
| 07:25 | clgv | seems to work overhere ;) |
| 07:26 | ucb | ah, coole! |
| 07:26 | clgv | it's active polling without signals? |
| 07:26 | clgv | D'oh! |
| 07:28 | augustl | ucb: if you can control the code, rewriting code so you can pass in an executor or something would be much more pleasant |
| 07:28 | augustl | i.e. make the Thread/sleep pluggable |
| 07:28 | ucb | augustl: yes, indeed, but I don't control the code sadly |
| 07:28 | ucb | and in any case, I'm abusing this thing |
| 07:28 | ucb | so I guess I'm just asking for trouble |
| 08:27 | gfredericks | do nrepl clients typically only allow constant prompt text? |
| 08:28 | gfredericks | I'm thinking of making an nrepl middleware that saves each repl result, and it would be nice if the prompt showed the name of the var that the result would be bound to |
| 08:29 | gfredericks | (erlang is a good example of this feature -- the prompt is simply "%d>") |
| 08:29 | gfredericks | I can't remember how to access the history in the erlang repl but I know there's a way |
| 08:29 | gfredericks | for clojure I was thinking of naming them $1 $2 $3 etc., but configurable |
| 08:30 | gfredericks | not sure if I should make them vars or locals |
| 08:32 | clgv | ,*1 |
| 08:32 | clojurebot | #<Unbound Unbound: #'clojure.core/*1> |
| 08:32 | clgv | ;1 |
| 08:32 | clgv | ,1 |
| 08:32 | clojurebot | 1 |
| 08:32 | clgv | ;*1 |
| 08:32 | zeebrah | is cider the only game in town for clojure on emacs? |
| 08:32 | clgv | ,*1 |
| 08:32 | clojurebot | #<Unbound Unbound: #'clojure.core/*1> |
| 08:32 | clgv | ok no repl env ;) |
| 08:33 | clgv | zeebrah: there are its ancestors ... |
| 08:35 | zeebrah | clgv: slime? maybe its time to try out the IDEs. i'm deeply unsatisfied with how unreliable cider is to setup and keep working |
| 08:38 | clgv | zeebrah: non-emacs options are eclipse+counterclockwise, intellij/cursive, lighttable, vim+fireplace (and I probably forgot some) |
| 08:39 | zeebrah | clgv: cool. i'll have to try some of them out |
| 08:42 | michaelr524 | heyyo |
| 08:44 | lvh | I'm getting icecap.handlers.delay_test$fake_timeout$timeout__22272 cannot be cast to clojure.lang.IFn$LO ; what the heck is a clojure.lang.IFn$LO |
| 09:01 | michaelr524 | trying emacs-prelude - seems like a really nice thing |
| 09:02 | michaelr524 | only it's pausing for a few good seconds every time I start typing something |
| 09:02 | michaelr524 | on windows 7\ |
| 09:02 | michaelr524 | is anyone familiar with this issue? |
| 09:09 | vijaykiran | michaelr524: didn't use prelude but perhaps check what modes are on and try disabling them |
| 09:09 | michaelr524 | vijaykiran: yes, good idea :) |
| 09:09 | vijaykiran | michaelr524: key-chord if enabled, might be one of the causes |
| 09:09 | michaelr524 | oh right, I saw something about it in the docs |
| 09:09 | michaelr524 | I'll try to disable it first |
| 09:09 | vijaykiran | michaelr524: again - never used prelude, so ymmv and all the |
| 09:10 | michaelr524 | vijaykiran: tghanks |
| 09:12 | gfredericks | lvh: it's a special IFn class for doing primitives |
| 09:12 | lvh | gfredericks: Heh, I literally just figured that out. |
| 09:12 | gfredericks | ,(class (fn [^long x] (inc x))) |
| 09:12 | clojurebot | sandbox$eval25$fn__26 |
| 09:12 | lvh | gfredericks: that was trickier than I had hoped it to be :/ |
| 09:12 | gfredericks | ,(parents (class (fn [^long x] (inc x)))) |
| 09:12 | clojurebot | #{clojure.lang.AFunction clojure.lang.IFn$LO} |
| 09:13 | lvh | gfredericks: Why can't IFn be cast to that? |
| 09:13 | lvh | I thought that was a type hint, a performance optimization. |
| 09:14 | lvh | (I'm okay with it being three orders of magnitude slower; I would also have taken a less inscrutable error message) |
| 09:14 | gfredericks | I've actually never seen that error message |
| 09:14 | gfredericks | so I'm not sure what conditions bring it about |
| 09:14 | lvh | gfredericks: (with-redefs) (or with-redefs-fn); in my case I was trying to with-redefs core.async/timeout |
| 09:15 | Bronsa | ,(defn x ^long [a] 1) |
| 09:15 | clojurebot | #'sandbox/x |
| 09:15 | Bronsa | ,(defn y [] (x)) |
| 09:15 | clojurebot | #'sandbox/y |
| 09:15 | dumptruckman | any idea how to turn off the restrictions on writing and deleting parenthesis with cursive? |
| 09:15 | Bronsa | ,(with-redefs [x (fn [a] 2)] (y)) |
| 09:15 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox/eval123/fn--124> |
| 09:16 | Bronsa | ,(defn y [] (x 1)) |
| 09:16 | clojurebot | #'sandbox/y |
| 09:16 | Bronsa | ,(with-redefs [x (fn [a] 2)] (y)) |
| 09:16 | clojurebot | #<ClassCastException java.lang.ClassCastException: sandbox$eval174$fn__175 cannot be cast to clojure.lang.IFn$OL> |
| 09:16 | Bronsa | lvh: ^ |
| 09:16 | lvh | Bronsa: Yes, that is hte error I got. |
| 09:17 | gfredericks | Bronsa: okay so the error here comes from inside of y |
| 09:17 | gfredericks | because it was compiled to expect x to be a IFn$OL and the redef changed that |
| 09:17 | Bronsa | lvh: if the var you're trying to redef has a primitive signature, the fn you redef it with has to have the same primitive signature |
| 09:17 | Bronsa | gfredericks: yep |
| 09:17 | Bronsa | ,(with-redefs [x (fn ^long [a] 2)] (y)) |
| 09:17 | clojurebot | 2 |
| 09:17 | Bronsa | this works for example |
| 09:17 | lvh | Bronsa: I was hoping that the two signatures would be compatible, but I guess not. Any idea what this is called? |
| 09:17 | lvh | i.e where do I find this in the documentation |
| 09:18 | Bronsa | I don't think there's any documentation on this |
| 09:18 | johnwalker | is anyone familiar with whats going wrong here? https://gist.github.com/johnwalker/b43315af11bb9dc4a197 |
| 09:19 | gfredericks | lvh: I think the only way to make them compatible like you want without giving up the speed of primitives is to have every function define an extra hundred or so methods just in case they ever get called with primitives |
| 09:20 | Fender | ,(clojure.walk/walk #(if (string? %) |
| 09:20 | Fender | (keyword %) |
| 09:20 | Fender | %) identity [["a" 1 "b"]]) |
| 09:20 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 09:20 | Fender | ,(clojure.walk/walk #(if (string? %) (keyword %) %) identity [["a" 1 "b"]]) |
| 09:20 | clojurebot | #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.walk> |
| 09:21 | Fender | ,(require '[clojure.walk]) |
| 09:21 | clojurebot | nil |
| 09:21 | Fender | ,(clojure.walk/walk #(if (string? %) (keyword %) %) identity [["a" 1 "b"]]) |
| 09:21 | clojurebot | [["a" 1 "b"]] |
| 09:21 | Bronsa | gfredericks: either that or compiling to (if (instance? f PimClass) (.invokePrim f ..) (.invoke f ..)) rather than directly to (.invokePrim f ..) |
| 09:21 | Fender | ,(clojure.walk/walk #(if (string? %) (keyword %) %) identity ["a" 1 "b"]) |
| 09:21 | clojurebot | [:a 1 :b] |
| 09:21 | Bronsa | Fender: you can query clojurebot |
| 09:21 | gfredericks | Bronsa: which gives up a bit of speed for that check |
| 09:21 | Fender | why the difference? when I hear walk, I think traverse |
| 09:22 | Fender | I know, just wanted to establish the case :) |
| 09:22 | gfredericks | Fender: try postwalk & prewalk; I think walk might be more general |
| 09:23 | Fender | but shouldnt it traverse the tree? |
| 09:23 | gfredericks | ,(doc clojure.walk/walk) |
| 09:23 | Bronsa | gfredericks: yeah, I think that's something that could (and should) be done when we get build profiles though -- direct .invokePrim for production builds & w/ check for dev builds |
| 09:23 | clojurebot | Excuse me? |
| 09:23 | gfredericks | &(doc clojure.walk/walk) |
| 09:23 | lazybot | ⇒ "([inner outer form]); Traverses form, an arbitrary data structure. inner and outer are functions. Applies inner to each element of form, building up a data structure of the same type, then applies outer to the result. Recognizes all Clojure data structures. Consumes seqs as with doall." |
| 09:23 | Bronsa | Fender: it doesn't say that it recursively traverses the data structure |
| 09:23 | michaelr524 | vijaykiran: well.. looks like cider is causing the problem somehow |
| 09:23 | Fender | oh |
| 09:24 | gfredericks | Fender: yeah looks like postwalk and prewalk specifically instrument the recursion |
| 09:24 | Bronsa | yep |
| 09:24 | michaelr524 | vijaykiran: once i cider-connect to the lein session the problem begins |
| 09:24 | Bronsa | I find it a little counterintuitive at times too, but the documentation is clear on that |
| 09:24 | Fender | hehe |
| 09:24 | Fender | you're right |
| 09:25 | Fender | &(doc clojure.walk/prewalk) |
| 09:25 | lazybot | ⇒ "([f form]); Like postwalk, but does pre-order traversal." |
| 09:25 | Fender | &(doc clojure.walk/postwalk) |
| 09:25 | lazybot | ⇒ "([f form]); Performs a depth-first, post-order traversal of form. Calls f on each sub-form, uses f's return value in place of the original. Recognizes all Clojure data structures. Consumes seqs as with doall." |
| 09:25 | Fender | ok, right |
| 09:25 | Fender | DF |
| 09:25 | gfredericks | man I wish those docstrings were mutually recursive |
| 09:25 | Fender | well, its not exactly documented |
| 09:25 | Fender | well it is |
| 09:25 | hyPiRion | gfredericks: ahoy, to the JIRA |
| 09:26 | Fender | thanx guys! |
| 09:26 | gfredericks | inc: like dec but the other way around |
| 09:26 | Bronsa | lol |
| 09:27 | gfredericks | System/exit: like `java ...` but for the end of your program instead of the beginning |
| 09:27 | hyPiRion | *: The inverse of / |
| 09:27 | justin_smith | michaelr524: completion can cause pauses |
| 09:28 | justin_smith | michaelr524: do you have any kind of completion mode on? |
| 09:28 | hyPiRion | &(doc mapv) |
| 09:28 | lazybot | ⇒ "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]); Returns a vector consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remai... https://www.refheap.com/91048 |
| 09:28 | michaelr524 | justin_smith: I disabled all prelude modules except the clojure one. maybe it's the cider-nrepl middleware for completion? |
| 09:29 | justin_smith | I think the prelude module for clojure would include completion (though I have no idea what a "module" is in emacs, and I have been using emacs for about 20 years0 |
| 09:30 | hyPiRion | &(doc clojure.core/assert-valid-fdecl) |
| 09:30 | lazybot | ⇒ "([fdecl]); A good fdecl looks like (([a] ...) ([a b] ...)) near the end of defn." |
| 09:30 | hyPiRion | gfredericks: we should have more of those ^ |
| 09:30 | michaelr524 | justin_smith: heh ok |
| 09:31 | justin_smith | michaelr524: "module" is either something the prelude folks made up, or you are using the wrong term - it's not an emacs thing |
| 09:31 | michaelr524 | justin_smith: it's just some emacs lisp code the prelude folks made to preload functionality |
| 09:32 | michaelr524 | justin_smith: in the clojure module they preload clojure mode and cider |
| 09:33 | justin_smith | so it's a small elisp library that just loads other libraries |
| 09:37 | michaelr524 | justin_smith: yup.. |
| 09:37 | michaelr524 | justin_smith: it's interesting.. i disabled the small elisp library that just loads other libraries |
| 09:38 | michaelr524 | justin_smith: now i load a clojure file and connect to cider and everything seems to work fine\ |
| 09:38 | michaelr524 | justin_smith: clojure mode and cider are loaded automatically anyway when I open the clj file it seems.,. |
| 09:56 | ubolonton | Anyone knows why core.async channels must be buffered when used with transducer? |
| 09:58 | clgv | ubolonton: where is that information from? |
| 09:59 | ubolonton | From the doc string of chan |
| 10:00 | ubolonton | It says "If a transducer is supplied a buffer must be specified" |
| 10:02 | clgv | ubolonton: ok from the point of the arity you must provide something in the buffer position, and this is stating that is must not be nil |
| 10:02 | cfleming | dumptruckman: https://cursiveclojure.com/userguide/paredit.html |
| 10:03 | ubolonton | Yes, that's why I'm asking |
| 10:03 | ubolonton | Why can't unbuffered channels use transducer? |
| 10:05 | clgv | ubolonton: the impl/channel ns is pretty much for a quickscan. so maybe you find the answer when you dig in there |
| 10:06 | clgv | ubolonton: or you wait for tbaldrige to show up here and ask him... |
| 10:06 | borkdude | slides for workshop that we will give saturday https://rawgit.com/borkdude/immutable-webapp/master/sheets/presentation.html#slide1 |
| 10:06 | ubolonton | When does he usually show up? |
| 10:07 | clgv | $seen tbaldrige |
| 10:07 | lazybot | tbaldrige was last seen quitting 49 weeks ago. |
| 10:07 | ubolonton | Ugh |
| 10:07 | clgv | no that cant be right |
| 10:07 | mdrogalis | It's like beatle juice. Gotta say his name 3 names. |
| 10:09 | clgv | functions spanning 90 lines :O |
| 10:09 | justin_smith | $seen tbaldridge |
| 10:09 | lazybot | tbaldridge was last seen quitting 16 hours and 41 minutes ago. |
| 10:09 | clgv | aha, spelling error ;) |
| 10:09 | justin_smith | bridge over troubled bald |
| 10:09 | ubolonton | Cool :D |
| 10:11 | clgv | Clojure is self-documenting and needs no docs, eh? https://github.com/clojure/core.async/blob/53bf7866f195e6ba247ff7122b99784e66e9f1bb/src/main/clojure/clojure/core/async/impl/channels.clj#L67 |
| 10:11 | clgv | :P |
| 10:11 | clgv | oop comments I meant |
| 10:11 | mdrogalis | clgv: The ecosystem is self-documenting. |
| 10:12 | clgv | mdrogalis: what do you mean? |
| 10:12 | mdrogalis | clgv: I'm being sarcastic, sorry. :P |
| 10:13 | clgv | mdrogalis: too few words to reliably detect that ;) |
| 10:14 | mdrogalis | clgv: Don't mind me. I'll just be over here in the corner making snarky noises. :D |
| 10:17 | samflores | I'm trying to learn ClojureScript, but when I try to load the compiled script in the browser I'm getting an "property undefined" error in the Google library |
| 10:17 | samflores | https://gist.github.com/samflores/8a47622cec489c63514a |
| 10:18 | samflores | anyone knows why? |
| 10:21 | mdeboard | ,(+ 1 1) |
| 10:21 | clojurebot | 2 |
| 10:21 | mdeboard | samflores: Apparently goog.string is not available in the window |
| 10:22 | daniel___ | samflores: you're not targeting node are you? |
| 10:22 | samflores | nope |
| 10:22 | daniel___ | sorry, you said browser |
| 10:23 | daniel___ | samflores, presumably its a compilation :whitespace issue? |
| 10:23 | daniel___ | :advanced and :simple works? |
| 10:23 | samflores | :advanced works. I didn't try simple yet |
| 10:23 | samflores | wait a sec |
| 10:25 | samflores | yeah, it works with simple too |
| 10:34 | daniel___ | samflores: i've seen some similar open issues on jira, dont know what the problem is tbh |
| 10:40 | lavokad | :sp |
| 11:01 | otaku_coder | I'm trying to get oauth2 working in my app, against the spotify web api but can't seem to find a working oauth2 lib. Have tried oauthenticate and oauth2-clj. Has anyone actually got these working? |
| 11:03 | justin_smith | https://clojars.org/clj-oauth I have had success with this one - forget off the top of my head if it supports oauth2 though |
| 11:06 | otaku_coder | justin_smith: sadly doesn't look like it supports oauth2 |
| 11:13 | samflores | daniel__, thanks. I'll use :simple for now |
| 11:33 | favetelinguis | why does this execution causing an never ending expresion (count (combo/permutations deck)) comb is the math.combinatorics and deck is a 52 elements long vector of vectors [[A C] [A H]...] |
| 11:35 | llasram | favetelinguis: The combo/permutations implementation just generates a lazy sequence of the permutations, not any sort of "smart" special-purpose representation of the set of permutations |
| 11:35 | llasram | favetelinguis: That means you'd end up generating and walking over all 52! permutations in order to `count` them |
| 11:35 | justin_smith | but that expression should still only be (* 52 52) - it shouldn't run indefinitely |
| 11:36 | justin_smith | wait, it's pairs of two, that's not 52! |
| 11:36 | llasram | justin_smith: It's a 52-element vector of pairs |
| 11:36 | justin_smith | ahh, so it's not taking all the pairs, the 52 elements are pairs, got it |
| 11:37 | jeremyheiler | justin_smith: also 52! is much larger than 52^2 |
| 11:37 | justin_smith | right, I know that part :P |
| 11:38 | favetelinguis | yes it is a big number but the comuter must be able to handle that? |
| 11:38 | justin_smith | eventually |
| 11:38 | llasram | I was actually recently playing around with some some smarter ways of working with combinatorial objects: https://gist.github.com/llasram/025e98d459ad48d71178 |
| 11:39 | llasram | Not directly usable, but has some ideas |
| 11:39 | llasram | favetelinguis: You might want to think a bit about exactly how large 52! is :-) |
| 11:39 | justin_smith | ,(reduce *' (range 1 53)) ; the number of elements it has to calculate |
| 11:39 | clojurebot | 80658175170943878571660636856403766975289505440883277824000000000000N |
| 11:39 | justin_smith | it takes a while to generate that many elements |
| 11:40 | justin_smith | notice also that this requires *' rather than *, because that's too large for a 64 bit number |
| 11:40 | favetelinguis | :) ok thanks was unsure if i was missing something, have not fully understand when lazy list can cause troblle |
| 11:41 | favetelinguis | was thingk maby count did not actually generate the list |
| 11:41 | justin_smith | favetelinguis: if this was not a lazy list, instead of taking a very long time, it would make your computer run out of memory |
| 11:41 | jeremyheiler | favetelinguis: if it didn't, what would coult return? it has to be eager to give a real answer |
| 11:41 | jeremyheiler | count* |
| 11:41 | favetelinguis | well this code realizez the lazy list right so the comuter shuld still run out for memory? |
| 11:42 | justin_smith | favetelinguis: only if you hold onto the head of the list |
| 11:42 | justin_smith | but instead, clojure is smart enough to know you are acting on each element but not binding the result, so it is silently discarded after counting |
| 11:42 | ToxicFrog | favetelinguis: count counts and discards each element rather than holding the entire list in memory at once. |
| 11:42 | favetelinguis | aa ok so count just generates the next element and inc some counter and then throws it away? |
| 11:43 | justin_smith | well, count simply fails to hold any reference to the previous element, and the jvm knows that the element can be discarded, because nobody holds a reference |
| 11:45 | hiredman | /win 19 |
| 11:54 | Fare | can anyone explain how leim quail completion works? |
| 11:54 | borkdude | just discovered that when a compojure route returns nil, apparently the next route is tried |
| 11:54 | borkdude | at least this is what seems to happen |
| 11:54 | Fare | e.g. in if I C-h I TeX (describe-input-method), it shows that \~i can be two characters — but how do I select the second? |
| 11:55 | Fare | oops, wrong channel |
| 11:57 | borkdude | cfleming when comment a line in a let like this (let [; |
| 11:58 | borkdude | cfleming after pressing ; it indents weirdly, it shouldn't change the indentation imho |
| 11:59 | cfleming | borkdude: can you send a refheap of what you're seeing? |
| 12:00 | borkdude | https://www.refheap.com/91053 |
| 12:04 | borkdude | cfleming emacs does this too sometimes |
| 12:04 | borkdude | reduce into '() is not my code btw ;) |
| 12:05 | cfleming | No problem, we're all friends here :-) |
| 12:06 | cfleming | So a few people asked for this, see https://stackoverflow.com/questions/6365334/lisp-commenting-convention |
| 12:06 | cfleming | Basically line comments at the end of a line are lined up at 60 chars |
| 12:07 | cfleming | It looks weird in your case because the first part of your line is incomplete |
| 12:08 | borkdude | cfleming I see, it's a feature? |
| 12:08 | borkdude | cfleming I never understood this feature I guess |
| 12:09 | cfleming | borkdude: Yup, you can disable it by setting your comment alignment column to 0 |
| 12:09 | borkdude | cfleming k cool thanks |
| 12:10 | bbloom | another trick is #_#_ |
| 12:10 | bbloom | ,(let [x 1 #_#_x (+ x 2) x (+ x 4)] x) |
| 12:10 | clojurebot | 5 |
| 12:11 | justin_smith | oh, #_ stacks? cool |
| 12:13 | bbloom | yeah, the inner #_ goes first b/c #_ recursively calls read |
| 12:13 | borkdude | ,(#_#_ foo bar 1) |
| 12:13 | borkdude | ,(#_#_ foo bar + 1) |
| 12:13 | borkdude | bbloom cool thanks, I didn't know you could stack #_ |
| 12:13 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn> |
| 12:13 | clojurebot | 1 |
| 12:13 | gfredericks | bbloom: oh snap good trick |
| 12:13 | gfredericks | (inc bbloom) |
| 12:13 | justin_smith | ,(#_#_#_#_#_ :a wtf (Throw (Exception. "UMM")) "hello" world reduce #_#_#_ :a :b (assert false) *' (#_ #_ 77 fnil range #_#_#_#_ 33 #_ 4 + 22 repl 1 52)) |
| 12:13 | lazybot | ⇒ 44 |
| 12:13 | clojurebot | 1551118753287382280224243016469303211063259720016986112000000000000N |
| 12:13 | borkdude | (inc bbloom) |
| 12:13 | lazybot | ⇒ 45 |
| 12:15 | Fare | bbloom: btw, have you read Jochen Lietdke's "A persistent system in real use—experiences of the first 13 years"? |
| 12:16 | borkdude | ,#_ funny |
| 12:16 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 12:16 | bbloom | Fare: no, but just dloaded it now |
| 12:17 | Fare | bbloom: does your persistent clojure system use a JVM? your own compiler? |
| 12:17 | Fare | (did I show you my first-class implementation diagrams?) |
| 12:17 | bbloom | Fare: i'm not ready to talk about the clojure pieces of what i'm doing here in this channel :-P |
| 12:18 | Fare | oh, sorry |
| 12:18 | bbloom | Fare: you didn't show me any diagrams |
| 12:18 | Fare | bbloom: I may or may not have told you that orthogonal persistence was a big requirement for TUNES. |
| 12:26 | dbasch | The phrase “may or may not” is interesting. From a logical perspective it should contain no information, yet the fact that the sentence was uttered at all gives much more likelyhood to “may” than to “may not.” |
| 12:26 | dbasch | likelihood |
| 12:29 | dkinzer | dbasch: depending on the context, I would say the opposite. |
| 12:30 | joegallo | well, it may or may not give much more likelihood to the "may" than to the "may not". imho. |
| 12:37 | gfredericks | it rules out the speaker wanting to communicate certainty in either direction |
| 12:40 | nickik | in clojurescript how do I get the type of something? |
| 12:40 | ToxicFrog | nickik: type? |
| 12:40 | ToxicFrog | ,(type "") |
| 12:40 | clojurebot | java.lang.String |
| 12:41 | ToxicFrog | I haven't used cljs but I'd expect it to work there too |
| 12:41 | BobSchack1 | type works the same way in clojurescript |
| 12:41 | nickik | but when I do this |
| 12:41 | nickik | (type (get heap (:val slot))) |
| 12:42 | nickik | nothing shows up in the html |
| 12:43 | nickik | when I do |
| 12:43 | nickik | (str (type (get heap (:val slot))) |
| 12:43 | nickik | I get 'function String() { [native code] }' for string |
| 12:48 | BobSchack1 | You're printing out the String constructor function |
| 13:04 | edw | I'm getting hangs in CIDER as the symbol lookup times out while typing things like (for [x [0 1 ...]] ...) after I type 'x'. Anyone else see this (new) behavior recently? |
| 13:14 | justin_smith | edw: using the alpha version? |
| 13:14 | edw | MELPA. Yep. |
| 13:15 | justin_smith | yeah, following the head of unstable cider is gonna hurt on a regular basis |
| 13:15 | edw | Oh I know, this is just way more painful than the usual. |
| 13:18 | justin_smith | edw: that stuff would be so much simpler if elisp had any sort of concurrency support |
| 13:18 | justin_smith | I wonder if go.el would be possible... |
| 13:19 | technomancy | there's async concurrency |
| 13:20 | technomancy | it's not general-purpose; it only works with network connections and subprocesses |
| 13:20 | technomancy | (which is fine for this, but not enough to port core.async) |
| 13:20 | justin_smith | interesting |
| 13:21 | justin_smith | technomancy: which means the problem isn't just emacs blocking on the communication with the repl, it's an error in the elisp code causing emacs to lock up unneccissarily |
| 13:22 | justin_smith | oh, duh, yeah I've used that callback based async process stuff in elisp (ages ago) |
| 13:22 | technomancy | justin_smith: well, arguably the problem is async code is a lot harder to do correctly =) |
| 13:23 | justin_smith | sure :) thus go.el! |
| 13:26 | technomancy | in the words of fsbot, "elisp needs some theology and geometry, some taste and decency. I suspect that we are teetering on the edge of the abyss." |
| 13:27 | justin_smith | my valve! |
| 13:35 | llasram | technomancy: What is that...? |
| 13:36 | {blake} | OK, so, I've made my dependency on clj-time implicit, set it to the latest version "0.8.0". In Cursive, if I Ctrl-Click on clj-time/core it goes to the right file. But in Cursive or a plain lein repl, I can tell it's still using 3.7. (Later versions added functions that aren't there.) |
| 13:36 | llasram | Oh, quote from /Confederacy of Dunces/ |
| 13:36 | technomancy | llasram: apparently from "A Confederacy of Dunces" |
| 13:37 | {blake} | "ack"ing shows clj-time 3.7 in the .idea directories, so I guess that explains the Cursive ish...but that shouldn't affect the command-line REPL, I don't think. |
| 13:37 | llasram | I initially searched assuming "elisp" and found several other (IRC logs?) of people saying the same thing :-) |
| 13:37 | justin_smith | technomancy: llasram: confederacy of dunces, which is also what I was referencing with "my valve" which I guess looked like a bizarre non-sequitor if you don't know the book |
| 13:38 | llasram | It's been several years |
| 13:38 | technomancy | justin_smith: just added it to http://technomancy.us/books =) |
| 13:38 | technomancy | so I'll totally get your reference in a few years |
| 13:38 | justin_smith | heh |
| 13:38 | justin_smith | it's totally a book from the '60s about a modern internet aspie nerd |
| 13:39 | llasram | I wish I could take a few years off to just read full time and catch up... |
| 13:39 | justin_smith | oh wait, it's from 1980, never mind that '60s part |
| 13:39 | technomancy | justin_smith: published in the 80s, written in the 60s? |
| 13:39 | xeqi | {blake}: 1. did you restart your repls? 2. does `lein deps :tree` tell you if something else is pulling it in? |
| 13:39 | justin_smith | oh, but the authoer killed himself in 1969 :P |
| 13:39 | justin_smith | technomancy: yup |
| 13:40 | justin_smith | I mean I knew it was from the '60s just by reading it, never checked authored / published data |
| 13:40 | justin_smith | *date |
| 13:40 | {blake} | CoD was published posthumously. |
| 13:40 | {blake} | IIRC |
| 13:40 | justin_smith | yeah, 11 years later |
| 13:40 | {blake} | xeqi: REPLs are restarted, lein deps :tree reports 0.8.0 |
| 13:41 | justin_smith | the title is from Johnathan Swift: "When a true genius appears in the world, you may know him by this sign, that the dunces are all in confederacy against him." |
| 13:41 | {blake} | Hated that book. Everyone tells me how great it is, though, so maybe I should re-read. |
| 13:42 | justin_smith | {blake}: it's one of those books that can be enjoyed only if you resign yourself to hating everyone in it |
| 13:43 | {blake} | justin_smith, That...is doubtless true. |
| 13:47 | llasram | I don't actually remember "hating" any of the characters... It was all just too comic. I want to meet any of them IRL, but none of them were plausible IRL |
| 13:48 | llasram | s,want,wouldn't want, |
| 13:48 | llasram | OTOH, I remember hardly any concrete details, so I probably need to re-read it too :-) |
| 13:49 | TimMc | want, wouldn't want, same thing |
| 13:49 | llasram | heh |
| 13:50 | TimMc | wan't? |
| 13:50 | TimMc | a new, confusing shorthand for "wouldn't want" |
| 13:51 | joshuafcole | I agree. Let's make this happen |
| 13:51 | {blake} | If we can agree to stop trying to make "fetch" happen. |
| 13:52 | joshuafcole | ugh |
| 13:52 | joshuafcole | I'd be shocked if anyone in this room were on that boat |
| 13:53 | aphyr | oh my god, that is SO fetch |
| 13:53 | justin_smith | {blake}: stop trying to make "stop trying to make "fetch happen"" happen, it's not going to happen |
| 13:53 | joshuafcole | (dec aphyr) |
| 13:53 | lazybot | ⇒ 1 |
| 13:53 | joshuafcole | :P |
| 13:53 | joshuafcole | (inc aphyr) |
| 13:53 | lazybot | ⇒ 2 |
| 13:53 | {blake} | Wait, it's not going to happen, or it's not NOT going to happen? |
| 13:53 | {blake} | I mean, I would want that. |
| 13:54 | {blake} | Or wouldn't I? |
| 13:54 | justin_smith | we're programmers, we are good with stacked booleans |
| 13:55 | justin_smith | err, that was garbled |
| 14:00 | TimMc | Yeah, just count on your finger. (0, 1, 0, 1, 0...) |
| 14:02 | Illusioneer | I have a clojure project compiled into a jar file. The jar is a webapp that can run from JAVA -JAR APP.JAR but I was told a better way to go is to use http-kit |
| 14:08 | clj-learner | hi, im trying intellij with cursive, but the code style seems bad, are there other's i can download? |
| 14:08 | clj-learner | the scheme |
| 14:10 | justin_smith | Illusioneer: assuming it is a ring app, to use http-kit you would need to change the server definition so it uses the http-kit ring adaptor rather than the one it uses currently |
| 14:11 | justin_smith | clj-learner: what's wrong with the style? do you mean the color scheme? |
| 14:12 | clj-learner | it doesnt align map elements for example |
| 14:12 | justin_smith | oh, the indentation? |
| 14:12 | clj-learner | yes |
| 14:12 | justin_smith | that's surprising |
| 14:12 | clj-learner | light table was fine |
| 14:14 | {blake} | It doesn't align map elements? It seems to when I type them in. (Or maybe I misunderstand.) |
| 14:15 | Illusioneer | justin_smith: I don't think it is a ring app, from what I can tell the dev made this stand alone, all his tests were executed from a java command line |
| 14:15 | justin_smith | Illusioneer: ring is just a lib |
| 14:16 | justin_smith | I mean, maybe it isn't a ring app, in which case switching from one http server to another in that project is even harder |
| 14:16 | mi6x3m | clojure, is there something like try-let |
| 14:16 | mi6x3m | or let-try ? |
| 14:17 | borkdude | , |
| 14:17 | justin_smith | Illusioneer: lein-ring is a lein plugin for using ring based webapps, but you can use ring without lein-ring, and I deploy apps to production with an embedded ring servers without using lein-ring |
| 14:17 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 14:17 | borkdude | :) |
| 14:17 | sqd | hi! i'm reading a ProcessBuilder InputStream, wrapped with clojure.java.io/reader and then line-seq (which gets transformed by a couple of filters and maps). it seems that the line-seq keeps everything in memory. can i just let it put every new line on a channel and then get rid of it? |
| 14:18 | justin_smith | Illusioneer: those apps run from the command line "java -jar ..." and use ring |
| 14:18 | dbasch | sqd: line-seq is lazy, it won’t keep everything in memory if you don’t hold on to the head |
| 14:19 | Illusioneer | thanks justin! |
| 14:19 | sqd | dbasch: ok thanks, then the memory usage comes from something else probably |
| 14:21 | TimMc | mi6x3m: I don't think so, but sounds like an easy macro to write. |
| 14:22 | justin_smith | sqd: the jdk comes with a profiler, jvisualvm, which can help see what is using all the memory |
| 14:22 | justin_smith | ~why |
| 14:22 | dbasch | mi6x3m: here’s one https://gist.github.com/ataggart/377278 |
| 14:22 | clojurebot | because that's not how macros work |
| 14:22 | sqd | justin_smith: nice, will check it out |
| 14:23 | mi6x3m | dbasch: thanks! |
| 14:24 | sqd | i'm using core.async.lab/spool to put a lazy-seq on a chan. does it matter much whether i apply transducers before or after? |
| 14:26 | dnolen_ | sqd: transducers are provided when constructing a channel so I'm not sure what you are saying |
| 14:29 | sqd | dnolen_: a reformulation: does it matter whether i (spool (sequence xform myseq)) or (spool myseq (chan 1 xform))? |
| 14:30 | dnolen_ | sqd: I don't it matters much - at least not w/o more context |
| 14:31 | sqd | dnolen_: ok thanks, then i think i understand things a bit :) |
| 14:32 | doctorm | node has a standard environment value for switching app modes, NODE_ENV=production, is there such a standard for clojure or does each app just choose it’s own? |
| 14:33 | clj-learner | now intellij doesnt open: "Internal error.java.lang.RuntimeException: com.intellij.ide.plugins.PluginManager$StartupAbortedException: Fatal error initializing 'com.intellij.util.indexing.FileBasedIndex' , etc" :( how do i solve this |
| 14:33 | llasram | doctorm: Clojure does not have any such as standard, and IMHO such an approach can be actively harmful |
| 14:33 | borkdude | clj-learner ask cfleming :) |
| 14:33 | technomancy | doctorm: it's more common to control that via the classpath |
| 14:34 | llasram | doctorm: In Clojure you tend to bring up long-running JVMs, in which you'll want to (at least) do both "dev" and "test" things |
| 14:34 | doctorm | llasram: Thanks, I don’t think it’s an official standard, I don’t really have an opinion on it, was just curious |
| 14:34 | technomancy | doctorm: that is, don't check for production vs dev, check for specifically the value you care about |
| 14:35 | technomancy | and yeah, the dev/test split is widely regarded to be more trouble than it's worth |
| 14:35 | doctorm | technomancy: I don’t quite understand that, for example let’s say I want to implement a certain error handler only in dev, do you mean instead of saying “production” or “dev” you would use something like “use-foo-handler”? |
| 14:36 | llasram | doctorm: https://github.com/stuartsierra/component is one example of something that gets you near the same kind of result, and (as a specific library) has gotten a certain amount of traction in the community |
| 14:36 | technomancy | doctorm: more or less, yeah |
| 14:37 | doctorm | llasram: I did watch his talk and played with component a bit, I thought it might be overkill after implementing a toy project with it, but I’ll give it another look with regards to dev/production management |
| 14:44 | doctorm | I think maybe it’s the reloaded workflow I don’t understand completely, is it expected to use that and component together? |
| 14:46 | llasram | doctorm: They definitely complement each other. I find stuartsierra's auto-reloading tooling overkill myself, but I don't make such extensive use of records and protocols as he apparently does |
| 14:47 | llasram | (Which is one way I agree component feels "overkill" -- I'd much prefer a tool which just used plain maps and functions, albeit not enough to write yet-another-DI-library) |
| 14:47 | technomancy | llasram: that's why we're such good buddies |
| 14:48 | llasram | technomancy: And here I was considering auditioning to be your nemesis! |
| 14:48 | technomancy | haha, oh yeah |
| 14:48 | doctorm | I think part of it is I feel cognitevely overloaded trying to grok new (to me) libraries at the same time I try and fit them into the component pattern (although the component pattern itself seems clear enough when Stuart explains it) |
| 14:48 | mdrogalis | Got that covered. |
| 14:48 | technomancy | llasram: I think tpope was volunteered; he fits all the qualifications |
| 14:50 | llasram | Oh well... |
| 14:51 | technomancy | I'll keep you on the list for possible future superhero team-ups though. |
| 14:51 | llasram | Ooh -- maybe in a parallel timeline |
| 14:52 | xeqi | technomancy: there are qualifications? |
| 14:53 | hiredman | uses vim |
| 14:53 | technomancy | xeqi: not sure I got beyond "uses vim" and "good at puns (for bantering duels)" |
| 14:55 | xeqi | I was wondering what would complement your gif powers |
| 14:56 | llasram | jpeg powers |
| 14:57 | SegFaultAX | tpope is a double whammy... uses vim *and* wrote a package manager. |
| 14:58 | doctorm | So broadly, when you’re in dev mode with component, you use the nrepl to switch out which components are being in the system? Or do you define two separate systems and conditionally start one? |
| 14:58 | xeqi | llasram: pop culture song refs? |
| 14:58 | doctorm | being used* in the system |
| 14:59 | llasram | xeqi: quotations from works of literary and historical significance? |
| 15:00 | xeqi | maybe, that scifi stuff is garbage |
| 15:00 | llasram | Although that one would come full circle in a few thousand years, as famous GIFs and image macros of the early 21-st century become part of the Western literary canon |
| 15:01 | justin_smith | lolmarginalia http://www.pinterest.com/caseyweed/weird-medieval-images-and-marginalia/ |
| 15:02 | justin_smith | book margins were definitely the reddit of their time |
| 15:02 | llasram | the bunny with the ax -- ha! / slightly skeptical |
| 15:02 | justin_smith | llasram: that was actually a common theme |
| 15:03 | xeqi | doctorm: I'd lean towards two systems. No need to start a CDN component for dev for example |
| 15:03 | justin_smith | llasram: GIS "marginalia rabbit" and be delighted |
| 15:03 | justin_smith | just found one with a rabbit apperently sexually molesting a monk |
| 15:04 | doctorm | xeqi: Ok thanks, I’ll try to make a small system with dev and production versions, and see how it goes. |
| 15:05 | llasram | justin_smith: that is just great |
| 15:05 | justin_smith | xeqi: using the CDN in dev is actually convenient if you aren't working waterfall and you are collaborating with designers :) |
| 15:06 | xeqi | doctorm: my recent explorations seem to lean towards lifecycle components that start/shutdown "sub-components". In unit tests just use the sub-components, ignoring lifecycles/(the system) where possible. |
| 15:06 | justin_smith | llasram: someone should really photoshop a bunch of those into "Ye Olde Reddite" |
| 15:08 | doctorm | xeqi: So with sub-components, the main component acts as it’s own mini-system? Stuart did mention that a system is pretty much just a component. Can you give me a quick example of what a component with sub-components would look like, for say, a database. |
| 15:10 | mdeboard | what kind of components are you guys talking about, out of curiosity |
| 15:10 | mdeboard | doctorm xeqi |
| 15:11 | doctorm | mdeboard: Stuart Sierra’s component pattern - https://github.com/stuartsierra/component |
| 15:11 | mdeboard | Interesting |
| 15:11 | doctorm | I recommend watching the talk, otherwise it may be a bit hard to parse |
| 15:11 | mdeboard | Unfortunately I really don't understand the phrase dependency injection |
| 15:12 | justin_smith | http://www.kevinwilliampang.com/2009/11/07/dependency-injection-for-dummies/ |
| 15:12 | TimMc | mdeboard: Choosing, at runtime, the behavior of internal components of a system. |
| 15:14 | xeqi | doctorm: not really sub-components... just a way to seperated lifecycle vs actual working thing |
| 15:15 | xeqi | for example, with a db: the lifecycle could be creating a connection, and shutting it down |
| 15:16 | xeqi | then if you have a database record, it could just take that connection on creation, and query using it |
| 15:16 | justin_smith | xeqi: doctorm: or even swap out a connection for a connection pool |
| 15:16 | xeqi | justin_smith, doctorm: sure, simplified example |
| 15:17 | justin_smith | point being, that is also part of the component design, the modularity |
| 15:17 | l3dx | is friend the most commonly used auth lib? |
| 15:19 | doctorm | xeqi: justinsmith: Ok, to make sure I’m understanding, you create two records in that case, one for the connection and one for the database itself, and they both have lifecycles, so if you want to swap out either one, you can (instead of tying them both together where you would have to swap out both just to change the connection) |
| 15:20 | xeqi | doctorm: does the database record need to do something on startup/shutdown? |
| 15:22 | doctorm | xeqi: Not necessarily, I was thinking hypothetically. |
| 15:23 | doctorm | xeqi: I mean, it needs to wait for a connection to be available at least, does that count as doing something? |
| 15:38 | iamedu | Hello! I have a pretty dumb doubt.. regarding quoting.. why can't I do this? (do (def a 3) (println ~'a)) |
| 15:39 | Bronsa | iamedu: what are you trying to do? |
| 15:39 | iamedu | just playing with clojure.. i'd like to get a 3 printed out |
| 15:39 | ztellman | iamedu, ~ can only be used in the context of a syntax-quote: ` |
| 15:40 | ztellman | `~a |
| 15:40 | ztellman | is what you're looking for |
| 15:40 | mdeboard | (do (let [a 3]) (println `~a)) |
| 15:40 | mdeboard | ,(do (let [a 3]) (println `~a)) |
| 15:40 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 15:40 | mdeboard | derp, I suck |
| 15:40 | mdeboard | what's a computer |
| 15:40 | mdeboard | (do (let [a 3] (println `~a))) |
| 15:40 | mdeboard | ok you get the point, no more |
| 15:41 | justin_smith | don't really need a do there :) |
| 15:42 | justin_smith | iamedu: def inside another form is almost always wrong, especially if you are new to the language. It is only for creating globals with. |
| 15:42 | mdeboard | i know, i was just trying to maintain high fidentliy |
| 15:42 | mdeboard | Wow. Fidelity. |
| 15:43 | justin_smith | an ironic word to mis-spell :) |
| 15:43 | mdeboard | seriously |
| 15:43 | mdeboard | |
| 15:47 | dbasch | llasram: I’m trying to run the simplest hadoop job with Parkour (basically word count), and it works fine on my local machine. On a cluster I get this exception https://www.refheap.com/91067 |
| 15:47 | mdeboard | I wonder if stuart was inspired by react with this component pattern talk, or vice versa |
| 15:48 | mdeboard | Or rather, if react inspired the development of the concepts presented in the talk or vice versa |
| 15:48 | ChrisOei | So I'm writing a Clojure app that uses some new Java 8 stuff. Is there a way of specifying the minimum version of Java in the project.clj somewhere? |
| 15:49 | alejandro1 | ChrisOei: I didn't find one, so I wrote a plugin to do it https://github.com/ciniglio/min-java-version |
| 15:49 | vijaykiran | ChrisOei: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L248 |
| 15:49 | technomancy | ChrisOei: (when-not (> (System/getProperty "java.somethingsomething.version") 7) (println "Warning; need Java 8")) after defproject in project.clj |
| 15:49 | mdeboard | wow |
| 15:49 | mdeboard | That was a lot of answers |
| 15:49 | vijaykiran | :) in this technomancy's voids every other's |
| 15:50 | mdeboard | technomancy is the alpha and the omega |
| 15:50 | mdeboard | the source of all truth |
| 15:50 | ChrisOei | Thanks folks :) |
| 15:50 | technomancy | welllll it's not perfect since you can run a different java version for lein vs the project |
| 15:50 | mdeboard | Cursive (IntelliJ plugin) handles all that for you anyway |
| 15:50 | borkdude | version.startsWith is also great, it forces vendors to change their versioning at some point I heard |
| 15:51 | mdeboard | borkdude: lol |
| 15:51 | technomancy | hah! |
| 15:51 | mdeboard | Windows 7 ate 9 :( |
| 15:51 | justin_smith | ChrisOei: maybe use :jvm-opts https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L261 with the -version flag |
| 15:51 | justin_smith | -version along prints a version, -version:value forces that version |
| 15:52 | technomancy | justin_smith: oh cool; I didn't know that |
| 15:52 | mdeboard | lol |
| 15:52 | mdeboard | leiningen is officially enterprise software |
| 15:53 | justin_smith | -version"1.8.0+" or some such :) |
| 15:53 | justin_smith | mdeboard: that's a java option, not a lein option :) lein just passes along whatever is in there |
| 15:53 | vijaykiran | mdeboard: If my memory is good ... it was called leining - and enterprise edition was leiningEN |
| 15:55 | mdeboard | well |
| 15:55 | mdeboard | vijaykiran: common misconception and a bit of folklore/urban legend there |
| 15:55 | mdeboard | The original plan was to have heavy internationalization support for Leining, so since the first version was English only, it's LeiningEN |
| 15:56 | technomancy | oh man, maybe Leiningen will finally get a wikipedia Talk page |
| 15:56 | technomancy | one of my lifelong ambitions |
| 15:56 | mdeboard | German was next, obviously, but technomancy lost interest halfway through LeiningDE |
| 15:56 | vijaykiran | mdeboard: well, if you repeat often enough ... |
| 15:56 | mdeboard | It's true |
| 15:56 | technomancy | well, actually the technical name is "leiningEN_US" or "leiningEN_GB" |
| 15:57 | mdeboard | Yeah, important distinction |
| 15:57 | mdeboard | Funnily enough Canada has adopted leiningEN_GB |
| 15:58 | technomancy | except Quebec |
| 15:58 | mdeboard | well, naturally |
| 15:59 | sqd | should (derive ::tag ::parent) cause (async/sub pub ::parent ch) to receive messages on ::tag? |
| 15:59 | hiredman | unlikely |
| 16:00 | hiredman | it only would if isa? was used in the implementation of the pubsub stuff, which I really doubt |
| 16:00 | sqd | ok, i'll find a less ambiguous way to structure my channels then :) |
| 16:01 | sqd | thanks |
| 16:07 | hiredman | but that actually might be an interesting enhancement to the pubsub stuff |
| 16:07 | sqd | (checked, there's no isa? indeed in the source code) |
| 16:14 | matthiasn | Hey everyone, I am working on a blog post about transducers and the component library. Is anyone interested in reading the draft and providing some feedback before I publish it? |
| 16:48 | enn | Hello ... recently (today) cider-jump-to-var stopped working. Any idea what I could look at to diagnose? (Every var says "Symbol foo not resolved".) |
| 16:49 | hiredman | enn: is the code defining whatever you are trying to jump to loaded? |
| 16:49 | enn | yes |
| 16:49 | hiredman | are you sure? |
| 16:49 | enn | yes, I can run it from the command line |
| 16:49 | enn | er, repl |
| 16:49 | hiredman | do you mean the repl? |
| 16:49 | hiredman | in you repl what does the metadata for the var say? |
| 16:50 | enn | How can I view the metadata? |
| 16:51 | amalloy | (meta #'foo) |
| 16:53 | enn | {:arglists ([channel]), :ns #<Namespace guest-channels.channel>, :name event-types-for-conversions, :column 1, :doc "Return all qualifying and converting event types for a given\n channel. The union of these two types are required to calcuate\n conversions.", :line 127, :file "guest_channels/channel.clj"} |
| 16:53 | hiredman | yeah, I dunno, it looks like all the metadata you'd require is there |
| 16:53 | hiredman | maybe cider just sucks |
| 16:54 | enn | fwiw, the minibuffer arg list display has also stopped working |
| 16:54 | hiredman | are you running the same version of the cider stuff today? |
| 16:55 | enn | yes, to the best of my knowledge |
| 17:06 | m1dnight | Can I pass a clojure fn to java and apply it there? (on clojure objects, that is) |
| 17:09 | arrdem | m1dnight: sure. clojure.lang.IFn is the interface for interacting with functions. |
| 17:09 | arrdem | m1dnight: just take an IFn instance, and .invoke it with the appropriate number of Objects |
| 17:10 | m1dnight | aha |
| 17:10 | m1dnight | that would be sweet |
| 17:10 | m1dnight | I was going to adapt the LinkedBlockingQueue a bit to suit my needs but now I have to do more and more in it |
| 17:11 | m1dnight | I'm thinking about making my "actors" work like "if the mssage string equals, this message is delivered, regardless of # of args in the message" |
| 17:11 | m1dnight | so ["messagename" arg arg arg] would be the same as ["messagename" arg arg arg arg arg arg] |
| 17:12 | {blake} | hiredman: Did you not say, yesterday, that you couldn't use different versions of a library in the same project? |
| 17:12 | m1dnight | btw, is Rich Hickey on this channel? Just wondering.. |
| 17:12 | amalloy | $seen rhickey |
| 17:12 | lazybot | rhickey was last seen quitting 67 weeks and 2 days ago. |
| 17:13 | arrdem | is there a jira ticket for the fact that the optional metadata map isn't mentioned in defn's docstring? |
| 17:13 | arrdem | it's obvious if you read the declared arglist or the parser, but the docstring is strictly wrong. |
| 17:14 | amalloy | arrdem: well it says "attrs" |
| 17:14 | Bronsa | arrdem: there's no documentation about docstring/metadata map for ns either but I think the arglist is the spec in this case |
| 17:14 | amalloy | i imagine rich thinks that's enough to compel you to look at the arglist |
| 17:17 | hiredman | {blake}: yes, not without doing crazy things with classloaders |
| 17:18 | {blake} | hiredman: OK. I deleted clj-time from my .m2 (because I'm still getting clj-time 3.7 in my REPLs). Then I did a "lein deps". |
| 17:19 | mikerod | Does anyone have insight on what this destructuring is supposed to accomplish? (defn testf [& [xs]] xs) |
| 17:19 | {blake} | hiredman, And it pulled in four clj-time.pom files (3.7, 5.0, 6.0 and 8.0) and two clj-time.jars (6.0 and 8.0). |
| 17:19 | {blake} | hiredman: So I'm trying to reconcile that. |
| 17:20 | mikerod | I get things like: (testf 1) ;= 1 - (testf [1]) ;= [1] - (testf {:a 1}) := {:a 1} |
| 17:20 | mikerod | and (testf) ;= nil |
| 17:20 | amalloy | mikerod: it's a crappy way to make xs optional |
| 17:20 | amalloy | don't use it |
| 17:20 | mikerod | amalloy: oh |
| 17:20 | mikerod | I just realized it allows varargs |
| 17:20 | Bronsa | mikerod: it's a way to do (fn f ([x] (f x nil)) ([x y] ..)) |
| 17:20 | mikerod | but would just ignore the rest |
| 17:21 | hiredman | {blake}: there are a lot of reasons the library could get downloaded, but if you run `lein classpath` you should only see one clj-time on the classpath |
| 17:21 | mikerod | weird, I ran across it and was initially confused |
| 17:21 | hiredman | {blake}: lein deps :tree will show all the depdencies and transitive depdencies so you can figure out what is pull in clj-time |
| 17:21 | mikerod | but I think I get it now. And yes, I don't think I'd be planning to use that structure anytime soon. :P |
| 17:22 | {blake} | hiredman: OK, yeah, that makes sense. |
| 17:22 | hiredman | {blake}: if you do seen multiple clj-time entries it is likely someone released a fork or something using a different group-id, which means to lein and maven it is a completely different library, even if it has the same clojure code in it, which can cause all kinds of problems |
| 17:22 | {blake} | And since my classpath only shows 8.0, my problem must be something else, even though it looks like 3.7. |
| 17:23 | {blake} | hiredman: Well, only one in the classpath. So I got that going for me. Which is nice. |
| 17:23 | hiredman | {blake}: are any of the libraries you depend on, or transitivelt depend on aot compiled? |
| 17:23 | hiredman | that can do screwy things |
| 17:24 | {blake} | hiredman, Possibly. I got 30 libraries. |
| 17:24 | hiredman | write a little shell script that takes the output of lein classpath and checks every jar file to see if it contains files clj_time or clj-time related |
| 17:25 | {blake} | hiredman, 'k. |
| 17:25 | hiredman | {blake}: aot compiling reusable library code is ill advised |
| 17:25 | amalloy | {blake}, hiredman: lein classpath | tr ':' $'\n' |grep clj[-_time] |
| 17:25 | {blake} | hiredman: This is a project I've inherited, but none of these libraries are ours. |
| 17:25 | amalloy | oops |
| 17:25 | amalloy | clj[-_]time |
| 17:26 | hiredman | amalloy: do you need zgrep or something? |
| 17:26 | amalloy | hiredman: no, why? |
| 17:26 | amalloy | oh, you wanted to check the jars |
| 17:26 | amalloy | i was just checking their names |
| 17:26 | hiredman | I dunno, I've only done this dance once a long time ago |
| 17:26 | hiredman | yeah, in the jars |
| 17:27 | amalloy | if they contain clj-time inside them but not in the name that's probably justifiable homicide |
| 17:27 | {blake} | Yeah, that script just turns up clj-time... :P |
| 17:27 | hiredman | amalloy: sure |
| 17:27 | hiredman | {blake}: have you run lein clean lately? |
| 17:27 | {blake} | hiredman, No...I thought about that but it seemed sorta cheesy. |
| 17:28 | hiredman | likely there are stale clj-time related class files from before you fiddled your project.clj |
| 17:29 | {blake} | hiredman: Yeah, I see how that could be now. It's compiling. |
| 17:33 | {blake} | hiredman, That was it, thanks. *repeats to self: "I will not superstitiously clean...I will not superstitiously clean...."* |
| 17:34 | amalloy | {blake}: alias leinplus='lein do clean,' |
| 17:35 | {blake} | amalloy: Thanks. I think. |
| 17:36 | amalloy | {blake}: don't actually do that. technomancy couldn't sleep at night if you did |
| 17:37 | {blake} | amalloy: OK. Unless...is he sleeping too soundly? Should he be tossing and turning with the weight of his sins? |
| 17:37 | {blake} | amalloy: Because then I'll totes do it. |
| 17:38 | technomancy | the weight of the carbon footprint of my mistakes |
| 17:38 | {blake} | technomancy: Whoa. Great idea for a folk song: "How Much Does Your Footprint Weigh?" |
| 17:43 | ed-g | Hello, I'm creating a web service using Clojure and it seems like both Bishop and Rook are good alternatives. When might I prefer one to the other? I have some experience with Compojure. |
| 17:47 | marcuscreo | howdy |
| 18:10 | mercwithamouth | ping |
| 18:10 | m1dnight | Offtopic, but hillarious: https://github.com/thoughtbot/liftoff/pull/178#issuecomment-57688590 |
| 18:14 | mdeboard | component lib is pretty cool |
| 18:14 | mdeboard | unless i'm missing something not a thing you'd use for e.g. a web app |
| 18:14 | mdeboard | wrt serving requests |
| 18:16 | mdeboard | I think, anyway. But I am bad at this |
| 18:16 | ed-g | mdeboard: are you replying to my question? I intend to keep track of the state using a database. Most of the data will be read-only in any case. |
| 18:22 | m1dnight | hmm, appearantly (map .getClass <col>) does not work.. but (map #(.getClass %) <col>) does, why is that? |
| 18:22 | m1dnight | Is it because it is a static function from java? |
| 18:23 | m1dnight | ,(map .getClass '(1 2 3)) |
| 18:23 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: .getClass in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 18:23 | m1dnight | ,(map #(.getClass %) '(1 2 3)) |
| 18:23 | clojurebot | (java.lang.Long java.lang.Long java.lang.Long) |
| 18:23 | amalloy | methods aren't functions. map takes a function |
| 18:23 | m1dnight | oh, okay :) That makes sense, thanks for the response |
| 18:24 | ed-g | Has anyone here created a REST api using Clojure? What tools did you like/ not like? |
| 18:26 | SegFaultAX | ed-g: Check out luminus. |
| 18:26 | SegFaultAX | As for like/don't like, I don't like friend, but it's the main solution for that sort of thing right now. |
| 18:27 | mercwithamouth | why not compojure? |
| 18:27 | mercwithamouth | comopojure-rest |
| 18:28 | bridgethillyer | aka liberator |
| 18:54 | seangrove | dnolen_: Is there a straight-forward way to get the render time of each component using instrumentation? |
| 18:54 | seangrove | Sorry, that's of course referring to Om |
| 18:54 | dnolen_ | seangrove: I think the only way is to measure the time elapsed between will-update & did-update |
| 18:55 | seangrove | dnolen_: Thought that might be the case, since renders are batched |
| 18:55 | seangrove | Thanks! |
| 18:56 | freudsfeud | clojure noob here, can anyone suggest a good ide to start learning clojure (currently running Ubuntu) |
| 18:56 | mercwithamouth | emacs! =P |
| 18:56 | technomancy | don't trust anything installed via apt |
| 18:56 | freudsfeud | ol |
| 18:56 | technomancy | any clojure thing |
| 18:56 | freudsfeud | ok |
| 18:56 | technomancy | that trips up a lot of people |
| 18:56 | freudsfeud | the version in apt is 1.4 |
| 18:57 | cfleming | {blake}: are you stil having problems with versions in the Cursive REPL? |
| 18:57 | freudsfeud | current is 1.7 right? |
| 18:57 | freudsfeud | I took that as a warning. |
| 18:57 | amalloy | 1.6 is latest stable |
| 18:57 | freudsfeud | 1.6 right |
| 18:57 | amalloy | 1.7 is alpha or something |
| 18:57 | amalloy | but yeah, apt is no good for clojure |
| 18:58 | dbasch | freudsfeud: for learning, lighttable might be a good place to start if you’re not familiar with emacs |
| 18:58 | amalloy | to get stuff going on your machine, download and install leiningen; use whatever text editor you're already used to |
| 18:58 | freudsfeud | i am currently using vim for everything |
| 18:58 | amalloy | vim has fine clojure support |
| 18:58 | freudsfeud | ok |
| 18:58 | amalloy | to learn more about clojure without needing to set up your machine, you can also try sites like 4clojure.com |
| 18:58 | freudsfeud | I really haven't looked into it enough before I posted, sorry |
| 18:59 | freudsfeud | I have started that |
| 18:59 | mercwithamouth | and SICP. i'm reading that alongside my clojure play |
| 18:59 | freudsfeud | and the practices, the little tests. good stuff |
| 18:59 | mercwithamouth | scheme and clojure are a little different but it puts you in the lisp world...especially if you're a person just tinkering and you have time. |
| 19:00 | freudsfeud | I learned Python when I first started programming. some similarities there that make it easier |
| 19:10 | mercwithamouth | what i found interesting....the strong similarities to javascript and lisp. you can really tell how they borrowed heavily from it |
| 19:13 | {blake} | cfleming: lein clean fixed my REPL version problems. |
| 19:20 | ed-g | SegFaultAX, mercwithamouth, bridgethrillyer: thanks! |
| 19:23 | freudsfeud | just installed leiningen and vim support, thanks! |
| 19:36 | BShep | when should i learn clojure |
| 19:36 | dbasch | BShep: how about now? |
| 19:37 | BShep | well im doing math right now... i had a look at trycloj.. im not sure about it |
| 19:38 | TimMc | I'm not sure what kind of answer you're hoping for. |
| 19:38 | BShep | ya ur right |
| 19:40 | technomancy | well, if you don't learn it now, your other options are later and never |
| 19:41 | technomancy | I'm sure you could go on to lead a long and fulfilling life no matter which you choose |
| 19:41 | celwell | ha... on another topic: I was wondering: How can I unpack a seq and drop it into a vector? I have this: |
| 19:41 | celwell | [:table (map #(into [] [(:label (val %)) (:value (val %))]) (:form_response r))] |
| 19:41 | celwell | sorry for formatting |
| 19:41 | freudsfeud | i think he/she is gone |
| 19:42 | technomancy | celwell: you're putting a vector into a vector in that example |
| 19:42 | celwell | technomancy: yes, but inner vector needs to be spliced out |
| 19:42 | justin_smith | celwell: #(do [... ]) |
| 19:42 | technomancy | celwell: I mean the `into' call there does nothing |
| 19:43 | justin_smith | or use fn instead of #() |
| 19:43 | Raynes | #(do ..) is icky |
| 19:43 | amalloy | celwell: are you looking for something like (into [:table] (mapcat (comp (juxt :label :value) val) (:form_response r)))? |
| 19:43 | technomancy | oh man I was just about to say juxt |
| 19:43 | amalloy | Raynes: wrong, it is the grossest thing in the world |
| 19:43 | technomancy | too slow |
| 19:43 | celwell | the format that I'm going for can be seen here: https://github.com/yogthos/clj-pdf#a-complete-example |
| 19:44 | celwell | if you look at the example it has for :table |
| 19:44 | amalloy | okay, so s/mapcat/map in my guess probably |
| 19:44 | amalloy | does he know that "halvetica" is not a font family? |
| 19:45 | justin_smith | do the vectors inside :table strictly need to be vectors, or can they be lazy-seqs? |
| 19:45 | justin_smith | if they need to be vectors, use mapv |
| 19:45 | celwell | amalloy: but I want to have it laid out all at once rather than added to the :table vector later |
| 19:46 | amalloy | celwell: what you are saying doesn't make any sense. you need to produce a vector of a certain shape; what does "all at once" even mean? |
| 19:46 | justin_smith | celwell: that seems like a nonsequitor |
| 19:48 | celwell | like [:table ["a" "b" "c"] ["1" "2" "3"] ["A" "B" "C"]] rather than starting with just [:table] and using 'into' |
| 19:50 | celwell | I mean, I want to be able to just declare the structure with all the vectors rather than building it up with into's and such |
| 19:51 | amalloy | you can't do that. your call to map is a function call, and can only possibly return one value. there's no way to "include" that in a vector starting with :table, except to start with [:table] and then add things to it |
| 19:52 | amalloy | but it's also like...not a problem. whatever is making you think it's bad to put things in a vector is probably an assumption you should re-evaluate |
| 19:52 | celwell | amalloy: can I make some sort of macro to splice it? (sorry if I use the wrong terms) |
| 19:53 | justin_smith | why? why do you think you need to do this? |
| 19:53 | amalloy | no. you can write other stuff like `[:table ~@(map ...)], but it's just sugar for doing the same thing |
| 19:57 | celwell | Ok, yeah I guess that's fine; I just maybe there's a simpler way to do it. Thanks, I ended up with: |
| 19:57 | celwell | (into [:table] (map (comp (juxt :label :value) val) |
| 19:57 | celwell | (:form_response r))) |
| 19:57 | justin_smith | celwell: so it's ok to have a lazy seq instead of vector inside? |
| 19:58 | amalloy | justin_smith: there aren't any lazy-seqs in that value |
| 19:58 | justin_smith | oh, right |
| 19:58 | justin_smith | sorry |
| 19:58 | amalloy | celwell: actually, i know that's what i wrote, but i think it's kinda prettier if you write (into [:table] (map (juxt :label :value) (vals (:form_response r)))) |
| 20:01 | celwell | amalloy: yeah I liek that better too |
| 20:09 | amalloy | an amusing hobby: arrowing forms until they're totally unrecognizable. eg, instead of (while (< 10000 (count (first @(:buffers (meta foo))))) (Thread/sleep 5000)), it's clearly more readable to write (-> foo (meta) (:buffers) (deref) (first) (count) (->> (< 10000)) (while (Thread/sleep 5000))). then you show that to people who say that the purpose of -> is to "reduce nesting" |
| 20:10 | bbloom | amalloy: c'mon man, drop all those unecessary parens |
| 20:10 | amalloy | bbloom: you can pry them from my cold, dead hands |
| 20:10 | dbasch | amalloy: are they your father’s parentheses? |
| 20:10 | amalloy | but, just for you, a version which is obviously more readable: (-> foo meta :buffers deref first count (->> (< 10000)) (while (Thread/sleep 5000))) |
| 20:13 | bbloom | amalloy: there must be a rewrite rule for ->> and < |
| 20:13 | amalloy | bbloom: a rewrite rule? |
| 20:13 | bbloom | (->> ?x (< ?y) => (-> ?x (>= ?y)) |
| 20:14 | bbloom | (-> foo meta :buffers deref first count (>= 10000) (while (Thread/sleep 5000))) ; right? |
| 20:15 | amalloy | bbloom: oh, sure, that's a possible rewrite. but i wouldn't want it done automatically |
| 20:15 | bbloom | amalloy: who said anything about automatically? you wanted to reduce nesting levels :-P |
| 20:15 | amalloy | there are scenarios where "x is less than 10000" makes more sense to say than "10000 is at least as large as x" |
| 20:16 | amalloy | or whatever the equivalences are there |
| 20:16 | amalloy | but you actually meant >, not >= |
| 20:16 | bbloom | oh duh |
| 20:16 | bbloom | of course |
| 20:17 | bbloom | "are the following monotonically increasing? x 10000" |
| 20:17 | dbasch | >=, worldwide sponsor of null pointer exceptions |
| 20:17 | amalloy | i actually think the comparison operators are one of the great use-cases for ->, because then you can write "x" followed by "less than 10000", and mean "x is less than 10000" |
| 20:18 | amalloy | ie, (-> x (< 10000)) |
| 20:18 | amalloy | instead of having to do mental translations to this monotonically-increasing stuff |
| 20:18 | bbloom | racket as an infix notation thing |
| 20:18 | bbloom | scala too |
| 20:18 | bbloom | (x . < . 10000) |
| 20:19 | amalloy | yeah, using . notation for that seems weird to me, but whatever gets them infix that they like |
| 20:19 | bbloom | yeah |
| 20:19 | bbloom | but i'm a big fan of variadic comparison operators |
| 20:19 | amalloy | sure, those are obviously great |
| 20:20 | dbasch | greater than non-variadic ones |
| 20:22 | dbasch | comparing comparison operators is better than doing actual work |
| 21:01 | cfleming | {blake}: Oh, ok - cool. |
| 22:01 | enn | Hello, I'm getting the following backtrace in my Cider REPL after upgrading to the latest snapshot in Melpa: http://hastebin.com/juyuburewa.avrasm |
| 22:01 | enn | I'm not sure exactly what causes it, it seems to just pop up eventually if I spend long enough in a Clojure buffer while jacked in |
| 22:08 | justin_smith | enn: does the latest melpa cider need a new version of the cider nrepl middleware? |
| 22:10 | enn | justin_smith: maybe. in my profiles.clj I have [[cider/cider-nrepl "0.8.0-SNAPSHOT"]], which is correct, but I'm not sure how to tell it how to grab a newer 0.8.0-SNAPSHOT. |
| 22:12 | justin_smith | there is a configuration to force getting a newer version of a snapshot, otherwise lein checks once ever 24 hours iirc |
| 22:13 | enn | I'll try that |
| 22:14 | enn | huh. Well, lein -U deps did grab a newer version of cider-nrepl. But I still get the same backtrace (after restarting emacs and cider). |
| 22:19 | enn | ah, I guess I'm seeing this: https://github.com/clojure-emacs/cider/issues/844 |
| 23:11 | bbloom | hyPiRion: did you come across any literature in/around linear types with anything approximating clojure's transients? |
| 23:12 | bbloom | i don't see any obvious citations connecting the ideas to your bibliography :-) |
| 23:26 | ubolonton | $seen tbaldridge |
| 23:26 | lazybot | tbaldridge was last seen quitting 1 day and 5 hours ago. |
| 23:36 | mdeboard | How would I go about porting over an annotation to clojure? |
| 23:39 | justin_smith | mdeboard: example from rich hickey https://gist.github.com/richhickey/377213 |
| 23:40 | mdeboard | yeah I saw that |
| 23:40 | mdeboard | language has changed alot, didn't know if htings had changed since |
| 23:40 | justin_smith | did you try it? |
| 23:41 | mdeboard | no I'm out of gas, been trying to write a minecraft plugin in clojure for awhile, I'm collapsing |
| 23:41 | justin_smith | I've heard minecraft is a pain to extend |
| 23:42 | mdeboard | well there are these specialized servers that I think abstract most of that stuff away? |
| 23:42 | mdeboard | I bought this book for learning to program java by writing minecraft plugins, for my daughter and I to go through together |
| 23:42 | mdeboard | it's actually pretty straightforward |
| 23:42 | mdeboard | believe it or not |
| 23:43 | justin_smith | interesting, I had no idea |
| 23:43 | mdeboard | I *think* the thing that makes it notoriously hard is the fact the java source is obfuscated |
| 23:44 | mdeboard | so you have to de-obfuscate, code against that, then obfuscate... or some such |
| 23:44 | mdeboard | so then CanaryMod & Bukkit are two servers that I *think* abstract that problem away |
| 23:44 | TEttinger | thanks, Microsoft! now I don't need to blame Notch's bad code when I can blame a huge mega-corporation! |
| 23:44 | mdeboard | it's so much more fashionable |
| 23:45 | justin_smith | TEttinger: have you followed the news about the reason for Windows 10 not being Windows 9? |
| 23:45 | TEttinger | no |
| 23:45 | mdeboard | IT'S BECAUSE WINDOWS 7 ATE 9 |
| 23:45 | TEttinger | groooooaaaan |
| 23:45 | mercwithamouth | lol |
| 23:45 | justin_smith | turns out a bunch of software, including java, was checking if the version string started with "Windows 9" to check for versions 95 or 98 |
| 23:46 | mdeboard | dude I was so proud of myself for making that joke this morning https://twitter.com/matt_deboard/status/517746095196504066 |
| 23:46 | mdeboard | then coworker pointed out it was the subtitle on the /. submission |
| 23:46 | justin_smith | so naming a version windows 9 broke a whole bunch of shit - so they renamed it 10 to fix other peoples crap |
| 23:46 | arrdem | mdeboard: that used to be the case, then they added a "developer" license that removes the obfuscate/deobfuscate transform if you sign... also there are a bunch of simplifying frameworks that have come out. |
| 23:47 | mdeboard | arrdem: Is that what CanaryMod is? |
| 23:47 | arrdem | justin_smith: that would seem to be the rumor at least... |
| 23:47 | arrdem | mdeboard: not sure, I don't think so. |
| 23:47 | mdeboard | No it's because Windows 7 ate 9 :| |
| 23:47 | justin_smith | arrdem: the source I saw showed a bunch of open source code (includking java) checking for that substring |
| 23:48 | handojin | hi all |
| 23:48 | arrdem | justin_smith: yeah it's been floating around reddit and other sources for a few days now unclear whether it's a joke or authoritative AFAIK, but sadly I can believe it. |
| 23:48 | handojin | any clue why my nrepl won't start? |
| 23:48 | handojin | but says |
| 23:48 | justin_smith | arrdem: this was link to actual codebases, so that's pretty believable to me |
| 23:48 | mdeboard | handojin: Are you using a computer |
| 23:48 | handojin | error in process sentinel: Could not start nREPL server: Error loading cider.nrepl.middleware.trace: java.lang.RuntimeException: No such var: trace/traced?, compiling:(cider/nrepl/middleware/trace.clj:12:11) |
| 23:49 | handojin | i'm afraid so |
| 23:49 | mdeboard | I think that may have something to do with it |
| 23:49 | arrdem | mdeboard: lol |
| 23:50 | arrdem | handojin: it would seem that you' |
| 23:50 | arrdem | re trying to load an old version of tools.trace |
| 23:50 | justin_smith | handojin: does your cider nrepl plugin version match your cider version? |
| 23:50 | arrdem | handojin: or that would be my guess |
| 23:50 | handojin | hmmm |
| 23:50 | justin_smith | handojin: and also, cider has been breaking a lot lately if you are using the alpha on melpa |
| 23:50 | mdeboard | smh @ melpa |
| 23:51 | handojin | not that adventurous |
| 23:51 | arrdem | it's really not that bad TBH |
| 23:51 | arrdem | I do daily updates and track each update in git.. |
| 23:51 | arrdem | just roll back if shit don't work |
| 23:51 | justin_smith | handojin: what versions are you using? |
| 23:51 | handojin | CIDER 0.7.0alpha (package: 20140619.914) |
| 23:52 | handojin | says M-x cider version |
| 23:52 | justin_smith | what cider nrepl middleware plugin version? |
| 23:52 | arrdem | handojin: that's not the latest. |
| 23:52 | justin_smith | also I think there is a 0.7.0 (non alpha) |
| 23:52 | arrdem | justin_smith is correct, 0.7.0 is released. 0.8.0-alpha is where it's at atm. |
| 23:53 | handojin | it's what came with prelude |
| 23:53 | justin_smith | if you want to be bleeding edge use 0.8.0-alpha, for stable use 0.7.0 - there is no reason to use 0.7.0-alpha, worst of both worlds |
| 23:53 | handojin | how would i check middleware version? |
| 23:53 | arrdem | handojin: trace is I believe a baked in middleware |
| 23:54 | justin_smith | handojin: it should be in your ~/.lein/profiles.clj or in your project.clj |
| 23:54 | handojin | oh, ok |
| 23:54 | justin_smith | cider has two halves, the part that runs in emacs, and the part that runs in clojure, and if the versions go out of sync weird things can happen |
| 23:55 | mercwithamouth | for cider 0.7 do we have to pull from github? it's not pulling from elpa |
| 23:55 | arrdem | mercwithamouth: yeah doing a manual local install is probably the only way to be sure |
| 23:55 | mercwithamouth | gotcha |
| 23:57 | handojin | .lein/profiles.clj sayeth cider/cider-nrepl "0.7.0-SNAPSHOT" |
| 23:58 | handojin | apparently i need to restart emacs (M-x prelude-update-packages) |
| 23:58 | arrdem | yeah ditch that snapshot and do a local install of CIDER 0.7.0 for emacs from git |
| 23:58 | arrdem | just to be sure |
| 23:58 | handojin | weird thing is that everything worked fine until i hit an error |
| 23:58 | arrdem | well... that's kinda tautological isn't it? |
| 23:58 | justin_smith | handojin: I know what you mean, but lol :) |
| 23:59 | handojin | well this happen yesterday too - then i just restarted emacs and all was well |