2014-03-16
| 00:22 | joelt | newbie question: how do i take two equal length sequences and return a seq of items that match by index? |
| 00:23 | joelt | (a b b b) (a b c c) should return (a b) |
| 00:36 | mysamdog | In a project I'm working on, I have a form with a text input and a textarea. The form's action is /submit, and the method is post. |
| 00:37 | mysamdog | In my app-routes, I have this: (POST "/submit" [title content] (db/save-page title content)), and I know that the save-page function works |
| 00:38 | mysamdog | However, both the title and the content always appear as nil in the post request |
| 00:38 | mysamdog | What am I doing wrong? |
| 00:40 | Galmagneet | mysamdog, is it important that you pray 5 times per day to God, the wisest and most merficul. |
| 00:42 | mysamdog | Also, the whole project is here: https://github.com/mysamdog/soar |
| 00:43 | mysamdog | The html file with the form in it is src/soar/templates/editor.html, and the handler is src/soar/handler.clj |
| 00:45 | tmciver | joelt: not sure if you've found a solution yet but: https://www.refheap.com/59378 |
| 00:47 | joelt | i was using a generator but seemed odd. |
| 00:47 | joelt | thx |
| 00:48 | tmciver | np |
| 00:49 | jebberjeb | (map first (filter #(= (first %) (second %)) (map vector x y))) |
| 00:49 | jebberjeb | bleh |
| 00:51 | dissipate | jebberjeb, what's that for? |
| 00:52 | xeqi | mysamdog: try adding wrap-keyword-params to the middleware stack |
| 00:52 | mysamdog | xeqi, thats in ring.middleware.params, right? |
| 00:53 | xeqi | or using compojure.handler/api or compojure.handler/site |
| 00:53 | xeqi | mysamdog: I think its in ring.middleware.keyword-params |
| 00:54 | jebberjeb | was responding to joelt |
| 00:54 | jebberjeb | (map first (filter (partial apply =) (map vector x y))) |
| 00:54 | dissipate | ,(doc vector) |
| 00:54 | clojurebot | "([] [a] [a b] [a b c] [a b c d] ...); Creates a new vector containing the args." |
| 00:55 | dissipate | weird, the doc for 'vector' on my android phone repl is different |
| 00:56 | joelt | jebberjeb: ah cool. that seems even cleaner. |
| 00:56 | dissipate | ,(doc partial) |
| 00:56 | clojurebot | "([f] [f arg1] [f arg1 arg2] [f arg1 arg2 arg3] [f arg1 arg2 arg3 & ...]); Takes a function f and fewer than the normal arguments to f, and returns a fn that takes a variable number of additional args. When called, the returned function calls f with args + additional args." |
| 00:57 | dissipate | joelt, they seem the same to me |
| 00:57 | dissipate | what am i missing here? |
| 00:59 | mysamdog | Hmmm, compojure/handler.site doesn't seem to work |
| 01:01 | joelt | dissipate: sorry, no offense... i think mine is imperative looking, jebber's is functional, and yours is slightly in between (only because of the if). |
| 01:01 | joelt | none are "better" |
| 01:01 | joelt | they all work... just interesting to see the differences though. |
| 01:03 | tmciver | joelt: jebberjeb's is more idiomatic than mine; my clojure is rusty. :/ |
| 01:03 | dissipate | joelt, mine? i didn't have one, must have been someone else. but i hear ya. i've been looking at all the different ways to implement the fibonacci lazy sequence |
| 01:05 | xeqi | (for [[a b] (map vector x y) :when (= a b)] a) |
| 01:06 | jebberjeb | wow, that's dense but still very expressive |
| 01:06 | jebberjeb | love it |
| 01:06 | joelt | xeqi:vector is a verb? |
| 01:07 | xeqi | joelt: vector is a function ##(vector 1 2) |
| 01:07 | lazybot | ⇒ [1 2] |
| 01:07 | dissipate | xeqi, i thought 'for' was 'imperative' heresy |
| 01:09 | xeqi | dissipate: nope, it is pretty close to a different syntax for `map` in simple cases |
| 01:10 | xeqi | `doseq` would be closer to a for loop in impertive languages |
| 01:11 | joelt | i didn't realize the for [a b] part decomposed the second part... that threw me. |
| 01:11 | joelt | i like it though. |
| 01:11 | dissipate | ,(doc :when) |
| 01:11 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to clojure.lang.Symbol> |
| 01:11 | xeqi | joelt: it looks better with a line break before the :when, so the destructuring lines up |
| 01:11 | dissipate | hmm, what's this ':when' keyword thing |
| 01:12 | xeqi | dissipate: its a special keyword understood by the `for` macro -- http://clojuredocs.org/clojure_core/clojure.core/for |
| 01:13 | xeqi | not really special in any other sense, just when used in that spot for the `for` macro |
| 01:13 | dissipate | xeqi, ah, i see. interesting |
| 01:14 | joelt | could of said for [[a x] [b y]... no? |
| 01:15 | joelt | but that would of generated combinations i guess. |
| 01:15 | xeqi | joelt: [a x b y] will do the cross product of the vectors |
| 01:15 | dissipate | xeqi, why does this remind me of a list comprehension in python? :P |
| 01:15 | xeqi | dissipate: because it is a list comprehension? |
| 01:15 | defn | ,(remove #(= %) [1 "" nil]) |
| 01:15 | clojurebot | () |
| 01:15 | dissipate | xeqi, looks like a vector comprehension, no? |
| 01:16 | defn | ,(= "nil") |
| 01:16 | clojurebot | true |
| 01:16 | xeqi | `for` returns a list, though I don't really think in terms of list vs vector most of the time |
| 01:16 | defn | ,(= nil) |
| 01:16 | clojurebot | true |
| 01:17 | defn | ,(= false) |
| 01:17 | clojurebot | true |
| 01:17 | defn | Hmm |
| 01:18 | defn | ,(= '()) |
| 01:18 | clojurebot | true |
| 01:18 | dissipate | xeqi, so what is the enclosing vector notation used for, with 'for'? |
| 01:19 | defn | Destructuring |
| 01:19 | xeqi | dissipate: bindings for naming and destructuring, much like function declarations [] around params |
| 01:20 | defn | You can use :let as well in the binding form |
| 01:21 | dissipate | xeqi, makes sense now. thanks. |
| 01:24 | defn | ,(for [[k v] [[1 2]] :let [a (str k)]] a) |
| 01:24 | clojurebot | ("1") |
| 01:25 | defn | That took a long time on a phone. |
| 01:25 | defn | Jesus. |
| 01:25 | defn | Maybe 200 keystrokes. |
| 01:26 | defn | Thanks iphone. |
| 01:26 | dissipate | wow, 'for' list comprehensions can get gnarly |
| 01:27 | dissipate | nest collection bindings that can refer to previous bindings |
| 01:27 | dissipate | er, nested |
| 01:28 | joelt | Is there a way for the loop to return nil when it doesn't match? |
| 01:29 | joelt | instead of filtering it returns something else? |
| 01:29 | l2x | ,(for [[k v] [[1 2] [x y]] :let [a (str k)]] a) |
| 01:29 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 01:29 | l2x | ,(for [[k v] [[1 2] ["x" "y"]] :let [a (str k)]] a) |
| 01:29 | clojurebot | ("1" "x") |
| 01:30 | trap_exit | , (doc take) |
| 01:30 | clojurebot | "([n coll]); Returns a lazy sequence of the first n items in coll, or all items if there are fewer than n." |
| 01:30 | trap_exit | , (doc nth) |
| 01:30 | clojurebot | "([coll index] [coll index not-found]); Returns the value at the index. get returns nil if index out of bounds, nth throws an exception unless not-found is supplied. nth also works for strings, Java arrays, regex Matchers and Lists, and, in O(n) time, for sequences." |
| 01:30 | trap_exit | why does one take [n coll] and another take [coll n] |
| 01:31 | trap_exit | I thought I was an idiot for not memorizing this properly |
| 01:31 | trap_exit | but now I feel this is inconsistent |
| 01:31 | amalloy | ,(mapcat (fn [a b] (when (= a b) [a])) '(a b b b) '(a b c c))) is another plausible option, joelt |
| 01:31 | clojurebot | (a b) |
| 01:33 | amalloy | trap_exit: there's no good reason. nth takes its arguments in the "wrong" order for historical reasons (that's the order common lisp used) |
| 01:33 | mischov | "take x number items from this collection" "return from this collection the nth item" |
| 01:33 | trap_exit | amalloy: hmm, I actually like [coll n] more |
| 01:34 | trap_exit | it goes along better with assoc, dissoc |
| 01:34 | trap_exit | i.e. datastructuer first, then args later |
| 01:34 | amalloy | sure, it goes okay with collection functions, but not with sequence functions |
| 01:34 | amalloy | eg, take, drop, filter, map |
| 01:34 | mischov | take makes more sense the other way because you're taking that number from the collection, so it reads kinda like a sentence of intent. |
| 01:34 | trap_exit | well, if we made filter/map also use collection first, then -> works better too |
| 01:35 | trap_exit | take from LST n elements |
| 01:35 | trap_exit | drop from LST n elements |
| 01:35 | trap_exit | filter LST for items that match ... |
| 01:35 | amalloy | trap_exit: (map coll1 coll2 f)? |
| 01:35 | arrdem | .... wat |
| 01:35 | trap_exit | amalloy (map (zip coll1 coll2) f) ... :-) |
| 01:35 | dissipate | trap_exit, one problem with drop is that if you drop from an infinite lazy sequence, you get an infinite result |
| 01:36 | amalloy | mischov: your phrasing argument makes no sense. "return the nth item from this collection" is just as reasonable a phrasing, or "take from this collection x items" |
| 01:36 | arrdem | dissipate: you get infinite _realized_ results :P |
| 01:36 | trap_exit | dissipate: I fail to see how laziness effects this |
| 01:36 | mischov | amalloy: It makes sense for take in particular. |
| 01:36 | dissipate | trap_exit, it doesn't. just saying it's generally not good. :P |
| 01:37 | mischov | amalloy: which is why I always assumed take was ordered as it is. |
| 01:37 | amalloy | mischov: of course it's the natural way to phrase take |
| 01:37 | amalloy | but the very awkward wording of "take from this coll the nth item" doesn't support any position at all |
| 01:38 | arrdem | ,(doc zip_ |
| 01:38 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 01:38 | arrdem | ,(doc zip) |
| 01:38 | clojurebot | Gabh mo leithscéal? |
| 01:38 | amalloy | ~zip |
| 01:38 | clojurebot | zip is not necessary in clojure, because map can walk over multiple sequences, acting as a zipWith. For example, (map list '(1 2 3) '(a b c)) yields ((1 a) (2 b) (3 c)) |
| 01:38 | trap_exit | alright, let's forget english |
| 01:38 | trap_exit | I thikn this complects things |
| 01:38 | trap_exit | I'd be happier if everything that operates on sequences had sequence as first argument |
| 01:38 | mischov | amalloy: no, not really.. :D |
| 01:38 | trap_exit | frees up limited memory to remember important things |
| 01:39 | arrdem | amalloy: well I knew that (map (partial apply vector) ..) was a thing, I was just checking :P |
| 01:39 | amalloy | trap_exit: nth is (almost?) the only thing that takes a sequence as its first arg. just remember that everything takes sequences last, and nth is the (rarely-used) exception |
| 01:39 | dissipate | amalloy, does it make sense to say 'take nth item' from this sequence when the items prior have to be calculated anyways? |
| 01:41 | dissipate | amalloy, how about (first (drop n ...)) |
| 01:41 | defn | Example? |
| 01:41 | defn | What is "it"? |
| 01:42 | mischov | dissipate: (take (create-a-bunch-of-items-over-a few-lines-of-function) 5) or (take 5 (create-a-bunch-of-items-over-a-few-lines-of-function)) |
| 01:42 | arrdem | eh.. we have as->... this is kinda a moot issue besides the inconvenience of not always being able to use -> |
| 01:42 | dissipate | mischov, the latter |
| 01:44 | mischov | dissipate: I always figured that way why seqs/collections are usually last in functions. |
| 01:44 | mischov | dissipate: way why* |
| 01:44 | mischov | dissipate: was why* |
| 01:44 | mischov | I can't type. Huzzah! |
| 01:45 | mischov | amalloy: now that you mention it.. yea, nth drives me nuts! |
| 04:17 | yuri_niyazov | Hey guys |
| 04:17 | yuri_niyazov | What is the expected result from the following piece of code? |
| 04:17 | yuri_niyazov | (let [a (transient {})] (dotimes [x 16] (assoc! a x :ok)) (persistent! a)) |
| 04:17 | pyrtsa | yuri_niyazov: You should always use the *result* of the (assoc! ...) call. |
| 04:18 | pyrtsa | Don't think it's in-place. It's destructive to its first argument but not necessarily in-place. |
| 04:18 | pyrtsa | So instead of dotimes, use reduce. |
| 04:18 | yuri_niyazov | thx! |
| 04:19 | pyrtsa | The documentation should be more explicit of this. |
| 04:19 | pyrtsa | (doc assoc!) |
| 04:19 | clojurebot | "([coll key val] [coll key val & kvs]); When applied to a transient map, adds mapping of key(s) to val(s). When applied to a transient vector, sets the val at index. Note - index must be <= (count vector). Returns coll." |
| 04:20 | pyrtsa | ^ The documentation isn't correct, actually. It should say something like "Returns coll with the arguments associated." or something like that. |
| 04:21 | pyrtsa | The postcondition (identical? coll %) does *not* hold for conj! or assoc!, in general. |
| 04:22 | pyrtsa | (Where % is the return value.) |
| 04:27 | yuri_niyazov | I understand now, thank you very much |
| 04:28 | yuri_niyazov | It's confusing because it's a different object being returned *sometimes*, not always |
| 04:32 | pyrtsa | Agreed. Especially since the documentation doesn't highlight this fact in any way. |
| 04:36 | dsrx | ,(let [a (transient {})] (dotimes [x 16] (assoc! a x :ok)) (persistent! a)) |
| 04:36 | clojurebot | {0 :ok, 1 :ok, 2 :ok, 3 :ok, 4 :ok, ...} |
| 04:39 | pyrtsa | dsrx: The gist of it is, transient maps do (if I remember right) eight assocs in-place but then return a new instance. |
| 04:40 | dsrx | ahh, I see |
| 04:40 | pyrtsa | The doc comment doesn't point this out, which actually makes either the behavior or the doc incorrect. |
| 04:41 | pyrtsa | Granted, transients have been marked as alpha in Clojure 1.5.x. |
| 04:47 | SegFaultAX | dsrx: You should use assoc! like assoc |
| 05:00 | amalloy | pyrtsa: well, the only behavior you should count on is that transient maps do any number of assocs in place, at any time |
| 05:00 | amalloy | and return a new object any number of times |
| 05:01 | pyrtsa | amalloy: See the docs? |
| 05:01 | pyrtsa | (doc assoc!) |
| 05:01 | clojurebot | "([coll key val] [coll key val & kvs]); When applied to a transient map, adds mapping of key(s) to val(s). When applied to a transient vector, sets the val at index. Note - index must be <= (count vector). Returns coll." |
| 05:01 | pyrtsa | "Returns coll." is not right. |
| 05:01 | pyrtsa | Likewise for conj!. |
| 05:02 | pyrtsa | The docstring should be fixed for Clojure 1.6, nothing else. |
| 05:02 | amalloy | pyrtsa: i agree, the docstring definitely should not say "returns coll". perhaps there's still time to get that into 1.6 if you file a jira issue |
| 05:02 | pyrtsa | Filing one right now. |
| 05:03 | SegFaultAX | When does 1.6 go final? Is there a date yet? |
| 05:03 | amalloy | SegFaultAX: i always assumed clojure release dates were "whenever rich thinks it's done" |
| 05:03 | amalloy | maybe with slight biasing to coincide with clojure/conj |
| 05:04 | pyrtsa | http://dev.clojure.org/jira/browse/CLJ-1385 |
| 05:05 | SegFaultAX | Did you set the priority or is it auto-set? |
| 05:06 | amalloy | i think it defaults to major |
| 05:06 | pyrtsa | Ouch. I tried to set it to Major but it shows up as Minor now. |
| 05:06 | pyrtsa | Can it be changed? |
| 05:06 | pyrtsa | Nevermind. |
| 05:07 | pyrtsa | It probably should be Minor, it's Major. (I had a different issue open, hence my confusion.) |
| 05:07 | pyrtsa | Looks like I can't edit it anymore, can I+ |
| 05:07 | pyrtsa | ? |
| 05:08 | SegFaultAX | I don't usually consider copy changes to be major, but meh. Whomever triages the ticket will update its status appropriately. |
| 05:08 | pyrtsa | Yah, I guess it's alright. |
| 07:33 | cYmen | Good morning. |
| 07:34 | cYmen | I can't start the nrepl con in my emacs and I only get 7 lines of error the most useful part of which is just a "Compilation failed: Subproces failed" |
| 07:34 | cYmen | What should I do? |
| 07:35 | cYmen | Ah the output is in the *Messages* buffer |
| 07:53 | liflash | hi, I asked a question about macros and thought it was solved, but it isn't. So here another try: why is the result of a function call within a macro evaluated again? |
| 07:54 | liflash | that is, the function returns a list of strings and I get the exception that string cannot be cast to fn |
| 07:54 | liflash | ,(defn foo [] '("hello" "world")) |
| 07:54 | clojurebot | #'sandbox/foo |
| 07:54 | liflash | ,(foo) |
| 07:54 | clojurebot | ("hello" "world") |
| 07:55 | liflash | ,(defmacro bar [] (foo)) |
| 07:55 | clojurebot | #'sandbox/bar |
| 07:55 | liflash | ,(bar) |
| 07:55 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn> |
| 08:02 | dsrx | ,(macroexpand (bar)) |
| 08:02 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn> |
| 08:03 | dsrx | ,(macroexpand-1 (bar)) |
| 08:03 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn> |
| 08:03 | dsrx | oops |
| 08:03 | liflash | hmmm |
| 08:03 | dsrx | ,(defmacro baz [] '(foo)) |
| 08:03 | clojurebot | #'sandbox/baz |
| 08:04 | dsrx | ,(macroexpand (baz)) |
| 08:04 | clojurebot | ("hello" "world") |
| 08:04 | liflash | yeah, this works, because the call to foo is delayed until runtime |
| 08:05 | liflash | does the macro has to return a function? |
| 08:05 | dsrx | a macro needs to expand to a form that can be evaluated |
| 08:05 | liflash | hmm |
| 08:05 | liflash | i see |
| 08:06 | dsrx | sorry, I screwde up my use of macroexpand |
| 08:06 | liflash | actually the list is within a map |
| 08:06 | dsrx | ,(macroexpand '(when 42)) |
| 08:06 | clojurebot | (if 42 (do)) |
| 08:06 | dsrx | ,(macroexpand '(bar)) |
| 08:06 | clojurebot | (bar) |
| 08:06 | liflash | ,(defn foo [] {:foo '("hello" "world")}) |
| 08:06 | clojurebot | #'sandbox/foo |
| 08:06 | dsrx | er.. |
| 08:06 | liflash | ,(bar) |
| 08:06 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: bar in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 08:07 | dsrx | ,(defmacro bar [] (foo)) |
| 08:07 | clojurebot | #'sandbox/bar |
| 08:07 | dsrx | ,(macroexpand '(bar)) |
| 08:07 | clojurebot | {:foo ("hello" "world")} |
| 08:07 | liflash | this works fine if for example: |
| 08:08 | liflash | ,(defn foo [] {:foo #{"hello" "world"}}) |
| 08:08 | clojurebot | #'sandbox/foo |
| 08:08 | liflash | ,(bar) |
| 08:08 | clojurebot | {:foo #{"hello" "world"}} |
| 08:08 | liflash | it's only a problem if the result contains a real list |
| 08:08 | cYmen | man reloading the repl in emacs is a pita |
| 08:08 | dsrx | cYmen: M-x cider-reload ? |
| 08:09 | dsrx | liflash: yeah, when the reader sees an unquoted list it's evaluated as a function call |
| 08:09 | dsrx | ,("this" "errors") |
| 08:09 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn> |
| 08:10 | cYmen | dsrx: that works? :o |
| 08:10 | dsrx | ,(quote {:foo ("hello" "world")}) |
| 08:10 | clojurebot | {:foo ("hello" "world")} |
| 08:10 | dsrx | ,'{:foo ("hello" "world")} |
| 08:10 | clojurebot | {:foo ("hello" "world")} |
| 08:10 | dsrx | cYmen: yeah |
| 08:11 | liflash | hmmm |
| 08:11 | liflash | so how would i would have to use explicitly (quote.. ) in the function, if this function is used in a macro? |
| 08:12 | liflash | - how would |
| 08:13 | liflash | ,(defn foo [] {:foo (quote ("hello" "world"))}) |
| 08:13 | clojurebot | #'sandbox/foo |
| 08:13 | liflash | ,(bar) |
| 08:13 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn> |
| 08:13 | dsrx | liflash: {:foo (quote ("hello" "world"))} is equivalent to {:foo '("hello" "world")} |
| 08:14 | liflash | yes, i thought so |
| 08:14 | liflash | but this would mean in a macro i can't call functions that contain lists in their result |
| 08:18 | dsrx | ,(defn quux [] '{:foo '("hello" "world")}) |
| 08:18 | clojurebot | #'sandbox/quux |
| 08:18 | dsrx | ,(defmacro baz [] (foo)) |
| 08:18 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 08:18 | dsrx | err |
| 08:19 | dsrx | ,(defmacro baz [] (quux)) |
| 08:19 | clojurebot | #'sandbox/baz |
| 08:19 | dsrx | (baz) |
| 08:19 | dsrx | ,(macroexpand '(baz)) |
| 08:19 | clojurebot | {:foo (quote ("hello" "world"))} |
| 08:19 | dsrx | ,(baz) |
| 08:19 | clojurebot | {:foo ("hello" "world")} |
| 08:21 | liflash | so I have to quote the returned map in the function? |
| 08:25 | liflash | don't know how to do this, since: |
| 08:25 | liflash | ,(defn foo [] (let [s {:foo '("hello")}] s)) |
| 08:25 | clojurebot | #'sandbox/foo |
| 08:25 | cYmen | dsrx: hm....technically it does but I still have to evaluate my code again and start the web server :) |
| 08:25 | liflash | and the map is generated by (map ...) |
| 08:26 | irctc | can somebody help me? I get java.lang.ClassNotFoundException when trying to clojure.core/read-string a string which includes a record. Strangely in the REPL this works fine and the class itself can be found there |
| 08:32 | liflash | dsrx: cYmen: to generate an even more realistic example: |
| 08:33 | liflash | ,(defn foo [] (reduce conj '() '("hello" "world"))) |
| 08:33 | clojurebot | #'sandbox/foo |
| 08:33 | liflash | ,(foo) |
| 08:33 | clojurebot | ("world" "hello") |
| 08:33 | liflash | ,(bar) |
| 08:33 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: bar in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 08:35 | liflash | dsrx: cYmen: how would I quote it, so the result isn't evaluated again? |
| 08:36 | liflash | irctc: do you have some more information? when do you get the exception? is clojure contained in your dependencies? |
| 08:38 | irctc | liflash: I have slurped a file and then I call read-string ... and I get an exception when running the application |
| 08:38 | irctc | liflash: when I try this in the repl there is no exception |
| 08:38 | irctc | liflash: so maybe this record class is not loaded in that namespace ? I am not sure |
| 08:40 | liflash | irctc: I'm new to clojure, too. so I can only guess by myself. what does the exception say? |
| 08:41 | cYmen | liflash: (defmacro bar [] '(foo)) |
| 08:41 | cYmen | but that doesn't do what you want I think |
| 08:42 | liflash | cYmen: this is our solution from yesterday ;) |
| 08:42 | cYmen | ,(defmacro bar [] '(foo)) |
| 08:42 | clojurebot | #'sandbox/bar |
| 08:42 | cYmen | ,(macroexpand '(bar)) |
| 08:42 | clojurebot | (foo) |
| 08:42 | cYmen | This just calls foo. |
| 08:42 | liflash | cYmen: the call to foo is delayed to runtime, but i need it at compile time |
| 08:42 | liflash | exactly |
| 08:45 | cYmen | ah got it |
| 08:45 | cYmen | ,(defmacro bar [] `~(foo)) |
| 08:45 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 08:46 | cYmen | ,(defn foo [] (reduce conj '() '("hello" "world"))) |
| 08:46 | clojurebot | #'sandbox/foo |
| 08:46 | cYmen | ,(defmacro bar [] `~(foo)) |
| 08:46 | clojurebot | #'sandbox/bar |
| 08:46 | cYmen | ,(macroexpand '(bar)) |
| 08:46 | clojurebot | ("world" "hello") |
| 08:47 | cYmen | see, told you it was "just quote unquote" ;D |
| 08:47 | liflash | ,(bar) |
| 08:47 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn> |
| 08:47 | cYmen | I know ;) |
| 08:48 | liflash | so we are at the beginning again...? |
| 08:49 | liflash | ah, no... wait a sec |
| 08:49 | cYmen | ,(defmacro bar [] `'~(foo)) |
| 08:49 | clojurebot | #'sandbox/bar |
| 08:49 | cYmen | ,(bar) |
| 08:49 | clojurebot | ("world" "hello") |
| 08:49 | liflash | ,(macroexpand '(bar)) |
| 08:49 | clojurebot | (quote ("world" "hello")) |
| 08:50 | liflash | hmmm... looks good |
| 08:50 | cYmen | ,(defmacro bar [] `(list ~(foo))) |
| 08:50 | clojurebot | #'sandbox/bar |
| 08:50 | cYmen | ,(bar) |
| 08:50 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn> |
| 08:50 | cYmen | ,(defmacro bar [] `(quote (list ~(foo)))) |
| 08:50 | clojurebot | #'sandbox/bar |
| 08:50 | cYmen | ,(bar) |
| 08:50 | clojurebot | (clojure.core/list ("world" "hello")) |
| 08:50 | cYmen | ,(defmacro bar [] `(quote ~(foo))) |
| 08:50 | clojurebot | #'sandbox/bar |
| 08:50 | cYmen | ,(bar) |
| 08:50 | clojurebot | ("world" "hello") |
| 08:50 | cYmen | oh whatever |
| 08:51 | liflash | thx for the experiments, I'll have a look in the repl |
| 08:52 | cYmen | http://i.imgur.com/4orTtew.jpg |
| 08:52 | liflash | :D |
| 08:55 | cYmen | basically, foo returns a list, too stop clojure from trying to call that as a function it needs to be quoted |
| 08:55 | cYmen | s/too/to |
| 08:55 | cYmen | but '(foo) will also quote the call to foo |
| 08:56 | liflash | exactly |
| 08:56 | cYmen | `'~(foo) quotes the quote but unquotes the call to foo |
| 08:56 | cYmen | ``~(foo) seems to work, too |
| 08:57 | liflash | `'~(foo) quotes the result of foo |
| 08:57 | liflash | so the returned map/list is quoted in the result of the macro |
| 08:57 | cYmen | right |
| 08:57 | liflash | would that be a problem for the caller of the macro and therefore the 'user' of the map? |
| 08:58 | cYmen | uh depends an what that caller expects, I suppose |
| 08:59 | cYmen | right now he gets a list back |
| 09:00 | liflash | in my situation foo returns a map, that contains the list which we are talking about. so now the map would be quoted by the macro |
| 09:01 | liflash | so would something like (:foo (bar)) work? |
| 09:01 | liflash | assuming the quoted map contains the key :foo |
| 09:02 | cYmen | you mean you want bar to be executed? |
| 09:03 | cYmen | write down some examples of input and output for your macro ;) |
| 09:04 | liflash | ok, i just tried it and seems to work perfectly |
| 09:04 | liflash | thank you very much for your help |
| 09:06 | cYmen | oh, it's a learning experience for me, too so thank you :) |
| 09:06 | liflash | don't you think it's a pain to think about the returned data types when calling a function? |
| 09:21 | cYmen | what do you mean? |
| 09:21 | cYmen | Am I not calling the function because I am interested in the returned data and hence its type? :) |
| 09:21 | liflash | only in the data ;) |
| 09:22 | liflash | all this wouldn't have happened if the returned type was not a list |
| 09:22 | cYmen | But data without a type is just a mess of bits. :) |
| 09:24 | tristanStrange | hey all... how can i cast a lazySeq to an ints suitable for passing to a Java method? |
| 09:26 | cYmen | tristanStrange: into-array? |
| 09:26 | cYmen | Not quite sure what you mean by "ints" |
| 09:27 | tristanStrange | i'll take a look thanks. Erm... i mean an array of integer primitives |
| 09:28 | cYmen | in that case that should work :) |
| 09:28 | cYmen | http://clojuredocs.org/clojure_core/clojure.core/into-array |
| 09:40 | steckerhalter | any suggestions for storing/querying data? what's the least painful way? |
| 09:41 | steckerhalter | it could probably get quite a lot of data, a few GB maybe |
| 09:42 | cYmen | depends on what kind of data but basically I think this question is language agnostic |
| 09:50 | steckerhalter | cYmen: I'm asking for something that works well with Clojure. where you don't have to jump through all the hoops as often necessary |
| 09:51 | tristanStrange | I'm trying to call .setPixels on a WritableRaster... but get the following error: |
| 09:51 | tristanStrange | IllegalArgumentException No matching method found: setPixels for class sun.awt.image.IntegerInterleavedRaster clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:80) |
| 09:51 | cYmen | steckerhalter: Well, yeah but what kind of data do you have? I mean using a database from clojure is pretty straightforward, for example... |
| 09:51 | tristanStrange | docs for java method here: http://docs.oracle.com/javase/7/docs/api/java/awt/image/WritableRaster.html#setPixels(int, int, int, int, int[]) |
| 09:51 | tristanStrange | and I'm feeding it four integers and an array of ints as arguments |
| 09:52 | tristanStrange | can anyone guess why? |
| 09:52 | cYmen | tristanStrange: because one of the arguments doesn't match? is an array maybe an Array and not a []? Just guessing. |
| 10:07 | ghanim01 | hi |
| 10:11 | mercwithamouth | hola |
| 10:19 | tristanStrange | ah thanks cYmen. I needed an int[] not an Integer Array... int-array did the job |
| 10:30 | cYmen | tristanStrange: so where are you at with your image processing experiments? |
| 10:31 | tristanStrange | hey cYmen... not too far at all yet.. still trying to get used to Clojure |
| 10:32 | tristanStrange | I'm hoping to get a Sims style GA set up that modifies the expression trees that create images |
| 10:32 | tristanStrange | and was expecting lisp to make that a lot easier.... |
| 10:33 | tristanStrange | this paper is my inspiration: http://www.karlsims.com/papers/siggraph91.html |
| 10:34 | tristanStrange | I've got something going that generates the image files from functions now |
| 10:34 | cYmen | huh |
| 10:34 | cYmen | looks cool |
| 10:34 | cYmen | not that i understand what it is about ^^ |
| 10:35 | ktos | Hi |
| 10:35 | ktos | tell me please, does clojure like lisp can use "system image"? |
| 10:36 | cYmen | hm... I have no clue |
| 10:44 | wagjo | ktos: no |
| 10:44 | wagjo | ktos: see https://groups.google.com/forum/#!topic/clojure/UlkoDy_YyKU |
| 10:59 | ktos | wagjo: thank you |
| 11:02 | borkdude | Should this be considered an error in the spec of clojure? https://gist.github.com/borkdude/9584500 |
| 11:28 | raven1 | Howdy! I'm a noob on clojure so maybe this could sound silly, but there's a way where i can write a client for memcached that would have syncronous and async commands ? |
| 11:29 | raven1 | I clarify, I am trying to write a simple memcached client with method for get and set key but I want to implement the syncronous and async methods for the same action (with thread pooling) how I should proceed ? |
| 11:29 | cYmen | borkdude: What's that *1 thing you're using? |
| 11:30 | borkdude | *1 is the last evaluated value in the repl |
| 11:35 | cYmen | I don't even understand your problem. :) |
| 11:38 | [raven] | cYmen: mine or borkdude one ? |
| 11:38 | cYmen | borkdude's |
| 11:39 | [raven] | cYmen: gotcha :) you've 2 cents for mine? |
| 11:39 | cYmen | no, I'm just starting myself |
| 11:39 | cYmen | Far too advanced. :) |
| 11:39 | borkdude | Normally (read-string (pr-str x)) == x |
| 11:39 | borkdude | this is not the case with keywords that are created from certain strings, like those with a whitespace in it |
| 11:40 | tristanStrange | ok, how does one make the functions in clojure.math.numeric-tower availiable to themselves? |
| 11:40 | cYmen | borkdude: so you're saying (keyword "foo bar") should be something like :foo-bar? |
| 11:40 | borkdude | cYmen I'm not saying that per se. |
| 11:40 | borkdude | cYmen maybe it should not even be allowed to create such a keyword |
| 11:41 | tristanStrange | I'm getting file notfound exception when i include (:require clojure.math.numeric-tower) in my namespace |
| 11:41 | [raven] | cYmen: fair enough :) |
| 11:42 | tristanStrange | sketchy found out how to do it. ignore me :/ |
| 12:01 | benmoss | is it specified behavior that ,(:foo {:foo "bar"} {:foo "baz"}) always returns "bar"? |
| 12:02 | benmoss | don't know where the docs would be for keyword access |
| 12:03 | benmoss | oh nevermind |
| 12:09 | cYmen | benmoss: If it only returns bar, I'm surprised it takes another argument. |
| 12:10 | cYmen | oh the second argument is a default value |
| 12:10 | benmoss | yeah |
| 12:10 | cYmen | ,(:foo {:bla "bar"} {:foo "baz"}) |
| 12:10 | clojurebot | {:foo "baz"} |
| 12:10 | cYmen | seems fine :) |
| 12:10 | benmoss | at first i thought it was variadic but only cared about the first map |
| 12:10 | benmoss | but yeah realized that just after i asked :) |
| 12:11 | cYmen | apparently your IDE is lacking description of variables for function calls :) |
| 12:22 | gfredericks | is there a standard file-store impl of ring.middleware.session.store? |
| 13:09 | AmandaC | should this work? (for [y (range 32) (println “Foo”)) |
| 13:10 | AmandaC | I mean, I’d think it’d work, but it doesn’t seem to in my code. o.o |
| 13:11 | katox | ,(for [y (range 3)] (println "Foo")) |
| 13:11 | clojurebot | (Foo\nFoo\nFoo\nnil nil nil) |
| 13:12 | gfredericks | AmandaC: what you pasted isn't even syntactically valid, so it's not clear if that's your problem or whatever else |
| 13:13 | AmandaC | Hold on, I’ll upload the code I’m actually using real quick. |
| 13:13 | gfredericks | refheap.com |
| 13:13 | AmandaC | http://amanda.darkdna.net/p/43277 <— I’ve got my own little pastebin. :p |
| 13:14 | gfredericks | fancy |
| 13:14 | gfredericks | ah ha |
| 13:14 | arrdem | notbad.jpg |
| 13:14 | gfredericks | so your for expression is probably fine |
| 13:14 | gfredericks | the problem is that for creates a lazy seq, and you're using it for side effects |
| 13:14 | gfredericks | you should probably just s/for/doseq/ |
| 13:15 | arrdem | yep. doseq is the tool you want, not for. |
| 13:15 | AmandaC | ah |
| 13:15 | bufferloss | is clojurescript on topic in here? |
| 13:15 | arrdem | bufferloss: msotly |
| 13:15 | arrdem | *mostly |
| 13:15 | Bronsa | actually you probably want simply dotimes |
| 13:15 | gfredericks | Bronsa: good catch |
| 13:15 | Bronsa | you can avoid the range then. (dotimes [i 32] ..) |
| 13:15 | bufferloss | ok cool I'm trying to run this tutorial http://clojurescriptone.com/getting-started.html but when I run `lein bootstrap` I get "'bootstrap' is not a task. See 'lein help'." |
| 13:16 | bufferloss | I cloned the repo, I cd'd into the directory, ran lein bootstrap, and that ^ |
| 13:16 | bufferloss | any ideas what might be going wrong? |
| 13:16 | Bronsa | AmandaC: also (* i (* y 16)) can be written as (* i y 16) |
| 13:17 | bufferloss | I'm a coder of many years, noob to clojure - I've set up a basic non-web app that connects to postgres and runs queries and saves data back to postgres - I've also written a super basic compojure app with a couple basic endpoints, one to deliver HTML and another couple to deliver some postgres queries as EDN |
| 13:17 | bufferloss | was hoping to get started with clojurescript, but... yeah, this happened |
| 13:17 | Bronsa | and those 4 (.method g ..) can be rewritten as (doto g (.method ..) ..) |
| 13:17 | AmandaC | Bronsa: Math isn’t my strong point, so I was unsure if that was valid |
| 13:17 | arrdem | bufferloss: it looks like lein bootstrap is an odd little command for when lein is used to build itself... |
| 13:18 | arrdem | bufferloss: you shouldn't need it or be using it. |
| 13:18 | bufferloss | arrdem: hmm, so maybe I only need to use lein repl |
| 13:18 | gfredericks | clojurebot: multiplication is commutative |
| 13:18 | clojurebot | Ack. Ack. |
| 13:18 | bufferloss | ok cool thx |
| 13:18 | AmandaC | Rather, if it would produce the wanted result |
| 13:18 | arrdem | bufferloss: probably |
| 13:21 | bufferloss | erg, ok well after running lein repl - it installs deps, and then boots the nREPL but after I try to run (dev-server) I get this https://gist.github.com/anonymous/9586650 |
| 13:21 | TravisD | Hazzah for associative multiplication |
| 13:21 | arrdem | associativity is a lie... the NaNs wait for you... |
| 13:22 | bufferloss | so much for an easy to use tutorial :/ |
| 13:22 | AmandaC | Hrm, now I need to figure out how to get the HeapByteBuffer that the pprint says for :pattern out of what is apparently a gloss.data.bytes.core.SingleBufferSequence |
| 13:24 | AmandaC | ahha, first |
| 13:26 | bufferloss | well I was going to try to use EDN, but honestly at this point I think I'm going to fall back to Backbone and use JSON |
| 13:26 | bufferloss | are there any common JSON output libs that'll take what is, effectively EDN and render it as JSON from ring? |
| 13:26 | TravisD | arrdem: Because you might overflow for some "bracketings" and not others? |
| 13:27 | arrdem | TravisD: Yep. All sorts of evil things can happen... |
| 13:28 | TravisD | yeah :( I hate evil things. |
| 13:32 | TravisD | One of my friends was telling me about some cool algorithm for summing or multiplying or averaging a list of numbers that had nice numerical properties. Somehow it split the data up into a tree and managed to avoid loss of precision. I also think it was related to the fibonacci numbers, maybe |
| 13:32 | TravisD | Does anyone know what I'm talking about? |
| 13:36 | TravisD | The lie: |
| 13:36 | TravisD | ,(let [big Double/MAX_VALUE] (= (* 0.5 2 big) (* (* 0.5 2) big) (* 0.5 (* 2 big)))) |
| 13:36 | clojurebot | false |
| 13:39 | TravisD | Similarly, commutativity is a lie: |
| 13:39 | TravisD | ,(let [big Double/MAX_VALUE] (= (* 0.5 2 big) (* big 2 0.5))) |
| 13:39 | clojurebot | false |
| 13:39 | TravisD | sadness :( |
| 13:40 | whodidthis | do the usual ring session middlewares allow using different cookie lifetimes |
| 13:52 | whodidthis | oh sweet, found :session-cookie-attrs from source |
| 14:27 | ro_st | technomancy: what's the quickest way to resolving "java.util.zip.ZipException: error in opening zip file" when doing lein deps? lein stacktrace is at leiningen.core.classpath$extract_native_deps |
| 14:27 | ro_st | DEBUG=true lein deps doesn't give me any useful info, and i'd like to avoid redownloading my entire .m2 |
| 14:48 | bufferloss | how does compojure/ring serve or decide from where to serve static files? |
| 14:48 | bufferloss | it seems the default is resources/public, is that a setting in ring? I don't see any reference to this in the compojure wiki |
| 14:52 | cYmen | bufferloss: lein compojure-app? |
| 14:52 | bufferloss | the compojure docs for route/resources are not clear to me |
| 14:53 | bufferloss | cYmen: uhh, not sure, I just added compojure to my project.clj and set up some basic routing |
| 14:53 | bufferloss | I see now that the example I followed uses (route/resources "/") which obviously looks in the resources folder, yet the docs make no mention of a resources folder |
| 14:53 | bufferloss | http://weavejester.github.io/compojure/compojure.route.html |
| 14:55 | cYmen | hm... |
| 14:55 | bufferloss | hmm, so it seems route/files serves from the actual project root, wheras route/resources serves from a folder called resources |
| 14:55 | bufferloss | of which, there is no mention in the docs that this is the case |
| 14:55 | cYmen | so the repl.clj that I get generated has (wrap-file "resources") |
| 14:55 | bufferloss | what is the difference exactly then? |
| 14:57 | cYmen | looking at the source I think it might be that files serves everything as a file |
| 14:57 | cYmen | while resources might serve images as image content type or something |
| 14:59 | xeqi | bufferloss: files come from the file system, resources come from the classpath |
| 14:59 | xeqi | in general lein puts "resources/*" on the classpath |
| 14:59 | bufferloss | xeqi: k, I'm not sure what the implications of that are to how I should develop or which I should choose |
| 14:59 | xeqi | bufferloss: I choose resources. Then you can ship jars |
| 14:59 | cYmen | I though a class path was just a list of folders where java looks for classes. |
| 15:00 | xeqi | that contain js/css and refer to them |
| 15:00 | bufferloss | xeqi: ah, ok that makes sense |
| 15:00 | cYmen | What IS a classpath? :) |
| 15:00 | bufferloss | cYmen: yeah I think that's pretty accurate for a definition of classpath, though there may be other implications for builds etc |
| 15:00 | xeqi | cYmen: pretty much, but then they found out they wanted to ship non-classes in jars, so resources also load from them |
| 15:01 | xeqi | for css/js in web apps, or icons in desktop apps |
| 15:01 | xeqi | as examples |
| 15:02 | cYmen | Ah, so they are somehow relative to a "project" and included in magic zips like jars? |
| 15:03 | cYmen | And that's why you can access resources therein from a deployed jar? |
| 15:07 | xeqi | close enough |
| 15:08 | cYmen | okay :) |
| 15:08 | cYmen | thanks |
| 15:39 | TravisD | Is there a function like (def enumerate (partial map-indexed vector)) in the clojure libraries? |
| 15:41 | amalloy | TravisD: there used to be, but it was removed. i think because it encourages inefficiency (building a big old lazy list just to map over it, instead of just using map-indexed to begin with) |
| 15:42 | TravisD | Ah, yeah, I guess often you would do (map f (enumerate coll)) or something |
| 15:43 | TravisD | I wanted to filter a list, but remember the indices of the values I kept |
| 15:44 | gfredericks | does anybody have any ideas for making :repl-options :nit composable? |
| 15:44 | gfredericks | init* |
| 15:45 | gfredericks | or some other way to put default util stuff in the :user profile? |
| 15:45 | technomancy | gfredericks: :injections is more composable |
| 15:45 | hyPiRion | TravisD: I usually implement a function I call aside |
| 15:46 | hyPiRion | ,(defn aside [& fs] (fn [& xs] (mapv #(%1 %2) fs xs))) |
| 15:46 | clojurebot | #'sandbox/aside |
| 15:46 | hyPiRion | ,(map-indexed (aside identity :val) [{:val 42} {:val 23}]) |
| 15:46 | clojurebot | ([0 42] [1 23]) |
| 15:47 | hyPiRion | not sure if the naming makes sense, though |
| 15:48 | TravisD | hyPiRion: Ah, cool. For some other things I was considering writing a function (fn-pair [f g] (fn [x y] [(f x) (g y)])), but your aside is much nicer |
| 15:48 | TravisD | (defn fn-pair...) |
| 15:56 | TravisD | One downside of using erc is that I often almost type things I wish to evaluate in the cider repl in the #clojure buffer instead :P |
| 15:59 | amalloy | TravisD: keep-indexed? |
| 15:59 | TravisD | amalloy: Could work, but I was bothered by filtering nils rather than having a predicate |
| 16:00 | TravisD | I guess it might work nicely with when-let |
| 16:00 | amalloy | TravisD: but if you want to remember the indexes, you'll never have a boolean anyway. it'll be either an [index value] pair, or something you want to remove |
| 16:01 | TravisD | amalloy: Yeah, in the code I was writing I was being sloppy about making it clear what was being filtered |
| 16:09 | gfredericks | technomancy: oh hey this might work |
| 16:09 | gfredericks | thamks |
| 16:09 | gfredericks | (inc technomancy) |
| 16:09 | lazybot | ⇒ 100 |
| 16:10 | hyPiRion | still < 0x100 |
| 16:11 | gfredericks | lazybot: who has teh most karma |
| 16:12 | gfredericks | I don't imagine :injections gets eval'd in any particular namespace? |
| 16:12 | hyPiRion | oh, that's årobably a good PR for lazybot, some list of people with the most karma |
| 16:13 | hyPiRion | *probably |
| 16:15 | gfredericks | oh using a vector for :init would be pretty composable actually, |
| 16:15 | amalloy | gfredericks: i think it's got to be technomancy |
| 16:15 | gfredericks | and not crazy obnoxious like the ((comp last list) ...) stuff I'm doing currently |
| 16:16 | TravisD | Can you decrement karma also? |
| 16:17 | gfredericks | (dec rubby) |
| 16:17 | lazybot | ⇒ -1 |
| 16:17 | TravisD | :O |
| 16:17 | TravisD | is there a count of the number of karmic operations done on a user? |
| 16:18 | TravisD | (karma rubby) |
| 16:18 | amalloy | $karma rubby |
| 16:18 | lazybot | rubby has karma -1. |
| 16:18 | hyPiRion | (identity rubby) |
| 16:18 | lazybot | rubby has karma -1. |
| 16:18 | TravisD | heh |
| 16:18 | TravisD | you are all just numbers! |
| 16:18 | gfredericks | $karma TravisD |
| 16:18 | lazybot | TravisD has karma 2. |
| 16:19 | TravisD | $karma gfredericks |
| 16:19 | lazybot | gfredericks has karma 42. |
| 16:19 | TravisD | (inc not-a-real-user) |
| 16:19 | lazybot | ⇒ 1 |
| 16:19 | TravisD | Ah.. |
| 16:20 | gfredericks | woooah 42 |
| 16:20 | gfredericks | that's better than 100! |
| 16:20 | TravisD | heh, yeah! |
| 16:20 | TravisD | (inc gfredericks) |
| 16:20 | lazybot | ⇒ 43 |
| 16:20 | TravisD | D: |
| 16:20 | gfredericks | now I just gotta find a way to get decremented |
| 16:20 | gfredericks | hey guys why aren't you using haskell yet |
| 16:20 | TravisD | (dec gfredericks) |
| 16:20 | lazybot | ⇒ 42 |
| 16:21 | gfredericks | that was quick |
| 16:21 | TravisD | Preemptive, even |
| 16:33 | amalloy | gfredericks: just checked in lazybot's db, technomancy is the karma winner, followed by me; TimMc, Raynes, and you round out the top 5 |
| 16:33 | amalloy | also someone on another irc network has a karma of 9002, probably as some kind of inside joke? |
| 16:34 | Raynes | $karma 44 |
| 16:34 | lazybot | 44 has karma 0. |
| 16:34 | Raynes | $karma Raynes |
| 16:34 | lazybot | Raynes has karma 44. |
| 16:38 | isaacbw | $karma technomancy |
| 16:38 | lazybot | technomancy has karma 100. |
| 16:43 | gfredericks | I would not have expected to be #5 |
| 17:08 | patrickod | I'm having issues at the moment with java.lang.NoClassDefFoundError errors when trying to run an ubjerjar compiled with 'lein ring uberjar'. I'm new to clojure and unsure of the cause of this. https://gist.github.com/patrickod/e70edeba39652f663029 |
| 17:08 | patrickod | Googling seems to suggest that adding (:gen-class) into the namespace definition for the handler.clj would fix this but that hasn't helped. |
| 17:11 | seangrove | bbloom: ping |
| 17:11 | seangrove | bbloom: You around to check the clarity and sanity of a proposal? |
| 17:16 | seangrove | patrickod: No warnings when creating the uberjar? |
| 17:16 | patrickod | one second I'll paste the output of that |
| 17:17 | patrickod | seangrove updated the gist with the output of lein ring uberjar |
| 17:19 | seangrove | patrickod: AOT can be a bit of pain when you're first getting started with it, don't let it get you down too much. |
| 17:19 | patrickod | haha no worries. :) part of the learning curve |
| 17:19 | seangrove | patrickod: Have you looked at https://devcenter.heroku.com/articles/getting-started-with-clojure ? |
| 17:19 | patrickod | I just happened across that googling. reading now |
| 17:20 | seangrove | Oh, sorry, maybe not that one.. |
| 17:20 | seangrove | There we go https://devcenter.heroku.com/articles/clojure-support |
| 17:20 | seangrove | :profiles {:uberjar {:main myproject.web, :aot :all}} |
| 17:21 | seangrove | Excess flood from bbloom... |
| 17:23 | seangrove | patrickod: Yeah, it's great once you get it, but it can be frustrating in the meantime |
| 17:26 | patrickod | seangrove it worked :) |
| 17:26 | patrickod | thanks! |
| 17:26 | seangrove | Glad to hear it |
| 17:37 | AeroNotix | where can I find a list of all clojure namespaces? All things I usually wouldn't stumble across? |
| 17:38 | brehaut | AeroNotix: http://clojure.github.io/clojure/ |
| 17:39 | AeroNotix | hmm, ok. Was just looking here |
| 18:07 | TimMc | $karma TimMc |
| 18:07 | lazybot | TimMc has karma 55. |
| 18:07 | TimMc | huh |
| 18:10 | shep-home | I'm playing with trying to improve the performance of some code, and I want to tweak a lazy sequence |
| 18:10 | shep-home | I think that the overhead of the lazy is too large compared to my algorithm |
| 18:10 | shep-home | is there a way of making a kinda-lazy-seq? |
| 18:10 | AeroNotix | shep-home: what does this kinda-lazy-seq do? |
| 18:11 | shep-home | That is, do my recursive call 100 times eagerly, then return a lazy fn for the rest |
| 18:11 | AeroNotix | shep-home: take? |
| 18:11 | AeroNotix | shep-home: show some code |
| 18:11 | hyPiRion | AeroNotix: is lazy |
| 18:12 | AeroNotix | doh |
| 18:12 | shep-home | AeroNotix: one sec, lemmo post |
| 18:13 | shep-home | https://gist.github.com/shepmaster/9590585 |
| 18:13 | shep-home | That is from my editor window, so it doesn't actually work ;-) |
| 18:15 | shep-home | (I've updated with the last working version) |
| 18:16 | shep-home | I originally had lazy-cat, but that creates 3 anon functions, so I switched to this version, which only makes one |
| 18:17 | shep-home | i havent fully benched the difference, but I think theres a tiny (<10%) speedup |
| 18:17 | shep-home | could be all in my head |
| 18:17 | AeroNotix | I'm gonna bail on this-- I'm not familiar with how to optimize lazy seqs |
| 18:17 | AeroNotix | It's quite nuanced |
| 18:18 | shep-home | A pain with profiling this in visual VM is that the call stack just goes on and on and on |
| 18:18 | shep-home | deeper and deeper |
| 18:18 | shep-home | AeroNotix: Me either ;-) |
| 18:18 | shep-home | I also tried a core.async version |
| 18:18 | shep-home | and that had reasonable speedup to 4 threads |
| 18:19 | shep-home | but then flatlined (I think due to lock contention) |
| 18:19 | AeroNotix | well |
| 18:19 | AeroNotix | one immediate thing for me is the two recursive calls are done one after the other |
| 18:20 | AeroNotix | I'd find a way to do those concurrently |
| 18:21 | shep-home | Here's the pretty graph of the core.async version: http://i.imgur.com/HYZNqeX.png |
| 18:21 | shep-home | AeroNotix: do you mean for the lazy seq version? Or for the core.async version? |
| 18:22 | AeroNotix | just in-general |
| 18:22 | bbloom | seangrove: i'm back now |
| 18:22 | bbloom | what's up? |
| 18:22 | shep-home | I'm not sure that lazy-seq and concurrency play together... do they? |
| 18:22 | shep-home | err, generation of lazy-seqs |
| 18:22 | AeroNotix | pass |
| 18:23 | hyPiRion | not if they are recursive |
| 18:26 | shep-home | hyPiRion: That's what I was afraid of. And I'm not sure how to disentangle this particular recursion |
| 18:48 | felher_ | Hey folks. Is (or value default_if_value_nil) idiomatic in clojure when one is sure value is either nil or non-falsy, or is (if (nil? value) default_if_value_nil value)) or something different preferred? |
| 18:49 | brehaut | or is fine for defaulting values |
| 18:49 | amalloy | (or a b) is pretty cool |
| 18:49 | felher_ | kay, thanks folks. |
| 18:49 | felher_ | :) |
| 18:49 | brehaut | (-> some complicated thing (or b)) also works great |
| 18:49 | amalloy | there's also fnil if you get the value from a function call |
| 18:50 | brehaut | (for things that return and consume nils happily) |
| 18:51 | felher_ | nice, good to know. Ty :) |
| 19:13 | AeroNotix | so |
| 19:13 | AeroNotix | in core.map |
| 19:13 | AeroNotix | for instance, it has a lambda. I'm looking at program now which has 37k instances of that lambda. |
| 19:14 | AeroNotix | Wouldn't it be better if that was just a separate function? |
| 19:14 | AeroNotix | I know it's a trivial thing to do |
| 19:14 | AeroNotix | but |
| 19:14 | AeroNotix | thoughts? |
| 19:18 | shep-home | AeroNotix: I wonder what the benefit would be. Any way to tell? |
| 19:18 | AeroNotix | memory |
| 19:19 | shep-home | You are referring to `step`, right? |
| 19:19 | shep-home | cause there's also the anonymous one below that |
| 19:20 | AeroNotix | Same difference |
| 19:21 | AeroNotix | shep-home: those'll both compile to separate classes |
| 19:21 | AeroNotix | and each time you call, you make an instance of that class. IIRC? |
| 19:21 | AeroNotix | I mean --- I'm not advocating people never use lambdas. That's crazy. |
| 19:21 | AeroNotix | but, it'd be interesting to see what'd happen if the entire standard library implementation did not use them. |
| 19:23 | shep-home | Looks like step could be pulled out, but the anon one captures locals... |
| 19:24 | AeroNotix | sure |
| 19:25 | amalloy | AeroNotix: map's lambda takes up space because that space needs to be taken up in order to implement map. try implementing map without it |
| 19:25 | amalloy | make sure it's as lazy as the existing implementation |
| 19:25 | AeroNotix | amalloy: I'm just talking generally |
| 19:26 | amalloy | in general, if the entirety of clojure.core didn't use lambdas, it would be totally awful. fire would rain from the sky |
| 19:27 | amalloy | it doesn't even make sense. you can lift any lambda that doesn't close over anything into a defined function, but there are very few of those, and not much point in doing so anyway |
| 19:30 | shep-home | AeroNotix: can you tell with lambda is taking memory? |
| 19:30 | shep-home | which* |
| 19:31 | shep-home | amalloy: cause `step` in `map` doesn't close over anything. Is it possible that it could contribute to memory usage for each unfinished map? |
| 19:32 | amalloy | *shrug* a lambda that doesn't close over anything takes up as much space as (Object.) |
| 19:32 | amalloy | ie, a pointer |
| 19:32 | amalloy | AeroNotix: if you want to avoid creating lazy sequences (which is roughly the same as lambdas in this context), you can use clojure.core.reducers |
| 19:35 | shep-home | amalloy: so, a little bit, as opposed to the static / constant a top-level defn would have? Or is there more hidden? |
| 19:38 | shep-home | And this amount of space is probably neglible compared to the memory used by the lazy-seq's data. |
| 19:39 | shep-home | But it is a single place that could be changed to reduce memory consumption across all users |
| 19:42 | shep-home | Similar with concat$cat, it seems |
| 19:42 | amalloy | if you assume instant gc, there would be one instance of map$step and one instance of map$step$fn per call to map. that is like zero space. it's just some gc churn |
| 19:42 | amalloy | and you can't avoid the map$step$fn, because it's closing over cs |
| 19:43 | amalloy | (map$step$fn is the lambda introduced by the lazy-seq macro, in case that's not obvious) |
| 19:50 | shep-home | Well, for my current problem, replacing concat with a version with concat$cat at the top level doesn't make any noticeable time difference |
| 19:51 | shep-home | and I don't know how to quantify memory/GC activity over the entire run, so I cant say anythign there |
| 20:29 | seangrove | dnolen_: What did you use for the literate programming post? I'm looking at being more concrete with the examples than I was in the video, I think it'd be great to have it inline in a post |
| 20:29 | dnolen_ | seangrove: it was just manual |
| 20:29 | seangrove | Ok, thought there might have been something else |
| 20:50 | stcredzero | I may be going crazy here, but it seems like the keys in a map in a defrecord object are all turning into false. |
| 20:58 | gfredericks | thewat |
| 21:02 | hyPiRion | ,(alter-var-root #'false? (constantly true)) |
| 21:02 | clojurebot | true |
| 21:02 | hyPiRion | yay |
| 21:03 | xeqi | ,(false? false) |
| 21:03 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn> |
| 21:03 | hyPiRion | oh, that was probably wrong |
| 21:03 | hyPiRion | ,(.bindRoot #'false? (constantly true)) |
| 21:03 | clojurebot | nil |
| 21:04 | hyPiRion | ,(map false? (keys (apply hash-map (range 10)))) |
| 21:04 | clojurebot | (true true true true true) |
| 21:04 | xeqi | ,(false? false) |
| 21:04 | clojurebot | true |
| 21:05 | xeqi | oh what fun things that can do to the bots |
| 21:05 | Raynes | https://github.com/Raynes/clhue In case you've ever wanted to program your light bulbs. |
| 21:09 | gfredericks | hyPiRion: ha you wanted (constantly (constantly true)) |
| 21:09 | hyPiRion | gfredericks: yeah, I realised in hindsight |
| 21:09 | gfredericks | ,(->> true constantly constantly (alter-var-root #'false?)) |
| 21:09 | clojurebot | #<core$constantly$fn__4057 clojure.core$constantly$fn__4057@6b7d38> |
| 21:09 | gfredericks | ,(false? false) |
| 21:09 | clojurebot | true |
| 21:09 | gfredericks | ,(false? ["FALSE!"]) |
| 21:09 | clojurebot | true |
| 21:10 | akurilin | Hey so the peeps in here who make restful Ring apps, do you guys actually bother with any kind of MVC or do you have some sort of custom approach to decoupling your ssystem? |
| 21:12 | stcredzero | Yes, it does appear that (keys my-map) is returning '(false false false false false) |
| 21:15 | stcredzero | Is there any way someone can see asking (filter fn (keys a-map)) and getting '(false false false false)? |
| 21:16 | gfredericks | ,{(Boolean. false) 12 (Boolean. false) 13} |
| 21:16 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: (Boolean. false)> |
| 21:17 | gfredericks | ,(hash-map (Boolean. false) 12 (Boolean. false) 13) |
| 21:17 | clojurebot | {false 13} |
| 21:17 | stcredzero | Yes, but then asking keys, I'd only get '(false) |
| 21:18 | gfredericks | yeah, just experimenting |
| 21:19 | gfredericks | sounds pretty spooky |
| 21:19 | stcredzero | This is just the most bizzaro error ever. Should I be upgrading to Clojure 1.6? |
| 21:21 | stcredzero | I think it might be due to the fact that I have lots of (map) and (pmap) calls in a game loop, and though I use doall, I don't ask for a vector, so these things remain lazy sequences, even though their items have been realized. |
| 21:22 | stcredzero | Or am I misunderstanding lazy sequences and what (doall) does? |
| 21:23 | beamso | doall doesn't return any values |
| 21:23 | stcredzero | none at all? |
| 21:23 | kras | Hello, everyone |
| 21:23 | beamso | i think it just makes everything in the lazy sequence evaluate |
| 21:24 | stcredzero | ,(doall (map identity '(1 2 3 4))) |
| 21:24 | clojurebot | (1 2 3 4) |
| 21:24 | kras | Looking for suggestions on 'lex/yacc' type libraries in clojure |
| 21:24 | stcredzero | Looks like it returns a value to me |
| 21:25 | beamso | ,(doall (map inc '(1 2 3 4))) |
| 21:25 | clojurebot | (2 3 4 5) |
| 21:26 | beamso | oops. my bad. i think i was getting dorun and doall confused. |
| 21:26 | stcredzero | Is there something that has the effect of (fn [coll] (vec (doall coll))) ? |
| 21:26 | akhudek | kras: instaparse |
| 21:27 | stcredzero | Or is (fn [coll] (vec (doall coll))) redundant to (vec)? |
| 21:27 | amalloy | stcredzero: that lambda is a lengthy way of writing vec |
| 21:27 | stcredzero | amalloy: danke |
| 21:28 | amalloy | i don't think you can ever get (keys x) to return (false false false) if x is one of clojure's built-in map types |
| 21:29 | kras | akhudek: thank you, will have a look. Any idea how the performance is? My language is simple but I need to parse huge files |
| 21:29 | akhudek | kras: no idea, we've only used it for fairly short inputs |
| 21:31 | akhudek | kras: but the author does care about performance https://github.com/Engelberg/instaparse/blob/master/docs/Performance.md |
| 21:32 | stcredzero | amalloy: here's the snippet of code that makes me think that's happening: http://pastebin.com/WE3mkACS (old-grid should be a map) |
| 21:32 | amalloy | kras: aphyr recently tried giving equivalent grammars to instaparse and antlr, and his experiments suggest antlr is a lot faster. i can't vouch for his methodology, but he said the results were about 70x faster for antlr |
| 21:33 | stcredzero | So, is there any risk in going to Clojure 1.6, or should I just jump in? |
| 21:33 | kras | amalloy: antlr I guess generated Java code if I am right? it's not a pure clojure library? |
| 21:34 | amalloy | kras: he recently wrote some clojure bindings for it: https://github.com/aphyr/clj-antlr |
| 21:34 | stcredzero | ANTLR is definitely Java |
| 21:34 | amalloy | stcredzero: one possibility is that you have keys in your map that aren't false, but print the same as it |
| 21:35 | amalloy | for example, i strongly recommend against using str to print data structures, since ##(str ["false" false (symbol "false")]) |
| 21:35 | lazybot | ⇒ "[\"false\" false false]" |
| 21:37 | stcredzero | amalloy: what's odd is that I *never* do anything to the keys once the old-grid map is created. I never remove entries. What should I do to print keys? |
| 21:37 | amalloy | pr-str |
| 21:38 | amalloy | stcredzero: i'd suggest printing the actual map, too, if you're getting behavior from it that makes no sense |
| 21:39 | stcredzero | amalloy: a sensible suggestion |
| 21:40 | kras | thanks amalloy: and akhudek: give give both antlr and instaparse a shot ... |
| 21:41 | kras | will* |
| 21:43 | amalloy | stcredzero: none of those doalls in there make sense, by the way. and f should just be (fn [k] (not= k (f1 k))). and (> (count x) 0) should be (seq x) |
| 21:44 | SegFaultAX | I would be pretty shocked if instaparse could come close to antlr. |
| 21:45 | mr-foobar | In clojurescript + core.async ... can I use any number of (go ...)'s and channels ? Are there any performance implications ? |
| 21:45 | amalloy | SegFaultAX: incidentally, i profiled instaparse, and it was spending most of its time inside of a swap! modifying an arraymap |
| 21:45 | SegFaultAX | amalloy: How big was the arraymap? |
| 21:45 | amalloy | so persistent data structures aren't free *all* the time, as i usually claim |
| 21:46 | amalloy | oh, i dunno. probably small. i just had timing information and stacktraces |
| 21:46 | SegFaultAX | Free lunch and silver bullets, etc. |
| 21:46 | amalloy | mr-foobar: http://swannodette.github.io/2013/08/02/100000-processes/ |
| 21:50 | TravisD | Yowzah, that gets my processor all hot and bothered |
| 21:50 | TravisD | looks cool though |
| 21:51 | TravisD | Although, it's misleading how the URL makes it look like there are 100,000 processes, |
| 21:51 | TravisD | Oh, I should have read the update :) |
| 21:52 | mr-foobar | amalloy: There is only one channel, returned by render-loop. Are channels also cheap ? |
| 21:54 | amalloy | i believe channels are cheap too |
| 21:54 | SegFaultAX | mr-foobar: Fairly cheap, yes. |
| 21:55 | isaacbw | anyone know what the ruby component of turbolinks does? Is it required to use turbolinks or is it just there to integrate with rails. i.e could turbolinks be used in a clojure-driven app without writing a server component |
| 21:56 | SegFaultAX | isaacbw: Sure it could, but you'd have to implement it yourself. |
| 21:56 | mr-foobar | amalloy SegFaultAX Awesome! I really feel there is a design-pattern that uses channels but I can't put a name to it. It seems something like games would use. |
| 21:56 | isaacbw | SegFaultAX: what do you mean |
| 21:57 | SegFaultAX | isaacbw: Turbolinks is basically a big fat hack that swaps out bits and pieces of the page for you so assets don't have to be reloaded. |
| 22:04 | dsrx | oh god turbolinks |
| 22:13 | beamso | a defprotocol definition, with a :gen-class directive in the namespace, generates an interface/abstract class? |
| 22:14 | beamso | with any deftypes implementing that defprotocol as classes implementing/extending the protocol? |
| 22:15 | stcredzero | amalloy: The thing that I ask (keys) of prints out as a Clojure map! |
| 22:27 | joshbamboo1 | isaacbw: have a look at pjax http://pjax.heroku.com/ Turbolinks is based on this. |
| 22:36 | gfredericks | stcredzero: what is its type? |
| 22:36 | isaacbw | joshbamboo1: is the time supposed to be changing when I click on the links? |
| 22:36 | gfredericks | ,(keys (repeat 5 (first {false 42}))) |
| 22:37 | clojurebot | (false false false false false) |
| 22:37 | joshbamboo1 | if pjax is not enabled, then the time should update, indicating that the whole page has been returned from the server. Click the check box (it's on the waiter's serving plate - hard to spot), and the time won't change when clicking the links. |
| 22:38 | isaacbw | ah, I see! |
| 22:38 | isaacbw | awesome, thanks for the link |
| 22:38 | joshbamboo1 | pjax essentially returns an HTML fragment and swaps out a portion of the page, rather than returning the whole page. There's nothing magical, but it's a nice visual and speed improvment. |
| 22:39 | joshbamboo1 | The server needs a way of knowing whether to render a full document or just a framgment obviously. I believe pjax uses a custom header for this. |
| 22:40 | isaacbw | so is turbolinks just rails trying to be even more monolithic instead of leveraging what already exists? |
| 22:42 | joshbamboo1 | The other thing you need to watch out for, is if the fragment has script such as jQuery document ready event handlers. With pjax, the document ready never fires since it's only a fragment returned, not the whole document. Not sure how pjax handles this. Turbolinks provides a similar handler which I think gets called when the ajax call returns as a way to handle this. |
| 22:44 | joshbamboo1 | Only skimmed, this might help: http://geekmonkey.org/articles/28-introducing-turbolinks-for-rails-4-0 |
| 22:47 | joshbamboo1 | Sounds like the idea is similar to pjax, but applied in a slight different document scope. See also https://plus.google.com/+YehudaKatz/posts/A65agXRynUn?utm_source=rubyweekly&utm_medium=email for some other caveats, esp long lived JS |
| 22:49 | joshbamboo1 | I guess the Turbolinks whole document approach is more what 37 Signals needed, rather than the extra overhead of pjax with marking certain sections. These kinds of features find their way in to Rails due to a really need by 37 Signals, not because the rest of the world necessarily needs them.. |
| 22:49 | joshbamboo1 | ^really need == real world need |
| 22:54 | dsrx | https://twitter.com/markbates/status/443490828540198912 @markbates Rails 5 will be renamed to Basecamp. This will help to end confusion over which types of apps to build using Rails. |
| 23:04 | stcredzero | gfredericks: the type of the old-map is clojure.lang.PersistentHashMap |
| 23:07 | stcredzero | gfredericks: but now the mismatched (keys) collection is [[0 -3]] |
| 23:30 | Fraz2 | does anyone know if it's possible to use the lein kibit with custom rules defined in my project |
| 23:31 | Fraz2 | this is possible using vanilla kibit, but the lein plugin does not support a rules argument |
| 23:31 | Fraz2 | trying to hack it in I find that I can't even 'require' filesfrom my own project since my files are not on the classpath when lein kibit is running |
| 23:37 | seangrove | dnolen_ bbloom Hopefully getting more coherent https://dl.dropboxusercontent.com/u/412963/zenrise/zenrise.html As usual, feedback appreciated |
| 23:40 | stcredzero | So no one wants to chime in on the desirability of going to Clojure 1.6? |
| 23:41 | seangrove | stcredzero: Shouldn't be too damaging, but there's no hurry |
| 23:42 | bbloom | seangrove: hmm... seems like there has to be something an order of magnitude simpler |
| 23:44 | seangrove | bbloom: The effects aren't really apparent until you've built a medium-sized app. Almost certainly could simplify the examples though, you're right |
| 23:44 | bbloom | is the goal of a "transformer" just to itself be data, so that it's toolable? |
| 23:45 | bbloom | i guess my question is why not just parameterize the nav-bar with a function which converts the provided data in to the items |
| 23:45 | bbloom | probably worth looking at http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol(v=vs.110).aspx too |
| 23:46 | bbloom | and for bi-directional purposes: http://wpftutorial.net/ValueConverters.html |
| 23:47 | l1x | hi, is this the right way of decomposing list or there is better way of doing that? https://gist.github.com/l1x/9593619 |
| 23:47 | bbloom | seangrove: just generally "data templating" is a toolable template language that is basically just functions of data -> views & has a lot of the details sorted out. the 2-way data-binding bits are complex, but see http://msdn.microsoft.com/en-us/library/ms742521(v=vs.110).aspx anyway |
| 23:48 | bbloom | i'm not sure why i need a transform-registry and a bunch of other machinery like that |
| 23:49 | SegFaultAX | ,(doc some) |
| 23:49 | clojurebot | "([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)" |
| 23:49 | SegFaultAX | l1x: ^ |
| 23:49 | bbloom | seangrove: what i really want is to be able to supply an IFn and, for tooling reasons, have that IFn also be a data record that i can inspect or manipulate for simple use cases |
| 23:49 | seangrove | bbloom: That's essentially what this is - the 'registry' is so that it can all be serialized out to edn, to keep it tooling-friendly |
| 23:49 | l1x | SegFaultAX: thanks!! |
| 23:50 | bbloom | seangrove: ah i see... lots of concepts at once |
| 23:50 | bbloom | seangrove: is it possible to defer the serialization requirements? |
| 23:51 | bbloom | seangrove: or at least delay introducing them until usage of the fundamentals are clear |
| 23:51 | bbloom | seangrove: also, since your transform registry already just has functions it in, you can't serialize that... so why not use namespaces/vars for this? |
| 23:51 | seangrove | bbloom: I needed it while building the tooling, I'd have to think of a way to pull that out |
| 23:51 | bbloom | we've already got a definition-registry, called namespaces :-) |
| 23:52 | seangrove | bbloom: That would work as well, but having a centralized hashmap means it can be exposed in the tooling as a drop down and introspected |
| 23:52 | seangrove | "This component is connected to these paths, use this function here, and validate that the function gets the keys it needs and outputs the keys the component needs" |
| 23:53 | seangrove | Being able to look up the functions and get the meta-data from them (in a bit of a hobbled edn format) has been pretty useful for that |
| 23:54 | bbloom | this is the situtation in which it kinda sucks we don't have an eval or compile function in cljs |
| 23:54 | seangrove | bbloom: Hah, I was considering funding cljs-in-cljs for that very reason while building this out ;) |
| 23:55 | bbloom | this is kinda a tangent, but frankly it may be less work to port compiler stuff to run in the browser than it would be to play the server/client coordination game |
| 23:56 | stcredzero | Is pervasive laziness going to be dangerous for my game loop? Seems like I keep piling up proxies inside lazy sequences, then run into weird bugs. |
| 23:57 | bbloom | stcredzero: i'm not sure how laziness or proxies relates at all to a game loop.... |
| 23:58 | bbloom | seangrove: anyway, this spec makes *some* sense to me |
| 23:58 | SegFaultAX | Well I can see how laziness might relate, but proxies? |
| 23:58 | seangrove | bbloom: There's no server-side right now, but I'm happy enough with the way the system, tooling, etc. is coming out that I wouldn't be excited to back up to the point of porting the compiler ;) |
| 23:58 | seangrove | bbloom: I'll continue hashing it out these are all good questions |
| 23:59 | seangrove | And if the tooling is actually usable, then it's all interesting, and if not, then it's not really worthwhile anyway. |
| 23:59 | bbloom | seangrove: yeah, you're making progress, so just keep on hacking |
| 23:59 | bbloom | you can figure out the theory of it all later :-P |