2014-05-03
| 03:38 | ivan | this lein-figwheel is cool https://groups.google.com/forum/#!topic/clojurescript/sKXiohA4hsw |
| 03:52 | dbushenko | hi! |
| 03:53 | dbushenko | is there a way to get all local variables and all bindings inside one function? |
| 04:26 | amalloy | dbushenko: maybe. why would you want that? |
| 05:17 | wink | definitely sounds interesting, I only ever needed that for all global variables (in ruby) |
| 05:20 | dbushenko | amalloy: trying to insert a debugging repl inside the code |
| 05:20 | dbushenko | need to evaluate it using the whole environment |
| 05:21 | amalloy | okay. in a macro, you can refer to &env, which will be a map whose keys are the names of locals |
| 05:21 | amalloy | the values of the map are opaque and mysterious |
| 05:22 | dbushenko | is &eve available outside the macro? I tried to evaluate it in the repl and it is not found |
| 05:22 | dbushenko | *&env |
| 05:53 | amalloy | no, that's why i said in a macro |
| 06:01 | amalloy | the idea is to expand into useful code based on the locals |
| 06:01 | amalloy | ,(defmacro all-locals [] (into {} (for [[sym _] &env] `['~sym ~sym]))) |
| 06:01 | clojurebot | #'sandbox/all-locals |
| 06:01 | amalloy | ,(defn foo [x] (prn (get (all-locals) 'x))) |
| 06:01 | clojurebot | #'sandbox/foo |
| 06:01 | amalloy | ,(foo 5) |
| 06:01 | clojurebot | 5\n |
| 06:52 | dbushenko | amalloy_, thanks! |
| 06:52 | dbushenko | that was helpful! |
| 07:33 | ambrosebs | Bronsa: can analyze take a keyword argument for the macroexpand-1 function to use? |
| 07:33 | ambrosebs | (analyze frm env :macroexpand-1 m) |
| 07:34 | ambrosebs | otherwise it seems I need to rewrite my own analyze to use my own mexpand? |
| 07:34 | magopian | i'm trying to understand the validation seqs in http://www.braveclojure.com/writing-macros/#7__Brews_for_the_Brave_and_True |
| 07:34 | magopian | and I don't get the "#(or (empty? %) ..." part |
| 07:34 | Bronsa | ambrosebs: you mean rather than binding ana/macroexpand-1? |
| 07:34 | magopian | why have this (empty?) thing in there? what is it used for? |
| 07:35 | magopian | ah, forget it, I just got it :) |
| 07:36 | ambrosebs | Bronsa: hopefully I've understood how dynamic binding works, but it seems the body of analyze always rebinds ana/macroexpand-1 to the same fn |
| 07:36 | magopian | (it's to not have this validation error message displayed if the value is empty... it's a bit backwards because the validation function has to return "true" if valid |
| 07:36 | Bronsa | ambrosebs: yeah, sure |
| 07:36 | ambrosebs | Bronsa: rebinding it doesn't seem to do anything |
| 07:37 | Bronsa | ambrosebs: I'll add a 3-arity to analyze and friend taking a default map of bindings |
| 07:37 | Bronsa | so you can do (analyze form env {#'ana/macroexpand-1 my-own-mexpand}) |
| 07:38 | ambrosebs | Bronsa: seems like a good time to use keyword args |
| 07:38 | ambrosebs | Bronsa: but cool |
| 07:38 | Bronsa | ambrosebs: not a big fan of kw args tbh |
| 07:39 | ambrosebs | or a flat map of kw args |
| 07:39 | clgv | magopian: well the logic in the example checks not-empty first. you probably dont want to have two error messages for the same error when the second does not even apply |
| 07:39 | ambrosebs | gah |
| 07:39 | Bronsa | having a map of var->fn makes it just a matter of (merge default-bindings opts) |
| 07:40 | ambrosebs | just woke up from a nap |
| 07:41 | magopian | clgv: yup, got that after posting my question ;) |
| 07:42 | magopian | is it more idiomatic to use (get mymap mykey) or (mykey mymap) ? |
| 07:43 | magopian | (or even (mymap mykey) which looks sooooo backwards to me, but I know it works) |
| 07:43 | magopian | ,(get {:foo :bar} :foo) |
| 07:43 | clojurebot | :bar |
| 07:44 | magopian | ,(:foo {:foo :bar}) |
| 07:44 | clojurebot | :bar |
| 07:44 | magopian | ,({:foo :bar} :foo) |
| 07:44 | clojurebot | :bar |
| 07:44 | clgv | magopian: it is idiomatic to have the keyword in first position for keyword access to maps. for everything else you need to put the map first, since otherwise your code might fail |
| 07:45 | clgv | ,(:foo {:foo 42 :bar 4711)) |
| 07:45 | clojurebot | #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )> |
| 07:45 | clgv | ,(:foo {:foo 42 :bar 4711}) |
| 07:45 | clojurebot | 42 |
| 07:45 | clgv | ,(1 {1 2}) |
| 07:45 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn> |
| 07:45 | clgv | ,({1 2} 1) |
| 07:45 | clojurebot | 2 |
| 07:46 | magopian | ahhhh, I see, i didn't think of that, of course, you don't need keywords in a map |
| 07:46 | magopian | thanks a lot clgv |
| 07:47 | magopian | I find the forms without the "get" a bit more difficult to read, because you first have to find out what is this "function" you're calling |
| 07:47 | magopian | eg: |
| 07:47 | clgv | magopian: yeah can use `get` then |
| 07:47 | magopian | ,(let [mymap {1 2}] (mymap 1)) |
| 07:47 | clojurebot | 2 |
| 07:48 | clgv | but sometimes it's really useful to pass in a map where a function is expected |
| 07:48 | magopian | clojure feels very ruby/perl-like to me pythonista used to the TWOOTDI :) |
| 07:48 | clgv | twoo..? |
| 07:48 | magopian | There's One Obvious Way To Do It |
| 07:48 | magopian | (it's a Python moto) |
| 07:48 | clgv | arent there multiple ways in python? |
| 07:49 | clgv | afaik it's a multi paradigm language where you can program almost any way you like |
| 07:49 | magopian | the language and well known, well spread and well evengelized idioms aim to have one obvious way to do things |
| 07:49 | magopian | being able to doesn't mean it's a good idea |
| 07:50 | magopian | you could use a "for" with indexes and stuff, but it's not idiomatic, and you're very very encouraged to do things like "for ... in ..." |
| 07:50 | clgv | in general true but it raises the question why to support multiple paradigms then ;) |
| 07:50 | magopian | (the same way you usually don't use "for" and loops in clojure) |
| 07:50 | magopian | clgv: i'm not talking about paradigms here (programming in a functional/imperative/oo way) |
| 07:50 | magopian | but really about "is it idiomatic to use this or this form" |
| 07:51 | clgv | there is no rule to not use "for" in clojure ... it's pretty useful for data processing |
| 07:51 | clgv | but it's a different "for" than in pythion ;) |
| 07:52 | clgv | magopian: but than you have one idiomatic form for each paradigm right? so that's more than one way ;) |
| 07:53 | magopian | well, not really |
| 07:53 | magopian | you don't need one for each paradigm |
| 07:53 | magopian | i don't have a proper example at hand sadly |
| 07:54 | magopian | and i'm in no way trying to compare oranges and apples |
| 07:54 | magopian | just telling about my feeling of being a bit lost with so many different possibilities giving the same end result |
| 07:54 | magopian | which one should I use? |
| 07:55 | magopian | i understand the freedom of using just any solution I feel like, but then, it's a bit more difficult for maintainers and reviewers |
| 07:55 | Bronsa | magopian: depends on what's your variable. (fn [m] (:key m)), (fn [k] ({:foo 1 :bar 2} k)) |
| 07:56 | magopian | Bronsa: i see |
| 07:56 | magopian | you have a point |
| 07:57 | clgv | magopian: that's the rule from above with keywords in call position |
| 07:57 | magopian | I might always use "get" or the "map first" forms, as they can be used in any case |
| 07:58 | magopian | the keyword first only works for... well, keywords ;) |
| 07:58 | clgv | yeah but in that case it reads more like accessing attributes of data |
| 08:08 | scape_ | not sure where refheaps paste button went, some reason I think I heard someone mention this last night. anyways.. here is a paste I'm curious about: https://www.refheap.com/85069 |
| 08:09 | scape_ | why does that actually work in the thread? is first some how not actualized until after the thread sleeps? |
| 08:10 | scape_ | because the thread, it appears, gets the first element, sleeps (which is when the array is reset), and then somehow still can update the array. I'm confused how this is possible |
| 08:14 | clgv | scape_: what exactly do you expect to happen and what do you observe? |
| 08:15 | scape_ | the threads reference to first ele would likely be a1, looking at the code, but its not |
| 08:15 | scape_ | let me try somthing |
| 08:16 | ambrosebs | Bronsa: in case my last msg didn't work, I mean (analyze form env opt) |
| 08:16 | clgv | scape_: could be b1 as well |
| 08:17 | scape_ | https://www.refheap.com/85069 |
| 08:17 | ambrosebs | (analyze frm env {:bindings bmap}) |
| 08:18 | clgv | scape_: so? obviously b1 otherwise it would fail with an exception |
| 08:18 | Bronsa | ambrosebs: uhm to you mean in case more opts will be added? sounds reasonable |
| 08:18 | clgv | ,(let [a (promise)] (deliver a 0) (deliver a 1)) |
| 08:18 | clojurebot | nil |
| 08:18 | ambrosebs | Bronsa: hehe yes |
| 08:18 | clgv | oh wait. that was removed it seems |
| 08:18 | scape_ | yes thats my point |
| 08:18 | scape_ | :) |
| 08:19 | clgv | what's your point? |
| 08:19 | Bronsa | ambrosebs: you have a point. let me change that then |
| 08:20 | Bronsa | TIL get-in has a not-found arg |
| 08:20 | clgv | scape_: what is your original goal? |
| 08:20 | clgv | scape_: for coordination between threads you should use atoms or refs |
| 08:20 | scape_ | ok |
| 08:21 | clgv | well promises as coordination work for certain scenarios as well. but the array is not really suitable |
| 08:22 | Morgawr | I'm probably missing something but.. how come I can't see the "paste" button on refheap.com anymore? Has it been moved and I can't find it or am I just stupid? :( |
| 08:22 | scape_ | yes, i see. figured it out too, array copy is fast |
| 08:23 | scape_ | hit ? Morgawr |
| 08:23 | Morgawr | ah |
| 08:23 | Morgawr | ctrl+enter |
| 08:23 | Morgawr | why remove the button altogether? |
| 08:23 | scape_ | idk :-\ |
| 08:23 | clgv | ui improvement? :P |
| 08:23 | TEttinger | pessimization? |
| 08:23 | Morgawr | I appreciate keyboard commands but this confused me a lot lol |
| 08:23 | TEttinger | worse is better? |
| 08:24 | clgv | start a petition to get back the start menu on refheap ... oh wait, paste button I mean ;) |
| 08:26 | TEttinger | just use the API and spam it with pastes demanding a paste button back |
| 08:27 | Morgawr | TEttinger: lol |
| 08:36 | clgv | ,(slurp "http://refheap.com") |
| 08:36 | clojurebot | #<SecurityException java.lang.SecurityException: denied> |
| 08:36 | clgv | ah clojurebot won't help ;) |
| 08:52 | cYmen_ | Greetings clojurians. |
| 09:02 | cYmen_ | Cursors are only consistent during the application render phase - that is inside the life cycle methods. |
| 09:02 | cYmen_ | man...this om tutorial |
| 09:03 | cYmen_ | I know neither what the render phase is nor the life cycle methods. At least there is an explanation of cursor but I'm not sure I understand it. |
| 09:07 | clgv | cYmen_: is there a link to preliminary literature? |
| 09:08 | clgv | cYmen_: otherwise let the author know what's missing |
| 09:10 | cYmen_ | I think the authors assumes a little too much knowledge of react or something. |
| 09:10 | cYmen_ | This is the basic introductory om tutorial and it says it requires knowledge of clojure/clojurescript. |
| 09:12 | clgv | cYmen_: happens to all of us right? ;) |
| 09:13 | cYmen_ | Yeah, I'm in no way surprised and the tutorial is really not bad. |
| 09:13 | clgv | I know nothing of react or om. ;) |
| 09:14 | cYmen_ | Well, it's some sort of framework for dealing with events. |
| 09:14 | clgv | yeah, seems to be the next big thing for clojurescript frontends as far as one can read on the ML ;) |
| 09:16 | cYmen_ | hm...don't really read the mailing list |
| 09:16 | cYmen_ | getting into clojure with a day job and a life is too fucking hard >_< |
| 09:19 | Morgawr | cYmen_: https://github.com/levand/quiescent I found this to be a much simpler and (imo) better implementation of React on top of clojurescript. Om is much more powerful but also much more complicated |
| 09:19 | Morgawr | although I'm no webdev and I only dabbled with it a bit |
| 09:19 | Morgawr | having no knowledge whatsoever about react, I found quiescent to be easier to understand than Om |
| 09:19 | mpenet | it's not the first time I hear this about om... didn't try it myself tho |
| 09:20 | mpenet | there's "reagent" also I think |
| 09:20 | Morgawr | yeah |
| 09:22 | cYmen_ | maybe I should try this quiescent |
| 09:22 | cYmen_ | at least I'll get a different view on things :p |
| 09:22 | cYmen_ | but then again constantly trying something new is a great way to never get anywhere |
| 09:24 | clgv | cYmen_: depends whether you are studying or actually trying to build something for work ;) |
| 09:26 | cYmen_ | clgv: if I start asking philosophical questions like that I'll never do anything again ;) |
| 09:32 | clgv | cYmen_: the comparison on the quiescent page could help you^^ |
| 09:33 | cYmen_ | yeah I'm pretty happy with that |
| 09:33 | cYmen_ | and the general backinfo on react, too |
| 09:35 | ToxicFrog | Hmm |
| 09:35 | clgv | is "virtual dom" a similar concept like having an invisible buffer image in a gui to draw faster without gui updates? |
| 09:35 | ToxicFrog | The documentation is ambiguous, but looking at the source, it looks like core.async filter< just flat out drops any messages that don't match p, rather than leaving them on the original channel |
| 09:36 | ToxicFrog | Is there an equivalent that doesn't drop messages? Ideally I want to have a channel with a bunch of different tasks all filter<ing on it with different ps. |
| 09:39 | ToxicFrog | Ok, it looks like I want either pubsub or tap |
| 09:51 | ToxicFrog | Man |
| 09:51 | ToxicFrog | The fact that you can only use <! and >! if you are lexically within a go block is annoying as hell |
| 10:20 | ashtonkemerling | Morning folks. |
| 10:20 | ashtonkemerling | Never realized how big this chanel was. |
| 10:41 | fro | hello everyone! How do you stub external services? Maybe there is a library, that allows to save function responses somewhere on the disk (fixtures) automatically for using that for tests? |
| 10:42 | ashtonkemerling | I always found that Midje had very nice semantics for stubbing out functions. |
| 10:43 | ashtonkemerling | But alas there was no way that I found to provide a reusable map of stubs. |
| 10:45 | TEttinger | serializable-fn ? |
| 10:46 | fro | yes, I just want something, that will save function results automatically for test (better on hard disk). I can do it by hand, but I think this functionality is so obvious and maybe somebody have a solution |
| 10:48 | ashtonkemerling | If you have the spare bandwidth maybe write it for the community at large? |
| 10:48 | ashtonkemerling | It appears to be something that we're missing at the moment. |
| 10:54 | fro | I just wonder maybe somebody have something in "the cache" |
| 10:56 | Morgawr | does it make sense that some clojure code runs faster without type notations/hints? |
| 10:56 | ashtonkemerling | Off the top of my head? No. |
| 10:56 | ashtonkemerling | Unless if the old type hints were wrong. |
| 10:56 | Morgawr | mm.. wait nevermind, I just had a spike, in average it runs the same |
| 10:56 | Morgawr | false alarm |
| 10:57 | ashtonkemerling | Make sure your JVM is warmed. |
| 10:57 | ashtonkemerling | That usually ruins benchmarks. |
| 10:57 | clgv | criterium^^ |
| 10:57 | Morgawr | thanks |
| 10:57 | Morgawr | I'll keep that in mind |
| 10:58 | clgv | Morgawr: warmup and statistical analysis are the winning points here ;) |
| 10:58 | Morgawr | yup |
| 10:59 | Morgawr | is there a way to define type hints for collection of classes? like I have a vector of bodies (Body is a defrecord) |
| 10:59 | ashtonkemerling | And that's why benchmarks are notoriously hard. |
| 10:59 | clgv | Morgawr: no. it would not have any impact on performance anyway |
| 10:59 | TEttinger | unless it's an array |
| 11:00 | clgv | Morgawr: what do you do with it? accumulating some values? |
| 11:00 | Morgawr | clgv: calling map or reduce (depends on the cases) on it |
| 11:00 | clgv | TEttinger: well but then you need areduce amap and co to have a result from a type hint ;) |
| 11:00 | TEttinger | right |
| 11:00 | clgv | Morgawr: reduce is efficient on vectors so you are safe there |
| 11:00 | Morgawr | so, next question is... is there any advantage in type hinting part of a function's signature but not all of it? |
| 11:01 | whodidthis | hit me up with a cool way to add 1 to first 3 elements in vector [5 4 6 3 4] |
| 11:01 | TEttinger | ,(apply + (take 3 [5 4 6 3 4])) |
| 11:01 | clgv | Morgawr: type hints only matter for interop with java. so just use (set! *warn-on-reflection true) and see where you get warnings and then apply type hints to get rid of those warning |
| 11:01 | clojurebot | 15 |
| 11:02 | Morgawr | clgv: I thought type hints helped with performance too? |
| 11:02 | whodidthis | sorry, +1 to first 3 elements so [5 4 6 3 4] becomes [6 5 7 3 4] |
| 11:02 | clgv | Morgawr: no not in general only when you call member functions of java classes. type hints remove the need for runtime reflection |
| 11:03 | Morgawr | clgv: ah.. I see... |
| 11:03 | ashtonkemerling | Because Java is expecting a concrete type. |
| 11:03 | Morgawr | this means it doesn't help with defrecord either, right? |
| 11:03 | ashtonkemerling | So it's gotta figure it out. |
| 11:03 | clgv | Morgawr: special case are arrays where you need typehints as well |
| 11:03 | ashtonkemerling | Whereas Clojure prefers protocols & friends. |
| 11:04 | Bronsa | ,(mapv + [5 4 6 3 4] (concat (repeat 3 1) (repeat 0))) |
| 11:04 | clojurebot | [6 5 7 3 4] |
| 11:04 | Bronsa | whodidthis: ^ |
| 11:04 | clgv | ashtonkemerling: well it is actually the clojure compiler, when no type hints are given and the method signature with only object params does not resolve to anything usable it just generates code to call the give java method via reflection |
| 11:05 | TEttinger | ,(map-indexed #(if (> 3 %1) (inc %2) %2) [5 4 6 3 4])) |
| 11:05 | clojurebot | (6 5 7 3 4) |
| 11:05 | ashtonkemerling | Right. |
| 11:05 | Bronsa | TEttinger ew |
| 11:05 | ashtonkemerling | I've always hated map-indexed |
| 11:05 | Morgawr | I've found it useful a few times :P |
| 11:05 | ashtonkemerling | 90% of the time I use it I've made a huge mistake. |
| 11:06 | ashtonkemerling | Usually trying to redo a nasty JS algorithm without thinking it through enough. |
| 11:06 | whodidthis | Bronsa: cool |
| 11:06 | ashtonkemerling | .... not that I've done that lately. |
| 11:07 | TEttinger | ,(map apply (concat (repeat 3 inc) (repeat identity)) [5 4 6 3 4])) |
| 11:07 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long> |
| 11:07 | ashtonkemerling | ,(repeat 3 inc) |
| 11:07 | clojurebot | (#<core$inc clojure.core$inc@6314d9> #<core$inc clojure.core$inc@6314d9> #<core$inc clojure.core$inc@6314d9>) |
| 11:08 | ashtonkemerling | That seems an odd way to do that. |
| 11:08 | TEttinger | haha |
| 11:08 | Bronsa | TEttinger you don't want apply there |
| 11:08 | TEttinger | he was looking for a cool way! |
| 11:08 | ashtonkemerling | ,(map (concat (repeat 3 inc) (repeat identity)) [5 4 6 3 |
| 11:08 | ashtonkemerling | 4])) |
| 11:08 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 11:08 | ashtonkemerling | ,(map (concat (repeat 3 inc) (repeat identity)) [5 4 6 3 |
| 11:08 | ashtonkemerling | 4]) |
| 11:08 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 11:08 | ashtonkemerling | Derp |
| 11:08 | ashtonkemerling | ,(map (concat (repeat 3 inc) (repeat identity)) [5 4 6 3 4]) |
| 11:08 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn> |
| 11:09 | whodidthis | repeat is also quite cool for exploding lighttable |
| 11:09 | ashtonkemerling | Yeah, figured. |
| 11:09 | ashtonkemerling | Still not sold on that editor. |
| 11:09 | ashtonkemerling | But I'm thinking of using it to sell my coworkers on Om. |
| 11:09 | whodidthis | i heard chris grang working on new editor now |
| 11:10 | ashtonkemerling | Hope not |
| 11:10 | ashtonkemerling | That's how you end up with a mess of half-finished things. |
| 11:12 | whodidthis | https://www.youtube.com/watch?v=L6iUm_Cqx2s |
| 11:12 | ashtonkemerling | I don't feel that LightTable is done. |
| 11:13 | ashtonkemerling | If only sound worked on this machine.... |
| 11:13 | ashtonkemerling | Right folks, time for me to go do things. Catch you all later. |
| 11:13 | whodidthis | im also quite saddened but maybe he has a plan |
| 11:13 | Glenjamin | does he say LT is done? |
| 11:16 | Morgawr | as far as I know there are other people working with Chris on LT/Aurora (not too sure), and I think he's going to have Aurora run inside LT or something |
| 11:16 | Morgawr | at least the design is similar |
| 11:16 | Morgawr | maybe he's going to have a suite of editors for Clojure (and other languages) that run in a shared "engine" or something |
| 11:20 | Glenjamin | the impression i got was more that aurora was a research project |
| 11:20 | Glenjamin | and lighttable was a product |
| 11:25 | rolfb | ,(apply map list '((1 2) (3 4) (5 6))) |
| 11:25 | clojurebot | ((1 3 5) (2 4 6)) |
| 11:25 | rolfb | hi, could someone explain to me what's happening with the combination of apply map list? |
| 11:27 | Bronsa | ,(map list '(1 2) '(3 4) '(5 6)) |
| 11:27 | clojurebot | ((1 3 5) (2 4 6)) |
| 11:28 | rolfb | map iterates over each column? |
| 11:28 | bbloom | (doc map) |
| 11:28 | clojurebot | "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments." |
| 11:28 | cYmen_ | map simply iterates over all collections always taking one element from each and applying the function |
| 11:28 | rolfb | aha |
| 11:29 | bbloom | ,(map + [5 10] [1 2]) |
| 11:29 | clojurebot | (6 12) |
| 11:29 | cYmen_ | but map wants its parameters like this (map function list1 list2 list3) |
| 11:29 | rolfb | that's the part which was missing for me then |
| 11:29 | cYmen_ | you need apply because your list1...list3 are in a list themselves |
| 11:29 | cYmen_ | so basically if you have (param1 param2 param3) |
| 11:29 | cYmen_ | and a function foo which takes 3 parameters you can call it with apply |
| 11:30 | cYmen_ | (apply foo (...params...)) |
| 11:30 | cYmen_ | well.. (apply foo params) |
| 11:30 | cYmen_ | ,(let [params (1 2 3 4 5)] |
| 11:30 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 11:30 | rolfb | thanks cYmen_; i think i've got it now. the confusing part was map iterating over columns instead, but it makes sense now |
| 11:30 | cYmen_ | ,(let [params (1 2 3 4 5)] (apply + params)) |
| 11:30 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn> |
| 11:30 | cYmen_ | ,(let [params '(1 2 3 4 5)] (apply + params)) |
| 11:30 | clojurebot | 15 |
| 11:31 | cYmen_ | ,(let [params '(1 2 3 4 5)] (+ params)) |
| 11:31 | clojurebot | #<ClassCastException java.lang.ClassCastException: Cannot cast clojure.lang.PersistentList to java.lang.Number> |
| 11:31 | rolfb | could have used reduce instead of apply here? |
| 11:32 | cYmen_ | sure |
| 11:32 | rolfb | ,(let [params '(1 2 3 4 5)] (reduce + params)) |
| 11:32 | clojurebot | 15 |
| 11:32 | rolfb | maps and lists is new to me |
| 11:32 | rolfb | but it's very cool |
| 11:33 | cYmen_ | most languages have that these days |
| 11:33 | cYmen_ | often it is more like "for each" |
| 11:33 | rolfb | cYmen_: i'm used to map iterating over the top elements |
| 11:33 | rolfb | not taking the first of each collection |
| 11:34 | cYmen_ | "top" elements? |
| 11:34 | rolfb | yeah, if you have a nested structure, it doesn't map the first column in each collection to the method you are mapping over |
| 11:35 | rolfb | it maps the entire structure as one argument |
| 11:35 | cYmen_ | oh yeah, map does that as well in clojure |
| 11:35 | Glenjamin | rolfb: (map f coll) does that, but (map f coll1 coll2) is similar to (map f (zip coll1 coll2)) in other languages |
| 11:35 | cYmen_ | but since you're using apply you have several structures |
| 11:36 | rolfb | yup, the difference Glenjamin points out it why I was confused |
| 11:37 | rolfb | thanks everyone |
| 11:56 | cYmen_ | Why is this rotten cljs browser repl not working. |
| 11:56 | bhauman | cYmen_: if its not working its probably because you are using it correctly |
| 11:57 | cYmen_ | YES! |
| 11:57 | cYmen_ | Excatly what I thought. |
| 11:57 | cYmen_ | But using it incorrectly didn't help. |
| 11:57 | bhauman | lol |
| 11:58 | bbloom | cYmen_: yell at cemerick... or yell at dnolen to yell at cemerick :-) |
| 12:00 | bhauman | cYmen_: you could try this lein plugin I just wrote and see if it meets you needs |
| 12:00 | cYmen_ | bbloom: I'd rather have some debugging advice. :) |
| 12:00 | cYmen_ | bhauman: What does it do? |
| 12:01 | bhauman | it’s a live coding plugin it depends on how you wrote your code base |
| 12:01 | bhauman | http://rigsomelight.com/drafts/interactive-programming-flappy-bird-clojurescript.html |
| 12:01 | bhauman | its replaced my REPL workflow |
| 12:02 | Glenjamin | i read that article this morning, seems like a great concept |
| 12:02 | jonasen | bhauman: It worked great for me! I'm definitely going to use it more. |
| 12:02 | Glenjamin | (inc bhauman) |
| 12:02 | lazybot | ⇒ 2 |
| 12:03 | jonasen | (inc bhauman) |
| 12:03 | lazybot | ⇒ 3 |
| 12:03 | cYmen_ | I don't have a code base yet. |
| 12:03 | bhauman | sweet I’m up to 3 :) |
| 12:03 | bhauman | cYmen_: then I would try it |
| 12:03 | Glenjamin | the app i'm working on at the mo has records in its main atom, so a code reload screws up the state |
| 12:04 | Glenjamin | i don't suppose you have any tips for that, beyond "don't use records" |
| 12:04 | cYmen_ | bhauman: Going to try it later. Looks great! |
| 12:04 | bhauman | Glenjamin: so the records turn into striaght up maps? |
| 12:05 | Glenjamin | i treat them as maps, but i have a few hundred thousand and i was using records for efficiency |
| 12:05 | bhauman | jonasen: Glenjamin: thanks for the props guys |
| 12:05 | Glenjamin | this is server-side |
| 12:06 | Glenjamin | but when i try and reload my code but keep on using the same state atom, i had issues because the record classes weren't the same anymore |
| 12:06 | cYmen_ | bhauman: How are you using react with this? Should be save to use with om, right? |
| 12:06 | bhauman | Glenjamin: ahh … but I don’t see how that messes up the client side |
| 12:06 | bhauman | Glenjamin: records had different fields |
| 12:06 | bhauman | ? |
| 12:07 | Glenjamin | no, same record, but tools.namespaces had wiped out the old one |
| 12:07 | bhauman | cYmen_: yep the same or better with om |
| 12:07 | cYmen_ | Crap, have to go. |
| 12:07 | cYmen_ | Will try it as soon as I get back. Stick around so I can bother you! |
| 12:07 | Glenjamin | i'll have to give it another go when i get a chance - having to rebuild the state after a reload was getting annoying |
| 12:08 | bhauman | Glenjamin: Don’t hesitate to reach out. I’d like to understand any workflow problems that happening |
| 12:09 | jonasen | is om meant to be used with react-0.10.0 or react-0.9.0? |
| 12:10 | jonasen | bhauman: the figwheel template includes react-0.9.0 |
| 12:10 | bhauman | jonasen: yep, that is just for convenience, I’m pretty sure om is on 0.9.0 right now |
| 12:11 | bhauman | https://github.com/swannodette/om/blob/master/examples/animation/index.html#L4 |
| 12:59 | hugod | eul135@$^ |
| 14:04 | rolfb | (doc subseq) |
| 14:04 | clojurebot | "([sc test key] [sc start-test start-key end-test end-key]); sc must be a sorted collection, test(s) one of <, <=, > or >=. Returns a seq of those entries with keys ek for which (test (.. sc comparator (compare ek key)) 0) is true" |
| 14:04 | rolfb | what does "ek" mean here? |
| 14:24 | michaelr525 | hi |
| 14:25 | fifosine | Does anyone know of clojure programs that utilize self-modification? |
| 14:32 | michaelr525 | here is a question: I have a function which reifies a Java type and returns the object, later a method on that object is called somewhere from the Java code. It seems that Clojure's runtime is having a hard time to dynamically load the required namespaces and so I'm getting errors like: Attempting to call unbound fn. I included a call to require the needed namespace to the method of the reified object and it seems that it helped. The |
| 14:32 | michaelr525 | question is how to do it in a more elegant and correct way? |
| 14:47 | michaelr525 | why are you so quiet, #clojure channel? |
| 14:51 | cshell | What’s the common pattern for deploying a ring app to production? Is it just ‘lein ring…’ from a git repo or do people prefer uberjars? |
| 15:03 | michaelr525 | here is a question: I have a function which reifies a Java type and returns the object, later a method on that object is called somewhere from the Java code. It seems that Clojure's runtime is having a hard time to dynamically load the required namespaces and so I'm getting errors like: Attempting to call unbound fn. I included a call to require the needed namespace to the method of the reified object and it seems that it helped. The |
| 15:03 | michaelr525 | question is how to do it in a more elegant and correct way? |
| 15:07 | amalloy | michaelr525: that's about all you can do. require the namespace once, before attempting to use the stuff in it |
| 15:10 | michaelr525 | amalloy: is it a known problem? |
| 15:10 | michaelr525 | it looks like the object's method is called from a different classloader or something like that |
| 15:14 | amalloy | is it a known problem that you can't run clojure code that hasn't been compiled yet? yes |
| 15:16 | michaelr525 | hmm |
| 15:16 | michaelr525 | The whole thing is AOTd, is it the same? |
| 15:16 | michaelr525 | isn't |
| 15:17 | michaelr525 | amalloy: ^ |
| 15:19 | amalloy | probably not |
| 15:20 | michaelr525 | amalloy: the thing is Clojure usually resolves namespaces and loads them on demand automatically, I just wonder why it fails here? |
| 15:21 | amalloy | huh? no it doesn't. it loads namespaces when, and only when, someone requires them |
| 15:22 | michaelr525 | amalloy: of course I require them in the (ns) clause of the namespace which contains my reifying function.. |
| 15:22 | michaelr525 | but AFAIR, the actuall loading at runtime happens on demand |
| 15:23 | amalloy | michaelr525: it's quite possible i don't understand the scenario you've described |
| 15:23 | amalloy | perhaps you could put together a minimal paste that demonstrates the problem |
| 15:23 | michaelr525 | amalloy: ok, don't go anywhere :) it'll be ready in a minute |
| 15:28 | michaelr525 | https://gist.github.com/michaelr524/eb09034134b6fab964f0 |
| 15:28 | michaelr525 | amalloy: ^ |
| 15:29 | michaelr525 | the object returned by create-scheme goes to Java land which later calls (deserialize) which results in an unbound fn exception |
| 15:31 | michaelr525 | if I put there (require '[avroclj.avro :as avro]) just before calling (avroclj.avro/deserialize), it resolves the error |
| 15:32 | michaelr525 | like this: https://gist.github.com/michaelr524/14cc830a36e7c7d296c9 |
| 15:32 | ptcek | Anyone doing MILP or LP in clojure/lisp (in particular creating the model and converting to .mps/.lp files)?? |
| 15:32 | lazybot | ptcek: Definitely not. |
| 15:33 | amalloy | michaelr525: sounds like a different classloader to me, or even a different jvm? storm probably does some weird stuff with your objects |
| 15:34 | michaelr525 | amalloy: different jvm? |
| 15:34 | michaelr525 | hmm |
| 15:35 | michaelr525 | amalloy: i thought I could probably insert an (init) function in there which will require everything I need for this to work.. |
| 15:35 | michaelr525 | but it sounds dirty |
| 16:07 | cYmen_ | phew |
| 16:14 | cYmen_ | Is there a guide/howto on how to properly set up a brepl? |
| 16:16 | cespare | (let [n Double/POSITIVE_INFINITY] (case n Double/POSITIVE_INFINITY "yes" "no")) ; "no" ?? |
| 16:16 | lazybot | cespare: Uh, no. Why would you even ask? |
| 16:18 | cespare | (let [n Double/POSITIVE_INFINITY] (= n Double/POSITIVE_INFINITY)) ; true |
| 16:18 | cespare | this doesn't make sense to me. |
| 16:18 | amalloy | cespare: case clauses aren't evaluated (ie, they're quoted). 'Double/POSITIVE_INFINITY is a symbol, not a number |
| 16:19 | cespare | ok thanks |
| 16:19 | cespare | case bites me again :) |
| 16:19 | bbloom | cespare: use `condp =` |
| 16:19 | bbloom | ,(let [n Double/POSITIVE_INFINITY] (condp = n Double/POSITIVE_INFINITY "yes" "no")) |
| 16:19 | clojurebot | "yes" |
| 16:20 | cYmen_ | Is there some way to check if the js part of the brepl connect is being executed? |
| 16:30 | kenrestivo | the chrome network debug tab? |
| 16:35 | cYmen_ | hm..crap looks like it's not even getting called |
| 16:35 | cYmen_ | I must be missing something. :/ |
| 16:37 | kenrestivo | i use weasel instead and life is joy |
| 16:38 | cYmen_ | weasel? |
| 16:39 | kenrestivo | ~weasel is https://github.com/tomjakubowski/weasel/ |
| 16:39 | clojurebot | In Ordnung |
| 16:39 | kenrestivo | weasel? |
| 16:39 | kenrestivo | ~weasel |
| 16:39 | clojurebot | weasel is https://github.com/tomjakubowski/weasel/ |
| 16:39 | clojurebot | weasel is https://github.com/tomjakubowski/weasel/ |
| 16:39 | kenrestivo | oh clojurebot, you so laggy |
| 16:41 | amalloy | kenrestivo: the lag is on your end. clojurebot answered you instantly |
| 16:41 | kenrestivo | big win for me with weasel was being able to refresh the page and not lose my nrepl connection |
| 16:42 | cYmen_ | yuck |
| 16:42 | cYmen_ | spotify application |
| 16:42 | cYmen_ | just...yuck |
| 16:43 | kenrestivo | i have no idea what spotify is, and have never used it |
| 16:44 | hiredman | clojurebot: clojurebot |exploits| differences in network latency to appear to violate causality |
| 16:44 | clojurebot | You don't have to tell me twice. |
| 16:44 | hiredman | ~clojurebot |
| 16:44 | clojurebot | clojurebot is perhaps the definition of a legacy software system |
| 16:44 | hiredman | that too |
| 16:44 | kenrestivo | i thought clojurebot has a poetic soul? |
| 16:45 | kenrestivo | as for lag, i've got znc and ppp and mobile involved, so yeah, it's prolly me |
| 16:46 | kenrestivo | clojurebot rules and knows all |
| 17:05 | ToxicFrog | What is the equivalent in clojure of 'import java.io.ServerSocket'? |
| 17:06 | ToxicFrog | I figured (require '[java.io :refer ServerSocket]) would do it, but that gets me a confusing and unhelpful "no namespace: spellcast.net" error message (which is the name of the file's ns) |
| 17:06 | ToxicFrog | :refer [ServerSocket], rather |
| 17:07 | bbloom | ToxicFrog: see (doc ns) and (doc import) |
| 17:07 | bbloom | require is for clojure namespaces, use import for java types |
| 17:07 | ToxicFrog | Aah |
| 17:07 | ToxicFrog | That worked! |
| 17:07 | ToxicFrog | Unfortunately, now that I'm past that, I have a syntax error. |
| 17:07 | ToxicFrog | Where? NO-ONE KNOWS. |
| 17:08 | ToxicFrog | Fucking hell, at least tell me what line you were parsing before you crash! |
| 17:15 | amalloy | ToxicFrog: fucking hell, at least paste a proper stacktrace before you complain about uninformative stacktraces! |
| 17:17 | ToxicFrog | amalloy: here you go: https://gist.github.com/anonymous/7761258d238c96edc7af |
| 17:18 | ToxicFrog | If you can figure out from that even what file the error was in, let alone exactly where, I will be amazed. |
| 17:18 | amalloy | hm, that is pretty bad. i would have expected to see a Caused By in there somewhere |
| 17:18 | ToxicFrog | Nope. That's the whole thing. |
| 17:19 | ToxicFrog | There's not even a "... n more" truncation. |
| 17:19 | ToxicFrog | (I did in fact find and correct the error by manual inspection of the entire codebase, which thankfully this program is still small enough for) |
| 17:19 | bbloom | ToxicFrog: you've got a defn somewhere without a arg list in it |
| 17:20 | amalloy | yeah, that's obvious enough, bbloom, but i was surprised to see this doesn't say where |
| 17:20 | ToxicFrog | bbloom: well, yes, the question is where? |
| 17:21 | bbloom | ToxicFrog: it's probably wherever you last changed something ;-) |
| 17:21 | bbloom | that's the sort of error that git diff can find for you instantly, heh |
| 17:21 | bbloom | (not making excuses for bad errors, just saying) |
| 17:21 | ToxicFrog | Actually, it wasn't anywhere near where I'd just changed something; I'd started writing something, then decided it was better off elsewhere and ended up writing a complete addition file without deleting the original (defn ...) I'd started writing. |
| 17:21 | ToxicFrog | You're right that git diff would probably have found this pretty quick. |
| 17:31 | dbasch | this is a pretty crappy error message: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L6826 |
| 17:32 | dbasch | or at the very least the exception should be thrown higher up, where there’s more information |
| 17:37 | visof | hello |
| 17:38 | Frozenlock | dbasch: How so? |
| 17:38 | Frozenlock | Usually when I see this msg it's because I forgot to include the params vector |
| 17:39 | dbasch | Frozenlock: yes, but you don’t know where it happened |
| 17:39 | visof | Caused by: java.io.FileNotFoundException: clojure/foobar/native/.gitignore (No such file or directory) how can i dolve this error? |
| 17:39 | Frozenlock | dbasch: Ah ok, I see what you mean |
| 17:39 | dbasch | see ToxicFrog’s paste earlier |
| 17:40 | Frozenlock | visof: the file is not found... Does it exist? |
| 17:41 | visof | Frozenlock: i create native/.gitignore; when run lein run; i got native disappeared |
| 17:43 | dbasch | visof: what does your program do? |
| 17:46 | visof | dbasch: http://sprunge.us/jCia |
| 17:47 | cYmen_ | What is the relation between the app-state in the atom and the state that is passed to render-state when using om? |
| 17:48 | cYmen_ | Consider this https://github.com/swannodette/om/wiki/Basic-Tutorial#dealing-with-text-input-fields |
| 17:48 | cYmen_ | It seems the list of contacts is in: (def app-state |
| 17:48 | cYmen_ | (atom |
| 17:48 | cYmen_ | {:contacts |
| 17:48 | cYmen_ | but the contents of an input field are in (def app-state |
| 17:48 | cYmen_ | (atom |
| 17:48 | cYmen_ | oh ffs |
| 17:49 | cYmen_ | sorry about the paste mess |
| 17:49 | visof_ | dbasch: http://sprunge.us/jCia |
| 17:49 | visof_ | dbasch: still there? |
| 17:49 | dbasch | visof_: yes, I don’t understand how that even compiles |
| 17:50 | visof_ | dbasch: why? |
| 17:50 | visof_ | " is deleted in html |
| 17:50 | dbasch | for one, you have strings without quotes |
| 17:50 | visof_ | yeah |
| 17:50 | visof_ | that's because the browser but i have them in my file |
| 17:51 | dbasch | why don’t you paste it to refheap? |
| 17:51 | visof_ | dbasch: http://pastie.org/9137563 |
| 17:53 | dbasch | visof_: and your project.clj? |
| 17:54 | visof_ | dbasch: http://pastie.org/9137567 |
| 17:54 | cYmen_ | Is refheap private now? |
| 17:55 | amalloy | haha has Raynes still not fixed the paste button? |
| 17:55 | visof_ | dbasch: http://pastie.org/9137574 error |
| 17:55 | visof_ | dbasch: what do you think how can i fix this error? |
| 17:55 | cYmen_ | amalloy: I guess not |
| 17:56 | Raynes | No, since nobody bothered telling me about it. |
| 17:56 | visof_ | Raynes: i'm bothered |
| 17:56 | Raynes | You're all terrible people. |
| 17:58 | cYmen_ | What, I just noticed it an brought it to your attention! |
| 17:59 | visof_ | dbasch: still here? |
| 18:00 | dbasch | visof_: yes, your code can’t possibly work as is |
| 18:00 | dbasch | for one, your clojure dependency is wrong |
| 18:00 | dbasch | and also your requires are incompatible with your code |
| 18:00 | visof_ | dbasch: so what do you suggest to fix it? |
| 18:00 | Raynes | I'll have this fixed in two shakes of a how the hell did this happen. |
| 18:01 | dbasch | visof_: where is jiraph.masai-layer? |
| 18:03 | visof_ | dbasch: you mean at project.clj? |
| 18:03 | Raynes | whoa |
| 18:03 | Raynes | Someone is using Jiraph? |
| 18:03 | Raynes | Wild. |
| 18:03 | dbasch | visof_: no, in your requires |
| 18:04 | Raynes | Deja vu. |
| 18:04 | Bronsa | Raynes: how long have you been waiting to make that joke? |
| 18:04 | Raynes | Bronsa: Which? |
| 18:05 | Bronsa | Raynes: "wild", of someone using "jiraph" |
| 18:05 | visof_ | dbasch: [flatland.jiraph.layer.masai] |
| 18:07 | whodidthis | this is going to take a while |
| 18:08 | dbasch | visof_: your project file and your source just don’t make any sense |
| 18:11 | visof | dbasch: sorry i got DC |
| 18:11 | visof | dbasch: still around? |
| 18:12 | dbasch | visof: your source code and project file just don’t make sense |
| 18:12 | visof | dbasch: so what do you think to fix it? |
| 18:13 | dbasch | visof: it looks like you’re trying to follow a tutorial, but you probably should step back and explain what you’re trying to do |
| 18:13 | visof | dbasch: i just want to start to use jiraph |
| 18:14 | visof | create a graph then add some nodes to it |
| 18:14 | visof | as in tutorial |
| 18:17 | Raynes | Haha, I know how I broke refheap. |
| 18:18 | amalloy | you removed the submit button, bro |
| 18:18 | Raynes | I was editing the templates and realized I was in the wrong file, so I deleted a line I thought I had accidentally just typed. |
| 18:18 | amalloy | we all know |
| 18:18 | Raynes | That line was the submit button. |
| 18:18 | amalloy | Raynes: fwiw, that's a great advertisement for using `git add -p` to review changes before committing them |
| 18:18 | Raynes | Or magit. |
| 18:19 | amalloy | presumably that would work too. except you use magit and made this mistake |
| 18:20 | Raynes | amalloy: Um |
| 18:20 | Raynes | amalloy: You have to choose to use that feature. |
| 18:20 | Raynes | I did not. |
| 18:20 | Raynes | It's no different from having to choose to use `git add -p` |
| 18:21 | amalloy | whatever. i'm not saying magit is bad, i'm saying review features are good and you should use them |
| 18:21 | amalloy | since you brought up magit, i thought you were suggesting you had already used such a feature |
| 18:22 | Raynes | I do use that feature. |
| 18:22 | Raynes | Just not this one particular time. |
| 18:27 | Raynes | amalloy: magit master race |
| 18:44 | Raynes | refheap is fixed |
| 18:45 | AWizzArd | Websockets? What lib to use? |
| 18:56 | the-kenny | http-kit? |
| 19:01 | AWizzArd | the-kenny: yes, I ran into that. But then… the github repo was updated the last time 2 months ago. |
| 19:02 | AWizzArd | And has 38 open issues. |
| 19:05 | the-kenny | Hm, I'm not aware of any "newer" library. No recent updates might be a sign of mature software. Some of the issues are websocket-related though |
| 19:10 | AWizzArd | the-kenny: nginx is many more years in development but had recent commits, although it should be extremly mature by now. |
| 19:11 | Caffeine | What would be a fast, scalable database for storing Clojure structures (maps, vecs, etc.)? |
| 19:12 | AeroNotix | Caffeine: depends on your query requirements and needed consistency guarantees |
| 19:13 | AeroNotix | Caffeine: do you have anything more specific to go on? |
| 19:13 | Caffeine | AeroNotix: I'll put more constraints in the application.. less in the DB... it's really more for storage than anything else... Property pattern oriented data... maps extending other maps, mainly. |
| 19:14 | AeroNotix | Caffeine: you're not understanding me |
| 19:14 | AeroNotix | Different databases have different guarantees about what they can do in a CAP theory sense. |
| 19:14 | cmarques | Hello, how can I reload new routes when using Ring + Compojure without having to restart the server? Thanks! |
| 19:14 | AeroNotix | Caffeine: and they also provide different ways of storing and retrieving data |
| 19:15 | visof | how can i run https://github.com/ninjudd/jiraph basic example? |
| 19:15 | DomKM | Is it possible to lazily serialize and deserialize lazy seqs using nippy/freeze-to-out! and nippy/thaw-from-in! |
| 19:15 | visof | i didn't get done with errors |
| 19:15 | AeroNotix | cmarques: :ring {:auto-reload true} in your project.clj |
| 19:15 | Caffeine | AeroNotix: I was considering SQL for a long time, but I need something closer to clojure/lisp... more dynamic |
| 19:15 | AeroNotix | Caffeine: It just sounds like you have no clue what you need. |
| 19:16 | AeroNotix | Caffeine: *WHY* do you need a more dynamic database? |
| 19:16 | visof | what i did http://pastie.org/9137563 |
| 19:16 | AeroNotix | Caffeine: what particular aspect of your application demands a "dynamic" database, whatever that means. |
| 19:16 | visof | http://pastie.org/9137574 |
| 19:16 | visof | http://pastie.org/9137567 |
| 19:16 | Caffeine | AeroNotix: Because the columns and tables have to be modified by the end users... that's what I mean |
| 19:17 | visof | please anybody help? |
| 19:17 | AeroNotix | Caffeine: but even a regular SQL table you could do that with |
| 19:18 | Caffeine | AeroNotix: Anyway, I thought there was something more clojurish... if there's nothing, I'll just pick one which has a decent clojure wrapper I guess |
| 19:18 | AeroNotix | Caffeine: There's nothing for the zero specifications you have given, no. |
| 19:18 | AeroNotix | "More Clojurish" means... nothing? |
| 19:19 | AeroNotix | What does that even mean |
| 19:19 | Caffeine | AeroNotix: Hhaha ok ok thanks |
| 19:19 | AeroNotix | Caffeine: is your application a toy? |
| 19:19 | AeroNotix | If so; just use anything |
| 19:20 | AeroNotix | but if you are making something you hope to sell, or are desining a system for your job. It would behove you to put more thought into this. |
| 19:22 | AWizzArd | I have to agree with AeroNotix here. |
| 19:23 | cmarques | AeroNotix: thanks, will try |
| 19:23 | AeroNotix | There's tonnes of little details with databases. Data model, consistency guarantees, availability guarantees, replication, query models. |
| 19:24 | AeroNotix | etc etc |
| 19:24 | Caffeine | AeroNotix: Yeah, I'll do that... It's just crazy the number of databases there are around... I've already (last year) spend a week or so looking into the most popular various SQL and NoSQL databases.. you really have to know everything up front to be able to make a clear choice. |
| 19:24 | AeroNotix | Caffeine: exactly. |
| 19:24 | AeroNotix | Caffeine: particularly pay attention to something called CAP theory. |
| 19:24 | AeroNotix | And base your decisions on that |
| 19:25 | AeroNotix | after that it's quite simple to narrow your choices down |
| 19:26 | Caffeine | Looked into that in the past too.. yeah I'll write down what I know and find a way to fill the gaps to make a better decision. |
| 19:27 | AeroNotix | Caffeine: look up anything by kyle kingsbury |
| 19:27 | AeroNotix | And his work on Jepsen |
| 19:28 | Caffeine | Ah okay, I'll look at that too. |
| 19:28 | Caffeine | Thanks.. homework time it seems |
| 19:30 | mackin | i have a performance question regarding the jetty server, say a request comes in that requires computation that takes a while. if another request comes in, does it block on the first request completing? |
| 19:31 | AWizzArd | Does not block, as Jetty handles each request in a new thread. |
| 19:31 | AWizzArd | Jetty even supports something such as continuations. That means: you can start a new thread doing the computation and move the web-thread back into the pool, so it can work off other requests. |
| 19:32 | AWizzArd | And when your computation has finished you can "wake up" that old thread again, as if it never has stopped. |
| 19:32 | mackin | are there a limited number of webthreads? or can you specify the number |
| 19:32 | AWizzArd | Limited number yes. Check docs for more specific info or try #Jetty |
| 19:33 | mackin | ty AWizzArd |
| 19:36 | ToxicFrog | Is there an equivalent to (pr) that emits a string rather than writing to a stream? |
| 19:37 | AWizzArd | ToxicFrog: perhaps try (pr-str …) |
| 19:42 | ToxicFrog | AWizzArd: sweet, thanks |
| 19:50 | Foam- | Hello everyone. :) Anyone here familiar with embedding ClojureCLR from another .net language? I am struggling with the implementation, specifically how to pass in a string, have it get evaluated, and get the return result |
| 19:51 | Foam- | Is there a ClojureCLR channel? Maybe this isn't the right spot |
| 19:53 | bbloom | Foam-: are you calling eval and getting a string back? or are you just unable to call eval at all? |
| 19:53 | waynr | howdy folks |
| 19:53 | waynr | is it possible to develop a lein plugin and use it in a local project without deploying it? |
| 19:53 | AeroNotix | waynr: sure |
| 19:53 | bbloom | waynr: just `lein install` it in to your local maven repo |
| 19:54 | AeroNotix | lein install the plugin locally in the plugin directory and then use it |
| 19:54 | AeroNotix | yeah^ |
| 19:54 | waynr | where is my local maven repo? |
| 19:54 | AeroNotix | waynr: don't think about that |
| 19:54 | waynr | is this kind of workflow documented or described somewhere? |
| 19:54 | AeroNotix | lein install will do it properly |
| 19:54 | AeroNotix | just use `lein install` in the plugin project root |
| 19:55 | waynr | and then it will be available in another project root? |
| 19:55 | AeroNotix | waynr: yeah |
| 19:55 | AeroNotix | but do you really need a lein plugin? |
| 19:55 | AeroNotix | a lot of stuff can be done with aliases |
| 19:55 | waynr | i'm listening |
| 19:55 | AeroNotix | well, no, I'm listening. What're you writing a plugin for? |
| 19:56 | Foam- | bbloom: I don't even know how to call eval. Well, I import clojure.lang. then call "Compiler.eval(my_string)". then I get this odd error regarding "path1" |
| 19:56 | Foam- | :D |
| 19:57 | waynr | it's difficult to describe |
| 19:57 | waynr | let me try |
| 19:57 | bbloom | Foam-: i dunno much about clj clr, but i can tell you that eval operates on *data* not strings |
| 19:58 | bbloom | ,(eval "(+ 5 10)") |
| 19:58 | clojurebot | "(+ 5 10)" |
| 19:58 | bbloom | ,(eval (read-str "(+ 5 10)")) |
| 19:58 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: read-str in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 19:58 | bbloom | ,(eval (read-string "(+ 5 10)")) |
| 19:58 | clojurebot | 15 |
| 19:59 | Foam- | bbloom: yeah, I saw that eval is expecting an Object. do you know how I'm supposed to convert a string to an object? I've found a reference to "LispReader" but that's it so far, not really sure how to use it yet |
| 19:59 | bbloom | Foam-: i just showed you ^^ |
| 19:59 | Foam- | ha |
| 19:59 | waynr | so there is this clojure project at work that creates staging directory to prepare for os packaging of other clojure projects and it creates that staging directory based on templates and project-specific configs. currently, the project-specific configs are stored in the "staging" project but i'd like to try turning this staging project into a lein plugin so it can be used from within the other clojure |
| 19:59 | waynr | projects themselves |
| 20:00 | bbloom | Foam-: i highly recommend you get some familiarity with clojure itself before trying to embed it |
| 20:00 | waynr | then the configs would be stored in those projects themselves rather than in the staging project |
| 20:01 | Foam- | bbloom: i have a lot of lisp experience. the issue is translating a string of code from a CLR to ClojureCLR. I guess LispReader is the path forward |
| 20:01 | AeroNotix | yeah sounds like a plugin is needed, since you need to have access to arbitrary project map |
| 20:01 | AeroNotix | waynr: |
| 20:02 | bbloom | Foam-: if you've got anything smaller than a file, read-string is the way to go |
| 20:02 | waynr | AeroNotix: that's what i was thinking, but i'm still fairly new to clojure |
| 20:02 | AeroNotix | waynr: nw |
| 20:02 | fowlslegs | bbloom: Thanks so much for your comments 4 minutes ago. That helped me figure out how to handle something. |
| 20:02 | bbloom | Foam-: and clojure is fairly different than both CL and Scheme, so it's worth studying it |
| 20:02 | bbloom | fowlslegs: huh? what did i say? :-P |
| 20:02 | AeroNotix | very different from CL, dunno about scheme. |
| 20:03 | waynr | thanks AeroNotix! |
| 20:03 | AeroNotix | waynr: nw |
| 20:03 | bbloom | AeroNotix: i'd argue the otherway, hence i argue it's different from both ;-) |
| 20:03 | fowlslegs | Just the read-string/ eval combination. It gave me a good way to get around the 32-bit limit of Integer/parseINt |
| 20:04 | bbloom | fowlslegs: why not Long/parseLong ? |
| 20:05 | AeroNotix | bbloom: Ah! Imprecise wording. I meant that *I* personally don't know Scheme enough to comment on how different it is from Clojure. |
| 20:06 | bbloom | ,(Long/parseLong "100000000000") ; fowlslegs |
| 20:06 | clojurebot | 100000000000 |
| 20:06 | Rosnec | as someone who came from Common Lisp to clojure, it's pretty different |
| 20:06 | AeroNotix | Rosnec: indeed |
| 20:06 | Rosnec | and Scheme and Common Lisp have a lot more in common with each other than they do with clojure |
| 20:07 | Foam- | bbloom: I understand :) It's really not a clojure issue, just a plumbing issue with the CLR port |
| 20:07 | fowlslegs | bbloom: ahh that's what dbasch must have meant yesterday. |
| 20:07 | Rosnec | actually, I originally started learning CL by watching online MIT lectures on Scheme |
| 20:08 | Rosnec | well, that and some google searching |
| 20:08 | bbloom | Foam-: you want this class: https://github.com/clojure/clojure-clr/blob/master/Clojure/Clojure/api/Clojure.cs |
| 20:08 | fowlslegs | bbloom: I have never seen the Long/* operators before. |
| 20:08 | bbloom | fowlslegs: they are just static methods on java.lang.Long |
| 20:08 | bbloom | Foam-: the way you use clojure from c#, for instance, is you get a var by name and invoke it like a function |
| 20:09 | Rosnec | so could somebody point me to an explanation on why recur does not destructure its arguments? |
| 20:09 | Rosnec | until today, I would have expected this to work: |
| 20:09 | bbloom | Rosnec: recur is not a binding form |
| 20:09 | Rosnec | `(defn foo [& {:keys [b] :or {b 2}}] (if (> b 5) b (recur :b (inc b)))) |
| 20:10 | Foam- | bbloom: thanks :) the implementation is a bit different from, say, ironscheme or such. I am looking at https://github.com/clojure/clojure-clr/blob/master/Clojure/Simple.Console/SimpleConsole.cs now |
| 20:10 | fowlslegs | bbloom: Are you saying operator is incorrect terminology or were you just giving me additional information? |
| 20:10 | bbloom | fowlslegs: both |
| 20:10 | bbloom | Rosnec: re-read http://clojure.org/special_forms#Special%20Forms--(loop%20[bindings*%20]%20exprs*) |
| 20:12 | Foam- | what is RT and Var? is that the clojure runtime and the scope? |
| 20:12 | bbloom | Foam-: RT is just a bunch of runtime functions provided by the host language..... Var is a fundamental concept in Clojure... hence why i suggest you spend some time with clojure before embedding it |
| 20:13 | Rosnec | it just seems odd to me that I could define a function which can be called like (f :foo 3), but a recur form within f would take the form (recur {:foo 3}) |
| 20:13 | bbloom | Rosnec: you have to do the destructuring in the loop form |
| 20:14 | bbloom | Rosnec: loop is a binding form, recur is not |
| 20:14 | Rosnec | ohhh |
| 20:14 | Rosnec | now it's starting to click |
| 20:14 | Rosnec | yeah, I understand now |
| 20:17 | Rosnec | it still seems odd that the function takes different arguments from the outside than it does from recur |
| 20:17 | Rosnec | I previously thought that if you define a function foo |
| 20:18 | Rosnec | that calling (foo args) was no different than calling (recur args), aside from TCO |
| 20:18 | Rosnec | are there any other differences? |
| 20:18 | amalloy | Rosnec: well, the "reason" for this is that (fn foo [& xs]) is really just a method that takes one argument, xs, a list. and when you recur, you have to provide the one value it expects |
| 20:18 | Rosnec | aside from having to restructure the arguments? |
| 20:22 | fowlslegs | bbloom: Is there somewhere I can find a list of these methods where I can find out what they do without investing myself in learning Java? |
| 20:22 | bbloom | fowlslegs: http://docs.oracle.com/javase/7/docs/api/overview-summary.html have fun |
| 20:30 | visof | what this error mean Caused by: java.lang.IllegalArgumentException: No method in multimethod 'to-source' for dispatch value: class clojure.core.match.WildcardPattern ? |
| 20:30 | visof | and how can i fiz this? |
| 20:30 | clojurebot | excusez-moi |
| 20:30 | Foam- | bbloom: turns out this is a ClojureCLR setup issue. I needed to init things first via Var.pushThreadBindings. |
| 20:30 | visof | s/fiz/fix |
| 20:31 | Foam- | bbloom: so it had nothing to do with the manner in which I was evaling from C# |
| 20:32 | visof | please anybody help |
| 20:33 | Rosnec | to-source is a multimethod, which accepts certain types of arguments |
| 20:33 | Rosnec | clojure.core.match.WildcardPattern is not one of them |
| 20:33 | Rosnec | yet you gave it one |
| 20:33 | Rosnec | visof |
| 20:34 | visof | Rosnec: http://pastie.org/9138021 |
| 20:34 | visof | that's the full error |
| 20:35 | visof | so how can i fix it? |
| 20:36 | Rosnec | visof, check what it is you're giving to the to-source function |
| 20:36 | Rosnec | or perhaps to-source is within something else you're calling? |
| 20:36 | Rosnec | visof: are you directly calling to-source? if not something you're calling is calling it |
| 20:37 | visof | Rosnec: all i try to do is sample jiraph |
| 20:38 | Rosnec | visof: what do you mean by sample? do you mean you're running some examples that come with it? |
| 20:38 | Rosnec | I've never used jiraph before |
| 20:41 | amalloy | i think jiraph is using a version of core.match that doesn't support AOT, and you're trying to AOT-compile it |
| 20:42 | amalloy | that's what the stacktrace tells me, anyway |
| 21:12 | gfredericks | ,((fn f [x] (->> (repeatedly rand) (take-while #(< % x)) (map f))) 0.9) |
| 21:12 | clojurebot | (() (() () ())) |
| 21:33 | akurilin | Ok this is strange: I will occasionally make some changes to my ring app and it will throw an exception when I make a request to it, reporting that some of my unit tests were unable to locate a namespace (which is a dependency of the test profile) |
| 21:33 | akurilin | I believe by tests are loaded under the default lein profile |
| 21:34 | akurilin | and I think most people keep their test deps under the :dev profile |
| 23:10 | ToxicFrog | Oh, seriously? |
| 23:10 | ToxicFrog | core.async implements its own terrible per-thread exception handler :( |