2012-10-11
| 00:05 | AtKaaZ | ##((juxt name symbol) 'a) |
| 00:05 | lazybot | ⇒ ["a" a] |
| 00:07 | ivan | &(apply str (repeat 10 "\uFFFF")) |
| 00:07 | lazybot | ⇒ "￿￿￿￿￿￿￿￿￿￿" |
| 00:08 | AtKaaZ | ,(.length (str (macroexpand '((juxt namespace symbol) `'`'`'`a)))) |
| 00:08 | clojurebot | 333 |
| 00:09 | AtKaaZ | ,(* 2 (.length (str (flatten (macroexpand '((juxt namespace symbol) `'`'`'`a)))))) |
| 00:09 | clojurebot | 58 |
| 00:10 | AtKaaZ | ,(* 2 (.length (str (macroexpand '((juxt namespace symbol) `'`'`'`a))))) |
| 00:10 | clojurebot | 666 |
| 00:14 | wingy | im reading about interactive development using nrepl |
| 00:14 | wingy | "Immutant provides two methods for connecting to an application's runtime with a REPL: Swank (for emacs & possibly vim if you are feeling adventurous) and nREPL (for any nREPL client)." |
| 00:14 | wingy | what does Immutant means? |
| 00:17 | muhoo | it's a project |
| 00:18 | muhoo | ,google immutant |
| 00:18 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: google in this context, compiling:(NO_SOURCE_PATH:0)> |
| 00:18 | AtKaaZ | $google immutant |
| 00:18 | lazybot | [Immutant | Home] http://immutant.org/ |
| 00:18 | muhoo | clojurebot: google immutant |
| 00:18 | clojurebot | First, out of 1760 results is: |
| 00:18 | clojurebot | Immutant | Home |
| 00:18 | clojurebot | http://immutant.org/ |
| 00:29 | wingy | after reading this https://github.com/clojure/tools.nrepl i still dont get how to connect to a remote nrepl instance |
| 00:32 | AtKaaZ | wingy, like: lein repl :connect nrepl://localhost:50821 |
| 00:32 | AtKaaZ | in my case that's the url for the ccw/eclipse started one |
| 00:33 | Sgeo | Can nREPL servers be password protected? |
| 00:33 | wingy | AtKaaZ: cool it worked |
| 00:33 | wingy | where did you get that info? |
| 00:34 | AtKaaZ | wingy, I remembered it from a video, not sure but maybe it was chas emerick |
| 00:34 | AtKaaZ | in this vid: https://www.youtube.com/watch?v=VVd4ow-ZcX0 |
| 00:35 | wingy | AtKaaZ: lein help repl |
| 00:35 | wingy | ill watch it now :) |
| 00:35 | wingy | i love your video recommendations |
| 00:35 | wingy | wow 1.30 h :) |
| 00:36 | AtKaaZ | ikr, I'm only at 28min :) |
| 00:36 | wingy | we should watch a video together some time |
| 00:36 | wingy | so we can live discuss :) |
| 00:36 | wingy | i watched movies with my pal like that many times :) |
| 00:37 | AtKaaZ | I usually have a few open and paused , do other stuff and randomly continue |
| 00:37 | wingy | yeah |
| 00:37 | AtKaaZ | wingy, it talks about your :join false which I saw earlier recommended for you, at about minute 28 in the video |
| 00:38 | wingy | cool |
| 01:46 | uvtc | ,(str/replace "score is 22" #"(\d+)" #(str "1" %1)) |
| 01:46 | clojurebot | #<CompilerException java.lang.RuntimeException: No such namespace: str, compiling:(NO_SOURCE_PATH:0)> |
| 01:46 | uvtc | ,(clojure.string/replace "score is 22" #"(\d+)" #(str "1" %1)) |
| 01:46 | clojurebot | "score is 1[\"22\" \"22\"]" |
| 01:46 | uvtc | How can I get "score is 122"? ^^ |
| 01:47 | uvtc | I want to take the whole thing that matched the regex, then (str "1" whole-thing). |
| 01:51 | ivan | ,(clojure.string/replace "score is 22" #"(\d+)" "1$1") |
| 01:51 | clojurebot | "score is 122" |
| 01:52 | ivan | ,(clojure.string/replace "score is 22" #"(\d+)" #(str "1" (first %1))) |
| 01:52 | clojurebot | "score is 122" |
| 01:53 | uvtc | Thanks, ivan. But why is that `first` call required there? |
| 01:53 | ivan | ,(clojure.string/replace "score is 22" #"\d+" #(str "1" %1)) |
| 01:53 | clojurebot | "score is 122" |
| 01:53 | AtKaaZ | ,(clojure.string/replace "score is 22" #"(\d+)" #(when-let [[x] %] (str "1" x) )) |
| 01:53 | clojurebot | "score is 122" |
| 01:53 | ivan | something to do with matching groups giving you a vector |
| 01:54 | ivan | you have a matching group, and a "whole match" (in my vague non-understanding) |
| 01:54 | uvtc | Ah, didn't see that if you left out parens, the whole match is $1 |
| 01:54 | uvtc | Thanks, ivan! |
| 01:55 | uvtc | Oh wait I'm wrong there. |
| 01:55 | uvtc | ,(str/replace "score is 22" #"\d+" "1$1") |
| 01:55 | clojurebot | #<CompilerException java.lang.RuntimeException: No such namespace: str, compiling:(NO_SOURCE_PATH:0)> |
| 01:55 | wei_ | how do you traverse a list with an atom that represents the current item? for example, I'm displaying one image in a list of images, and i want to be able to get the next or previous image. |
| 01:55 | AtKaaZ | ,(clojure.string/replace "score is 22" #"(\d+)" #(println %&)) |
| 01:55 | clojurebot | ([22 22]) |
| 01:55 | clojurebot | #<NullPointerException java.lang.NullPointerException> |
| 01:56 | uvtc | AtKaaZ: Wait ... $% vs. %& ... |
| 01:57 | AtKaaZ | uvtc, I was only showing what the param(s) are to that function it's that [22 22] vector |
| 01:57 | AtKaaZ | aka 1 param |
| 01:57 | AtKaaZ | but it is due to the grouping parens near the (\d+) right? |
| 01:57 | uvtc | AtKaaZ: Oh, right. Forgot about %& in literal function syntax. |
| 01:59 | uvtc | Seems like it would be handy if "$&" meant "the whole match"... |
| 02:00 | amalloy | uvtc: $0, i think |
| 02:00 | AtKaaZ | ,(clojure.string/replace "score is 22 33" #"(\d+)" "1$0") |
| 02:00 | clojurebot | "score is 122 133" |
| 02:00 | uvtc | Holy malloy! Avast! |
| 02:00 | uvtc | Thanks, amalloy, that's it. :) |
| 02:00 | amalloy | it would be pretty silly for clojure's & notation to sneak into java's regex replacer :P |
| 02:01 | AtKaaZ | ,(clojure.string/replace "score is 22 33" #"(\d+)" "1$1") |
| 02:01 | clojurebot | "score is 122 133" |
| 02:02 | AtKaaZ | wish I knew the answer to wei_ 's question |
| 02:02 | wei_ | thanks AtKaaz |
| 02:02 | wei_ | I was beginning to wonder whether it was too newb a question |
| 02:03 | Sgeo | wei_, maybe two lists, with the head of one of them representing the current item? |
| 02:03 | wei_ | so i can pop to find the next one. but how to get prev? |
| 02:04 | Sgeo | ['(3 2 1) '(4 5 6)] could be, for example, the list 1 2 3 4 5 6 with the current position being on 4 |
| 02:04 | AtKaaZ | wei_, was the atom the index to an immutable "list" ? |
| 02:04 | Sgeo | The previous would be the head of the left list, current is the head of the right list |
| 02:06 | wei_ | works for me. thanks Sgeo! |
| 02:06 | Sgeo | You're welcome |
| 02:06 | Sgeo | Note that I don't know if that's idiomatic Clojure style, but it avoids the need for mutability |
| 02:06 | wei_ | the atom can be that whole structure, i guess |
| 02:07 | Sgeo | Note that this concept is, I think, what clojure.zip is about |
| 02:07 | AtKaaZ | Sgeo, so when you go to the next, you'd get new lists like ['(4 3 2 1) '(5 6)] ? |
| 02:07 | Sgeo | AtKaaZ, yes |
| 02:08 | Sgeo | ,(-> '(1 2 3 4 5 6) clojure.zip/seq-zip) |
| 02:08 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.zip> |
| 02:09 | Sgeo | ,(require 'clojure.zip :as 'zip) |
| 02:09 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.Symbol> |
| 02:09 | Sgeo | ,(require '[clojure.zip :as zip]) |
| 02:09 | clojurebot | nil |
| 02:09 | Sgeo | ,(-> '(1 2 3 4 5 6) zip/seq-zip) |
| 02:09 | clojurebot | [(1 2 3 4 5 ...) nil] |
| 02:09 | Sgeo | ,(-> '(1 2 3 4 5 6) zip/seq-zip zip/down zip/next zip/next zip/next) |
| 02:09 | clojurebot | [4 {:l [1 2 3], :pnodes [(1 2 3 4 5 ...)], :ppath nil, :r (5 6)}] |
| 02:10 | Sgeo | ,(-> '(1 2 3 4 5 6) zip/seq-zip zip/down zip/next zip/next zip/next zip/prev) |
| 02:10 | clojurebot | [3 {:l [1 2], :pnodes [(1 2 3 4 5 ...)], :ppath nil, :r (4 5 6)}] |
| 02:10 | wei_ | what's with the zip/down? |
| 02:10 | AtKaaZ | yep I'm totally lost :) |
| 02:10 | Sgeo | ,(-> '(1 2 3 4 5 6) zip/seq-zip zip/down zip/next zip/next zip/next zip/prev zip/node) |
| 02:10 | clojurebot | 3 |
| 02:11 | Sgeo | wei_, in clojure.zip, when you make a zipper out of something, your "location" starts out as the entire structure itself |
| 02:11 | Sgeo | ,(-> '(1 2 3 4 5 6) zip/seq-zip zip/node) |
| 02:11 | clojurebot | #<CompilerException java.lang.RuntimeException: No such namespace: zip, compiling:(NO_SOURCE_PATH:0)> |
| 02:11 | Sgeo | ,(require '[clojure.zip :as zip]) |
| 02:11 | clojurebot | nil |
| 02:11 | Sgeo | ,(-> '(1 2 3 4 5 6) zip/seq-zip zip/node) |
| 02:11 | clojurebot | (1 2 3 4 5 ...) |
| 02:11 | Sgeo | ,(-> '(1 2 3 4 5 6) zip/seq-zip zip/down zip/node) |
| 02:11 | clojurebot | 1 |
| 02:12 | wei_ | so in this case the list itself is the parent node for the items |
| 02:13 | Sgeo | ,(-> '(1 2 3) zip/seq-zip zip/down zip/right (zip/replace 10) zip/root zip/node) |
| 02:13 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn> |
| 02:14 | Sgeo | ..? |
| 02:15 | Sgeo | At any rate, the two list structure I showed you is, to the best of my understanding, a form of zipper, even if it doesn't support descending and isn't clojure.zip compatible |
| 02:15 | wei_ | ,(-> '(1 2 3) zip/seq-zip zip/down zip/right (zip/replace 10) zip/up zip/node) |
| 02:15 | clojurebot | (1 10 3) |
| 02:16 | ori-l | wei_: konami code? |
| 02:16 | wei_ | right, your implementation does resemble a zipper |
| 02:17 | wei_ | ori-l haha, i think you need a tree for that |
| 02:17 | Sgeo | ,(-> '(1 2 3) zip/seq-zip zip/down zip/right (zip/replace 10) zip/root) |
| 02:17 | clojurebot | (1 10 3) |
| 02:19 | Sgeo | I should really sleep now, I have class in less than 6 hours |
| 02:20 | AtKaaZ | ,(-> '(1 2 3) zip/seq-zip zip/down zip/right zip/right (zip/replace 4) zip/up) |
| 02:20 | clojurebot | [(1 2 4) nil] |
| 02:21 | AtKaaZ | oh right, forgot root |
| 02:29 | AtKaaZ | ,(quote a b c) |
| 02:29 | clojurebot | a |
| 02:32 | AtKaaZ | how would you replace the numbers with d a b c here: ##(-> 4 (list 1 2 3)) |
| 02:32 | lazybot | ⇒ (4 1 2 3) |
| 02:32 | AtKaaZ | other than this ##(-> 'd (list 'a 'b 'c)) |
| 02:32 | lazybot | ⇒ (d a b c) |
| 02:34 | AtKaaZ | ,(-> 'd (list (map symbol '(a b c)))) |
| 02:34 | clojurebot | (d (a b c)) |
| 02:43 | AtKaaZ | how do you make a list of params become non-list, in non-macros |
| 02:43 | AtKaaZ | ,(#(do (-> (last %&) (list (reverse (pop (reverse %&)))) ) ) 1 2 3) |
| 02:43 | clojurebot | (3 (1 2)) |
| 02:46 | tomoj | huh? |
| 02:46 | AtKaaZ | :) I want to pass 2 param but they are in a list |
| 02:46 | AtKaaZ | there was a simple way but I'm missing it now |
| 02:47 | AtKaaZ | rigth apply? |
| 02:47 | tomoj | say what you want like (= (__ + '(1 2)) 3) |
| 02:47 | tomoj | where __ is the blank you want to fill in |
| 02:48 | AtKaaZ | it's "apply" what I was looking for |
| 02:48 | AtKaaZ | ,(apply list '(1 2 3)) |
| 02:48 | clojurebot | (1 2 3) |
| 02:50 | AtKaaZ | ok appply would've worked but not in my example: (#(do (-> (last %&) (list (___ (reverse (rest (reverse %&)))) ) ) ) 1 2 3) |
| 02:53 | AtKaaZ | basically I want to do this: (list 1 (2 3)) without flatten and return (1 2 3) |
| 02:53 | AtKaaZ | ,(flatten (list 1 '(2 3))) |
| 02:53 | clojurebot | (1 2 3) |
| 02:54 | AtKaaZ | that, but without flatten :) |
| 02:55 | AtKaaZ | tomoj, ,(list 1 (____ '(2 3))) |
| 02:57 | AtKaaZ | in other words, is it possible to return a non-collection list of things heh |
| 02:58 | AtKaaZ | I guess macros then |
| 03:11 | wingy | clj is such a good repl lang |
| 03:11 | AtKaaZ | ok i give up, i wanted a generic way to see the difference between -> and ->> by being able to pass any number and type of params to be added to a list by ie. (funxion-any -> a b 2 ) or (funxion01 a b 2) which would return (2 a b) or (a b 2) if ->> |
| 03:11 | AtKaaZ | ,(#(do (flatten (-> (last %&) (list (reverse (rest (reverse %&))) ) ))) 'a 'b 'c) |
| 03:12 | clojurebot | (c a b) |
| 03:13 | AtKaaZ | ,(defmacro x [& coll#] `(-> (last '~coll#) (list ~@coll#))) (x 1 2 3) |
| 03:13 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 03:14 | tomoj | AtKaaZ: what do you want (list 1 (____ '(2 3))) to be? |
| 03:14 | AtKaaZ | (1 2 3) |
| 03:15 | tomoj | that's not possible |
| 03:15 | tomoj | ##(apply list 1 '(2 3)) is possible |
| 03:15 | AtKaaZ | i was afraid of that |
| 03:15 | lazybot | ⇒ (1 2 3) |
| 03:15 | tomoj | -> and ->> aren't functions |
| 03:15 | AtKaaZ | if I do apply like that, then I can't use it with -> and ->> |
| 03:15 | tomoj | ,(clojure.walk/macroexpand-all '(-> a b 2)) |
| 03:15 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.walk> |
| 03:16 | AtKaaZ | yeah I know it's a macro |
| 03:16 | tomoj | ,(clojure.walk/macroexpand-all '(-> a b 2)) |
| 03:16 | clojurebot | (2 (b a)) |
| 03:19 | AtKaaZ | ok I guess this is the best I can do ##(#(do (flatten (-> (last %) (list (reverse (rest (reverse %))) ) ))) '(a b c 2)) |
| 03:19 | lazybot | ⇒ (2 a b c) |
| 03:19 | AtKaaZ | ,(#(do (flatten (->> (last %) (list (reverse (rest (reverse %))) ) ))) '(a b c 2)) |
| 03:19 | clojurebot | (a b c 2) |
| 03:20 | tomoj | I guess I still don't understand what you're trying to do |
| 03:21 | AtKaaZ | experimenting, but well I wanted to make a generic way of this structure (-> 1 (list 2 3)) where -> 1 2 and 3 etc. would be changable |
| 03:22 | AtKaaZ | so in my example above, I can change/add anything in the (a b c 2) part and the ->> |
| 03:22 | AtKaaZ | the ->> can be one of -> or ->> :) just to see the result |
| 03:28 | AtKaaZ | ok considering the latest revisions: (defmacro x [f# coll#] `(flatten (~f# (last ~coll#) (list (reverse (rest (reverse ~coll#)))) ))) (x ->> '(a b c d)) |
| 03:31 | AtKaaZ | or this one might be better: (defmacro x [f# & coll#] `(flatten (~f# (last '~coll#) (list (reverse (rest (reverse '~coll#)))) ))) (x -> a b c d) |
| 03:32 | AtKaaZ | I just wish I could get ~@coll# without the last param |
| 03:32 | tomoj | ~@(butlast coll#)? |
| 03:32 | clojurebot | Cool story bro. |
| 03:33 | tomoj | note you don't need to # the x params |
| 03:33 | tomoj | also ##(#(cons (last %) (butlast %)) '(a b c d)) |
| 03:33 | lazybot | ⇒ (d a b c) |
| 03:37 | AtKaaZ | lol @clojurebot , but how come that works hmm, i tested it that's pretty awesome |
| 03:37 | AtKaaZ | why don't I need to # the params? |
| 03:38 | tomoj | you only need gensyms in the code your macro returns |
| 03:39 | tomoj | those params are in the macro code, not its result |
| 03:39 | tomoj | 'x# |
| 03:39 | tomoj | &'x# |
| 03:39 | lazybot | ⇒ x# |
| 03:39 | tomoj | &`(let [x# 3] x#) |
| 03:39 | lazybot | ⇒ (clojure.core/let [x__11709__auto__ 3] x__11709__auto__) |
| 03:40 | tomoj | why not just macroexpand to see the difference between -> and ->>? |
| 03:43 | AtKaaZ | I was already aware of that, so kinda trying experimenting other ways; started from (-> 1 (list 2 3)) and then what if I wanted to allow a b c, then what if I didn't want to manually quote them like (-> 'a (list 'b 'c)) then what if I wanted to pass only the relevant inputs -> a b c to a function |
| 03:44 | AtKaaZ | so far you taught me this important thing: ~@(butlast coll#) and I'm still not yet to the part with x# |
| 03:45 | AtKaaZ | oh right x# I got the part with gensyms not being needed |
| 03:51 | AtKaaZ | ,(apply quote '(a b c)) |
| 03:51 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: quote in this context, compiling:(NO_SOURCE_PATH:0)> |
| 03:52 | AtKaaZ | ,(map symbol '(a b c)) |
| 03:52 | clojurebot | (a b c) |
| 03:52 | AtKaaZ | ,(map symbol '(a b c 1)) |
| 03:52 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String> |
| 03:53 | AtKaaZ | actually I want this: (map quote '(a b c)) |
| 03:54 | wingy | AtKaaZ: you never sleep |
| 03:54 | AtKaaZ | maybe in here: (defmacro y [& c] `(list ~@(map quote c))) (y 1 2 3 4 d e) |
| 03:54 | AtKaaZ | wingy, I sleep when I am offline |
| 03:55 | wingy | me 2 |
| 03:55 | wingy | sleep code sleep code |
| 03:55 | AtKaaZ | I don't code, yet, I'm nowhere near there:) |
| 03:56 | wingy | learn code learn code |
| 03:57 | AtKaaZ | ,(list (symbol 'quote) 'a) |
| 03:57 | clojurebot | (quote a) |
| 03:57 | wingy | the best way to learn something is to code something though |
| 03:57 | wingy | code an app you wanna launch for real |
| 03:58 | AtKaaZ | ,(println (symbol "'a")) |
| 03:58 | clojurebot | 'a |
| 03:59 | AtKaaZ | ,(println 'a) |
| 03:59 | clojurebot | a |
| 03:59 | AtKaaZ | wingy, yeah but I need to learn some more, experiment randomly |
| 03:59 | wingy | use Light Table for that |
| 03:59 | wingy | its the best learning env |
| 04:00 | wingy | http://www.chris-granger.com/2012/08/17/light-table-reaches-010/ |
| 04:00 | AtKaaZ | thanks, I think I've seen it before, but not lately |
| 04:01 | wingy | it will make learning clj 1000 times more fun |
| 04:06 | AtKaaZ | 18mb launcher wonder why it needs to connect to the internet, not allowing =) |
| 04:07 | wingy | for stats |
| 04:07 | wingy | you got firewall? |
| 04:07 | AtKaaZ | yep, I it won't start without internet, oh well |
| 04:07 | wingy | heh .. its probably nothing harmful |
| 04:08 | wingy | trust me .. its worth it |
| 04:08 | AtKaaZ | I'll just fake a local server for it lol |
| 04:08 | wingy | its like lein .. doing some checks and installing things |
| 04:08 | AtKaaZ | in lein we trust :)) |
| 04:08 | wingy | trust ibdknox |
| 04:08 | wingy | he is harmless |
| 04:09 | wingy | it will save you 1000 hours |
| 04:09 | wingy | when final is here im sure i will ignore "lein repl" :) |
| 04:12 | tomoj | datomic should have a pricing plan where you give rich equity for a temporary license |
| 04:13 | wingy | they should have a cloud alternative |
| 04:13 | wingy | providing it as a heroku addon with full managed scalability |
| 04:13 | wingy | me hate sysadmin works |
| 04:15 | tomoj | yeah heroku addon would be cool |
| 04:15 | wingy | https://groups.google.com/forum/?fromgroups=#!topic/datomic/6uh2edM-i1g |
| 04:15 | wingy | no answer though |
| 04:15 | tomoj | the peer limit seems weird |
| 04:20 | tomoj | well |
| 04:21 | tomoj | you could pretty easily do in-memory datomic on heroku I think |
| 04:22 | tomoj | though you don't have a lot of ram so.. |
| 04:25 | wingy | in memory is only for development though |
| 04:25 | clojurebot | Ik begrijp |
| 04:26 | tomoj | yeah |
| 04:30 | wingy | if i make a transaction with datomic: @(d/transact conn [{:db/id #db/id[:db.part/user -1000001] :name "foo"}]) |
| 04:30 | wingy | how do i get back the entity (id) immediately? |
| 04:54 | michaelr525 | is there anything like that function in core? http://clojuredocs.org/clojure_contrib/clojure.contrib.map-utils/deep-merge-with |
| 04:55 | michaelr525 | merges a map recursively |
| 04:56 | michaelr525 | hmm |
| 04:57 | michaelr525 | i'll just copy that function over to my code :) |
| 05:31 | edlich | Sorry first time here. Looking if something happens... |
| 05:59 | Kototama | I don't understand people complaining about the Lisp syntax, it's so much better than JavaScript. After writing a few macro here is what I get http://paste2.org/p/2322970 |
| 06:02 | tomoj | cool |
| 06:02 | tomoj | we can do better than backbone, though :) |
| 06:03 | Kototama | probably :-) |
| 06:04 | wingy | how do i require the test files in repl? |
| 06:05 | wingy | it usually is looking for namespaces in the src/ dir |
| 06:05 | wingy | not the test/ > |
| 06:05 | wingy | ? |
| 06:08 | tomoj | maybe lein with-profiles test repl ? |
| 06:08 | tomoj | just a guess |
| 06:09 | tomoj | er |
| 06:09 | edlich | and lein test in another shell is not possible? |
| 06:10 | tomoj | with-profile |
| 06:10 | edlich | Or possible lein repl and then require the test file (but I didn't test if this works) |
| 06:10 | wingy | i just required the namespace that was defined |
| 06:11 | wingy | it worked since test/ must be in the class path |
| 06:11 | edlich | So problem solved?! |
| 06:12 | wingy | yeah |
| 06:12 | wingy | just trying to find a good testing workflow now |
| 06:13 | wingy | i run it atm with (run-tests 'testing-ns) |
| 06:13 | edlich | By the way is someone working with travis-ci.org ? |
| 06:14 | edlich | The clojure part needs more documentation as: what could be written in the script part etc. |
| 06:15 | edlich | This might be how you wingy should test ;-) |
| 06:15 | wingy | edlich: have not used travis yet |
| 06:16 | wingy | i'll get there :) |
| 06:16 | edlich | it's cool |
| 06:16 | edlich | but beta. |
| 06:16 | wingy | whats the benefits? |
| 06:16 | edlich | You can set a github hook. |
| 06:16 | edlich | So every commit gets an automatic build. Have a look: |
| 06:16 | wingy | cool |
| 06:17 | edlich | https://travis-ci.org/#!/edlich/rasbojnik |
| 06:17 | edlich | (but my project is also just starting... (not much code in there...) |
| 06:22 | edlich | What would be really great would be a clojure coach. There should be a platform to hire one. |
| 06:22 | wingy | would be so much better if the failures in clojure.test gave some different colors |
| 06:23 | wingy | there is a lot of info about clj already |
| 06:23 | wingy | consult http://thinkrelevance.com/ |
| 06:24 | edlich | I have ALL books and I am studying them. |
| 06:24 | edlich | I am thinking more of something as a neat help like small feedback 50 cents, middle Feedback = 2$ big Feedback 5$ |
| 06:25 | edlich | I think I ask Stu when meeting him at the next conference. Good hint. Thanks. |
| 06:25 | wingy | yeah he should know |
| 06:27 | edlich | By the way do you know a forum to ask technical questions beside the toplevel Google Group #!forum/clojure ? |
| 06:28 | wingy | stackoverflow :) |
| 06:29 | edlich | OK have to build up a credibility there ;-) |
| 06:33 | wingy | is using (with-test) preferable since your tests are coupled with your code |
| 06:33 | wingy | could it yield better TDD behavior? |
| 06:33 | wingy | or should we decopule them with (deftest) instead in different files |
| 06:37 | edlich | (someone else should jump in here. Not yet a Clojure testing Guru). |
| 06:38 | clgv | wingy: separating tests from code is done in a lot of clojure projects. |
| 06:39 | wingy | clgv: i've noticed .. but what i like with looking at clj code is that i can read the doc and meta data for the fns as well |
| 06:39 | wingy | they are all in one place |
| 06:39 | wingy | perhaps the testing would make it easier to understand how to use the code? |
| 06:40 | wingy | since if they are in different files i would probably never look at them |
| 06:40 | wingy | too much work when browsing in github |
| 06:40 | wingy | :) |
| 06:40 | wingy | but it seems that no one likes this |
| 06:41 | clgv | oh, if I want to see typically use cases and there are tests, I often read them to get an impression |
| 06:41 | clgv | wingy: it would be nice though, to have some connection between tests and code. maybe via metadata or something |
| 06:42 | wingy | what are the bad things with having them in one place |
| 06:42 | wingy | bloat? |
| 06:42 | clgv | depending on the size of your namespaces it could get very crowded |
| 06:42 | wingy | yeah .. but that would force everyone to write/read tests :) |
| 06:42 | wingy | first class citizens |
| 06:43 | wingy | like doc! |
| 06:43 | clgv | I cant follow that conclusion |
| 06:43 | wingy | i prefer to read the doc in source code rather than from external places since its all there |
| 06:43 | wingy | yeah .. just preferences |
| 06:43 | wingy | ill try both out and see how it works out |
| 06:49 | wingy | how do i mock http requets? |
| 06:49 | clgv | morning laurent ;) |
| 06:50 | noidi | wingy, if you're using Ring or something based on it, the requests are just Clojure maps. there's nothing to mock. |
| 06:51 | wingy | noidi: im using clj-http to make requests in some fns |
| 06:51 | wingy | noidi: but ill test the route handlers as well later , thx for the tip |
| 06:51 | clgv | wingy: mock the clj-http functions you are using ^^ |
| 06:51 | hyPiRion | Humm, defrecords doesn't support destructuring for record elements. In hindsight, that may be a good thing. |
| 06:51 | wingy | clgv: with dynamic binding? |
| 06:52 | clgv | wingy: if you use midje, you can just use its related features... |
| 06:52 | wingy | im using clojure.test |
| 06:53 | wingy | dynamic binding should do mocking pretty easy |
| 06:53 | clgv | hyPiRion: huh? defrecord has a 100% map implementation. or what exactly do you mean? |
| 06:53 | wingy | if there isnt another mocking way |
| 06:53 | wingy | no mocking libs in clj? |
| 06:53 | clgv | wingy: there are some macros like with-redefs ... |
| 06:54 | noidi | wingy, in midje you can do (fact ... (provided (some-fn arg1 arg2) => return-value)) |
| 06:54 | clgv | noidi: thats one of the features I chose midje for ^^ |
| 06:55 | wingy | noidi: is there a way to programmatically run midje from repl? |
| 06:55 | noidi | wingy, e.g. (provided (client/get "http://www.google.com") => {:fake "response"})) |
| 06:55 | hyPiRion | clgv: (defrecord Foo [[bar] baz] ...) isn't legal. |
| 06:56 | noidi | wingy, the facts are run upon evaluation. just re-evaluate the fact, and you'll get error printouts in the repl if the tests fail. |
| 06:56 | clgv | hyPiRion: ah, you want to define a structuring in the definition. right, that's not going to work |
| 06:56 | wingy | noidi: how do you run the tests? |
| 06:57 | clgv | wingy: lein test or evaluating the namespace should work |
| 06:57 | hyPiRion | Oh, while I remember: Is there any way of making a clojure-set/map/vector/list/seq which contain itself? |
| 06:59 | hyPiRion | X = #{X} seems to be impossible, which picked my curiosity |
| 06:59 | noidi | wingy, there's also the midje plugin for leiningen |
| 06:59 | clgv | hyPiRion: yeah cycle references are not possible with immutable datastructures- you'll need some indirection. but you can manage it with transient |
| 07:00 | hyPiRion | clgv: not possible with immutable datastructures in Clojure* |
| 07:00 | hyPiRion | ;) |
| 07:00 | clgv | hyPiRion: I think that is general |
| 07:01 | noidi | hyPiRion, you can add in laziness with (delay) |
| 07:01 | clgv | ok. lazy sequences can have cycles ^^ |
| 07:01 | hyPiRion | clgv: If you have unbound variables, then it's doable. |
| 07:01 | noidi | oops, I mean promise |
| 07:02 | clgv | hyPiRion: right. but the variable is then not immutable and thats the trick |
| 07:02 | noidi | (let [a (promise), b (promise)] (deliver a {:b b}) (deliver b {:a a})) |
| 07:02 | hyPiRion | clgv: I suppose that's depending on the definition of immutable. |
| 07:02 | noidi | or something like that >( |
| 07:02 | noidi | :) |
| 07:03 | noidi | then you can do (:a @(:b @(:a @(:b a)))) |
| 07:03 | clgv | hyPiRion: well take maps and vectors. you definitly can't do it with them. |
| 07:04 | hyPiRion | clgv: Again, not in Clojure. Say X = {:foo Y}, and Y is unbound. You can then assign Y = X. |
| 07:05 | hyPiRion | /s/assign/unify/ |
| 07:05 | clgv | hyPiRion: well if immutable means that the data structure rflects changes by returning a modified version of itself, than you can't do it in general |
| 07:05 | hyPiRion | noidi: I know of that one. The sad part is that you have to dereference the items :( |
| 07:06 | clgv | hyPiRion: try to build a graph representation with deftype/defrecord (without transients) as edges and nodes where the edges contain both nodes and each node contains its edges |
| 07:07 | clgv | and :volatile-mutabile and :unsynchronized-mutable are not allowed |
| 07:07 | hyPiRion | clgv: yeah, I know. It's not possible in Clojure. |
| 07:08 | tomoj | I started implementing inductive graphs |
| 07:08 | clgv | hyPiRion: no, with the above definition of immutable it is not possible in general for those immutable data structures |
| 07:08 | clgv | your unbound variable is a mutable thing which is the trick |
| 07:09 | tomoj | is a promise mutable? |
| 07:09 | hyPiRion | tomoj: Depends on who you ask :p Clojurians say no, CTMCP says yes |
| 07:09 | clgv | tomoj: no but its assignment is defereed |
| 07:09 | hyPiRion | * I mean reverse |
| 07:09 | clgv | tomoj: you can't change it once it was delivered. |
| 07:09 | tomoj | clgv: that seems like a good description of the unbound variable case too |
| 07:10 | tomoj | I think IPending makes clojure's promise's mutable in one sense |
| 07:11 | hyPiRion | Yeah, clojure's promise is mutable. If you e.g. do (let [a (promise)] (run-thread (deliver a 10)) (run-thread (deliver a 20))), then a could be either 10 or 20 |
| 07:11 | clgv | hmm promise is not a value though - it's something you can deref to get a value^^ |
| 07:11 | hyPiRion | Well, that's my thought. |
| 07:11 | clgv | hence the mutable/immutable attributes are not really fitting |
| 07:12 | tomoj | my promises can't be delivered that way |
| 07:12 | hyPiRion | It's an iffy subject. If I defer the computation of a value, is it immutable or mutable? |
| 07:12 | clgv | tomoj: yeah the second deliver will loose and throw an exception |
| 07:12 | hyPiRion | ,(let [a (promise)] (deliver a 10) (deliver a 20)) |
| 07:12 | clojurebot | nil |
| 07:13 | hyPiRion | ,(let [a (promise)] (deliver a 10) (deliver a 20) @a) |
| 07:13 | clojurebot | 10 |
| 07:13 | hyPiRion | ,(let [a (promise)] (deliver a 20) (deliver a 10) @a) |
| 07:13 | clojurebot | 20 |
| 07:13 | clgv | huh, was that old 1.2.1 which did throw an exception? |
| 07:13 | hyPiRion | clgv: Well, I was actually kind of hoping an exception would be thrown now. |
| 07:13 | hyPiRion | :( |
| 07:14 | clgv | that got changed in 1.3 it seems |
| 07:14 | clgv | maybe it's useful in some case to have the first deliver win silently |
| 07:15 | tomoj | the problem is to let functional clojure code easily get determinism |
| 07:15 | hyPiRion | clgv: It's okay if the values you deliver are the same, but well.. it's not deterministic now, is it? |
| 07:15 | tomoj | so that you never deliver different values, except when you don't care (IO? random numbers?) |
| 07:16 | clgv | hyPiRion: hm yes, it's in your duty to guarantee the determinism |
| 07:24 | hyPiRion | &'foo |
| 07:24 | lazybot | ⇒ foo |
| 07:30 | clgv | &(#(% %) #(% %)) |
| 07:30 | lazybot | java.lang.StackOverflowError |
| 07:30 | Cheiron | Hi, would you please help me with this? http://pastie.org/5034598 |
| 07:46 | noidi | Cheiron, check out group-by http://clojuredocs.org/clojure_core/clojure.core/group-by |
| 07:46 | noidi | (group-by :a records-2) will give you a map from the :a value to the record |
| 07:48 | Cheiron | I need to match by values . for example (Record-1 :a "1") , i need to match the record in records-2 where its :as also equals to "1" . not sure how group-by will help |
| 07:49 | noidi | (for [r1 records-1, :let [r2 (first ((group-by :a records-2) (:a r1)))]] (update-in r1 [:vals] concat (:vals r2))) |
| 07:49 | noidi | something like that |
| 07:50 | noidi | note that that's untested semi-pseudocode :) |
| 07:50 | Cheiron | noidi: yes thanks :) |
| 07:52 | noidi | just look up each (:a r1) in the map produced by group-by and you'll get all r2s with the same :a |
| 07:52 | michaelr525 | maybe (index) and (join) from clojure.set is worth checking |
| 07:53 | michaelr525 | inspired by jay fields` post |
| 07:54 | Cheiron | noidi: group-by ins't going to work for me |
| 07:54 | Cheiron | i don't know, it is hairy .... |
| 07:57 | michaelr525 | hairy?! |
| 07:57 | michaelr525 | wtf |
| 07:57 | michaelr525 | what's hairy about group by? |
| 08:02 | Cheiron | not group-by . my data . :a values in records-1 aren't repeated . same true for :a values in records-2 |
| 08:03 | Cheiron | :a values are unique within the vector but there is a match value in the other vector |
| 08:06 | Cheiron | so the question, is how to find by value, not by key |
| 08:07 | clgv | Cheiron: the just use something like (for [x r1, y r2 :when (= (:a x) (:a y))] ...build-combined-data...) |
| 08:07 | clgv | that has quadratic complexity though, in case that matters. |
| 08:07 | Cheiron | what the Big(O) of that line? |
| 08:08 | Cheiron | Big (N * N) ? |
| 08:08 | clgv | O(N²) yes |
| 08:08 | Cheiron | any ideas for more efficient code? |
| 08:08 | clgv | you will need to sort both collections to get N*log(N) |
| 08:09 | clgv | you can sort both and then do a recursion over both collections |
| 08:11 | Cheiron | what about something like select-value ? http://blog.jayfields.com/2011/01/clojure-select-keys-select-values-and.html |
| 08:14 | clgv | Cheiron: you can have O(1) access and a total of O(N) if you build maps of them before. but thats some how cheating since the constants will differ. when sorting you only need comparisons. using a map you need to evaluate a hash function |
| 08:14 | clgv | but you can try both and see what fits best for your data |
| 08:20 | clgv | *"constant factors" I meant ^^ |
| 08:25 | Cheiron | i see |
| 08:44 | Cubic | Hi |
| 08:44 | Cubic | I have a bit of a problem with java overloaded methods and reflection |
| 08:45 | Cubic | I'm trying to write a function that calls a static method that has an overload for CharSequence and ByteBuffer |
| 08:46 | Cubic | I want to avoid reflection, and I suppose I can do this somehow, but putting type hints before the argument or the call hasn't really helped |
| 08:48 | Cubic | Basically I have this: (defn glBindAttribLocation [program index name] (GL20/glBindAttribLocation program index ^java.lang.CharSequence name)) |
| 08:49 | Cubic | and this: (defn glBindAttribLocationbb [program index name] (GL20/glBindAttribLocation program index ^java.nio.ByteBuffer name)) |
| 08:49 | clgv | Cubic: you need a typehint for "program" as well |
| 08:50 | clgv | Cubic: usually you need the first type hint for the first argument if it can not be inferred. |
| 08:50 | Cubic | It's int in both cases though, the overloads only differ in the last argument |
| 08:53 | clgv | ah ok. then wrap it like (int program) |
| 08:55 | Cubic | Huh? Attaching typehints to all args actually fixed it. I don't really understand why, but thanks anyway. |
| 08:57 | jweiss | does anyone write tests in the namespace as code, surrounded by a macro that runs tests at compile time unless a "development" flag is not on, in which case the macro just emits nothing? if not, what's the drawback vs separate tests? |
| 08:57 | jweiss | s/namespace/same namespace/ |
| 09:03 | cberg | I'm feeling stupid today: Running lein repl in a project base dir, I can't access the project namespaces from the repl. What could I be doing wrong? |
| 09:05 | edlich | Paste your equivalent as (require 'my-stuff.core) |
| 09:06 | edlich | then we can see... |
| 09:07 | clgv | I'd start with an actual error message ;) |
| 09:07 | clgv | if you have none, what exactly did you do and what did not happen as expected |
| 09:08 | edlich | so you do not even get the REPL prompt?! |
| 09:08 | cberg | Ok, so the require worked... |
| 09:09 | edlich | what was the mistake? |
| 09:09 | cberg | I may be completely wrong but I thought I used to be able to just jump to a namespace with in-ns and work with the symbols there without requiring? |
| 09:12 | clgv | cberg: yes, that is completely wrong. in-ns just switches the namespace asnd creates it if it does not exist already. hence you end up in an "empty" namespace if you did not load it's implementation previously via use/require |
| 09:14 | cberg | Yeah, sorry. I couldn't use Clojure for a few months and apparently my brain leaked. Never mind. |
| 09:15 | clgv | that error seems pretty common. I wonder where `in-ns` is introduced without explaining it properly |
| 09:25 | pyrhho | My project depends on two other packages, which each depends on a different version of the org.codehaus.jackson library (which conflict). I'm new to java (and clojure) how should I fix this?? |
| 09:25 | lazybot | pyrhho: What are you, crazy? Of course not! |
| 09:25 | TimMc | $mail antares_ seqs-and-colls is now under dual-license for inclusion into clojure-doc, if desired. |
| 09:25 | lazybot | Message saved. |
| 09:26 | TimMc | pyrhho: I believe you can put a "hard version" of jackson into your dependency list. |
| 09:26 | pyrhho | ah. so if I have a version specified in my project.clj it will override those project's dependencies? |
| 09:26 | TimMc | pyrhho: This is really a Maven issue, and for reference these are called conflicting transitive dependencies. |
| 09:27 | pyrhho | TimMc: ok. thanks. that is helpful to goodle |
| 09:27 | pyrhho | |
| 09:28 | TimMc | I *think* if you say "[1.2]" (instead of "1.2") in your dependency list it will fix it, but best to look around. |
| 09:28 | TimMc | Do the two Jackson versions have the same major version? |
| 09:29 | TimMc | You might even be able to use a soft version ("1.2"). |
| 09:29 | pyrhho | TimMc: ah, actually it looks like just setting the version in my project.clj has worked |
| 09:29 | duck1123 | pyrhho: You might want to check out lein pedantic. It'll identify all the conflicts and help you choose the right versions |
| 09:29 | pyrhho | TimMc: erm. maybe |
| 09:30 | pyrhho | TimMc: Yeah soft version has worked. thanks |
| 09:30 | pyrhho | duck1123: ok will check that out. thanks |
| 09:30 | TimMc | What version of lein are you on? 1.x or 2.x (master)? |
| 09:31 | pyrhho | TimMc: Leiningen 2.0.0-preview10 on Java 1.6.0_32 Java HotSpot(TM) 64-Bit Server VM |
| 09:36 | quadrocube | Hey, anyone out there?) Can smone help me with this stuff: why is these piece of code throw the clojure.lang.ArityException: Wrong number of args (2) passed to: PersistentVector ? Trying to find it out for a couple of hours now.. |
| 09:36 | quadrocube | ((fn flat[x] ( if (coll? x) (reduce [] #(concat % (flat %2)) x) [x])) '(1)) |
| 09:36 | quadrocube | just simple flatten |
| 09:37 | TimMc | pyrhho: lein classpath is ugly, but it will tell you exactly what's being included. |
| 09:38 | pyrhho | TimMc: oh cool.. didn't realise 'lein classpath' existed. thanks |
| 09:46 | clgv | quadrocube: because you have the wrong parameter order for reduce ##(doc reduce) |
| 09:46 | lazybot | ⇒ "([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as... https://www.refheap.com/paste/5716 |
| 09:46 | dark_element | I am trying to build a project with this as dependency https://github.com/samaaron/serial-port |
| 09:46 | clgv | reordering your example: (reduce #(concat % (flat %2)) [] x) |
| 09:48 | quadrocube | arrrgh, thx so much, lazybot, dark_element and clgv! Can't forgive myself's stupiditness.. Thx again) |
| 09:48 | dark_element | getting this error "java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path" when running the uberjar created from leiningen |
| 09:49 | clgv | quadrocube: try to build your code incrementally to avoid such mistakes |
| 09:50 | dark_element | I think this project https://github.com/samaaron/serial-port should be used with cake but its discontinued |
| 09:53 | dark_element | any help would be appreciated |
| 09:55 | jsabeaudry | dark_element, What are your needs in terms of serial comm? |
| 09:55 | clgv | dark_element: I think there was a difference how cake and leiningen packed native dependencies. so you might just need to change the jar layout of the RxTx lib |
| 09:56 | dark_element | jsabeaudry just playing around with it reading some string from serial port |
| 09:56 | jsabeaudry | dark_element, Then I'd say just read/write to the device using a file stream |
| 09:58 | dark_element | clgv will try that out |
| 09:59 | dark_element | jsabeaudry will most probably have to run the jar on windows |
| 10:00 | dark_element | jsabeaudry i am helping somebody to plot volatge ratings from a device in graph, maybe even show it in browser. |
| 10:06 | AWizzArd | When I can type „javac” in the shell and get a reply, how can I then find out at what path Leiningen tries to find my javac? Cause Leiningen doesn’t find it… |
| 10:11 | bhenry | can i queue up futures to limit how many will run simultaneously? |
| 10:11 | nDuff | AWizzArd: My impression was that leiningen used tools.jar directly, rather than invoking javac. |
| 10:14 | clgv | bhenry: not until 1.5 I guess. in 1.5 you may change the executor it seems |
| 10:14 | clgv | bhenry: but you can just use a self configured ThreadPoolExecutor for parallel execution |
| 10:19 | bhenry | in update-message here: https://gist.github.com/06cdd93dadcbe68c2378 can i just call each move-data block in a future, then deref the futures so that it will do those three in parallel but not move on to the next three until they finish? |
| 10:19 | clgv | no |
| 10:20 | clgv | bhenry: you can use pmap to have bounded parallel execution - but you can't set the bound yourself with it |
| 10:20 | bhenry | hm |
| 10:21 | clgv | bhenry: the easiest way to set how many parallel computations are done, is to create a ThreadPoolExecutor yourself |
| 10:23 | AWizzArd | nDuff: do you have an idea how I can let Leiningen know where my jdk is installed? JAVA_HOME seems to get ignored. |
| 10:23 | mpenet | bhenry: you can also use pallet-thread, a thin wrapper around java executors, if you really dont want to touch java interop |
| 10:24 | bhenry | i'll check it out thanks |
| 10:30 | lpetit | clgv: hello |
| 10:30 | clgv | lpetit: hi |
| 10:31 | lpetit | clgv: will start looking at your pull request |
| 10:31 | clgv | lpetit: =) |
| 10:32 | lpetit | clgv: when you think you're ok with a code in a branch, you should change the corresponding issue' status to Fixed:to-be-integrated |
| 10:33 | clgv | lpetit: ah ok. I thought I wait for feedback first. good to know |
| 10:33 | lpetit | Since it's ready to be integrated into main, but not done yet (and I'll either change it to Fixed:to-be-delivered, either to Accepted or New if the code needs rework) |
| 10:34 | lpetit | Also, a mention (link) to the github pull request or commit to integrate in the issue comments, so that e.g. Chas or Christophe can take a look at it in a click ;) |
| 10:35 | lpetit | clgv: so, before I dig into the code and into the actual behavior, would you please tell me what it's supposed to do ? ;) |
| 10:36 | clgv | lpetit: ok. noted for next time. |
| 10:36 | lpetit | ok |
| 10:36 | lpetit | thx |
| 10:38 | clgv | lpetit: the patch enables to search the history for entries starting with the text in front of the cursor. the patch unifies the implementation with already existing stepping through history |
| 10:41 | lpetit | clgv; ok |
| 10:42 | lpetit | clgv: so we should change the default keyboard bindings … but to what ? |
| 10:42 | clgv | lpetit: good question. I thought it good to have them "near to" the history stepping |
| 10:43 | lpetit | something like ctrl+alt+up , ctrl+alt+down ? |
| 10:43 | clgv | lpetit: we could use "page up/down" |
| 10:44 | lpetit | I don't know where "page up/page down" buttons are on my Mac keyboard :) |
| 10:44 | AdmiralBumbleBee | fn-up and fn-down probabply |
| 10:44 | clgv | lpetit: would be the same as on lein repl with reply |
| 10:45 | lpetit | clgv: oh really? |
| 10:45 | clgv | lpetit: yeah. it has search there as well |
| 10:46 | lpetit | and what about just having search enabled by default? :p |
| 10:46 | TimMc | I love it when people thank the bots. |
| 10:46 | clgv | humm I'd like to have both available. since sometimes you know I definitely want one of the last three commands |
| 10:47 | lpetit | clgv: then you just trigger the history with an empty content in the log area? |
| 10:47 | lpetit | or with the cursor at the beginning of the log area's content ? |
| 10:48 | clgv | I think it does not do that yet |
| 10:48 | lpetit | clgv: should it do that, what would you think about the suggestion? |
| 10:49 | clgv | lpetit: I would have to try if it makes sense. currently it jumps to the end of the line so that you can easily evaluate the entry with trailing enter |
| 10:50 | clgv | lpetit: if you have both, you can search for something and still go one step back or forth with the other key bindings |
| 10:51 | clgv | lpetit: I dont know if I or others do or will do that often. I would need to check my behavior on that |
| 10:51 | lpetit | clgv: you mean, via the search going to a certain point in history, and then from this point, start browsing the history without the filter to refine the search? |
| 10:53 | clgv | lpetit: yeah somethimes you have very similar entries since you only used different parameters. I would suggest to keep both history modes and maybe ask the users if they really need both after a while |
| 10:54 | lpetit | clgv: which raises my question again: maybe we could make the new behavior with the search the default, and have new key bindings for the old behavior ? |
| 10:54 | clgv | lpetit: ah you meant it like that. |
| 10:54 | lpetit | just an idea |
| 10:55 | clgv | that could work. and maybe adding only one modification key for the old behavior? |
| 10:56 | lpetit | I haven't tested the code yet, but also, out of my mind: it should be possible to come back to what was typed, with the cursor at the same place, if finally the search does nothing. Is this already how it works? |
| 10:56 | lpetit | clgv: yes, the old behavior could be triggered by adding ALT => Ctrl+Alt+Up, Ctrl+Alt+Down |
| 10:56 | clgv | lpetit: if you do not change the cursor position you will come back to the initial statement |
| 10:57 | lpetit | clgv: and if you change the cursor position? |
| 10:57 | clgv | lpetit: if you change the cursor position you changed the query and you wont. hmm that could be added. |
| 10:58 | clgv | lpetit: currently, it would only go back to retained-input |
| 10:58 | lpetit | clgv: needs some real life testing. |
| 10:58 | clgv | yeah. fire it up and try ;) |
| 10:59 | lpetit | clgv: another idea: have considered doing a less restrictive search? Like you just type "foobar" and every history entry containing "foobar" will be filtered? |
| 10:59 | clgv | lpetit: I saw you changed nrepl dep again before my commit. can't the currently used nrepl lib be added to the repository in a third-party directory? |
| 11:00 | lpetit | clgv: I understand what you're saying, and your pain. I'm reluctant (currently) to not play by OSGi rules when possible. |
| 11:02 | clgv | lpetit: no, I did not consider that kind of search. that would be like in the code completion, I guess. I am only used to the prefix search due to repl-y and rlwrap. but maybe it would be worth it |
| 11:03 | lpetit | clgv: would depend whether the ineluctable increasing "noise" introduced would make it doable or not. Of course, this should then go hand by hand with a way to "highlight" the matching portion (but that could be saved for another day) |
| 11:03 | clgv | in leiningen I often do something like "(u" -> complete -> "(use '...)" or "(def s" -> complete -> "(def server (create ..." |
| 11:04 | clgv | I do that a lot if I have a certain debug/test scenario that I recently used |
| 11:04 | lpetit | where you could write "serve" -> history -> "def serer (create ...)" |
| 11:06 | lpetit | Sometimes, also, the most "unique" part of the history entry you can think of is not at the start of the line. Think about unique local names, etc. ? |
| 11:06 | lpetit | clgv: maybe the "search" function could be specified as a preference :) |
| 11:06 | lpetit | s/search/filter/ |
| 11:12 | clgv | lpetit: that's an option |
| 11:13 | clgv | I justed wanted to name my frequent use case on the repl ; |
| 11:17 | lpetit | que |
| 11:17 | lpetit | sure |
| 11:19 | clgv | lpetit: well, it's implemented with exchangeable filter anyway ;) |
| 11:19 | lpetit | clgv: :) |
| 11:19 | lpetit | clgv: I've got some urgent emails to answer to, bbl |
| 11:20 | clgv | lpetit: np |
| 11:47 | holo | hi |
| 11:48 | jsabeaudry | helo |
| 11:48 | holo | anyone here is being able to use heroku commands with default app in a directory with multiple apps? |
| 12:00 | Cubic | Is anyone here that uses emacs with clojure-mode? |
| 12:01 | Frozenlo` | Sure |
| 12:02 | Cubic | I've been trying to find a cheat sheet (or something the like) for it for a while now |
| 12:02 | AdmiralBumbleBee | Cubic: lots of people do |
| 12:02 | Cubic | basically just a list with the things it actually does |
| 12:02 | Cubic | Right now I'm quite desperately trying to comment out a section of my code and it won't let me |
| 12:03 | AdmiralBumbleBee | Cubic: c-h b? |
| 12:03 | Frozenlock | You mean ';' won't comment the line? |
| 12:03 | AdmiralBumbleBee | Cubic: are you using any other modes? |
| 12:03 | Frozenlock | M-x comment-region is really useful too. |
| 12:03 | uvtc | Cubic: M-; |
| 12:04 | Cubic | I'm using paredit with clojure-mode. And ; always starts a new line |
| 12:04 | AdmiralBumbleBee | you could also mark a region, c-x r t, and ;; |
| 12:04 | AdmiralBumbleBee | M-; is preferred though |
| 12:04 | uvtc | Oh, paredit. |
| 12:05 | Cubic | Oh great what now? Is that bad? Everyone and their dog told me paredit was the best thing since the invention of chocolate |
| 12:05 | TimMc | It is! |
| 12:05 | Frozenlock | It is, but I don't like it :p |
| 12:06 | AdmiralBumbleBee | Cubic: it's fine, you have to mark and use M-; or use rectangle commands or c-q ;; |
| 12:06 | uvtc | Cubic: my understanding is that paredit is wonderful, and most folks here recommend it unconditionally, but you've got to dive in head-first and power through the initial learning curve. I haven't yet done so myself. |
| 12:07 | TimMc | Cubic: You can also use #_ if you're commenting out syntactically valid code. |
| 12:07 | TimMc | ,[1 2 3 #_ 4 5 6] |
| 12:07 | AdmiralBumbleBee | Cubic: in general, if you find something like that again, you can just use c-q to avoid triggering any mode-related bindings |
| 12:07 | TimMc | clojurebot: hello? |
| 12:07 | AdmiralBumbleBee | then find the 'real' solution later |
| 12:07 | Bronsa | woah, what happened to clojurebot |
| 12:08 | TimMc | &[1 2 3 #_ 4 5 6] |
| 12:08 | lazybot | ⇒ [1 2 3 5 6] |
| 12:08 | uvtc | Cubic: I wrote up a little Emacs+Clojure tut, if you're interested: http://www.unexpected-vortices.com/clojure/10-minute-emacs-for-clojure.html |
| 12:08 | Frozenlock | uvtc: 10 minutes emacs tutorial is quite misleading I would say :P |
| 12:08 | Cubic | Eh thanks everyone. I'm pretty much new to emacs (I used it barely enough to be able to open and edit files without accidentally installing DOS in the process) |
| 12:09 | uvtc | Though, I really need to look into how to find out when there's an Ubuntu Emacs 24 so I don't have to add the cassou ppa... |
| 12:09 | uvtc | Frozenlock: I don't think so. It takes a while to internalize the key-combos, but I'd say 10 minutes is somewhere in the right ballpark for just getting your bearings straight. :) |
| 12:10 | AdmiralBumbleBee | in my experience, learning emacs is more about learning how to find help, not so much memorizing combos and chords |
| 12:11 | Frozenlock | uvtc: Must have took me around 2 hours the first time... buffers? Windows? Frame? Wtf am I doing AHHHHHHHH |
| 12:11 | zilti | Frozenlock: lol |
| 12:11 | Cubic | I got that down, but I still accidentally close windows and kill buffers I shouldn't all the time |
| 12:11 | Frozenlock | Coming from windows, I was utterly lost. |
| 12:12 | uvtc | Frozenlock: I may need to add those terms to my little tut. Thanks. |
| 12:12 | AdmiralBumbleBee | how would you accidentally kill a buffer you don't want to1? |
| 12:12 | Cubic | You'd be surprised |
| 12:13 | AdmiralBumbleBee | I already am |
| 12:13 | Frozenlock | AdmiralBumbleBee: If it hasn't changed since last save it will not ask you "are you really sure" |
| 12:14 | Cubic | Well, I definitely managed to kill my REPL at least once when I tried to close an error window |
| 12:14 | AdmiralBumbleBee | Frozenlock: I'm unsure of how you'd kill the wrong buffer, it's pretty obvious where you are (at least I think it is) |
| 12:14 | AdmiralBumbleBee | maybe you guys are just using a crappy theme :) |
| 12:15 | Frozenlock | Yes, but if you misclick you could click the little "x" thingy and close emacs :P |
| 12:15 | uvtc | Cubic: might be better to just start off for now with Emacs+clojure-mode, and then interact with Clojure in a repl in a separate terminal. |
| 12:15 | Frozenlock | That's before you learn the way and remove the menu bar of course :) |
| 12:16 | AdmiralBumbleBee | Frozenlock: if you're using the mouse when you're in emacs, I think that's probably a big problem :) |
| 12:16 | uvtc | Cubic: then, once you're comfortable with that, add in paredit. And then later nrepl.el. |
| 12:16 | Frozenlock | Amen to that. |
| 12:17 | Cubic | uvtc: I usually just throw in everything at once and then just try until I get some kind of flow. Worked with Vim anyways |
| 12:17 | clgv | Is clojure.core/require threadsafe when multiple threads try to require the same namespace dynamically? |
| 12:17 | Frozenlock | Cubic: Then lean elisp and make your own modes :) |
| 12:17 | technomancy | clgv: no =( |
| 12:17 | technomancy | no transactional loading |
| 12:17 | Cubic | clgv: is there actually a good reason to want to do that? |
| 12:18 | clgv | technomancy: ok that explains an observation of mine. so I have to wrap it in some coordination on my application level |
| 12:19 | clgv | Cubic: yes. remote code execution. all the code base is on the remote classpath and only function symbols are send to the remote side along with parameters |
| 12:22 | clgv | technomancy: is something like this in work? |
| 12:22 | clgv | technomancy: transactional loading, I mean |
| 12:22 | technomancy | clgv: I don't think so |
| 12:23 | clgv | technomancy: humm it shouldnt be hard to do or do I miss a major problem? |
| 12:23 | technomancy | clgv: ever try to contribute to clojure? |
| 12:23 | clgv | technomancy: ok, apart from that ;) |
| 12:24 | lpetit | clgv: I have tried the feature. It's easier to remember the keyword by still having the up/down arrows do their job, and just with an additional modifier (alt works for me on Mac keyboard, so ctrl+alt+UP / ctrl+alt+DOWN to be precise) |
| 12:24 | lpetit | clgv: but when I started moving in the history, even if I don't move the cursor, I lose what was currently typed |
| 12:25 | clgv | lpetit: it should work like stepping through history which can come back to what was typed. |
| 12:25 | lpetit | clgv: I'm wrong. It's if I move the cursor. But see? Moving the cursor is easy, so I'd prefer not lose what was type should I go back to it |
| 12:25 | clgv | leptit: I tried that one out before commiting ;) |
| 12:26 | Cubic | Is there something like Vim C-v i b in Emacs? |
| 12:27 | jsabeaudry | What does that do? |
| 12:27 | clgv | lpetit: ok I guess that could be fixed. |
| 12:27 | lpetit | clgv: I mean, I think this should get special treatment and be retained whatever the filter function at the end of the history list (really, it is not part of the history list yet, just appended to it during the search, I guess) |
| 12:27 | AdmiralBumbleBee | Cubic: what is that? |
| 12:27 | Cubic | Selects the inner parts of the current block (S-expression in Lisps) and if that already is selected, goes to the next outer scope |
| 12:28 | clgv | lpetit: yes. it could be removed from the forward search and put in an `or` form with the result of the forward search, or similar |
| 12:28 | Cubic | Well the C-v part is just for entering visual mode |
| 12:29 | wingy | is there a way to remove all removed vars when i use (require ns :reload-all) in the repl |
| 12:30 | lpetit | clgv: cool |
| 12:31 | intranation | Cubic: try expand-region: https://github.com/magnars/expand-region.el |
| 12:31 | clgv | lpetit: will you change that yourself or shall I fix that next time? |
| 12:32 | lpetit | I'd prefer if you fix that and submit a new pull request |
| 12:32 | AdmiralBumbleBee | Cubic: why are you trying to do that? |
| 12:34 | Cubic | For commenting out (or removing comments) in front a function definition (or similar) also, I want to select (and copy) the contents of a vector all the time cause I'm writing some OpenGL glue code at the moment |
| 12:34 | Cubic | where I'm just writing (defn glSomething [args] (GLSomeVer/glSomething args)) |
| 12:34 | AdmiralBumbleBee | Cubic: you want to prepend a selection of lines with text? |
| 12:35 | AdmiralBumbleBee | or remove text? |
| 12:35 | Cubic | I want to select the lines in the first place |
| 12:35 | lpetit | clgv: I found a bug |
| 12:35 | AdmiralBumbleBee | Cubic: ideally you'd use C-M-f and C-M-b to navigate and set mark |
| 12:35 | lpetit | clgv: say the history is "1 :a", "2 :b", "3 :c", "4 :d". |
| 12:36 | lpetit | clgv: say I start searching for "b" => I jump to "2 :b". Now I start editing. And I change my mind, erase the content, and start searching for "c" => I don't find it, because it starts searching from "2 :b" in the history |
| 12:37 | AdmiralBumbleBee | Cubic: there's also C-M-h |
| 12:37 | Cubic | AdmiralBumbleBee: I don't really know what that does. At least I see no difference to M-f and M-b |
| 12:37 | clgv | lpetit: hmm ok. so we need some kind of reset when editing |
| 12:37 | lpetit | do you want me to add comments on the ticket for all this ? |
| 12:38 | clgv | lpetit: yes, please |
| 12:39 | lpetit | ok |
| 12:39 | AdmiralBumbleBee | Cubic: M-f is forward word, C-M-f is forward-sexp |
| 12:41 | Cubic | AdmiralBumbleBee: Ah I see. That's still rather unwieldy though ;) |
| 12:42 | lpetit | clgv: ok, issue updated. We're on the right track ! |
| 12:42 | lpetit | :-D |
| 12:42 | AdmiralBumbleBee | Cubic: you could always make a macro real quick |
| 12:43 | clgv | lpetit: is the pull request closed? or should it be updated somehow when the corrections are done? |
| 12:43 | lpetit | clgv: I don't no much about pull requests. I don't know if it can be updated, or should be discarded. |
| 12:44 | clgv | lpetit: ah ok. I thought you might have a default workflow there. so I'll just figure that out, when I commited again |
| 12:44 | lpetit | clgv: while we're at it: would be great if that could be done in a branch reflecting the issue name. I'm used to this with cemerick, works great because I won't accidentally pull more than expected |
| 12:45 | clgv | lpetit: ok |
| 12:45 | lpetit | those "lightweight" branches work then like easier to manage patch files :) |
| 12:46 | lpetit | clgv: one last word please - consider rebasing your branch on the last master before issuing the new pull request |
| 12:47 | clgv | lpetit: yes. I did that with last too ;) |
| 12:47 | lpetit | :) |
| 12:50 | lpetit | clgv: I'm glad you started working on this |
| 12:54 | clgv | lpetit: it was bugging me for a while. there are also two additional REPLView things I want to fix |
| 12:54 | hyPiRion | ,(clojure.pprint/cl-format true "~9f~%" 3.045236495677389) |
| 12:54 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.pprint> |
| 12:54 | hyPiRion | (require '[clojure.pprint]) |
| 12:54 | hyPiRion | ,(require '[clojure.pprint]) |
| 12:54 | clojurebot | nil |
| 12:54 | hyPiRion | ,(clojure.pprint/cl-format true "~9f~%" 3.045236495677389) |
| 12:54 | clojurebot | 3.0452365 |
| 12:54 | wingy | what are the diffs between with-redefs and with-redefs-fn |
| 12:55 | hyPiRion | ,(clojure.pprint/cl-format true "~,9f~%" 3.045236495677389) |
| 12:55 | clojurebot | #<NumberFormatException java.lang.NumberFormatException: For input string: "3045236495"> |
| 12:55 | lpetit | clgv: spoilers please :) |
| 12:55 | wingy | im doing mocking for tests but dont know why i would wanna use the latter .. the former works great already for fns |
| 12:55 | clgv | lpetit: they are not as big as search: repl history size as option and removing "noise" from history |
| 12:55 | hyPiRion | Okay, why is not "~,9f" working properly here? Is this a bug in cl-format? |
| 12:56 | lpetit | clgv: tell me more about "removing noise" from history, please |
| 12:57 | clgv | lpetit: there are clojure comments in the history as well as (in-ns ' ...) statements that came from CCW and not from the user |
| 12:57 | Cubic | ,(clojure.pprint/cl-format true "~{~a ~}" [1 2 3 4]) |
| 12:57 | clojurebot | 1 2 3 4 |
| 12:57 | Cubic | Ohh I didn't know that |
| 12:57 | lpetit | clgv: ok, you should probably talk to cemerick about this one |
| 12:58 | clgv | lpetit: ok. I'll ask him before I start anything |
| 13:13 | clgv | lpetit: finishing time for today. good evening. |
| 13:20 | Sgeo | *sigh* |
| 13:21 | Sgeo | In Incanter, I saw some code that modifys refs... several refs, but each modified ref is modified in a separate dosync |
| 13:21 | Sgeo | Doesn't that kind of eliminate the point of STM in the first place? |
| 13:21 | Sgeo | Admittedly, since it's occuring in a macro, it's not likely to be a big deal in actual usage, but still... |
| 13:22 | duck11231 | does each change need to pass or fail together? |
| 13:23 | Sgeo | Hmm, not entirely sure. It doesn't make conceptual sense for one to pass and another to fail, but I think if other changes occur mixed in with those it's not a big deal? |
| 13:25 | Sgeo | https://github.com/liebke/incanter/blob/077cde547363afe675fd8400de11dda0a4b47952/modules/incanter-core/src/incanter/infix.clj#L42 |
| 13:26 | Sgeo | Also, ref-set where alter would be more stylistically appropriate, but since it's a ref in a transaction rather than an atom, it shouldn't make a semantic difference the way it would with an atom and reset! vs swap! |
| 13:28 | Sgeo | Oh hey, there actually is a significant problem with that code due to the split of dosyncs |
| 13:29 | Sgeo | +highest-precedence+ could receive a lower highest-precedence in a race condition |
| 13:30 | Sgeo | Although... does macro code ever get run in different threads? |
| 13:30 | Sgeo | Or is the compiler/macroevaluator/whatever single threaded? |
| 13:34 | Sgeo | Oh wait defop is a function not a macro |
| 13:34 | Sgeo | So yeah, that doesn't matter |
| 13:34 | Sgeo | It should be fixed. I will fix it when I have time. |
| 14:16 | Frozenlock | Weird... In noir I have a page showing me "{:status 302, :headers {"Location" "/subscribe"}, :body ""}" Instead of redirecting. Any idea what might be happening? |
| 14:17 | Frozenlock | Could the special form 'do' be messing things up here? |
| 14:31 | amalloy | you're rendering a map with hiccup as the response body, instead of making it the whole ring response |
| 14:36 | Frozenlock | So it seems. I've found the function causing this, but I don't know why.. https://www.refheap.com/paste/5728 |
| 14:36 | Frozenlock | Oh wait it might be because 'body' is returned inside a list. |
| 14:46 | jcromartie | Noir: because sessions are magic |
| 14:47 | cemerick | jcromartie: snarky, much? ;-) |
| 14:47 | jcromartie | very much |
| 14:47 | cemerick | Sessions are sorta magic everywhere, really. |
| 14:47 | Frozenlock | What's not to like? |
| 14:47 | cemerick | !, !, !, generally |
| 14:48 | cemerick | meanwhile, native ring sessions are simple, but hard |
| 14:48 | Frozenlock | By ! you mean mutations? |
| 14:48 | cemerick | yah |
| 14:48 | jcromartie | mutating thread-local bindings |
| 14:50 | Frozenlock | Any simple example of ring sessions? |
| 14:50 | jcromartie | cemerick: what's so hard about Ring sessions? |
| 14:50 | xeqi | heh, there are some fun rules about updating them |
| 14:51 | cemerick | jcromartie: if you're passing around full response maps, you need to be very careful about consistently applying downstream changes/additions to the existing state from the request |
| 14:51 | cemerick | I ran aground on that myself last week with Friend. |
| 14:51 | jcromartie | hmm |
| 14:52 | jcromartie | I actually don't really have a problem with stateful sessions as middleware |
| 14:52 | cemerick | well, maybe you've been doing it right this whole time :-) |
| 14:52 | l1x | , (/ (System/currentTimeMillis) 1000) |
| 14:52 | jcromartie | I also think the word "actually" is actually useless in most cases |
| 14:52 | clojurebot | 269996228887/200 |
| 14:53 | cemerick | it *works*, it's just easy to forget the rules. |
| 14:53 | l1x | hmm, how can i get back long rounded after the division? |
| 14:53 | jcromartie | what are the rules? |
| 14:53 | jcromartie | I always use merge/update-in/etc. when dealing with response maps |
| 14:53 | duck11231 | ,(long (/ (System/currentTimeMillis) 1000)) |
| 14:54 | clojurebot | 1349981214 |
| 14:54 | cemerick | jcromartie: weavejester can probably state them more succinctly, but basically: you need to consistently propagate any :session provided by a downstream handler |
| 14:55 | jcromartie | and by "downstream" you mean like, an "inner" handler |
| 14:55 | jcromartie | I always get a little mixed up with middleware terminology |
| 14:55 | weavejester | Right, the base session middleware is very simple - you can only read the session or replace the session. |
| 14:55 | cemerick | yes, or any other function that returns a response map you're going to pass along |
| 14:55 | duck11231 | it's hard to know which way is up |
| 14:56 | l1x | duck11231: thanks |
| 14:56 | jcromartie | my middleware basically follows the pattern: (if-let [resp (handler req)] (-> resp …)) |
| 14:56 | jcromartie | or rather when-let |
| 14:56 | l1x | i guess this variable is always 64 bit on every platform |
| 14:58 | tmciver | weavejester: I'm having trouble getting compojure.route/files to serve static files when I run my compojure app using 'lein run'. I see that 'public' is the default root directory. Does that mean files will be served from <project-dir>/public? It doesn't seem to work for me. |
| 14:58 | jcromartie | but aren't sessions just a convention and not any sort of standard? |
| 14:58 | jcromartie | you could really do whatever you want |
| 15:00 | weavejester | tmciver: That's correct. What does your route look like? |
| 15:00 | weavejester | tmciver: (route/files "/") ? |
| 15:00 | tmciver | weavejester: yes. let me do a quick sanity check. |
| 15:00 | weavejester | tmciver: Incidentally, route/resources is usually preferred over route/files. |
| 15:02 | tmciver | weavejester: I have test.js in <project_dir>/public. If I go to localhost/test.js, I get the 'not-found' route. |
| 15:03 | weavejester | tmciver: Could you show me what your routes look like? |
| 15:08 | tmciver | weavejester: https://www.refheap.com/paste/5729 |
| 15:09 | cemerick | jcromartie: Sure, but it all ends up needing to boil down to a token/cookie that will round-trip on the next request, etc. |
| 15:09 | jcromartie | yes |
| 15:12 | tmciver | weavejester: I also noticed that the 'file-path' local in the files function is 'test' when I try to get my test.js file. |
| 15:15 | weavejester | tmciver: Hm… let me look into this |
| 15:15 | weavejester | tmciver: Out of interest, is there any reason you're using files instead of resources? |
| 15:17 | tmciver | weavejester: none at all. But I just tried to use resources with the same result. |
| 15:18 | tmciver | weavejester: am I correct to assume that the dir that 'public' is supposed to in is the project dir? |
| 15:18 | amalloy | weavejester: fwiw i use files instead of resources because there's better support for things like Last-Modified, MIME types and so forth |
| 15:19 | weavejester | tmciver: Yes, and I can't reproduce your problem… How are you accessing your routes? By running the adapter and accessing them through a browser or HTTP client? |
| 15:19 | duck11231 | hmmm... for some reason, it looks like I'm using wrap-files and wrap-file-info |
| 15:19 | weavejester | amalloy: Ring 1.2 should have better support for last-modified on non-file resources |
| 15:21 | tmciver | weavejester: yes, I'm running the Jetty adapter through 'lein run' and using a browser. The other routes work fine with that setup. |
| 15:21 | tmciver | weavejester: I've no doubt I'm doing something silly, I just don't know what. |
| 15:22 | weavejester | tmciver: What happens if you run the following code in a REPL: |
| 15:22 | weavejester | ((route/files "/") {:uri "/test.js", :scheme :http, :request-method :get, :headers {"host" "localhost"}}) |
| 15:24 | tmciver | weavejester: that seems to work correctly . . . hmm |
| 15:25 | weavejester | tmciver: Okay, next try passing the same request map to your routes |
| 15:25 | weavejester | e.g. |
| 15:25 | weavejester | (routes {:uri "/test.js", :scheme :http, :request-method :get, :headers {"host" "localhost"}}) |
| 15:25 | tmciver | weavejester: 404 |
| 15:26 | TimMc | antares_: ping |
| 15:26 | antares_ | TimMc: pong |
| 15:26 | TimMc | Mail for you! |
| 15:26 | weavejester | tmciver: Innnnnteresting… |
| 15:26 | TimMc | lazymail |
| 15:26 | weavejester | tmciver: Try cutting out all the routes except for the files route and the not-found route? |
| 15:26 | tmciver | weavejester: I'd love to tell you that I'm doing something strange, but I don't think so. |
| 15:27 | weavejester | tmciver: Then if that works, add the other routes back in until the 404 appears |
| 15:27 | antares_ | TimMc: I see no new emails. Or is it this IRC/lazybot mail thing? I don't know how to use it :) |
| 15:27 | antares_ | lazybot: lazymail |
| 15:28 | antares_ | clojurebot: lazymail |
| 15:28 | clojurebot | No entiendo |
| 15:28 | TimMc | Yeah, I don't know how to use it either. :-P |
| 15:28 | antares_ | clojurebot: mail |
| 15:28 | clojurebot | if you can access the email account that is signed up then you winn |
| 15:28 | TimMc | Anyway, the seqs-and-colls repo is dual-licensed compatibly with clojure-doc now. |
| 15:28 | antares_ | TimMc: ah, nice |
| 15:28 | tmciver | weavejester: 404 still. :( |
| 15:29 | TimMc | $mail TimMc test |
| 15:29 | lazybot | Message saved. |
| 15:29 | antares_ | I am finishing dinner and going to work on namespaces and collections/sequences guides |
| 15:29 | antares_ | TimMc: thank you |
| 15:29 | TimMc | lazybot: Mail for me? |
| 15:29 | weavejester | tmciver: Hm... |
| 15:29 | tmciver | weavejester: I've got (route/resources "/") for the static files route. |
| 15:29 | weavejester | tmciver: Oh! You switched? |
| 15:29 | TimMc | antares_: "/msg lazybot mail" seems to be the thing |
| 15:30 | weavejester | tmciver: If you're going with resources, the directory changes to "resources/public" |
| 15:30 | antares_ | does lazybot use /dev/null for mail? :) |
| 15:30 | antares_ | ah, cool |
| 15:30 | antares_ | thanks TimMc |
| 15:30 | tmciver | weavejester: so my test.js file should be in 'resources/public'? |
| 15:31 | weavejester | tmciver: If you're using resources. If you're using files, it can be in 'public' |
| 15:31 | tmciver | weavejester: OK, went back to files and it seems to work with the other routes commented out. |
| 15:31 | tmciver | from the repl |
| 15:32 | weavejester | tmciver: Okay, try adding all the other routes back and trying it from the REPL again |
| 15:32 | Hodapp | I read "REPL again" as "Republican". I eagerly await election season in the US being over. |
| 15:33 | TimMc | I, too, need new glasses. |
| 15:33 | TimMc | I read "electron season". |
| 15:34 | weavejester | Hodapp: Now I need to resist jokes about functions that return different results for the same arguments... |
| 15:34 | tmciver | weavejester: yeah, seems to work from the repl now with all the routes, but not from a browser. I'm baffled. |
| 15:34 | ToBeReplaced | i'm getting confused with the information out there regarding SLIME/swank-clojure/nREPL >> i can't figure out what the intended use is now that swank-clojure is deprecated >> am i supposed to "lein repl" then "M-x nrepl" to it from emacs? |
| 15:35 | weavejester | tmciver: Well, we can peek at the request map being passed in with some middleware |
| 15:35 | weavejester | tmciver: (defn wrap-prn [h] (fn [r] (prn r) (h r))) |
| 15:36 | tmciver | weavejester: OK, I'll try that. Let me get back to you with the result; got to go do my 'real' work :( |
| 15:38 | Somelauw | jcromartie: Aren't all irc clients textual? |
| 16:09 | TimMc | ,alive? |
| 16:09 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: alive? in this context, compiling:(NO_SOURCE_PATH:0)> |
| 16:10 | ddeaguiar | ,(doc alive?) |
| 16:10 | clojurebot | Gabh mo leithscéal? |
| 16:10 | ddeaguiar | hm |
| 16:10 | fractaloop | WTF? |
| 16:11 | ddeaguiar | what was that.. |
| 16:11 | Somelauw | ,dead? |
| 16:11 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: dead? in this context, compiling:(NO_SOURCE_PATH:0)> |
| 16:11 | TimMc | I was just checking if clojurebot was back. |
| 16:11 | ddeaguiar | o |
| 16:14 | jcromartie | was clojurebot speaking Gaelic? |
| 16:15 | scriptor | most clojure devs speak Irish, didn't you know? |
| 16:15 | fractaloop | .... |
| 16:16 | devth | anyone know an up-to-date reference on clojure.data.zip.xml? most results are for old contrib and don't work anymore. |
| 16:24 | Somelauw | can all languages be implemented as a macro in clojure? |
| 16:24 | Somelauw | is there prolog? |
| 16:25 | emezeske | Somelauw: You might be interested in core.logic |
| 16:26 | Somelauw | it's even in the core |
| 16:29 | technomancy | ToBeReplaced: M-x nrepl-jack-in is the way to go. if you have slime set up and working you can keep using it though; it's not going away |
| 16:30 | ToBeReplaced | technomancy: thanks >> i was missing the prefix argument to make it more awesome |
| 16:33 | ToBeReplaced | technomancy: this page needs editing to match the current state of the world if you're feeling generous; i'm not signed up yet >> http://dev.clojure.org/display/doc/Getting+Started+with+Emacs |
| 16:36 | AtKaaZ | how can I see all fields/methods of a class? which is like of this type: clojure.core$future_call$reify__3499 |
| 16:37 | AtKaaZ | in an attempt to get the difference between java's Future, clojure's future and @future |
| 16:38 | antares_ | AtKaaZ: do you need to use it from Java? Why would you need to instapect methods on a future implementation? |
| 16:38 | AtKaaZ | ,(def f (future (Thread/sleep 1000) nil )) (cancel-future f) f |
| 16:38 | antares_ | @future is the same as (deref future), which basically calls #deref on it |
| 16:38 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 16:38 | AtKaaZ | ok but what is the underef-ed future supposed to be? |
| 16:38 | antares_ | you can treat Clojure futures as Java futures if you need to. |
| 16:39 | AtKaaZ | true I tested that a bit |
| 16:39 | antares_ | just like j.u.c. future, it is a reference to a value that may or may not be available |
| 16:39 | antares_ | if you call #get on it, it will block the current thread until it is available |
| 16:40 | AtKaaZ | ok, in other words it also knows if it's pending, completed or cancelled? |
| 16:40 | AtKaaZ | if it were cancelled what would f and @f look like? |
| 16:40 | AtKaaZ | it seems to me that @f should throw, but maybe f shouldn't? |
| 16:41 | antares_ | AtKaaZ: and what should it do then? |
| 16:41 | AtKaaZ | but since f also shows the @f then it should throw also , I don't know:) |
| 16:41 | antares_ | if it is cancelled, you never will get the value it is supposed to reference |
| 16:41 | AtKaaZ | yes I agree |
| 16:42 | AtKaaZ | so when you try showing f, you also invoke @f if the future is done ? |
| 16:42 | AtKaaZ | or even if it's cancelled? in an attempt to show all |
| 16:43 | AtKaaZ | if the future is pending, showing f shows #<core$future_call$reify__3499@7c9391d9: :pending> |
| 16:43 | AtKaaZ | but if it's cancelled shouldn't it show cancelled? |
| 16:43 | AtKaaZ | yet it thows instead |
| 16:43 | AtKaaZ | but @f should definitely throw in this case |
| 16:43 | reactormonk | I have a bit of an idea of lisp, what do I start with for closure? |
| 16:43 | hiredman | well, getting the name right helps with googling |
| 16:44 | brehaut | AtKaaZ: have you done a (source future-call) ? |
| 16:44 | TimMc | reactormonk: Are you asking how to get started developing in Clojure? |
| 16:44 | reactormonk | TimMc, exactly |
| 16:44 | reactormonk | except I might call it coding |
| 16:44 | TimMc | Sure. |
| 16:45 | TimMc | Grab Leiningen and you can get a REPL that way (and set up projects, etc.) |
| 16:45 | reactormonk | I'd like to use emacs |
| 16:45 | pandeiro | is using aget to retrieve dynamically resolved javascript object property names a bad approach? |
| 16:46 | reactormonk | TimMc, oh, nice |
| 16:46 | TimMc | reactormonk: I generally write in Emacs (with clojure-mode and paredit) and use lein for the REPL, so I'm the wrong person to ask. :-) |
| 16:46 | AtKaaZ | brehaut: I have now but can't pretend to understand :) btw, I only asked because someone reported it on clojure ML |
| 16:46 | _ulises | reactormonk: you can use nrepl for that |
| 16:47 | reactormonk | TimMc, sounds like the way I'd do it |
| 16:48 | AtKaaZ | brehaut, but thanks that is actually what I wanted to know, methods/fields |
| 16:48 | jweiss | i have an apparently large datastructure in memory (not so large that i'm almost out of heap space - set to 1G and taking up 500mb). but i can't figure out how to dump this to disk without going OOM. spit won't do it. nor will any prn/print variant. any suggestions? |
| 16:48 | patchwork | Is there any way to tell lein to start up without checking the net for deps? |
| 16:49 | patchwork | trying to use lein sometimes when I don't have a connection |
| 16:49 | patchwork | and it just hangs |
| 16:49 | technomancy | patchwork: sure; `lein -o whatever` |
| 16:49 | ChongLi | I'm having a weird issue with nrepl |
| 16:49 | ChongLi | it's adding a bunch of newlines whenever I press enter at the repl |
| 16:50 | reactormonk | TimMc, I ♥ paredit. I even edit syntax trees for linguistics with it :-) |
| 16:50 | patchwork | technomancy: Thanks! |
| 16:50 | ChongLi | causing my history entries to be full of newlines that I have to delete in order to read the entries |
| 16:50 | ChongLi | does this happen to anyone else? |
| 16:50 | technomancy | patchwork: that will remove other profiles, so if you want dev/user etc you may be better off with `lein with-profile offline,user,dev,default repl` |
| 16:54 | aperiodic | jweiss: maybe try a doseq? won't be a printable form unless you do some work, but seems worth a shot |
| 16:54 | aperiodic | s/printable/readable |
| 16:55 | jweiss | aperiodic: interesting, might work. i just don't get why the various print functions gobble up so much memory |
| 16:56 | jweiss | way more than the original data takes up in heap space. |
| 16:56 | aperiodic | jweiss: they probably build up the entire string for the datastructure before dumping it to disk |
| 16:59 | aperiodic | hmm, reading in the result might cause problems too, if your plan is to gobble the whole thing up and call read-string |
| 17:00 | jweiss | aperiodic: i don't need to read it back. problem is probably some loop out of control adding too much data, i should be able to tell if i can just look at it. |
| 17:03 | jweiss | ah appears to be a function that produces infinite seq that i accidentally traced. woops. |
| 17:09 | ticking | hmm I was wondering what is the best way to check if a potentially infinite list has still 2 elements? |
| 17:10 | ticking | (if-let [sec (second myseq)] foo) seems flawed because of data transparency considering nil |
| 17:11 | technomancy | ticking: (get (into [] (take 2 my-vec)) 2 :not-found) I guess? |
| 17:11 | technomancy | rather: (count (take 2 my-seq)) |
| 17:11 | amalloy | (nnext my-seq) |
| 17:12 | amalloy | or just next, i guess, since you only want to check for two. that checks for three |
| 17:12 | ticking | right |
| 17:12 | amalloy | &(map next [[] [1] [1 2] [1 2 3]]) |
| 17:12 | lazybot | ⇒ (nil nil (2) (2 3)) |
| 17:12 | ticking | yeah makes sense thanks ^^ |
| 17:13 | AtKaaZ | ,(nnext (range)) |
| 17:13 | clojurebot | (2 3 4 5 6 ...) |
| 17:13 | ticking | '(empty (next [1])) |
| 17:13 | ticking | ,(empty (next [1])) |
| 17:13 | clojurebot | nil |
| 17:14 | ticking | right yeah thanks ^^ |
| 17:15 | amalloy | ticking: don't call (empty) on the result. that's a disaster |
| 17:15 | ticking | ah right because it already returns nil if it is empty |
| 17:16 | ticking | amalloy, also I meant empty? ^^ |
| 17:16 | amalloy | ticking: but don't use empty? either, because there's no reason |
| 17:16 | ticking | right |
| 17:17 | AtKaaZ | ,(next [1]) |
| 17:17 | clojurebot | nil |
| 17:17 | AtKaaZ | ,(next [1 2]) |
| 17:17 | clojurebot | (2) |
| 17:17 | AtKaaZ | ,(next [1 2 3]) |
| 17:17 | clojurebot | (2 3) |
| 17:17 | AtKaaZ | ,(next []) |
| 17:17 | clojurebot | nil |
| 17:17 | AtKaaZ | nice |
| 17:18 | AtKaaZ | ,(empty? nil) |
| 17:18 | clojurebot | true |
| 17:18 | AtKaaZ | amalloy, why not? |
| 17:19 | amalloy | did you read the part where i said why not? |
| 17:19 | AtKaaZ | because there is no reason? |
| 17:19 | ticking | AtKaaZ, if and most if like constructs test for nil non nil as well as true false |
| 17:19 | amalloy | yes |
| 17:19 | ticking | nil is falsy and non nil is thuthy |
| 17:19 | AtKaaZ | oh right, thank you for that |
| 17:21 | callen | amalloy: how long did it take you to solve all those 4clojure problems? |
| 17:22 | amalloy | *shrug* |
| 17:22 | callen | amalloy: don't want to sound smug, or don't want to recollect all that time you'd spent? |
| 17:24 | mattmoss | What's wrong with empty? |
| 17:24 | brehaut | ~empty? |
| 17:24 | clojurebot | empty is amalloy: therfor I return [previous] if rest |
| 17:27 | AtKaaZ | mattmoss, well I was trying to use empty? to map nil to false and non-empty to true, but if-like constructs already do this mapping (so to speak) |
| 17:27 | mattmoss | oh, I thought amalloy (or whoever it was) was saying something like "never use empty?" |
| 17:28 | mattmoss | but right, no need for empty in that situation |
| 17:28 | duck1123 | don't use empty?. reverse the clauses and use seq |
| 17:28 | technomancy | ugh no |
| 17:28 | technomancy | empty? is an actual english word |
| 17:28 | mattmoss | duck1123: empty? already uses seq. And I prefer positive checks where possible. |
| 17:28 | technomancy | so much more readable |
| 17:28 | tmciver | weavejester: from earlier: here's the request map when I try to get a js file through the browser: https://www.refheap.com/paste/5732 |
| 17:29 | mattmoss | And what technomancy said. |
| 17:30 | weavejester | tmciver: You could try passing that map (minus the body inputstream) to your routes to see what happens |
| 17:30 | AtKaaZ | actually I correct myself, when I said non-empty I meant non-nil :) |
| 17:31 | duck1123 | my point was, I'd rather see (if (seq x) :foo :bar) than (if (empty? x) :bar :foo) but that's mostly because I tend to find the non-empty case to be more interesting |
| 17:32 | ticking | duck1123, I'd argue to use it so that it complements documentation, if the empty case is the one you want to emphasize use that otherwise don't |
| 17:32 | AtKaaZ | yeah that would make it more readable for newbz like I |
| 17:36 | tmciver | weavejester: Ugh, I got it working. It seems to be a problem with a middleware I tried wrote that alters the 'accept' header depending on the extension of the resource in the URL. Doh! |
| 17:37 | tmciver | weavejester: thanks for bearing with me. |
| 17:54 | weavejester | tmciver: No problem - glad you got it sorted out. |
| 18:30 | devth | suggestions on how to turn [{:g 1, :v "foo"} {:v "bar"} {:v "qux"} {:g 2, :v "baz"} {:v "quux"}] into {:1 ["bar" "qux"], :2 ["quux"]} ? |
| 18:30 | devth | sorry, wrong structure, let me try that again |
| 18:30 | devth | [{:g 1} {:v "bar"} {:v "qux"} {:g 2} {:v "quux"}] to {:1 ["bar" "qux"], :2 ["quux"]} |
| 18:33 | arrdem | ,(doc zipmap) |
| 18:33 | clojurebot | "([keys vals]); Returns a map with the keys mapped to the corresponding vals." |
| 18:33 | arrdem | so (zipmap (map :g datastructures) (map vals datastructures)) |
| 18:35 | devth | thanks, trying that. |
| 18:36 | jamii | Now with real documentation - https://github.com/jamii/strucjure#examples |
| 18:37 | devth | arrdem: that's close but there are a different number of keys and values, so i get nil keys. i'll keep playing w/ it tho. thanks. |
| 18:39 | devth | reduce might actually be what i need. |
| 19:30 | wingy | this test is passing since i mock the http/post with with-redefs https://gist.github.com/3876287 |
| 19:30 | wingy | i wonder how/why to use with-redefs-fn .. there is no example in the doc for it |
| 19:31 | wingy | what is the difference |
| 19:34 | amalloy | devth: https://gist.github.com/0864360312f804c37cd9 |
| 19:35 | devth | amalloy: wow, nice. thanks, i was still messing around with a really nasty reduce / update-in mess |
| 19:35 | emezeske | wingy: with-redefs-fn is a function instead of a macro, so it might be useful for things like e.g. generating test input data on the fly |
| 19:36 | emezeske | wingy: That is, it might be useful when you don't know what the bindings will be at compile-time |
| 19:36 | arrdem | herm... anyone know how to access the com.mongodb.ObjectId constructor in Congomongo? |
| 19:36 | amalloy | into/for solves an awful lot of problems that would otherwise require a hairy reduce |
| 19:36 | wingy | emezeske: i c |
| 19:36 | wingy | so if i know i might as well use with-redefs? |
| 19:37 | emezeske | wingy: with-redefs is probably more convenient most of the time |
| 19:37 | emezeske | wingy: Since you can just pass an arbitrary body to it, instead of a function to run |
| 19:37 | wingy | emezeske: i c |
| 19:38 | wingy | yeah since its a fn i have to wrap the expression inside a callback |
| 19:38 | wingy | also i cant use bindings in a fn right? |
| 19:38 | wingy | so i have to provide a map |
| 19:40 | wingy | emezeske: https://gist.github.com/3876287 |
| 19:41 | wingy | pretty straightforward |
| 19:41 | wingy | i should probably add the example with with-redefs-fn to do? |
| 19:41 | wingy | doc |
| 19:42 | emezeske | I thought the docs for with-redefs-fn were pretty explanatory, but I guess an example never hurt anyone |
| 19:43 | wingy | no examples |
| 19:45 | wingy | http://clojuredocs.org/clojure_core/clojure.core/with-redefs-fn |
| 19:45 | wingy | since the doc says its used for mocking during testing i added a test oriented example |
| 19:45 | emezeske | Seems reasonable. |
| 20:01 | gert | is there a recommended way to run tests on clojurescript code? |
| 20:01 | dnolen | gert: not really. |
| 20:03 | emezeske | gert: Webapp? |
| 20:04 | gert | emezeske: I'm writing ring-like chaining on the client side and would like to write tests for my code |
| 20:05 | emezeske | gert: So, yes? |
| 20:05 | gert | I suppose so yes :) |
| 20:05 | emezeske | gert: :P |
| 20:05 | gert | I'm looking at Clojurescript One's one.test atm |
| 20:05 | emezeske | gert: For that, I write a bunch of cljs functions that just use assert, and run the tests in PhantomJS |
| 20:06 | gert | that's a good idea - and possibly more lightweight than one.test |
| 20:06 | emezeske | I've been meaning to look at this too: https://github.com/kumarshantanu/clip-test |
| 20:07 | emezeske | Seems very promising. |
| 20:07 | gert | it does! |
| 20:07 | gert | I'm going to check that out. cheers! |
| 20:13 | wingy | how do i check if an id exists in datomic |
| 20:13 | wingy | (q '[:find ?id :in $ ?id :where [?id _ _]] (db conn) id) |
| 20:15 | wingy | didn't work and threw no error |
| 20:15 | AtKaaZ | should've worked |
| 20:15 | AtKaaZ | but you also don't have to specify the _ _ |
| 20:15 | wingy | perhaps ?id cannot be the same as the ?id passed in |
| 20:16 | AtKaaZ | this might be relevant: https://groups.google.com/forum/?fromgroups=#!topic/datomic/rJxgqnI4hz0 |
| 20:19 | wingy | it worked now |
| 20:19 | wingy | i passed a string as an id :[ |
| 20:19 | AtKaaZ | oh |
| 20:19 | wingy | should be converted to a long |
| 20:19 | AtKaaZ | yep, reminds me of yesterday:) |
| 20:19 | wingy | yeah |
| 20:20 | wingy | cant clojure implement static typing! |
| 20:20 | wingy | saves so much manual checking |
| 20:20 | AtKaaZ | it's curious however that the entity id exists even without any attributes... I've yet to test that out |
| 20:21 | AtKaaZ | "stated another way, having no attributes is as nonexistent as an entity can be." -Stu |
| 20:21 | wingy | i think the attrs exists |
| 20:21 | wingy | but you arent quering them |
| 20:21 | wingy | [?id] |
| 20:21 | wingy | the same as [?id _ _] |
| 20:22 | AtKaaZ | how can I delete erm retract an entity with a specific id? |
| 20:23 | AtKaaZ | ok I guess like so: @(d/transact conn [[:db.fn/retractEntity easton-id]]) |
| 20:24 | AtKaaZ | yep the two are the same: [?id] or [?id _ _] same result |
| 20:35 | tomoj | should java.util.Set etc be added to pprint's dispatch? |
| 20:36 | tomoj | ..bit bothersome that the HashSets datomic returns don't pprint. of course (comp pprint set) works |
| 20:43 | AtKaaZ | doesn't seem to work ? |
| 20:44 | AtKaaZ | works, my set was just empty |
| 20:50 | emezeske | tomoj: Could you maybe define a pprint multimethod for datomic sets? |
| 20:50 | tomoj | well they're just HashSets |
| 20:51 | tomoj | but yeah |
| 20:51 | tomoj | wondering why pprint shouldn't do that |
| 20:56 | ChongLi | hmmm |
| 20:57 | ChongLi | this new version of ac-nrepl or nrepl is adding a lot of latency to my keystrokes |
| 20:57 | ChongLi | I have no idea how to figure diagnose this |
| 21:11 | Sgeo | ,(-> 10 [1 2 3]) |
| 21:11 | clojurebot | #<IndexOutOfBoundsException java.lang.IndexOutOfBoundsException> |
| 21:11 | Sgeo | Well, that's an interesting way to fail |
| 21:13 | TimMc | &(macroexpand-1 '(-> 10 [1 2 3])) |
| 21:13 | lazybot | ⇒ ([1 2 3] 10) |
| 21:13 | AtKaaZ | what was it supposed to do? |
| 21:13 | emezeske | Sgeo: Interesting? Isn't that what you'd expect? |
| 21:13 | Sgeo | emezeske, I expected some kind of error |
| 21:13 | Sgeo | But wasn't sure what kind |
| 21:14 | emezeske | IndexOutOfBounds seems pretty reasonable and uninteresting to me :) |
| 21:14 | TimMc | ,(-> 1 [:a :b :c]) |
| 21:14 | clojurebot | :b |
| 21:14 | AtKaaZ | how would you add that 10 to that vector, using the same construct |
| 21:15 | TimMc | You wouldn't. |
| 21:15 | AtKaaZ | ,(-> 10 (cons [1 2 3])) |
| 21:15 | Sgeo | emezeske, I was wondering if it would try to insert into the vector or something |
| 21:15 | clojurebot | (10 1 2 3) |
| 21:15 | Sgeo | ,(macroexpand-1 '(-> 10 (1 2 3))) |
| 21:15 | clojurebot | (1 10 2 3) |
| 21:15 | Iceland_jack | evil.. |
| 21:15 | AtKaaZ | lol |
| 21:15 | TimMc | ,(macroexpand-1 '(-> 10 '(1 2 3))) |
| 21:15 | clojurebot | (quote 10 (1 2 3)) |
| 21:16 | AtKaaZ | that was pretty epic with macroexpand |
| 21:17 | amalloy | &(-> 10 (1 2 3) quote) |
| 21:17 | TimMc | ,(-> 10 '(don't mind me)) |
| 21:17 | clojurebot | 10 |
| 21:17 | lazybot | ⇒ (1 10 2 3) |
| 21:17 | TimMc | ((juxt inc dec) amalloy) |
| 21:17 | amalloy | hah |
| 21:18 | AtKaaZ | lol |
| 21:18 | TimMc | I can't believe mine worked. |
| 21:18 | AtKaaZ | why not? |
| 21:18 | TimMc | ,(quote 1 2 3 4) |
| 21:18 | clojurebot | 1 |
| 21:18 | amalloy | TimMc: you've made the comment macro obsolete |
| 21:18 | TimMc | :-D |
| 21:19 | amalloy | well, i guess not. since it quotes |
| 21:19 | AtKaaZ | ,(->> 10 '(don't mind me)) |
| 21:19 | clojurebot | (don't mind me) |
| 21:19 | amalloy | &(-> (+ 1 2) '(comment whatever)) |
| 21:19 | lazybot | ⇒ (+ 1 2) |
| 21:20 | TimMc | Good for obfuscated code. |
| 21:20 | AtKaaZ | ,(macroexpand '(-> (+ 1 2) '(comment whatever))) |
| 21:20 | clojurebot | (quote (+ 1 2) (comment whatever)) |
| 21:20 | AtKaaZ | makes sense ##('(1 2) 3) |
| 21:20 | lazybot | java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn |
| 21:20 | AtKaaZ | to not believe :) |
| 21:21 | AtKaaZ | ,(macroexpand '('(1 2) 3)) |
| 21:21 | clojurebot | ((quote (1 2)) 3) |
| 21:50 | Sgeo | How long do the Incanter unit tests usually take? |
| 21:50 | Sgeo | I'm planning on making a minor change to Incanter |
| 21:50 | Sgeo | Not one that should be API visible though |
| 21:52 | Sgeo | I still don't like the thought of making a new project each time I want to use some library from the REPl |
| 21:52 | Sgeo | REPL |
| 21:52 | tomoj | you could add pomegranate to your user profile |
| 21:53 | Sgeo | Hmm |
| 21:53 | tomoj | the example in the readme is actually incanter.. |
| 21:53 | jcromartie | what about an option for lein repl? |
| 21:54 | tomoj | I've thought it'd be nice to have repl-in |
| 21:54 | tomoj | `lein repl-in incanter` ? |
| 21:55 | Sgeo | Having to merge with clojars seems annoying |
| 21:55 | Sgeo | Erm, manually specifying the repositories like that |
| 21:55 | tomoj | so write a helper |
| 22:00 | ohpauleez | $(doc find-fn) |
| 22:00 | ohpauleez | ,(doc find-fn) |
| 22:00 | clojurebot | I don't understand. |
| 22:01 | ohpauleez | $find-fn |
| 22:03 | TimMc | $findfn 2 3 5 |
| 22:03 | lazybot | [clojure.core/+ clojure.core/unchecked-add clojure.core/+' clojure.core/unchecked-add-int] |
| 22:03 | TimMc | slobot |
| 22:03 | ohpauleez | thank you TimMc |
| 22:04 | ohpauleez | $findfn [1 2 3 4] ((1 2)(3 4)) |
| 22:04 | lazybot | java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn |
| 22:04 | ohpauleez | $findfn [1 2 3 4] '((1 2)(3 4)) |
| 22:04 | lazybot | [] |
| 22:05 | TimMc | partition 2? |
| 22:05 | ohpauleez | THANK YOU! |
| 22:05 | TimMc | haha, np |
| 22:05 | ohpauleez | I was drawing a blank, "step, group, grab" |
| 22:05 | ohpauleez | it was killing me |
| 22:12 | AtKaaZ | $findfn {:a 1} {:a 2} {:a 3} |
| 22:12 | lazybot | [] |
| 22:18 | TimMc | technomancy: I think I'm getting pretty close to having a working lein2 version of lein-otf -- the trouble now is to get lein-otf into the dependencies list of the target project! |
| 22:18 | TimMc | "Who am I" is always a hard thing to solve. |
| 22:20 | TimMc | Is there some way I can ask what version of a dependency is in use? |
| 22:21 | Sgeo | $findfn {:a 1} [:a] |
| 22:22 | lazybot | [clojure.core/keys] |
| 22:22 | Sgeo | Cool |
| 22:22 | AtKaaZ | $findfn {:a 1} [1] |
| 22:23 | AtKaaZ | that space:) |
| 22:24 | AtKaaZ | TimMc, from inside a lein plugin? |
| 22:24 | TimMc | Yep. |
| 22:25 | TimMc | AtKaaZ: This plugin needs to add itself to the :dependencies listing of the project it is run in. |
| 22:25 | AtKaaZ | so this is not needed? Specify the plugin as a development dependency: :dev-dependencies [[org.timmc/lein-otf "1.1.0"]] |
| 22:26 | AtKaaZ | oh wait, I assumed it's already added in profiles.clj |
| 22:26 | AtKaaZ | actually, I don't know what I'm talking about lol |
| 22:29 | Sgeo | What's a higher priority, fixing a theoretical but unlikely race condition in Incanter, or doing something cool |
| 22:29 | AtKaaZ | the latter, but not in my view:) |
| 22:30 | amalloy | TimMc: i don't think so, aside from looking through the project.clj to find yourself in the plugins list. but i'm definitely not a lein dev, so take that with a grain of salt |
| 22:33 | AtKaaZ | TimMc, I failed to follow the Usage, getting: uberjar-otf is not a task. Use "lein help" to list all tasks. |
| 22:34 | AtKaaZ | or maybe the part with "Get the plugin" is implied? |
| 22:37 | wingy | hey |
| 22:37 | wingy | what is the best way to handle something unexpected in clj |
| 22:38 | wingy | i did (throw (Exception.)) but my compojure server is still running and nothing was logged in console |
| 22:39 | Sgeo | What's the difference between (ensure someref) and (deref someref) in a transaction? |
| 22:39 | amalloy | Sgeo: very subtle, whatever it is |
| 22:40 | TimMc | Looking through :plugins *works*, although I'm not sure that will always work. |
| 22:40 | AtKaaZ | ,(throw (Exception. "boo")) |
| 22:40 | clojurebot | #<RuntimeException java.lang.RuntimeException: java.lang.Exception: boo> |
| 22:40 | AtKaaZ | ,(pst) |
| 22:40 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to java.lang.Throwable> |
| 22:40 | AtKaaZ | ,(pst) |
| 22:40 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to java.lang.Throwable> |
| 22:40 | TimMc | Sgeo: The question is really: What's the difference between (ensure foo) and (ref-set foo @foo)? |
| 22:41 | Sgeo | TimMc, what's the difference between (ref-set foo @foo) and @foo |
| 22:41 | TimMc | AtKaaZ: "Specify the plugin as a development dependency: ..." |
| 22:41 | AtKaaZ | TimMc, I definitely did that |
| 22:42 | AtKaaZ | in project.clj |
| 22:42 | TimMc | Are you using lein1 or lein2? |
| 22:42 | AtKaaZ | 2 |
| 22:42 | TimMc | There's your problem. |
| 22:42 | AtKaaZ | ah, sorry, I kinda just realized |
| 22:42 | TimMc | lein-otf isn't ready for lein 2.x yet. |
| 22:43 | TimMc | so the usage instructions haven't been updated for that. |
| 22:43 | AtKaaZ | can say it's for lein1 maybe |
| 22:45 | TimMc | Oh! I thought I did. Let me fix that... |
| 22:48 | TimMc | Bad connection, I'll do it tomorrow. Go'night. |
| 22:48 | Sgeo | Um. |
| 22:48 | Sgeo | Does ensure just change the timing of things, or does it actually have a semantic effect on correctness? |
| 22:49 | amalloy | Sgeo: my understanding is that it affects correctness in certain unusual algorithms |
| 22:49 | amalloy | but tbh i've never gotten a grasp on ensure |
| 22:49 | TimMc | write-skew |
| 22:49 | AtKaaZ | TimMc, bad RAM too "Go'night." :)) |
| 22:50 | AtKaaZ | ,(doc ensure) |
| 22:50 | clojurebot | "([ref]); Must be called in a transaction. Protects the ref from modification by other transactions. Returns the in-transaction-value of ref. Allows for more concurrency than (ref-set ref @ref)" |
| 22:50 | AtKaaZ | ,(doc ref-set) |
| 22:50 | clojurebot | "([ref val]); Must be called in a transaction. Sets the value of ref. Returns val." |
| 22:50 | TimMc | AtKaaZ: too much lag for backspace to be useful |
| 22:50 | Sgeo | But my understanding is that with deref in a transaction, the transaction should not see an outside transaction change the ref |
| 22:51 | TimMc | ensure is only intended to be used when you are reading the ref somewhere else in teh xaction. |
| 22:53 | Sgeo | TimMc, but shouldn't reading the ref itself ensure that the transaction will restart if anything else tries to write it? |
| 23:00 | jcromartie | when I use a certain fn to paint a JPanel, I see output from prn, etc., but I don't see exception messages |
| 23:00 | jcromartie | in the SLIME REPL |
| 23:00 | jcromartie | how can I see those? |
| 23:00 | AtKaaZ | maybe (pst) ? |
| 23:05 | jcromartie | no, (pst) doesn't see the exception from the AWT thread |
| 23:05 | Sgeo | ,(doc pst) |
| 23:05 | clojurebot | "([] [e-or-depth] [e depth]); Prints a stack trace of the exception, to the depth requested. If none supplied, uses the root cause of the most recent repl exception (*e), and a depth of 12." |
| 23:05 | AtKaaZ | maybe you can call it on AWT? |
| 23:05 | Sgeo | Are those any more understandable than Java stack traces? |
| 23:05 | AtKaaZ | thread |
| 23:08 | jcromartie | trying from lein repl instead of SLIME |
| 23:09 | AtKaaZ | something with javax.swing.SwingUtilities/invokeLater but I don't know how to exactly pass that Runnable |
| 23:10 | jcromartie | yeah, in the plain lein repl it shows up |
| 23:10 | jcromartie | but not in SLIME |
| 23:10 | jcromartie | seems like a swank bug? |
| 23:10 | jcromartie | I've seen this in other things too |
| 23:10 | jcromartie | like running a ring jetty server |
| 23:12 | AtKaaZ | how did you call it? I'm failing :) ##(javax.swing.SwingUtilities/invokeLater ^Runnable ((pst)) ) |
| 23:12 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: pst in this context |
| 23:12 | AtKaaZ | ,(javax.swing.SwingUtilities/invokeLater ^Runnable ((pst)) ) |
| 23:12 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to java.lang.Throwable> |
| 23:13 | jcromartie | hm |
| 23:14 | AtKaaZ | jcromartie, I mean, how did you call (pst) on AWT thread? |
| 23:14 | jcromartie | I didn't |
| 23:14 | AtKaaZ | from repl? |
| 23:14 | jcromartie | I'm saying that I just see exception stack traces |
| 23:14 | jcromartie | from the repl |
| 23:14 | jcromartie | but not the SLIME repl |
| 23:14 | AtKaaZ | oh |
| 23:14 | jcromartie | just when I run it with "lein repl" |
| 23:16 | AtKaaZ | ,(javax.swing.SwingUtilities/invokeLater #(pst)) |
| 23:16 | clojurebot | #<RuntimeException java.lang.RuntimeException: java.lang.ExceptionInInitializerError> |
| 23:17 | jcromartie | doesn't seem to work, AtKaaZ |
| 23:17 | jcromartie | just tried it |
| 23:17 | AtKaaZ | not even sure I'm doing it right though |
| 23:17 | jcromartie | (defmacro g-do [& forms] `(SwingUtilities/invokeLater #(do ~@forms))) |
| 23:17 | jcromartie | seems to work except for printing exceptions |
| 23:18 | AtKaaZ | ,(javax.swing.SwingUtilities/invokeLater (fn [] (println *ns*))) |
| 23:18 | clojurebot | #<RuntimeException java.lang.RuntimeException: java.lang.NoClassDefFoundError: Could not initialize class java.awt.Toolkit> |
| 23:18 | jcromartie | yeah don't count on clojurebot doing Swing |
| 23:18 | AtKaaZ | lol |
| 23:18 | jcromartie | clojurebot doesn't Swing that way ;) |
| 23:18 | AtKaaZ | maybe can use binding to reditect stderr? |
| 23:20 | AtKaaZ | I'm curious how you'd do that, my noobish tried isn't doing anything: (g-do (binding [*err* *out*] (pst)) ) |
| 23:21 | jcromartie | I don't think there's anyway to bind *err* to *out* across threads |
| 23:21 | jcromartie | is there? |
| 23:21 | jcromartie | that's the trick |
| 23:22 | jcromartie | maybe let |
| 23:22 | AtKaaZ | i don't know if across threads, I only tried on same thread |
| 23:23 | Sgeo | alter-var? |
| 23:23 | Sgeo | ,(doc alter-var) |
| 23:23 | clojurebot | Gabh mo leithscéal? |
| 23:23 | Sgeo | ,(doc alter-var-root) |
| 23:23 | clojurebot | "([v f & args]); Atomically alters the root binding of var v by applying f to its current value plus any args" |
| 23:23 | jcromartie | let over lambda :) |
| 23:23 | xeqi | (doc bound-fn) |
| 23:23 | clojurebot | "([& fntail]); Returns a function defined by the given fntail, which will install the same bindings in effect as in the thread at the time bound-fn was called. This may be used to define a helper function which runs on a different thread, but needs the same bindings in place." |
| 23:24 | jcromartie | I don't think (pst) works on the current thread |
| 23:26 | jcromartie | (pst) uses *e, which is only for the REPL thread |
| 23:26 | jcromartie | so |
| 23:27 | jcromartie | I need to catch and print the stack trace myself |
| 23:27 | AtKaaZ | how do you do that? |
| 23:28 | jcromartie | (g-do (try (/ 1 0) (catch Exception e (pst e)))) |
| 23:28 | jcromartie | just to illustrate |
| 23:28 | jcromartie | but yeah, just try/catch |
| 23:28 | AtKaaZ | cool thanks |
| 23:28 | jcromartie | not hard at all but not what I'm used to in Clojure :) |
| 23:43 | Sgeo | ,(-> #'reify meta :added) |
| 23:43 | clojurebot | "1.2" |
| 23:43 | Sgeo | :/ |
| 23:43 | Sgeo | http://lispetc.posterous.com/hello-jwt-from-clojure |
| 23:43 | Sgeo | This code uses a macro to produce a proxy. Wouldn't reify work better without needing the macrology? |
| 23:50 | JvJ | a |
| 23:50 | JvJ | hey does anyone in here use penumbra? |
| 23:53 | AtKaaZ | JvJ, I may want to use it eventually unless there's something better, but not currently using it. |
| 23:54 | JvJ | AtKaaZ, Just wondering. I'm having some diffuculty using penumbra with my lein projects, and wanted to know if anyone had similar problems. |
| 23:55 | AtKaaZ | JvJ: which fork are you using? |
| 23:56 | AtKaaZ | JvJ, just wondering if you saw the ML |
| 23:56 | JvJ | AtKaaz. What do you mean ML? |
| 23:56 | AtKaaZ | mailing list for clojure |
| 23:56 | JvJ | oh, I don't think I have |
| 23:57 | AtKaaZ | your dependency: [prismofeverything/penumbra "0.6.9"]]) maybe try just [penumbra "0.6.9"] or later version |
| 23:57 | AtKaaZ | hmm actually 0.6.0 I notice it's on https://github.com/ztellman/penumbra/blob/master/project.clj |
| 23:57 | JvJ | yeah, I've tried 0.6.0 and 0.6.9 |
| 23:59 | gert_ | emezeske: in a leiningen test profile I have a :cljsbuild > :compiler > :source-path "test-cljs" entry; this has a .cljs file with asserts in it, but how would it find my main "cljs" source path? |