2014-08-07
| 00:00 | ambrosebs | they mostly implement "flat" contracts, like even?, contains? |
| 00:00 | ambrosebs | and some higher-order function contracts |
| 00:00 | ambrosebs | it gets interesting when you want to constraint a channel to accept a function of certain input/output |
| 00:01 | ambrosebs | and then something deep inside the program goes wrong |
| 00:02 | ambrosebs | you basically end up creating a wrapper proxy of a channel that delays the checks, and remembers the relevant line numbers to blame if things go wrong |
| 00:02 | ambrosebs | erm, I'm sure I'll think of a better way of explaining that! |
| 00:02 | ambrosebs | in other words: preconditions/schema are just the beginning |
| 00:05 | trptcolin | sure |
| 00:07 | danielcompton | technomancy: can lein plugins be used as release tasks in lein release? |
| 00:27 | hellofunk | In Om, with build-all, if you supply optional map m with state, that same state is applied to all components created by build-all? |
| 00:38 | technomancy | danielcompton: definitely |
| 00:39 | danielcompton | technomancy: I figured it out, I had a custom rpm build process happening before deploy, deploy cleans up the target directory which was removing the rpm |
| 00:41 | notostraca | danielcompton: moral of the story, never clean anything, especially binaries or the human body |
| 00:42 | notostraca | weird, some netsplits on quakenet and freenode within 4 minutes of each other |
| 00:45 | amalloy | notostraca: maybe some physicists just discovered electricity is impossible and it's rippling out to the internet |
| 00:46 | gfixler | notostraca: is the pattern that of a standard shockwave pattern? |
| 00:48 | notostraca | heh |
| 00:49 | notostraca | yeah we had an earthquake on the other side of a small lake (staying at a lakefront home) on 4th of july weekend |
| 00:49 | notostraca | my dog was TERRIFIED |
| 00:49 | notostraca | at the same time there was thunder and lightning |
| 00:49 | notostraca | and later fireworks |
| 00:49 | notostraca | "why did you bring me here human?" |
| 00:49 | ambroseb_ | ,(doc sequence) |
| 00:49 | clojurebot | "([coll] [xform coll] [xform coll & colls]); Coerces coll to a (possibly empty) sequence, if it is not already one. Will not force a lazy seq. (sequence nil) yields (), When a transducer is supplied, returns a lazy sequence of applications of the transform to the items in coll(s), i.e. to the set of first items of each coll, followed by the set of second items in each coll, until any one of the co... |
| 00:50 | notostraca | transducer! |
| 00:50 | ambroseb_ | ,*clojure-version* |
| 00:50 | clojurebot | {:interim true, :major 1, :minor 7, :incremental 0, :qualifier "master"} |
| 00:50 | notostraca | aaaaaa |
| 00:50 | notostraca | someone change the title? |
| 00:50 | notostraca | is it out yet? |
| 00:50 | ambroseb_ | alpha-1 is out yes |
| 00:50 | notostraca | awesome |
| 00:51 | notostraca | I never upgraded to 1.6 because I didn't understand reducers yet, or why I should use them |
| 00:51 | notostraca | if 1.7 is improving on them, I think I should learn :) |
| 00:53 | trptcolin | ,(sequence (map inc) (range 10)) |
| 00:53 | clojurebot | (1 2 3 4 5 ...) |
| 00:53 | trptcolin | aww ambrosebs is using me as a repl from twitter isn't he |
| 01:09 | notostraca | ,(sequence (map sequence) ["foo" "bar"]) |
| 01:09 | clojurebot | ((\f \o \o) (\b \a \r)) |
| 01:33 | danielcompton | technomancy: is there a way to not sign a git tag when doing ["vcs" "tag"] ? |
| 01:34 | danielcompton | In a lein release |
| 01:34 | Raynes | Why would you ever want to do a thing like that |
| 01:35 | danielcompton | Raynes: gpg export laws |
| 01:36 | notostraca | all the syrian warlords love lein |
| 01:46 | amalloy | are there export laws that prohibit the distribution of signed objects? that seems super-weird. the USA used to have a low prohibiting the export of *algorithms*, but adding a single number to your artifact...? |
| 01:56 | mdeboard | I'm pretty stumped here. I'm trying to use a multimethod in clojurescript but I can't actually access the state I need to |
| 01:57 | mdeboard | I have a k/v pair like {:showing :all} in app state, but when I try (:showing app-state), it's nil |
| 01:57 | mdeboard | I'm following the tutorail :( |
| 01:57 | mdeboard | tutorial too |
| 01:57 | mdeboard | obv i've hosed someting |
| 02:07 | amalloy | mdeboard: no way to tell without some kind of code. so far it's "i have a green apple, but for some reason it's red" |
| 02:08 | mdeboard | slave driver. |
| 02:08 | mdeboard | I am trying to get my code in some kind of order so i can paste it |
| 02:08 | mdeboard | without it being totally impossible to decipher |
| 02:08 | amalloy | it's possible you're missing a deref or something? maybe app-state is (atom {:x :y}), not just {:x :y} |
| 02:09 | mdeboard | https://gist.github.com/mattdeboard/e2e473558572a202d9e6 is the code |
| 02:09 | amalloy | you can try printing out stuff like (type app-state), (keys app-state), and so on, to see which of your assumptions is false first |
| 02:09 | amalloy | (assuming here that type is a function that makes sense in cljs) |
| 02:09 | mdeboard | I'm trying to use multi-method based off the value of a key in app-state, but for whatever reason it doesn't work |
| 02:09 | mdeboard | app-state in the defmulti is a PersistentVector, not a MapCursor |
| 02:10 | mdeboard | The dispatch is on line 87 |
| 02:10 | danielcompton | amalloy: I was meaning export laws for gpg |
| 02:10 | mdeboard | I was just passing `app`, but that wasn't working so I tried making a new map |
| 02:18 | mdeboard | I got it working just referrig to the global app-state thing instead of the app snapshot being passed to `defmulti`... I don't think it's supposed to work like that. |
| 03:19 | piranha | anybody can explain like I'm five why transducers are cool? :) |
| 03:23 | SHODAN | piranha, because they help you take over the world quicker |
| 03:24 | piranha | SHODAN: that's what I understood as well, but how? |
| 03:24 | piranha | That's the main question, to be honest |
| 03:24 | piranha | they look like a partial application of map/reduce and I honestly don't really understand implications or applicability |
| 03:24 | SHODAN | they do it by vaporizing the temporal plasma causes fluctuations in the quantum area |
| 03:25 | piranha | what's so cool about them that I wasn't able to do as good before... |
| 03:25 | piranha | :-) |
| 03:25 | SHODAN | oops ;) |
| 03:25 | SHODAN | didn't read that through :) |
| 03:34 | TEttinger | piranha, oh my god where are your parents? |
| 03:34 | TEttinger | we need to get you into child protective services |
| 03:37 | pyrtsa | piranha: They're a composable representation of operations on a sequential "stream" of elements, meaning they're used alike for seqs, reducers and core.async channels. |
| 03:38 | pyrtsa | What the intro blog post didn't highlight is that the evaluating operations (sequence, transduce, ...) for transducers take into account when the value is `(reduced x)`, i.e. there is a way to break out of the iteration. |
| 03:47 | TEttinger | pyrtsa: !!! |
| 03:49 | amalloy | TEttinger: surely that's not news: reduce has had that feature since 1.5, and transducers are just combinators for reducing |
| 03:49 | TEttinger | I didn't realize what transducers did really |
| 03:49 | TEttinger | or reducers for that matter |
| 03:52 | wink | TEttinger: something with burritos, right? |
| 03:52 | pyrtsa | Burritos indeed. :) |
| 04:09 | piranha | pyrtsa: hm, that makes some sense |
| 04:10 | piranha | TEttinger: redurers are easy - they are just same map/filter/reduce, but working in parallel |
| 04:12 | TEttinger | cool |
| 04:12 | clgv | pyrtsa: wink: what's taccos then? |
| 04:13 | pyrtsa | I suppose reducers are like tacos. |
| 04:15 | hyPiRion | So now for the winning question: What would (sequence ((filter even?) (map #(* 3 %))) [1 2 3]) return? |
| 04:16 | pyrtsa | hyPiRion: An error! (You forgot the comp.) |
| 04:16 | hyPiRion | pyrtsa: no, and that's the problem :p |
| 04:16 | pyrtsa | But the point of course is that the composition is read left-to-right, unlike with ordinary functions in (comp f g). |
| 04:16 | pyrtsa | hyPiRion: Ouch! |
| 04:16 | hyPiRion | I get (3 6 9) |
| 04:17 | clgv | yeah, (->> seq (map inc) (filter even?)) gbeing equivalent to ((comp (map inc) (filter even?)) seq) is quite puzzling |
| 04:17 | pyrtsa | clgv: See what hyPiRion wrote. That bug will come and bite us. |
| 04:17 | clgv | pyrtsa: yes. |
| 04:18 | amalloy | piranha: "in parallel" is far from the most interesting part of reducers |
| 04:18 | pyrtsa | I mean, the fact that its a bug of our own and the library doesn't warn us of it. |
| 04:18 | piranha | amalloy: hm, what's the most interesting part? |
| 04:18 | clgv | pyrtsa: hyPiRion: but there is no easy fix with respect to how transducers are currently implemented since they are regular functions |
| 04:18 | amalloy | more exciting is reducing over something which is not a sequence: you don't have to allocate a zillion cons cells, or worry about management of non-memory resources being held onto for too long or whatever |
| 04:19 | hyPiRion | clgv: I know, but it's easy to be confused |
| 04:19 | piranha | ah... |
| 04:19 | pyrtsa | I quite dislike the overloading of functions with varying arities in transducers/reducers. I'd think it's best to pass the initial value explicitly. |
| 04:19 | clgv | hyPiRion: that's what I thought immediately when reading the blog post |
| 04:20 | clgv | I first thought they had a separate namespace like reducers |
| 04:22 | hyPiRion | pyrtsa: I find it a bit strange. They could've just added mapt, filtert, etc. to avoid that |
| 04:22 | pyrtsa | Yep. |
| 04:24 | clgv | hyPiRion: or a separate namespace like for reducers |
| 04:24 | hyPiRion | clgv: right, that would work too |
| 04:24 | clgv | well I guess the intention of that alpha release and the announcement was to get discuission ;) |
| 04:25 | Bronsa | exceptions with transducers are going to be fun |
| 04:26 | clgv | Bronsa: yeah, it would help to be able to name the result functions, I guess. similar to (fn myname [] ...) |
| 04:26 | amalloy | clgv: the problem with that approach is that with reducers in a separate namespace, nobody uses them at all. nothing is compatible. by glomming onto stuff in clojure.core, at least transducers will be useable |
| 04:27 | AeroNotix | Can anyone ELI5 http://blog.cognitect.com/blog/2014/8/6/transducers-are-coming ? |
| 04:27 | clgv | amalloy: you think the extra namespace leads to less usage for core.reducers? |
| 04:28 | amalloy | clgv: not just the extra namespace, but the fact that it's all isolated. there's r/map, which is distinct from clojure.core/map and you have to commit to using one or the other throughout most of your program |
| 04:28 | clgv | I am curious what would be the reasons. I didn't get that expression with usual libraries |
| 04:29 | clgv | amalloy: but map without a seuqence will also be completely different than with a sequence, right? |
| 04:29 | pyrtsa | To me it seems like the logical reason is we've already seen map/filter/take-while/drop/reduce/... in clojure.core and clojure.core.reducers, and they were making entry to clojure.core.async. Finding a common implementation for all 3 (and more) saves a lot of trouble. |
| 04:30 | amalloy | yes. but i can use the new map without having to lose compatibility with code that uses the old one |
| 04:31 | clgv | amalloy: humm without a concrete example for demonstration, I just have to believe that claim for now |
| 04:31 | amalloy | or disbelieve! i'm just some guy on the internet |
| 04:32 | hyPiRion | AeroNotix: (transduce (comp (map #(+ 5 %)) (filter even?)) str [1 2 3 4]) => "68". It's like (reduce str (filter even? (map #(+ 5 %) [1 2 3 4]))), but you can easily replace [1 2 3 4] with some other data structure/list-like thing (like channels) |
| 04:32 | clgv | amalloy: you have gained "some" credibility for me from reading your posts & co ;) |
| 04:33 | AeroNotix | hyPiRion: so the benefit is that it works with different datastructures other than sequences? |
| 04:33 | lpvb | how do I (doseq [x coll index (range (count coll))] ) like I intended? It looks like it's doing it in a nondeterministic way |
| 04:34 | hyPiRion | AeroNotix: Right, it can be used for core.async and core.reducers. It can be lazy (like map) or eager (like reduce/reducers). |
| 04:34 | AeroNotix | hyPiRion: the blog post made it ten times more confusing than that. Is that all there is to it? |
| 04:34 | sm0ke | is rich becoming a benevolent dictator? |
| 04:35 | sm0ke | why are there no CIP kind of thing? Clojure Improvement Proposal? |
| 04:35 | amalloy | [[x coll] (map-indexed list coll)] would be one way |
| 04:36 | hyPiRion | AeroNotix: That's the core of it, as far as I understand |
| 04:36 | AeroNotix | hyPiRion: that definitely could've been expressed better |
| 04:36 | clgv | sm0ke: that's called jira ;) |
| 04:36 | sm0ke | where is the jira for this? |
| 04:36 | sm0ke | tranducers |
| 04:36 | hyPiRion | AeroNotix: yeah, it's usually like that :p |
| 04:37 | clgv | sm0ke: I dont know whether that has a ticket yet |
| 04:37 | clgv | sm0ke: is there a design page yet? |
| 04:37 | mercwithamouth | any cool projects going on? |
| 04:37 | sm0ke | mercwithamouth: clojure community is confused on what is this tranducers |
| 04:38 | lpvb | amalloy: thanks |
| 04:38 | amalloy | whether it has a ticket yet? there will never be a ticket saying "add transducers to clojure"; rich has done it already |
| 04:38 | sm0ke | at least the mass of it |
| 04:39 | mercwithamouth | sm0ke: thats hot... |
| 04:39 | Glenjamin | my reading was "while adding a thing, i noticed it shares some stuff with two other things. The commonalities are now extracted and called transducers" |
| 04:40 | clgv | Glenjamin: yeah, read that as well. the implementation does not quite reflect "extracted" though ;) |
| 04:40 | Glenjamin | consolidated perhaps :) |
| 04:41 | hyPiRion | Glenjamin: "I can't use the same transformations over channels, lazy-seqs and core.reducers. So I added this new thing which makes you able to do so" |
| 04:41 | hyPiRion | Although your wording was way more precice |
| 04:41 | Glenjamin | heh |
| 04:42 | hyPiRion | Wonder how many years it'll take before Go supports the same thing. |
| 04:48 | djcoin | Does anyone have an opinion on D (being used at facebook for example) that has macros, has functional idioms etc.? |
| 05:01 | lpvb | should I (defn -main [& args] ... 0) |
| 05:01 | lpvb | does clojure do return codes |
| 05:03 | mpenet | lpvb: java does, (System/exit 0) |
| 05:08 | Bronsa | amalloy: http://dev.clojure.org/jira/browse/CLJ-1494 |
| 05:11 | Glenjamin | ,(mapcat inc) |
| 05:11 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$map$fn__4338> |
| 05:26 | hellofunk | any idea why i'd get a lazy sequence on something after calling doall on it? I have a (doall (filter ...) ) and when I log this value to javascript console, it says it is a lazy sequence |
| 05:27 | TEttinger | hellofunk, a lazy seq of lazyseqs maybe? |
| 05:27 | hellofunk | TEttinger hm, well it looks like this (doall (filter (complement ... but everything after that is concrete data in Om, all vectors in the app state |
| 05:28 | hellofunk | the fn I complement in is a set, using set-as-function |
| 05:28 | TEttinger | ,(doall (map identity (repeat 3 5))) |
| 05:28 | clojurebot | (5 5 5) |
| 05:29 | amalloy | (doall x) always returns x. if you give it a lazy seq, you get a lazy seq back |
| 05:29 | amalloy | it's one that's had its elements evaluated, but it's still a lazy seq |
| 05:30 | hellofunk | amalloy ah, the bit about doall retaining the head and returning the entire sequence in memory suggests it is not lazy (as per the docs) |
| 05:30 | gws | ,(doc doall) |
| 05:30 | amalloy | hellofunk: uhhhh, well that's kinda the whole point. if it were lazy it wouldn't have a name starting with do |
| 05:30 | clojurebot | "([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through the successive nexts of the seq, retains the head and returns it, thus causing the entire seq to reside in memory at one time." |
| 05:31 | hellofunk | amalloy no my point is that the docs suggest it is realizing the whole seq, therefore not returning it in a lazy form |
| 05:31 | amalloy | it is realizing the whole seq |
| 05:31 | hellofunk | amalloy but you are saying that it could return a lazy seq, even though it is realizing the whole seq? |
| 05:31 | gws | and then it's returning the head of the lazy seq :) |
| 05:31 | amalloy | but the object is still a lazy sequence: in clj-jvm, its class is LazySeq |
| 05:32 | amalloy | it's a LazySeq whose elements are all realized; it doesn't by some magic transmute itself into a vector or whatever |
| 05:32 | hellofunk | ok, so how to convert a lazy seq into a non-lazy seq? call seq on it? |
| 05:33 | amalloy | you are not understanding what "lazy seq" means |
| 05:33 | amalloy | it is a sequence whose elements might, or might not, actually exist in memory |
| 05:33 | amalloy | a lazy seq with all elements in memory is "not lazy" in the sense that you mean, but it is still a lazy seq |
| 05:34 | hyPiRion | hellofunk: it's not a question of converting a lazy seq into a non-lazy seq, but rather how to realise the lazy seq |
| 05:35 | hellofunk | ok, this is news to me. but I still need to figure out how to have a concrete collection rather than a lazy collection, so that the results of my operation are no longer a lazy seq |
| 05:36 | hellofunk | this answer from Rich is throwing me off: http://stackoverflow.com/questions/1641626/how-to-convert-lazy-sequence-to-non-lazy-in-clojure |
| 05:38 | hellofunk | looks like in my case it is as simple as doing (into [] ...) to convert iit |
| 05:38 | amalloy | hellofunk: i don't know what is throwing you off, but it is not that answer from rich (which says exactly what hyPiRion and i are saying). you don't understand the question you are asking, and when people tell you that you already answered it yourself you're refusing and then asking the question again |
| 05:38 | hellofunk | amalloy how did I answer the question myself? |
| 05:39 | amalloy | you called doall. that is literally all you need. the sequence's items are therefore all in memory |
| 05:39 | hyPiRion | hellofunk: "Just because the seq has type LazySeq doesn't mean it has pending evaluation" |
| 05:39 | amalloy | there is no "un-lazying" more thorough than that |
| 05:40 | amalloy | how weird that that's the one and only question on SO that rich has ever answered. was it such a traumatic experience for him? |
| 05:40 | hellofunk | amalloy well, my issue was only resolved by doing a (into [] ...) the doall was not sufficing for my purposes, so indeed I was likely not asking the right question. |
| 05:41 | amalloy | you must not be, because so far your questions have been "how do i make it not lazy"; if (into []) solves the problem but doall doesn't, it must be a totally different problem |
| 05:42 | hellofunk | amalloy in Om the rule is not to put lazy seqs into the appstate data. I still had a lazy seq even after calling doall, so my question was, how to convert it into something not lazy. as doall did not resolve this, I eventually arrived at using into |
| 06:03 | hellofunk | i found it necessary to upvote that question just so Rich wasn't stuck with a rep of 666 |
| 06:03 | visof | hi |
| 06:05 | visof | when trying to execute this code i got this error https://www.refheap.com/89011 , which refer createKeyIndex isn't defined for OrientGraph class, but i'm following the documentation here https://github.com/orientechnologies/orientdb/wiki/Graph-Database-Tinkerpop at Use indices section |
| 06:06 | visof | can anybody suggest anything about this problem? |
| 06:11 | clgv | ,(clojure-version) |
| 06:11 | clojurebot | "1.7.0-master-SNAPSHOT" |
| 06:11 | clgv | ah wow ^^ |
| 06:11 | clgv | ,(map inc) |
| 06:11 | clojurebot | #<core$map$fn__4338 clojure.core$map$fn__4338@125b4d> |
| 06:13 | alexyakushev | ,(transduce (comp (map inc) (filter even?)) + 0 (range 10)) |
| 06:13 | clojurebot | 30 |
| 06:14 | alexyakushev | Cool |
| 06:14 | alexyakushev | (->> (range 10) (filter even?) (map inc) (reduce + 0)) |
| 06:14 | alexyakushev | ,(->> (range 10) (filter even?) (map inc) (reduce + 0)) |
| 06:14 | clojurebot | 25 |
| 06:15 | Bronsa | alexyakushev: that's not the same |
| 06:15 | alexyakushev | Bronsa: I get it now |
| 06:15 | Bronsa | ,(->> (range 10) (map inc) (filter even?) (reduce + 0)) |
| 06:15 | clojurebot | 30 |
| 06:15 | alexyakushev | I thought comp applies arguments in the reverse order |
| 06:15 | alexyakushev | Duh |
| 06:15 | visof | can anybody help? |
| 06:16 | Bronsa | it does, that behaviour is just a result of how transducers compose |
| 06:16 | alexyakushev | ,((comp inc #(* 2 %)) 10) |
| 06:16 | clojurebot | 21 |
| 06:16 | alexyakushev | Bronsa: OK, so that is something to be careful about |
| 06:17 | Bronsa | yeah, you just have to remember to compose transducers as if you were using ->> rather than comp |
| 06:18 | alexyakushev | Can't say I like it:( |
| 06:19 | Glenjamin | ,(doc comp) |
| 06:19 | clojurebot | "([] [f] [f g] [f g h] [f1 f2 f3 & fs]); Takes a set of functions and returns a fn that is the composition of those fns. The returned fn takes a variable number of args, applies the rightmost of fns to the args, the next fn (right-to-left) to the result, etc." |
| 06:21 | alexyakushev | First it was "return type is based on arity", now comp works in different order if it works with transducers |
| 06:21 | alexyakushev | And the former has already leaked leading to creation of "flatmap" because mapcat already has varargs |
| 06:22 | Bronsa | alexyakushev: http://dev.clojure.org/jira/browse/CLJ-1494 |
| 06:23 | alexyakushev | This might break existing code |
| 06:23 | Bronsa | no |
| 06:23 | Bronsa | (mapcat f) has never worked, I explain that in the description |
| 06:23 | alexyakushev | Yeah, right, sorry |
| 06:24 | alexyakushev | Got it confused with concat |
| 06:25 | alexyakushev | Anyway the whole thing seems crutchy. Reducer functions lived perfectly in their own namespace, why couldn't transducers? |
| 06:25 | lvh | man I dislike jira |
| 06:26 | alexyakushev | Especially since the transducer operations are the only one left necessary (so that operations on reducers and channels can be removed) |
| 06:26 | lvh | alexyakushev: I think the idea is that transducers are a sufficiently awesome new discovery that it makes sense for them to be the default; also that typically they can be implemented without bothering existing code |
| 06:26 | lvh | yeah I don't get the channel one |
| 06:26 | lvh | I understand why you want to apply a transducer to a channel |
| 06:27 | lvh | I don't udnerstand why it has to be in the place of the buffer arg |
| 06:28 | Glenjamin | ,(do (require core.async) (doc core.async/chan)) |
| 06:28 | clojurebot | #<CompilerException java.lang.ClassNotFoundException: core.async, compiling:(NO_SOURCE_PATH:0:0)> |
| 06:28 | Glenjamin | ,(do (require 'core.async) (doc core.async/chan)) |
| 06:28 | clojurebot | #<FileNotFoundException java.io.FileNotFoundException: Could not locate core/async__init.class or core/async.clj on classpath: > |
| 06:29 | Glenjamin | http://clojure.github.io/core.async/#clojure.core.async/chan <- the buffer is the second arg, transducer is the third - was buffer third before? |
| 06:29 | alexyakushev | lvh: fair enough, but I can't see why they have to be default for sequence manipulation. There's only a performance benefit in the end, but generic sequence operations are easier to reason about |
| 06:29 | lvh | Glenjamin: I thought I saw an example in Rich's blog post where it was (chan tx), not (chan 1 tx) or something like that |
| 06:29 | lvh | could just be a bug in the blog post |
| 06:30 | lvh | or maybe I just misread, of course :) |
| 06:30 | alexyakushev | lvh: I doubt anyone will initially write the algorithm with transducers. Rather write in generic way, then rewrite to transducers |
| 06:32 | alexyakushev | Say, how do you execute ,(map inc (range 5)) with transducers? |
| 06:32 | alexyakushev | ,(into () (map inc) (range 5)) |
| 06:32 | clojurebot | (5 4 3 2 1) |
| 06:32 | alexyakushev | And oops |
| 06:34 | alexyakushev | ,(sequence (map inc) (range 5)) |
| 06:34 | clojurebot | (1 2 3 4 5) |
| 06:35 | pyrtsa | ,(into [] (map inc) (range 5)) |
| 06:35 | clojurebot | [1 2 3 4 5] |
| 06:50 | clgv | ,(source into) |
| 06:50 | clojurebot | Source not found\n |
| 06:50 | clgv | ,(doc into) |
| 06:50 | clojurebot | "([to from] [to xform from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined. A transducer may be supplied." |
| 06:50 | clgv | uh oh |
| 06:51 | scape_ | i think that's not wise, to have xform in between the two. seems confusing as an overloaded argument |
| 06:55 | scape_ | ,(doc filter) |
| 06:55 | clojurebot | "([pred] [pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns true. pred must be free of side-effects. Returns a transducer when no collection is provided." |
| 06:55 | sveri | Hi, what is the best way to execute a function at a given time only once? I was thinking about using quartzite...but it seems like one can only define cronjob like repeating events... |
| 06:59 | scape_ | ,(doc reduce) |
| 06:59 | clojurebot | "([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val i... |
| 06:59 | clgv | sveri: if you dont find anything else, you hack it by jurst removing the cronjob when it is triggered |
| 06:59 | visof | can i cast types in java inside clojure? |
| 06:59 | scape_ | ,(reduce (filter even) (range 5)) |
| 06:59 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: even in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 06:59 | scape_ | ,(reduce (filter even?) (range 5)) |
| 06:59 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/filter/fn--4361> |
| 07:00 | pyrtsa | ,(sequence (filter even?) (range 5)) |
| 07:00 | clojurebot | (0 2 4) |
| 07:00 | scape_ | oh |
| 07:01 | visof | how can i cast in clojure? |
| 07:01 | Bronsa | visof: what do you need that for? |
| 07:02 | visof | when trying to execute this code i got this error https://www.refheap.com/89011 , which refer createKeyIndex isn't defined for OrientGraph class, but i'm following the documentation here https://github.com/orientechnologies/orientdb/wiki/Graph-Database-Tinkerpop at Use indices section , i want to change graph OrientGraph type to OrientBaseGraph |
| 07:02 | visof | Bronsa: which is should be something like ((OrientBaseGraph) graph) |
| 07:04 | Bronsa | visof: OrientGraph doesn't extend OrientBaseGraph |
| 07:04 | Bronsa | I'm looking at http://www.tinkerpop.com/docs/javadocs/blueprints/2.0.0/com/tinkerpop/blueprints/impls/orient/OrientGraph.html#createKeyIndex(java.lang.String,%20java.lang.Class) |
| 07:05 | visof | Bronsa: so what do you suggest? |
| 07:05 | Bronsa | I don't know, I don't know that library |
| 07:05 | Bronsa | you need to use the right object, clojure has nothing to do with that |
| 07:05 | llasram | visof: Check your versions? What version of blueprints do you have? |
| 07:06 | visof | llasram: 2.5.0 |
| 07:06 | visof | Bronsa: the right object as in doc should be OrientGraph which i use |
| 07:07 | visof | llasram: what i have in project [com.tinkerpop.blueprints/blueprints-core "2.5.0"] |
| 07:08 | Bronsa | visof: http://www.tinkerpop.com/docs/javadocs/blueprints/2.1.0/com/tinkerpop/blueprints/impls/orient/OrientGraph.html loks like that method has been removed |
| 07:09 | Bronsa | ah I see nevermind |
| 07:09 | visof | Bronsa: check this section Methods inherited from class com.tinkerpop.blueprints.impls.orient.OrientBaseGraph |
| 07:10 | Bronsa | visof: it shouldn't really necessary to cast, but try ^OrientBaseGraph graph |
| 07:11 | llasram | visof: Since there's doc-confusion, you could use reflection to see exactly what methods are present |
| 07:11 | Bronsa | visof: also try (filter #(= "createKeyIndex" (.getName %)) (seq (.getMethods (class graph)))) |
| 07:12 | Bronsa | llasram: lol ^ |
| 07:12 | sveri | clgv: Hm, I am afraid thats the way I will have to do it |
| 07:12 | llasram | Bronsa: It's not really a jinx when one person has far more specific advice while the other is still waking up and remembering how their REPL works ;-) |
| 07:15 | clgv | sveri: but maybe you overlooked a one shot job option? |
| 07:15 | visof | Bronsa: (#<Method public void com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.createKeyIndex(java.lang.String,java.lang.Class,com.tinkerpop.blueprints.Parameter[])>) |
| 07:15 | Bronsa | visof: yeah you see, the method signature is different |
| 07:16 | Bronsa | you need to provide another argument, an array of Parameters, whatever that needs to be |
| 07:16 | Bronsa | visof: you can try using (object-array []) |
| 07:17 | visof | brixen: ClassCastException Cannot cast [Ljava.lang.Object; to [Lcom.tinkerpop.blueprints.Parameter; java.lang.Class.cast |
| 07:17 | Bronsa | err (into-array Parameter []) |
| 07:18 | Bronsa | that should make the method call work, next you need to figure out what that param actually is |
| 07:18 | Bronsa | visof: http://www.tinkerpop.com/docs/javadocs/blueprints/2.4.0/com/tinkerpop/blueprints/impls/orient/OrientBaseGraph.html#createKeyIndex(java.lang.String,%20java.lang.Class,%20com.tinkerpop.blueprints.Parameter...) |
| 07:19 | Bronsa | visof: next time though try to look up the updated doc, I'm happy to help but this wasn't a clojure issue at all |
| 07:20 | visof | Bronsa: okay, thank you very much, i'm appreciating |
| 07:21 | sveri | clgv: could be, I have gone through it twice and a post on SO says that quartz does not support one time events anymore so easily as it did with 1.x so I guess thats the reason it's not available |
| 07:22 | llasram | sveri: Do you want to schedule the event to run at some arbitrary point in the future, or right away? |
| 07:23 | visof | Bronsa: is should be something like this (.createIndex graph "name" Vertex (Parameter. "type" "UNIQUE")) ? |
| 07:23 | visof | when i did this i got ClassCastException Cannot cast com.tinkerpop.blueprints.Parameter to [Lcom.tinkerpop.blueprints.Parameter; java.lang.Class.cast (Class.java:3084) |
| 07:24 | llasram | sveri: The latter is just a `future`; the former can be a Java stdlib scheduled executor pool, for which there is a Clojure wrapper: https://github.com/overtone/at-at |
| 07:24 | visof | i have imported the Parameter using (import 'com.tinkerpop.blueprints.Parameter) |
| 07:24 | llasram | visof: You still need an array of parameters, not just a single parameter |
| 07:25 | llasram | The Java varargs syntax is a Java illusion over the JVM reality |
| 07:25 | Bronsa | visof: (into-array Parameter [(Parameter. ..) ..]) |
| 07:27 | Bronsa | (into-array [(Parameter. ..) ..]) works too |
| 07:51 | sveri | llasram: thank you, that looks interesting, are the schedules as exact as the quartz library? |
| 07:52 | sveri | I found out that akka for instance looses some milliseconds over a long period of time |
| 07:53 | llasram | sveri: er, no idea |
| 07:54 | llasram | OOC, what are you trying to do at a higher level? |
| 07:55 | sveri | ok, thank you :-) |
| 08:44 | mpenet | ,(let [x (Exception. "foo)] (with-out-str (.printStackTrace x))) |
| 08:44 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading string> |
| 08:45 | mpenet | ,(let [x (Exception. "foo")] (with-out-str (.printStackTrace x))) |
| 08:45 | clojurebot | "" |
| 08:45 | mpenet | *out* vs *err*, nevermind |
| 08:48 | ddellacosta | someone posted on common problems w/Om recently, does anyone recall that blog post? I think the author was from the U.K. or Europe, perhaps? |
| 08:48 | ddellacosta | I forget her name |
| 08:48 | annapawl` | that would be me :) |
| 08:49 | ddellacosta | annapawl`: oh, hey! I was looking for your post |
| 08:49 | ddellacosta | annapawl`: can you give me the link? I couldn't find it through my lame googling |
| 08:49 | annapawl` | ddellacosta: http://annapawlicka.com/common-mistakes-to-avoid-when-creating-an-om-component-part-1/ |
| 08:49 | lvh | how do I work around >!, <! needing to be in a go block? |
| 08:50 | lvh | I want to *use* them from a go-block; I'm just defining helper fns |
| 08:50 | ddellacosta | annapawl`: awesome, thanks. Great stuff btw, very necessary. We need more Om info out there... |
| 08:50 | llasram | lvh: You don't. They need to be within the lexical scope of the go block for the code re-writing to work |
| 08:51 | llasram | lvh: You should be able to write helper macros using them, but you generally shouldn't need to even that |
| 08:52 | annapawl` | ddellacosta: thx :) these were just the most common mistakes of mine. will do a longer post once i have a bit more time |
| 08:52 | ddellacosta | annapawl`: would like to read it! |
| 08:53 | lvh | llasram: okay, so moral of the story don't define helper fns that do that |
| 08:53 | lvh | gotcha :p |
| 09:13 | TimMc | Wake up and smell the [Object object]! |
| 09:13 | SagiCZ1 | wink: what would taht be |
| 09:13 | mdeboard | lol |
| 09:13 | mdeboard | @ TimMc |
| 09:15 | TimMc | (Huh, I got the capitalization wrong.) |
| 09:15 | mdeboard | It's Javascript |
| 09:15 | mdeboard | don't worry about it |
| 09:15 | TimMc | heh |
| 09:15 | mdeboard | it all evalutes to null anyway |
| 09:16 | mdeboard | i mean the cover of the "Secrets of the Javascript Ninja" book features a Samurai |
| 09:16 | wink | there's a book for that? I thought that must be an Ed Hardy-branded pink Kindle with only one PDF on it |
| 09:17 | mdeboard | http://www.manning.com/resig/ :P |
| 09:17 | mdeboard | secrets of the javascript samurai doesn't have the same ring |
| 09:18 | wink | mdeboard: http://puppetlabs.com/sites/default/files/1316713879_castle_reaction_0.gif |
| 09:18 | mdeboard | it's all kabuki theater |
| 09:18 | mdeboard | haha |
| 09:47 | llasram | mdeboard: but does it have the same 5 rings to it? |
| 10:04 | blunte | Hello all. I've got a function that makes a series of calls to other functions. It's a sequence of steps, with some steps being within (let) scopes of other steps. But not all steps are in inner scopes. |
| 10:04 | mdeboard | sounds aboutright |
| 10:04 | blunte | However, when the very first step has no results, I have no need to do the others. I'd like to return from the function. |
| 10:05 | mdeboard | if-let ? |
| 10:05 | blunte | I could stuff everything under an (if), but that would result in unnecessary indentation (and force me to make all successive steps be under the scope of the first) |
| 10:05 | mdeboard | ,(doc if-let) |
| 10:05 | clojurebot | "([bindings then] [bindings then else & oldform]); bindings => binding-form test If test is true, evaluates then with binding-form bound to the value of test, if not, yields else" |
| 10:05 | blunte | Hmm I'll take a look. |
| 10:06 | TimMc | or when-let |
| 10:09 | Bronsa | i wish clojure had a cond-let too |
| 10:13 | pyrtsa | Or my silly little "ret". https://gist.github.com/pyrtsa/1af9fdd56267a3631b0c (Must invent a better name for it.) |
| 10:14 | blunte | I don't think if-let or when-let will work for my case. When the condition is met, I do want to do the following steps; but some of those steps don't need the scope. Plus I still end up with steps 2-5 being indented unnecessarily |
| 10:14 | blunte | really I just want to bail out of the function if the first step returns 0 results. |
| 10:14 | Bronsa | looks interesting pyrtsa, (or (ret [..] ..) (ret [..] ..)) would works fine as a cond-let |
| 10:16 | TimMc | blunte: lexical bindings that you no longer need will be dropped (made available for GC.) |
| 10:17 | pyrtsa | blunte: So my ret can be used like (ret [a (...) b (...) _ (...) c (...)] expr) where each (...) may optionally return (reduced foo). |
| 10:18 | Glenjamin | you could extract the later steps into a function |
| 10:18 | Glenjamin | (let [thing (func)] (if (zero? (count thing)) thing (expand-thing thing))) |
| 10:22 | blunte | all interesting ideas. I'm thinking/looking. Thanks :) |
| 10:49 | mdrogalis | I noticed in one of the transducer commits, a fair amount of atoms got added to core. Did that give anyone else some pause? https://github.com/clojure/clojure/commit/2a09172e0c3285ccdf79d1dc4d399d190678b670#diff-d951a5cd799ae841ffcc6b45598180dbR2674 |
| 10:51 | puredanger | it's an interesting consequence of the transducer model - there is statefulness "inside the machine" |
| 10:51 | mdrogalis | puredanger: Right. I guess Rich was alright with that trade-off. *Shrug* |
| 10:51 | pyrtsa | Yeah, it doesn't show to the outside because the iteration only ever happens once for one result. |
| 10:52 | mdrogalis | Artistic license I guess. |
| 10:52 | pyrtsa | Modulo recomputations (with another atom instance) of course. |
| 10:52 | puredanger | yes - use sequence to get a lazy (cached) sequence |
| 10:53 | pyrtsa | mdrogalis: I think one reason is avoiding stack overflows. The driver of the iteration is a while loop in Java after all, not a nice recursion. |
| 10:53 | puredanger | (recursion not actually being nice w/o TCO in Java of course) :) |
| 10:53 | pyrtsa | Exactly. |
| 10:54 | mdrogalis | pyrtsa: Good point. |
| 10:55 | pyrtsa | I had to scratch my head a couple of times to understand what this block of code really does: https://github.com/clojure/clojure/blob/2a09172e0c3285ccdf79d1dc4d399d190678b670/src/jvm/clojure/lang/LazyTransformer.java#L166-L173 |
| 10:55 | alandipert_ | maybe we can switch to Atomic{Boolean,Integer} if we need the perfs |
| 10:56 | pyrtsa | ...mutation and jumping between several classes, inner classes, and source files making it a tad hard to follow. |
| 10:56 | puredanger | mdrogalis: this same pattern comes up in reducers with take/drop |
| 10:57 | mdrogalis | puredanger: Ah, okay. I never really grok'ed how reducers worked the first time. |
| 10:58 | mdrogalis | The day of wreckoning has come for me :P |
| 11:01 | tbaldridge | mdrogalis: there's a theory I have about mutable state. At first whenever I heard "mutable state" I used to think "ewww...bad code". More and more I think you have to look at where the mutable state is, and if it truely is a tradeoff. |
| 11:02 | mdrogalis | tbaldridge: That's true. I don't understand how transducers work well enough to make a fair comment on whether anything actually got traded away. |
| 11:02 | pyrtsa | Mutable state may only be problematic if it leaks to the outside somehow. |
| 11:02 | tbaldridge | mdrogalis: in this case, I don't see the bad part of using an atom, as backtracking isn't used, and the only concurrency is handled by the thing that creates the atom. |
| 11:02 | mdrogalis | Unfortunately there are a lot of ways to spring a leak. |
| 11:03 | tbaldridge | example? |
| 11:03 | Glenjamin | there's a lack of introspection capability in this case |
| 11:03 | mdrogalis | I don't mean with respect to this, tbaldridge. Just in general |
| 11:03 | tbaldridge | mdrogalis: ah right |
| 11:04 | sveri | When I was looking at scala I remember having seen a lot of functions using local mutable state inside the function and I remember martin Odersky saying that it's ok to do it like that if the state remains local inside the function |
| 11:04 | tbaldridge | (inc puredanger) |
| 11:04 | pyrtsa | E.g. Haskell uses local mutable state a lot. |
| 11:04 | lazybot | ⇒ 6 |
| 11:04 | mdrogalis | sveri: Kind of like how memoize works. |
| 11:04 | pyrtsa | Memoization leaks memory though. It can be very problematic on a long-running JVM. |
| 11:05 | sveri | pyrtsa: is that because of the memoization technique? or an implementation detail? |
| 11:05 | Glenjamin | it seems to me like this approach, as with pretty much all function composition, just leads to a lack of visibility |
| 11:05 | tbaldridge | pyrtsa: not true, you can have multiple ways to clear the cache |
| 11:05 | mdrogalis | pyrtsa: Right. My point being how it accrues local state, but outsiders dont see it |
| 11:05 | pyrtsa | sveri: It's because there's nothing cleaning up the memoised state. |
| 11:06 | Glenjamin | which you can either call information hiding, or a mystery |
| 11:06 | tbaldridge | Glenjamin: true, but when I need visibility I'll do what I do in every Clojure program. Define my transforms using data, then build the transducers before execution. |
| 11:06 | pyrtsa | tbaldridge: Ok, cool. But with the classic (def f (memoize (fn [...] ...))) you do have a leak. |
| 11:07 | tbaldridge | pyrtsa: yeah, core/memoize is kindof a simplistic approach |
| 11:07 | tbaldridge | pyrtsa: see https://github.com/clojure/core.cache for better examples |
| 11:08 | Bronsa | pyrtsa: there's core.memoize |
| 11:08 | tbaldridge | pyrtsa: core.cache has things like TTL, FIFO, soft refs, etc. |
| 11:09 | Bronsa | core.memoize has a memo-clear! + is backed by core.cache which has all the things tbaldridge said |
| 11:09 | pyrtsa | tbaldridge: That's useful. Can you share the memory pool of core.cache between multiple memoized functions? |
| 11:09 | pyrtsa | (Or take the above question for core.memoize.) |
| 11:11 | Bronsa | pyrtsa: the answer should be yes to both |
| 11:15 | puredanger | there are other sources of state inside the Clojure runtime (keyword cache, multi method impls, protocols, loaded-libs, etc). they all have perf/memory/usability tradeoffs. they mostly do what you want but have failure modes in the extremes. over time, those failure modes are being found and softened. none of that is unique to Clojure; all languages experience this. |
| 11:16 | pyrtsa | Agreed. |
| 11:23 | verma | searching and adding deps is such a pain, is there a lein command which adds the deps automatically, like node's npm install --save express? |
| 11:23 | puredanger | lein search helps you find deps |
| 11:24 | puredanger | I don't think there's anything to actually add deps automatically though |
| 11:24 | verma | hmm, ok, thanks puredanger |
| 11:27 | trptcolin | verma: i suspect that's a plugin that could be built though, now that we have https://github.com/technomancy/leiningen/blob/2a3fe249c04f466c9bf4c92e425dfc4597e5c64c/src/leiningen/change.clj |
| 11:28 | verma | trptcolin, oh sweet |
| 11:28 | verma | trptcolin, is there an existing pluing which uses that? |
| 11:29 | trptcolin | https://github.com/technomancy/leiningen/blob/da00e756859c6d104d5de4786a578c2d9d3fa85f/src/leiningen/release.clj |
| 11:30 | trptcolin | not technically a plugin but a plugin would take a similar approach |
| 11:30 | verma | trptcolin, sure, taking a look |
| 11:32 | novaloop | i'm curious why (binding [x "hello"] (reify Object (toString [_] x))) doesn't "pick up" the binding when i call toString on it. does reify somehow escape the dynamic variable scope? |
| 11:32 | Bronsa | novaloop: for the same reason why (binding [x "hello"] (fn [] x)) won't |
| 11:33 | novaloop | oh i see, the call stack within the binding is completed when the fn is returned |
| 11:34 | Bronsa | right |
| 11:34 | novaloop | thank you! |
| 11:34 | Bronsa | you need to capture the value in the lexical scope if you need it |
| 11:42 | novaloop | is there a reason reify doesn't work from within a macrolet (from clojure.tools.macro)? (macrolet [] (reify Object (toString [_] "hello"))) ;; ClassCastException |
| 11:42 | Bronsa | novaloop: can you paste the whole stacktrace? |
| 11:43 | Bronsa | (in a pastebin) |
| 11:43 | Bronsa | novaloop: anyway, c.t.macro/macrolet does some lexical transformations that break a number of things for different reasons |
| 11:44 | Bronsa | IIRC clojure.core/case breaks inside a macrolet aswell |
| 11:44 | novaloop | http://pastebin.com/NAPZYbkT |
| 11:46 | novaloop | ok that would explain it, macrolet is like going through its body and doign the expansions, and it doesn't know how to do that will all possible forms? |
| 11:46 | Bronsa | yeah |
| 11:47 | Bronsa | macrolet should be implemented as a special form, being implemented as a macro has some shortcomings |
| 11:50 | schmee | I have a lazy-seq which calls a bunch of functions with print statements in them |
| 11:50 | schmee | but the REPL spits out all the prints when the call finished, instead of doing it continuously |
| 11:50 | schmee | is there any way to make it print while doing the processing? |
| 11:51 | novaloop | so without macrolet, is there a trick to call a macro from within a reify method that has access to some state, without passing that state into the macro? e.g. (let [state {}] (reify Object (method [_] (call-my-macro-here)))) |
| 11:52 | lijnen | Hi all! I'm trying to include dependencies (quil with cljx) into cljs-in-cljs. Anybody experience with this? |
| 11:52 | novaloop | i guess i could generate the whole reify code from a macro |
| 11:53 | nbeloglazov | lijnen, could you elaborate? |
| 11:55 | lijnen | nbeloglazov: I'm looking for the quickest way to make Quil available within the cljs-in-cljs namespace so I can mess with Quil on runtime. :) |
| 11:55 | Bronsa | lijnen: is cljs-in-cljs still a thing? I though nobody was working on it anymore |
| 11:57 | lijnen | Bronsa: it's not really active no, but it's my only option. |
| 11:58 | lijnen | nbeloglazov: Bronsa: managed to get this far: http://cl.ly/image/1i0h2n1r2A1M. The next step is quil: http://cl.ly/image/0r1J3U1g3k3K |
| 12:00 | schmee | I'm confused regarding lazy-seq |
| 12:00 | schmee | why are these two versions of the same function not equivalent? https://gist.github.com/schmee/f17febda78242bc15dac |
| 12:01 | schmee | I'm sure it's something obvious I'm missing |
| 12:01 | mdrogalis | b |
| 12:01 | mdrogalis | Whoops, sorry. |
| 12:03 | pyrtsa | schmee: The first one is lazy on each iteration step, the latter only for the first one. |
| 12:04 | pyrtsa | schmee: Compare (lazy-seq (cons 1 (lazy-seq (cons 2 (lazy-seq (cons 3 nil)))))) with (lazy-seq (cons 1 (cons 2 (cons 3 nil)))). |
| 12:05 | schmee | pyrtsa: hmm... is there any way to wrap the function and make a lazy-seq "from the outside"? Instead of wrapping the innards of the original function in lazy-seq |
| 12:07 | pyrtsa | Not really, I don't think so. |
| 12:07 | schmee | alright, thanks for clearing things up! |
| 12:07 | pyrtsa | (cons x expr) evaluates expr before returning, after all. |
| 12:08 | pyrtsa | (That is, it doesn't force a lazy sequence, of course, if expr evaluates into one.) |
| 12:09 | clgv | $seen lpetit |
| 12:09 | lazybot | lpetit was last seen quitting 15 weeks ago. |
| 12:09 | clgv | $seen laurent |
| 12:09 | lazybot | I have never seen laurent. |
| 12:09 | clgv | $seen laurentpetit |
| 12:09 | lazybot | laurentpetit was last seen quitting 24 weeks ago. |
| 12:10 | mhalverson | I'm getting some unexpected behavior regarding defrecord equality -- it's causing a unit test failure, is why I discovered it. Reproducible by spinning up a fresh nrepl and pasting in these four lines: https://gist.github.com/mhalverson/7ebdd79f2a16446ecde2 . Does anyone else see the same behavior? |
| 12:12 | Bronsa | eh, there should already be a ticket for that |
| 12:13 | mhalverson | bronsa: hm, I couldn't find one in the clojure bug tracker (searching for issues with defrecord in the title)... |
| 12:18 | Bronsa | mhalverson: http://dev.clojure.org/jira/browse/CLJ-1457 might be the same issue, not sure |
| 12:20 | mhalverson | Bronsa: that's not the same issue I'm seeing (though of course it might have the same root cause) |
| 12:20 | Bronsa | mhalverson: I'm suggesting it hash the same root cause |
| 12:20 | Bronsa | has* |
| 12:21 | mhalverson | Bronsa: ah I see. I don't know enough about dynamic classloaders to have an intuition about this stuff... |
| 12:23 | mhalverson | Bronsa: I think the right action is to file a separate issue, since it's a separate symptom. Does that sound right? |
| 12:24 | Bronsa | mhalverson: sure, reference CLJ-1457 in the ticket description, if it turns out to be the same issue it'll get closed as a duplicate, no big deal |
| 12:24 | mdeboard | With cljs+om, how do you replace the subtree under say <div id="foo"> with something else? |
| 12:24 | mhalverson | Bronsa: sweet, thanks! |
| 12:25 | mdeboard | The code is here https://gist.github.com/mattdeboard/a7e20533ff59cee29004 ... the question is, if I want to replace <div id="app"> with different contents, how does that work? |
| 12:30 | bhenry | Hey guys what is the name of the function that will take a predicate and a seq and split the seq into two seqs where pred = false and pred = truthy? |
| 12:30 | mdeboard | dnolen_: Any pointers on the above? Like, if `om/root` targets <div id="app">, and part of my program generates a dom that represents one "view". Then, when the user clicks a button, I want to replace the contents of <div id="app"> entirely. How is that sort of thing handled with om? |
| 12:30 | mdeboard | bhenry: partition-by? |
| 12:30 | Bronsa | mhalverson: this is interesting http://sprunge.us/cDjj?clj |
| 12:30 | mdeboard | ,(doc partition-by) |
| 12:31 | clojurebot | "([f] [f coll]); Applies f to each value in coll, splitting it each time f returns a new value. Returns a lazy seq of partitions. Returns a stateful transducer when no collection is provided." |
| 12:31 | bhenry | MediumDivision: partition by will give more than two back unless the seq is already divided so that the first part is all truthy and second part is all falsey |
| 12:32 | bhenry | shoot that was for mdeboard not MediumDivision sorry |
| 12:32 | mhalverson | Bronsa: indeed! I think I'll add that snippet to the issue description... something funny is afoot with record redefinition |
| 12:32 | mdeboard | ,(doc sort-by) |
| 12:32 | clojurebot | "([keyfn coll] [keyfn comp coll]); Returns a sorted sequence of the items in coll, where the sort order is determined by comparing (keyfn item). If no comparator is supplied, uses compare. comparator must implement java.util.Comparator. If coll is a Java array, it will be modified. To avoid this, sort a copy of the array." |
| 12:33 | bhenry | it's a combination of remove and filter. it's like (list (filter pred seq) (remove pred seq)) |
| 12:33 | rdsck | Hi! |
| 12:33 | rdsck | How can I convert a sequence of byte-arrays to an InputStream? |
| 12:35 | llasram | rdsck: http://docs.oracle.com/javase/6/docs/api/java/io/ByteArrayInputStream.html ? |
| 12:37 | rdsck | llasram: Thank you! You mean I just do (.ByteArrayInputStream my_buf) and that is it? |
| 12:37 | rdsck | llasram: But I have not one buf, I have a sequnce of them |
| 12:38 | rdsck | llasram: and I need to convert (on-the-fly) the sequence to the stream |
| 12:38 | llasram | rdsck: Then also http://docs.oracle.com/javase/6/docs/api/java/io/SequenceInputStream.html |
| 12:40 | mhalverson | Bronsa: issue is here, if you care to chime in http://dev.clojure.org/jira/browse/CLJ-1495 |
| 12:41 | rdsck | llasram: thank you! it looks really nice. You mean I just can do (SequenceInputSream. (for [i (range 10000)] (ByteArrayInputStream. (get_buf i))) ? |
| 12:41 | rdsck | llasram: Is that correct? |
| 12:41 | melipone | hello! |
| 12:41 | melipone | how can I get the number of cores on my machine with clojure? |
| 12:42 | rdsck | melipone: (.availableProcessors (Runtime/getRuntime)) |
| 12:42 | llasram | rdsck: Close... Looks like SequenceInputStream tokes an Enumeration for some reason, so you'll need to adapt to an Enumeration somehow |
| 12:42 | llasram | common-collections has some stuff for that |
| 12:42 | melipone | rdsck: thanks! |
| 12:43 | llasram | s,tokes,takes, <- Freudian slip |
| 12:43 | technomancy | who was talking about people installing leiningen that don't know how the $PATH works the other day? https://twitter.com/mitdasein/status/497220920637796352 |
| 12:44 | llasram | wat |
| 12:44 | Bronsa | mhalverson: I updated the description with a minimal case of my snippet |
| 12:44 | dnolen_ | mdeboard: unmount / remount |
| 12:45 | dnolen_ | mdeboard: or have component inside that app div that you replace |
| 12:45 | technomancy | llasram: my position is that you should probably learn how your OS works before learning clojure fwiw |
| 12:45 | mhalverson | Bronsa: thanks for the sundry little improvements -- looks better :) |
| 12:46 | mdeboard | dnolen_: Ok, I'll do some reading. Hearing you on cognicast over the weekend got me fired up to learn om. |
| 12:46 | dnolen_ | mdeboard: this really a React question - whatever works for React works for Om |
| 12:46 | dnolen_ | mdeboard: cool! |
| 12:46 | mdeboard | yes i'm kind of reading the react docs in parallel but it's hard to tell how to translate between react examples & om examples |
| 12:46 | llasram | technomancy: I recently heard someone describe how he "wanted to learn to write in Linux, because that's what Unix is implemented in." So there's levels here. |
| 12:47 | TimMc | D-: |
| 12:47 | technomancy | I ... wow. |
| 12:47 | dnolen_ | mdeboard: it probably worth it to just understand React first |
| 12:47 | TimMc | I don't want any eunuchs on my machine! |
| 12:47 | dnolen_ | Om is easy as pie if you get React |
| 12:47 | mdeboard | ok, I'll change direction then and do that, thanks |
| 12:47 | technomancy | I don't want to be an elitist douche, but if you don't understand the basics you're in for a really rough time. |
| 12:48 | mdeboard | technomancy: yeah, linux is really kind of an advanced language |
| 12:48 | TimMc | technomancy: Learning a whole stack at once is always rough -- it's not even clear where the layers separate. |
| 12:48 | llasram | Yeah... There is a tension between "some things really are basic" vs "we must protect the Priesthood of the Machine God!" |
| 12:49 | llasram | But some things really are basic |
| 12:49 | mdeboard | Deus est machina |
| 12:49 | TimMc | ex |
| 12:49 | TimMc | Oh! Pun. |
| 12:49 | mdeboard | god IS the machine |
| 12:49 | rdsck | llasram: thank you! so I need something like enumeartion-seq but inversed, right? |
| 12:49 | llasram | Latin pun :-) |
| 12:49 | technomancy | it's not that he shouldn't be learning clojure, it's just that at this level there are more important things to learn. |
| 12:51 | llasram | rdsck: Exactly. Which unfortunately for some reason I don't think exists in the Clojure or Java stdlib, but: https://commons.apache.org/proper/commons-collections/javadocs/api-3.2.1/index.html |
| 12:52 | llasram | But is simple, so you could just write one which could go straight from seq -> Enumeration |
| 12:53 | llasram | Man, SequenceInputStream still doesn't work on an Iterator/Iterable even in Java 8 |
| 12:53 | llasram | Crazytown |
| 12:54 | rdsck | llasram: thank you very much! I don't know yet how could I write such convertor |
| 12:54 | llasram | OH! |
| 12:54 | llasram | rs0: Actually, I'm insane: http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#enumeration(java.util.Collection) |
| 12:54 | llasram | Er, ^^ rdsck |
| 12:55 | llasram | ,(enumeration-seq (java.util.Collections/enumeration (seq [1 2 3]))) |
| 12:55 | clojurebot | (1 2 3) |
| 12:55 | rdsck | llasram: So you mean that that is that easy |
| 12:56 | llasram | Layers of indirection are sacrifices before the deus est machina |
| 12:56 | rdsck | llasram: I just need (java.util.Collections/enumeration my-sequence) |
| 12:56 | llasram | Exactly |
| 12:56 | rdsck | llasram: that is perfect! |
| 12:56 | rdsck | llasram: Thank you very much!! I will go to my repl. Thank you once again!! |
| 12:57 | llasram | np |
| 13:12 | PigDude | any cursive users here? alt+up/down arrow selection doesn't work for me and i don't know where it is in the menus to bind it |
| 13:13 | PigDude | (this is on a mac) |
| 13:26 | cfleming | PigDude: I'm the Cursive dev |
| 13:26 | cfleming | Which keymap do you have selected? |
| 13:26 | cfleming | It might be bound to CMD-W |
| 13:26 | PigDude | oh hi cfleming :) |
| 13:26 | cfleming | Hi :) |
| 13:26 | PigDude | indeed, it is! |
| 13:27 | cfleming | Ok - confusingly there are two OSX keymaps |
| 13:27 | cfleming | I'm using the one called OSX 10.5+ or something similar |
| 13:27 | PigDude | oh, I see |
| 13:27 | PigDude | I'm using the Mac OS X one |
| 13:28 | cfleming | If you use the other one, Cmd-W will get wired into your reptilian hindbrain, and then you'll try to use it in web form fields and you'll close your browser tab and lose your writing. |
| 13:28 | cfleming | Not that that ever happened hundreds of times to me, of course. |
| 13:28 | PigDude | haha |
| 13:29 | PigDude | thanks cfleming, i'm going to use the 10.5 map, i wasn't even aware of it |
| 13:32 | cfleming | No worries, it's a bit confusing for sure. |
| 13:32 | cfleming | All the Cursive doc assumes the 10.5 map, too |
| 13:32 | cfleming | That's your issue in the tracker, right? |
| 13:34 | irctc | hello |
| 13:35 | irctc | is it possible to create a Var through def that is the result of a function? Somehow this doesn't work for me |
| 13:35 | PigDude | cfleming: yea, sorry, i'll close it :) |
| 13:35 | irctc | (def eps (Math/ulp 1.0)) or (def eps Math/ulp 1.0) both trigger errors |
| 13:36 | cfleming | No worries, it's a fair issue :) |
| 13:36 | verma | ,(def eps (Math/ulp 1.0)) |
| 13:36 | clojurebot | #'sandbox/eps |
| 13:36 | PigDude | now somebody else will find it |
| 13:36 | PigDude | and know the solution |
| 13:36 | verma | ,(Math/ulp 1.0) |
| 13:36 | clojurebot | 2.220446049250313E-16 |
| 13:36 | verma | irctc, seems to work |
| 13:37 | irctc | hmmm strange... must be gorilla repl then I guess |
| 13:39 | lpvb | do maps preserve order when seq'd? |
| 13:42 | lpvb | I guess not |
| 13:42 | klzzvn | any idea why core.match can't match on classes? https://gist.github.com/klzzvn/1c15abbbdb420d3f945c |
| 13:42 | irctc | man, two jehova's witnesses just rang the bell |
| 13:43 | irctc | first time this ever happened to me |
| 13:43 | lpvb | so should I use a vector of vectors when I want an ordered map |
| 13:43 | irctc | one of the two women physically recoiled when I told her that I am an atheist |
| 13:44 | technomancy | did you tell them you already beat final fantasy VII |
| 13:44 | p_l | irctc: :D |
| 13:44 | technomancy | oh wait that's jenova's witness never mind |
| 13:44 | hiredman | klzzvn: that is very weird behaviour, but it is also different from the usage shown in the readme |
| 13:44 | hiredman | klzzvn: the usage in the readme puts [] around the matches |
| 13:45 | klzzvn | hiredman: yeah, but it says it can work without [] for one column matches |
| 13:45 | klzzvn | hiredman: anyway, the behaviour is the same, even with [] |
| 13:45 | hiredman | bummer |
| 13:45 | irctc | I can't remember the ending of FFVII, I know that I played it but now I wonder whether I've actually ever finished it back in the days |
| 13:46 | p_l | I need to finish it, recently grabbed (finally) a legal copy off Steam :) |
| 13:46 | irctc | Damn, this makes me wanna play a JRPG like Suikoden or Wild Arms |
| 13:46 | verma | lpvb, sorted-map? |
| 13:46 | p_l | back then, it used to crash on me because Windows NT |
| 13:47 | lpvb | verma: thanks forgot about that completely |
| 13:47 | verma | ,(into (sorted-map) {:b 1 :a 2}) |
| 13:47 | clojurebot | {:a 2, :b 1} |
| 13:47 | irctc | I think I owned it on PS1 |
| 13:47 | lpvb | verma: actually I just wanted to preserve the order I put them in |
| 13:48 | technomancy | we used to get trolls coming into the #emacs channel to say "vi rules" and it was always fun to assume they were talking about final fantasy vi |
| 13:48 | lpvb | verma: array-map? |
| 13:48 | verma | lpvb, array-map may be then |
| 13:48 | technomancy | which was actually pretty great |
| 13:48 | verma | lpvb, yes :) |
| 13:49 | verma | ,(seq (array-map :b 1 :c 2 :a 4)) |
| 13:49 | clojurebot | ([:b 1] [:c 2] [:a 4]) |
| 13:50 | verma | does github show DMCA notices outside US as well? can anyone check? https://github.com/popcorn-official/popcorn-app |
| 13:51 | ToxicFrog | verma: shows up in Canada too |
| 13:52 | verma | ToxicFrog, thanks |
| 13:54 | klzzvn | verma: europe/croatia also |
| 14:01 | verma | klzzvn, thanks |
| 14:01 | TimMc | irctc: That JW must've been a n00b. I can only imagine the responses they get over the course of a month. |
| 14:04 | lpvb | should I (defn -main [& args] ... 0)? Does clojure do return codes? |
| 14:06 | puredanger | I think you have to (System/exit <num>) if you want to affect the JVM return code |
| 14:08 | hyPiRion | lpvb: (System/exit 0) if you want to explicity set it. It defaults to 0 if you haven't picked one and it exits cleanly though |
| 14:12 | TimMc | lpvb: Somewhat tangentially, I often have a -main fn that does not nothing but call a run fn and then System/exit (or shutdown-agents) to kill off any agents. |
| 14:14 | TimMc | (that way I can call the run fn from the REPL and not have to worry about killing the REPL too!) |
| 14:16 | jlongster | I'm playing around with the core.async `merge` method, but getting an error in the form of "no implementation of take! found for...". what am I doing wrong? https://gist.github.com/jlongster/585019272cde6d14d8e5 |
| 14:17 | dnolen_ | jlongster: you to :refer merge but if you do that you also need to exclude cljs.core/merge |
| 14:17 | dnolen_ | s/you/you need |
| 14:18 | jlongster | dnolen_: aah. google searching showed confusion with cljs.core/merge so should have known |
| 14:18 | jlongster | thanks |
| 14:19 | dnolen_ | jlongster: better than :refer-clojure :exclude is |
| 14:19 | dnolen_ | (async/merge [c1 c2]) |
| 14:20 | dnolen_ | so it's clear what is going on |
| 14:20 | jlongster | dnolen_: agreed, will do that |
| 14:39 | verma | it sucks that I have to refer to clojure.match as an external dependency, is it just in incubation before it becomes part of the core and comes with clojure? its handy as hell and always a few steps away :( |
| 14:41 | technomancy | verma: I agree; it sucks |
| 14:42 | technomancy | on the other hand if it were part of clojure it'd be subject to the same release cycles, which would be annoying in different ways |
| 14:42 | amalloy | i just had a related thought: i can't think of any core.* libraries that have actually become part of clojure, except those that rich took part in himself. am i wrong? |
| 14:43 | technomancy | wasn't clojure 1.2 the last time something from contrib made it into actual clojure? |
| 14:44 | amalloy | i dunno. 1.2 was very early days for me |
| 14:44 | trptcolin | reflect was 1.3 |
| 14:44 | jlongster | attempting to use async.core merge with pub/sub to enforce dependencies. how come the 3rd go block that read from c3 isn't run when c1 got a value? https://gist.github.com/jlongster/412d4616d3042288ea90 |
| 14:44 | verma | well, I didn't think of the release cycle stuff so it makes a little more sense now |
| 14:44 | technomancy | verma: core.match was really unstable until a year or so ago iirc |
| 14:46 | verma | technomancy, oh, well most of these libraries are in betas, early betas so I thought may be they have to go through this incubation period before they are accepted, much like what boost does sort of for standard C++ |
| 14:47 | technomancy | it's a drag though |
| 14:47 | technomancy | a day when you can't use pattern matching is like a day without music |
| 14:47 | verma | I guess an easy way to add these deps to my project.clj would be nice as well, right now lein search is the only thing I have to avoid looking for deps online and their versions, but lein search throws everything at me |
| 14:48 | amalloy | musicalDay MatchedPatterns = True; musicalDay _ = False |
| 14:49 | technomancy | verma: now that lein 2.4 has the change task, it should be a lot easier to write plugins that add deps for you |
| 14:49 | verma | I think it would be fun to work on a lein plugin for lein add deps --save like how node does |
| 14:49 | verma | technomancy, yeah, I was made aware of that earlier today |
| 14:50 | verma | I'll take a look at it, may be I could write something that gets accepted and I can finally earn a leiningen sticker :P |
| 14:52 | technomancy | sounds like a plan |
| 14:53 | PigDude | hm, clojure wraps bigints in its own class, so i can't call (.toByteArray 1203981209381238N) |
| 14:53 | PigDude | anyone know a way around that? |
| 14:53 | gfredericks | ,(.toByteArray (big-integer 1203981209381238N)) |
| 14:53 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: big-integer in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 14:53 | gfredericks | ,(.toByteArray (biginteger 1203981209381238N)) |
| 14:53 | clojurebot | #<byte[] [B@4f8ad5> |
| 14:54 | PigDude | oh, thanks gfredericks ! i didn't see (biginteger) |
| 14:55 | PigDude | ,(String. (.toByteArray (biginteger 1203120938N))) |
| 14:55 | clojurebot | "G�+*" |
| 14:55 | PigDude | hm.. is that right? |
| 14:55 | gfredericks | what should it be? |
| 14:55 | PigDude | I wanted to encode in hex |
| 14:55 | PigDude | (I know that shouldn't do it) |
| 14:55 | gfredericks | not sure what your question is then |
| 14:56 | PigDude | i guess it is how to convert clojure bigint to hex |
| 14:56 | gfredericks | a hex representation of what? |
| 14:56 | amalloy | $google java bigint hex |
| 14:56 | lazybot | [Java convert a HEX String to a BigInt - Stack Overflow] http://stackoverflow.com/questions/4316645/java-convert-a-hex-string-to-a-bigint |
| 14:56 | verma | why can't I find org.clojure/core.match on clojars? |
| 14:56 | jlongster | hm, still can't get this to work... does this not make sense, dnolen_? https://gist.github.com/jlongster/412d4616d3042288ea90 |
| 14:56 | PigDude | (f 255N) => "ff" |
| 14:56 | PigDude | for instance |
| 14:57 | gfredericks | verma: contrib libraries aren't published to clojars |
| 14:57 | verma | gfredericks, is there anywhere else they are indexed? |
| 14:57 | PigDude | this does not work for bigintegers |
| 14:57 | gfredericks | PigDude: I don't think toByteArray would give you that |
| 14:57 | gfredericks | ,(seq (.toByteArray (biginteger 255N))) |
| 14:57 | clojurebot | (0 -1) |
| 14:57 | amalloy | ,(.toString (biginteger 255N) 16) |
| 14:57 | clojurebot | "ff" |
| 14:58 | PigDude | ,(.toString (biginteger 251231231235N) 16) |
| 14:58 | clojurebot | "3a7e8c5d03" |
| 14:58 | verma | guess here, https://github.com/clojure |
| 14:58 | PigDude | ,(.toString (biginteger 251231231212312313235N) 16) |
| 14:58 | clojurebot | "d9e88a1b51de7bd93" |
| 14:58 | amalloy | second result of the google search i suggested |
| 14:58 | cbp | verma: maven central |
| 14:58 | verma | oh |
| 14:58 | verma | nice |
| 14:58 | PigDude | hm on my machine those are showing out of range exceptions |
| 14:58 | PigDude | amalloy: that was what i was trying first but it fails here |
| 14:58 | gfredericks | ,(.toString (biginteger -3N)) |
| 14:58 | clojurebot | "-3" |
| 14:58 | gfredericks | ,(.toString (biginteger -3N) 16) |
| 14:58 | clojurebot | "-3" |
| 14:58 | puredanger | verma: http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.clojure%22 |
| 14:58 | PigDude | I get IllegalArgumentException Value out of range for int: 212312312312355 clojure.lang.RT.intCast (RT.java:1115) |
| 14:59 | verma | puredanger, yeah got it |
| 14:59 | verma | thanks |
| 14:59 | amalloy | did you, say, forget the N? or are you using a suuuuuuper old version of clojure? or is your machine haunted by a vengeful spirit? |
| 14:59 | gfredericks | aw man the vengeful ones are the worst |
| 14:59 | PigDude | amalloy: oh, you know what i was doing wrong? not wrapping in (biginteger) |
| 15:00 | puredanger | ,Integer/MAX_VALUE |
| 15:00 | clojurebot | 2147483647 |
| 15:00 | gfredericks | Max Value would be a cool name for a person |
| 15:01 | PigDude | thanks, really helpful |
| 15:02 | gfredericks | what are better names for these things? https://github.com/gfredericks/referee/blob/master/src/com/gfredericks/referee.clj |
| 15:04 | amalloy | Either/Right/Left. you know you want it |
| 15:04 | gfredericks | nooooooo |
| 15:05 | gfredericks | also I want to know what technomancy would have done instead of protocol/records |
| 15:05 | llasram | gfredericks: I'd have done protocols/reify |
| 15:06 | gfredericks | eh? |
| 15:06 | gfredericks | for more opaque printings? |
| 15:06 | llasram | No need for a named type, especially a record. The instances are entirely defined by their implementations, which makes them perfect for `reify` |
| 15:10 | verma | it'd be nice if I could use something similar them for pattern matching, like haskell :P |
| 15:11 | verma | well, not hard to brew up your own using maps though |
| 15:11 | mthvedt | named types look a lot nicer in stack traces |
| 15:12 | mthvedt | or when printing |
| 15:13 | verma | deref'ing a Failure rethrows the exception? hmmm |
| 15:14 | gfredericks | similar to how futures behave |
| 15:14 | gfredericks | it doesn't have to be deref that does that, but something should do that |
| 15:15 | verma | oh, interesting |
| 15:16 | amalloy | gfredericks: delays do it too, as of like 1.6 i think |
| 15:16 | gfredericks | amalloy: what on earth did they do prior? |
| 15:17 | amalloy | horrible things. you may find the jira ticket i filed amusing |
| 15:17 | amalloy | http://dev.clojure.org/jira/browse/CLJ-1175 |
| 15:18 | gfredericks | HUH. |
| 15:19 | puredanger | …and you will know us by the trail of our delayed exceptions |
| 15:21 | verma | oooh ^:once, sounds risky and fun |
| 15:22 | SegFaultAX | Is there are story behind the indentation style in clojure.core? Or is it a simple/boring "Rich uses that style, so Clojure uses that style"? |
| 15:22 | amalloy | SegFaultAX: the latter |
| 15:23 | amalloy | except with a little bit of "nobody *really* cares now that clojure.lang isn't being changed much, so other styles creep in with patches so that it's neither pretty nor consistent" |
| 15:25 | gfredericks | every time I patch the java code it takes a lot of concentration to maintain whatever style is there |
| 15:25 | jlongster | dnolen_: nm, figured out my merge question |
| 15:25 | gfredericks | not to mention to avoid committing 200 trailing-whitespace changes |
| 15:25 | SegFaultAX | Hah |
| 15:26 | boxed | the java code is pretty sloppy yea.. first and only time I tried to look at it I found a big chunk of commented out code with no comment on why |
| 15:26 | amalloy | gfredericks: i have that problem in clojure.core too |
| 15:27 | boxed | (inc python) |
| 15:27 | lazybot | ⇒ 2 |
| 15:27 | SegFaultAX | boxed: I wouldn't necessarily call it sloppy. |
| 15:27 | boxed | :P |
| 15:27 | Glenjamin | there might be something helpful on the git blame for the comment |
| 15:27 | Glenjamin | or not |
| 15:27 | boxed | wanna bet? :P |
| 15:30 | amalloy | boxed: search for the comment //*/ and see if you can figure out why it's there, as an exercise |
| 15:30 | SegFaultAX | amalloy: "I've commented out, the reason why is left as an exercise for the reader" |
| 15:31 | gfredericks | clojurebot: clojure is left as an exercise for the reader |
| 15:31 | clojurebot | Ik begrijp |
| 15:32 | arrdem | the reader is also an exercise for the reader... |
| 15:32 | gfredericks | exercise is an exercise for the reader |
| 15:32 | gfredericks | in fact X is a Y for Z is true for all X,Y,Z |
| 15:33 | cbp | o man //*/ |
| 15:39 | boxed | amalloy: the place I saw had no comments for miles and miles around |
| 15:40 | amalloy | okay...did you figure out what the //*/ is for? |
| 15:41 | Jaood | amalloy: to comment comments? |
| 15:43 | amalloy | Jaood: //*/ is a lexer trick which closes an open /* comment-block if it's inside one, and does nothing if it's outside |
| 15:43 | amalloy | so it's like "i can't figure out if we're in commented-out code, but i want to stop commenting things out here" |
| 15:44 | gfredericks | lol |
| 15:44 | gfredericks | why on earth would you need to consciously do that |
| 15:44 | boxed | C comments aew so broken :/ |
| 15:45 | amalloy | gfredericks: look at the giant mess of commented-out code in clojure.lang, and the answer will be resolved in your mind |
| 15:45 | gfredericks | I retract the question |
| 15:47 | Jaood | amalloy: any specific file in clojure.lang? |
| 15:48 | amalloy | Jaood: not really. Compiler, RT, Utils, are all probably pretty bad |
| 15:48 | Jaood | ok, compiler.java has it at the top :) |
| 15:50 | boxed | checked in commented out code at work triggers an immediate walk-over-to-desk-ask-for-wtf |
| 15:55 | dnolen_ | all the transducers work in Clojure is now landed in ClojureScript https://github.com/clojure/clojurescript, have fun |
| 16:07 | technomancy | boxed: I could imagine that being used as a cry for help |
| 16:07 | technomancy | o O ( "the amount of commented out code is kinda like my emotions right now--hella crazy" ) |
| 16:07 | technomancy | http://achewood.com/index.php?date=08212002 |
| 16:08 | gfredericks | technomancy: you're suggesting clojure is rhickey's cry for help? |
| 16:09 | michaelr | hi |
| 16:09 | technomancy | no I mean in the context of a walk-over-to-desk-on-commented-code policy |
| 16:09 | amalloy | technomancy: new game: start each .clj file with #_#_#_#_ and a bunch of ns forms, let people guess what your dependencies are |
| 16:10 | michaelr | how would I easily update emacs-live to the latest? |
| 16:11 | michaelr | to get the latest cider |
| 16:12 | technomancy | michaelr: I'd recommend using the standard package manager for that |
| 16:12 | michaelr | technomancy: for cider or for emacs-live? |
| 16:12 | technomancy | michaelr: for everything in emacs, but in this case for cider |
| 16:12 | michaelr | hum hum.. |
| 16:12 | technomancy | emacs-live has this bizarre NIH package-like system that isn't particularly well documneted |
| 16:13 | michaelr | heh |
| 16:13 | michaelr | technomancy: it was working well for me up until now.. I'll have to go deeper with emacs if I'd have to leave it now ;) |
| 16:13 | michaelr | when all I want currently is to try the new cider.. |
| 16:17 | kschrader | michaelr: emacs-live is just a git repo, you can update it from within the .emacs.d directory, I think |
| 16:18 | michaelr | kschrader: I've tried git submodule update --recursive |
| 16:18 | michaelr | after trying git pull |
| 16:18 | michaelr | (it didn't work) |
| 16:20 | llasram | Finally made something `c.c.r/fold`able via ForkJoin, and it's kind of a mess. For some reason half of the c.c.r ForkJoin helpers are private |
| 16:24 | kschrader | hmmm |
| 16:24 | kschrader | if you haven't done any customization to Live you could just move the directory over and install it again |
| 16:25 | michaelr | yeah, i think i'll do that |
| 16:25 | michaelr | all my customizations are in .emacs-live.el |
| 16:36 | gfredericks | don't worry, I just used a Fn as a key in a hash-map |
| 16:36 | rweir | are there any easy-to-understand articles on reducers? |
| 16:37 | rweir | now transducers are here I feel like I'm two steps behind |
| 16:37 | lpvb | rweir: how about http://vimeo.com/45561411 |
| 16:38 | rweir | videos :/ |
| 16:38 | rweir | lpvb, I'll have a look, thank you |
| 16:38 | lpvb | it's a talk by rich though |
| 16:38 | rweir | ah, well, complaint retracted :) |
| 16:39 | puredanger | rweir: if you have comments on http://clojure.org/reducers and what more would help there, I'd be happy to get that feedback |
| 16:39 | hiredman | http://ce2144dc-f7c9-4f54-8fb6-7321a4c318db.s3.amazonaws.com/reducers.html is my favorite reducers write up (likely because I wrote it) |
| 16:39 | rweir | hiredman, with such an easy to remember url! |
| 16:39 | rweir | puredanger, thanks! |
| 16:39 | puredanger | hiredman: nice! I hadn't seen that! and +1 on that awesome url |
| 16:40 | hiredman | :) |
| 16:40 | puredanger | looks like a core.async version or something |
| 16:40 | rweir | all I'd read was the two posts rich made on them, and a couple of other random blog posts, which were...inscrubtable. I'll check those out, thanks. |
| 16:40 | puredanger | Rich's posts are great on understanding why and how to build but I found them light on "how to use" :) I was trying to plug that gap a little in the reducers page |
| 16:41 | rweir | yeah |
| 16:41 | rweir | they're like revelations lacking in commandments |
| 16:41 | hiredman | puredanger: rick gave some talk, I think it was language of the system at one of the conjs, were he asks a question to the audience about names for things, I yelled "uuids" from the back and he went "is that stu?" |
| 16:41 | puredanger | ha |
| 16:42 | rweir | possibly part of the problem is I translate "seq" to "iterable in python" and that gets the operation sense backwards |
| 16:42 | puredanger | I hear there is a healthy chunk on reducers in the Joy of Clojure 2nd ed but haven't seen it yet |
| 16:42 | puredanger | and I have a chunk on the Clojure book I'm working on for pragmatic |
| 16:42 | rweir | ah, I didn't even think to look in there |
| 16:42 | rweir | ah cool, what's the...target market for your book? |
| 16:43 | puredanger | the market are people that have read an intro Clojure book and learned the syntax but want to know how to actually build stuff with it |
| 16:43 | puredanger | tentatively called Clojure Applied |
| 16:43 | rweir | ah nice |
| 16:43 | puredanger | Ben Vandgrift is my co-author |
| 16:43 | amalloy | how about Clojurin' Action? |
| 16:43 | SagiCZ1 | sorry to jump in so late.. but just my 5 cents.. i really did not enjoy Joy of Clojure |
| 16:43 | puredanger | that might be too similar to an existing book :) |
| 16:44 | amalloy | i feel like the clojure book space doesn't have enough confusingly-similar names |
| 16:44 | SagiCZ1 | it felt like to hard for a beginner and too easy for an experienced.. |
| 16:44 | puredanger | amalloy: yeah, was thinking we should call it Programming in Clojure :) |
| 16:44 | SagiCZ1 | how about "Thinking in Clojure" |
| 16:44 | SagiCZ1 | or.. "Clojure Effective" |
| 16:44 | rweir | SagiCZ1, I found it to be in a good spot between "I've been writing clojure code that does a thing but I can already tell it is ugly" |
| 16:45 | puredanger | we thought about Thinking but publisher was worried of similarities to other Thinking in books |
| 16:45 | SagiCZ1 | rweir: and what would you recommend as one step before that? i went through the clojure-koans already... |
| 16:45 | puredanger | 4clojure? |
| 16:45 | clojurebot | 4clojure is the place to go for Clojure exercises |
| 16:45 | puredanger | or exercism.io |
| 16:45 | rweir | SagiCZ1, I read much of the o'reilly book, and tried 4clojure |
| 16:45 | SagiCZ1 | what is 4clojure? |
| 16:45 | rweir | (also writing a lot of clojure code at work) |
| 16:45 | amalloy | $google 4clojure |
| 16:45 | lazybot | [4clojure – Welcome!] https://www.4clojure.com/ |
| 16:46 | rweir | alas we're all beginners but skilled enough to tell :| |
| 16:46 | SagiCZ1 | at work i am being overwhelmed with Java EE.. so sad :( |
| 16:46 | SagiCZ1 | amalloy: thanks for the link |
| 16:46 | puredanger | SagiCZ1: You mean @Sad |
| 16:47 | SagiCZ1 | puredanger: sorry i dont get it.. why not "sad"? :) |
| 16:47 | puredanger | isn't everything annotations in JEE? |
| 16:47 | SagiCZ1 | 4clojure looks like a next step to koans.. i like it |
| 16:47 | SagiCZ1 | puredanger: oh i get it now.. yes.. its horrible.. i spend 80% of my time writing boilerplate code |
| 16:47 | SagiCZ1 | then i write something in clojure and i cant believe it can work with so few lines of code.. |
| 16:48 | puredanger | SagiCZ1: it's literally 100% glue code somehow. like gluing glue together to other glue with glue. |
| 16:48 | puredanger | well, at least the last time I did it that's how it felt |
| 16:48 | SagiCZ1 | puredanger: i dont even know where the actual logic executes anymore |
| 16:48 | puredanger | Oracle HQ |
| 16:49 | SagiCZ1 | puredanger: spring sets up some contexts, then injects dependencies here and there.. then the ui connects to all the silly beans.. is there anyone who stays sane writing Java EE web apps? |
| 16:53 | michaelr | yeahh well |
| 16:53 | michaelr | it was a waste of time |
| 16:53 | michaelr | I didn't get to try the new cider |
| 16:53 | michaelr | emacs live would not cooperate |
| 16:54 | technomancy | (inc amalloy) ; belatedly but that was classic |
| 16:54 | lazybot | ⇒ 153 |
| 16:55 | michaelr | did I miss something :) |
| 16:55 | SagiCZ1 | can i look at some solutions to 4clojure problems? |
| 16:56 | puredanger | I think you have to turn on the code golf mode |
| 16:56 | puredanger | and then follow people. |
| 16:56 | puredanger | although I followed chouser and his answers made me cry |
| 16:57 | SagiCZ1 | i can turn that on when i register i guess? |
| 16:57 | puredanger | dunno, it's been a few years :) |
| 16:57 | rweir | pretty much all of them are googlable if you're really stuck |
| 16:58 | puredanger | I think here: http://www.4clojure.com/league |
| 16:59 | amalloy | you can follow people without having to opt-in to the league, as far as i can remember |
| 16:59 | puredanger | http://www.4clojure.com/users - follow people there |
| 16:59 | puredanger | amalloy: totally possible |
| 16:59 | amalloy | i can't imagine why i'd have made the two depend on each other |
| 17:00 | SagiCZ1 | neither of you is there :D |
| 17:00 | puredanger | oh, did you work on it? I am stupid. |
| 17:00 | amalloy | puredanger: yes, more of it is mine than anyone else's, and it's running on my server :) |
| 17:00 | puredanger | amalloy: well thank you, it's great. |
| 17:00 | puredanger | (inc amalloy ) |
| 17:00 | lazybot | ⇒ 5 |
| 17:01 | puredanger | wat |
| 17:01 | amalloy | you're apparently the first person to think my username ends with a space |
| 17:01 | amalloy | *fifth |
| 17:01 | puredanger | ah :) |
| 17:01 | puredanger | (inc amalloy) |
| 17:01 | lazybot | ⇒ 154 |
| 17:01 | SagiCZ1 | wait what.. |
| 17:01 | puredanger | better. my client added that |
| 17:01 | SagiCZ1 | symbol can end with a space? |
| 17:02 | puredanger | ,(symbol "sure why not ! ") |
| 17:02 | clojurebot | sure why not ! |
| 17:02 | amalloy | SagiCZ1: the inc/dec system isn't real clojure. it's a hacky parser |
| 17:02 | amalloy | although it is true that you can construct symbols that the reader couldn't have read |
| 17:02 | SagiCZ1 | amalloy: ofc.. im blind |
| 17:02 | technomancy | should have gotten a gsoc project to upgrade lazybot's inc/dec to use the reader |
| 17:02 | technomancy | stretch goal: juxt support |
| 17:04 | SagiCZ1 | amalloy: can i control the "Run" button with keyboard shorcut? |
| 17:04 | amalloy | tab+RET probably |
| 17:05 | amalloy | probably doesn't work if you leave the javascript editor mode on; i turn that junk off |
| 17:05 | SagiCZ1 | just makes tab in the editor :) .. k dont worry about it |
| 17:07 | SagiCZ1 | amalloy: anyway.. very nice website :) |
| 17:08 | amalloy | you're welcome, SagiCZ1. i do love teaching |
| 17:09 | dnolen_ | ClojureScript 0.0-2301 going out for those of you that want to try reducers from ClojureScript |
| 17:09 | dnolen_ | the work involved porting a bit of Java so likely some edge cases, error reports welcome |
| 17:12 | tuft | sweet =) |
| 17:12 | mdeboard | yeah, wow |
| 17:13 | jjwatt | dnolen_: woa. neat. do they use webworkers? |
| 17:13 | mdeboard | dnolen_: working through a small react project.. you were right, om makes much more sense now. |
| 17:13 | dnolen_ | s/reducers/transducers |
| 17:14 | dnolen_ | jweiss: er I meant transducers and no |
| 17:14 | dnolen_ | mdeboard: glad to hear it |
| 17:14 | mdrogalis | dnolen_: That was fast :) |
| 17:15 | dnolen_ | mdrogalis: well porting the Clojure was easy copy and past |
| 17:15 | tuft | i'm thinking my first clojurescript project could be a window manager for os x using https://github.com/pd/zephyros |
| 17:15 | dnolen_ | the Java bits were a bit fiddly as usual |
| 17:15 | mdrogalis | dnolen_: Yeah. Still, good job. Appreciated. |
| 17:16 | dnolen_ | mdrogalis: it'll be even cooler when we get cljs.core.async sync'ed up |
| 17:18 | jjwatt | awesome. I hadn't seen rich's newer blog post about transducers (http://blog.cognitect.com/blog/2014/8/6/transducers-are-coming) |
| 17:20 | mdrogalis | dnolen_: Yup. I think that'll be a nice show of power. |
| 17:32 | SagiCZ1 | ,(take 2 (repeatedly rest '(:a :b :c :d :e))) |
| 17:32 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.core$rest cannot be cast to java.lang.Number> |
| 17:33 | SagiCZ1 | ,(repeatedly 3 rest '(:a :b :c :d :e)) |
| 17:33 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core/repeatedly> |
| 17:34 | TEttinger | ,(repeatedly 3 #(rest '(:a :b :c :d :e))) |
| 17:34 | clojurebot | ((:b :c :d :e) (:b :c :d :e) (:b :c :d :e)) |
| 17:34 | hiredman | ,(doc iterate) |
| 17:34 | clojurebot | "([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects" |
| 17:34 | TEttinger | ,(take 3 (iterate rest '(:a :b :c :d :e))) |
| 17:34 | clojurebot | ((:a :b :c :d :e) (:b :c :d :e) (:c :d :e)) |
| 17:34 | SagiCZ1 | i think i want reduce maybe |
| 17:34 | TEttinger | hiredman beat me to it :) |
| 17:34 | SagiCZ1 | reduce 3 times |
| 17:35 | TEttinger | what are you trying to do? |
| 17:35 | hiredman | ,(doc reductions) |
| 17:35 | clojurebot | "([f coll] [f init coll]); Returns a lazy seq of the intermediate values of the reduction (as per reduce) of coll by f, starting with init." |
| 17:35 | SagiCZ1 | nth |
| 17:35 | SagiCZ1 | withouth nth |
| 17:35 | SagiCZ1 | dont tell me the solution though |
| 17:35 | amalloy | ah, for 4clojure |
| 17:35 | TEttinger | ah, yeah |
| 17:35 | TEttinger | there's lots of ways to do that |
| 17:36 | SagiCZ1 | i am only looking for the pretty solutions |
| 17:36 | TEttinger | my favorite is #(`[~@%] (`[~@%&] (+))) |
| 17:36 | TEttinger | which is not a pretty solution |
| 17:36 | SagiCZ1 | holy crap |
| 17:36 | TEttinger | it's a swearjure example |
| 17:37 | SagiCZ1 | it actually works |
| 17:37 | TEttinger | ,(#(`[~@%] (`[~@%&] (+))) [:! :? :*] (+)) |
| 17:37 | clojurebot | :! |
| 17:37 | TEttinger | ,(#(`[~@%] (`[~@%&] (+))) [:! :? :*] (*)) |
| 17:37 | clojurebot | :? |
| 17:37 | SagiCZ1 | https://en.wikipedia.org/wiki/Brainfuck |
| 17:38 | TEttinger | it won't make sense to explain it without reading hyPiRion's article |
| 17:38 | TEttinger | http://www.hypirion.com/musings/swearjure this won't make sense either probably |
| 17:38 | TEttinger | swearjure is a fun toy |
| 17:39 | SagiCZ1 | look TEttinger, i am having some trouble implementing nth here.. i dont think it would be good for my mental health to read that article ;) |
| 17:39 | TEttinger | heh, I can explain how that example works now |
| 17:39 | TEttinger | it's creating a vector from the first arg |
| 17:40 | TEttinger | and it's using the second arg as an argument to it |
| 17:40 | TEttinger | ,([0 1 2 3] 0) |
| 17:40 | clojurebot | 0 |
| 17:40 | TEttinger | ,([0 1 2 3] 1) |
| 17:40 | clojurebot | 1 |
| 17:40 | TEttinger | now if you can reproduce that behavior in a fn, you're done |
| 17:41 | TEttinger | remember, a lot more things in clojure can be used as fns that you would expect |
| 17:41 | SagiCZ1 | #((vec %1) %2) |
| 17:41 | amalloy | man, that solution was really hurting my head until i finally remembered that ##(#(do % %&)) '(1 2 3)) returns (2 3) and not (1 2 3) |
| 17:41 | lazybot | clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox5671$eval11415$fn |
| 17:41 | amalloy | well, whatever. you get what i meant |
| 17:42 | SagiCZ1 | ,(#((vec %1) %2) (range 10) 5) |
| 17:42 | clojurebot | 5 |
| 17:42 | TEttinger | woo |
| 17:42 | SagiCZ1 | is that correct? |
| 17:42 | amalloy | does 4clojure think so? |
| 17:42 | SagiCZ1 | vec makes vector from list and "vector" makes vector from its arguments right? |
| 17:43 | TEttinger | that's a lot cleaner than when I was trying to solve the same problem, and it should be. downside is it doesn't work for infinite seqs |
| 17:43 | TEttinger | yes |
| 17:43 | SagiCZ1 | amalloy: clojure4 says its ok |
| 17:43 | TEttinger | vec also works on most collections |
| 17:44 | SagiCZ1 | ,(vec {:a 0 :b 5 :c 4}) |
| 17:44 | clojurebot | [[:c 4] [:b 5] [:a 0]] |
| 17:44 | SagiCZ1 | ,(vector {:a 0 :b 5 :c 4}) |
| 17:44 | clojurebot | [{:c 4, :b 5, :a 0}] |
| 17:45 | SagiCZ1 | how would i get [:a 0 :b 5 :c 4] ? |
| 17:45 | SagiCZ1 | ,((comp vec list) {:a 0 :b 5 :c 4}) |
| 17:45 | clojurebot | [{:c 4, :b 5, :a 0}] |
| 17:45 | SagiCZ1 | ,((comp flatten vec) {:a 0 :b 5 :c 4}) |
| 17:45 | clojurebot | (:c 4 :b 5 :a ...) |
| 17:45 | amalloy | flatten :((((((( |
| 17:46 | Bronsa | , (vec (mapcat identity {:a 0 :b 5 :c 4})) |
| 17:46 | clojurebot | [:c 4 :b 5 :a ...] |
| 17:46 | amalloy | you want ##(apply concat{:a 0 :b 5 :c 4}) |
| 17:46 | lazybot | ⇒ (:a 0 :c 4 :b 5) |
| 17:46 | SagiCZ1 | ,(doc concat) |
| 17:46 | clojurebot | "([] [x] [x y] [x y & zs]); Returns a lazy seq representing the concatenation of the elements in the supplied colls." |
| 17:46 | amalloy | mapcat seq or mapcat identity also works, but it just looks awkward to me |
| 17:46 | SagiCZ1 | amalloy: i dont get it |
| 17:47 | SagiCZ1 | amalloy: unless.. |
| 17:47 | SagiCZ1 | amalloy: unless "apply" applies foo to both keys and values in a map |
| 17:48 | SagiCZ1 | i mean.. apply takes the elements of coll and uses them as arguments to foo.. what does it do when the coll is a map? |
| 17:48 | metellus | SagiCZ1: it's because one "element" of a map is a key/value pair |
| 17:49 | metellus | so it's like ##(apply concast [[:a 0] [:b 5] [:c 4]]) |
| 17:49 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: concast in this context |
| 17:49 | TEttinger | 4clojure is awesome |
| 17:49 | SagiCZ1 | so it translates it to: ##(concat [:a 0] [:b 1] [:c 2]) |
| 17:49 | lazybot | ⇒ (:a 0 :b 1 :c 2) |
| 17:49 | metellus | so it's like ##(apply concat [[:a 0] [:b 5] [:c 4]]) |
| 17:49 | lazybot | ⇒ (:a 0 :b 5 :c 4) |
| 17:49 | Bronsa | amalloy: I'm so used to mapcat that I often forget how it's implemented. apply concat is definitely better there |
| 17:49 | metellus | yeah, SagiCZ1 |
| 17:50 | SagiCZ1 | metellus: thank you |
| 17:51 | SagiCZ1 | TEttinger: I like the idea of walking me through all the basic functions and letting me implement them myself. There is just too much clojure functions prepared for us. |
| 17:52 | SagiCZ1 | sorry for my English btw.. |
| 17:53 | TEttinger | SagiCZ1, yep, after you get out of the early 4clojure problems they let you use everything to solve trickier things |
| 17:54 | SagiCZ1 | TEttinger: yeah i would expect that |
| 18:42 | joshhead | is it now recommended to depend on lein-cljsbuild plugin from profiles.clj and not project.clj? (:plugins [[lein-cljsbuild "1.0.3"]]) |
| 18:47 | joshhead | I misread something in the readme, I think I was just confused |
| 19:05 | justin_smith | joshhead: in case you haven't figured it out yet, you can define per-project plugins in project.clj |
| 19:08 | joshhead | justin_smith: Yep I've got it. |
| 19:14 | dnolen_ | just cut ClojureScript 0.0-2307, same as 0.0-2301 just *way* faster for transducer and reducer based code |
| 19:16 | loon | anyone answer a question on how "seq map" gets the order it returns? |
| 19:17 | loon | (seq map) rather |
| 19:17 | loon | trying to figure out what order (keys map) returns |
| 19:18 | metellus | the order isn't guaranteed |
| 19:18 | amalloy | loon: arbitrary |
| 19:19 | loon | amalloy: hmm, ok |
| 19:19 | loon | amalloy: thanks |
| 19:19 | loon | metellus: thanks |
| 19:22 | cbp` | !die |
| 19:23 | mdeboard | finally |
| 19:31 | scape_ | lol |
| 19:52 | mdeboard | Is there a consensus wrt clojurescript and routing vs. explicit event-handling? |
| 19:52 | mdeboard | I'm doing event handling in reactjs to handle page loading and what have you... but I guess they fulfill different needs |
| 19:52 | Glenjamin | mdeboard: i tend to trigger an event, that updates the url |
| 19:53 | Glenjamin | and also use that URL to drive my page state |
| 19:53 | Glenjamin | the URL is just another prop that your top-level component uses to decide what to do |
| 19:53 | mdeboard | I tried using react-router library but it seems like it pretty fundamentally changes how react works |
| 19:54 | mdeboard | or, maybe, it changes how you're supposed to write the funcs |
| 19:54 | Glenjamin | i have a router that gives me a component class reference when given the current URL |
| 19:56 | mdeboard | Yeah I was using secretary in cljs/om, seems to work pretty good |
| 19:56 | mdeboard | but react-router is like an indirection layer, it's kind of weird. |
| 19:57 | Glenjamin | react-router is just a way to wrap up that url-to-page-component stuff, and give you a <Link> component to drive the url changes |
| 19:58 | mdeboard | Yeah, I guess I'm just not getting it |
| 20:00 | mdeboard | seems like a good and proper abstraction though. |
| 20:15 | joshhead | I'm trying to use the new pipeline function in core/async 0.1.319.0-6b1aca-alpha but I'm getting a "Cannot read property 'call' of undefined" error. Might just be me, has anyone else had an issue trying transducer support in new cljs? |
| 20:16 | joshhead | possibly the transducer stuff is not in core.async cljs yet? |
| 20:17 | dnolen_ | joshhead: no there yet |
| 20:17 | dnolen_ | er, not there yet |
| 20:17 | joshhead | ah okay, thanks dnolen_ |
| 20:18 | dnolen_ | joshhead: might give it a go tomorrow if I have time if someone else doesn't get to it first |
| 20:18 | joshhead | I'll check for it again soon :) |
| 20:23 | mdeboard | elixir has really cool pipeline func |
| 20:24 | mdeboard | apropos of nothing |
| 20:49 | verma | technomancy, lein change :dependencies identity doesn't seem to restore quotes around version numbers |
| 21:05 | mdeboard | Glenjamin: What did you mean by 18:52 <Glenjamin> and also use that URL to drive my page state |
| 21:05 | mdeboard | were you talking react or om |
| 21:05 | mdeboard | if the former I'll ask in #react |
| 21:34 | tuft_ | is there a way to get test.check to include some additional values in failure output? |
| 21:34 | tuft_ | hmm, wonder if it would do a regular let binding inside my for-all stuff |
| 21:35 | tuft_ | nope =) |
| 21:35 | tuft_ | that could be handy |
| 21:41 | xeqi | tuft_: you could use (gen/return ...) as a generator in the forall |
| 22:48 | akhudek | hmm, lein is suddenly freezing indefinitely when creating an uberjar |
| 22:49 | brehaut | thats often an indication that you have some code running in a top level that shouldnt be |
| 22:49 | brehaut | (ie, something beyond an ns form or a def) |
| 22:50 | akhudek | yeah, though I’ve checked for this and havent’ found it yet :-/ |
| 22:50 | akhudek | will look again |
| 22:50 | brehaut | could even be a def (rather than defn) if it, eg, creates a blocking service or something |
| 22:51 | akhudek | probably only a def right? |
| 22:52 | brehaut | i mean something like (def webserver (ring/run-jetty …)) |
| 23:07 | akhudek | hmm, it’s lein-environ |
| 23:10 | akhudek | or maybe not |
| 23:15 | maxnomoon | Hello, guys. Can anyone help with some code review on a simple game logic? |
| 23:16 | maxnomoon | I tried exercims.io, but they seem to be focused on simple exercises and there aren't many folks there. |
| 23:16 | arrdem | throw up a refheap and someone may criticize |
| 23:16 | arrdem | ~ask |
| 23:16 | allenj12_ | hey, what would be the most efficient way for creating a quantize function.. so example would be (quantize 55 [40 50 57 60]) would be 57 |
| 23:17 | allenj12_ | i thought about just looping an incremented number and subtracting and adding till i find a matching number.. but it seems messy |
| 23:18 | maxnomoon | I'm generating a simple tribe. At first I was conj'ing two arrays of men and women, later I decided that would be more 'functional' to generate [:male :female :male] sequence and map over it with some 'generate-human' function. |
| 23:18 | maxnomoon | However that makes diffucult generating different gender based on some ratio. |
| 23:18 | allenj12_ | maxnomoon: you should refheap your code and comment your question |
| 23:19 | danielcompton | What's the name of the concept that goes- reduce: sequence -> value, map: sequence -> sequence and _ : sequence to larger sequence? It's like fanout or mapcat but I thought there was a proper name for it.' |
| 23:20 | arrdem | danielcompton: mapcat's the common one. (reduce concat (map f seq)) is equivalent tho.. |
| 23:21 | danielcompton | arrdem: what do other communities call it? I'm trying to name a function that takes a value and returns a sequence |
| 23:22 | maxnomoon | https://www.refheap.com/89033 I need some help with general tips on how to approach that kind of a problem. |
| 23:28 | TEttinger | danielcompton: disperse, spread, enlarge (contrasted with reduce) |
| 23:42 | justin_smith | danielcompton: from value to sequence could be generate or iterate |
| 23:43 | acagle1 | exit |
| 23:43 | amalloy | danielcompton: there are a lot of functions that return a sequence from a value. the most general one is called unfold, in haskell (where they call reduce fold) |
| 23:44 | amalloy | arrdem: never write (reduce concat ...) - you want apply concat instead |
| 23:44 | danielcompton | I think unfold is the generic term |
| 23:45 | danielcompton | The opposite of fold (reduce) |
| 23:55 | akhudek | wow, importing [javax.imageio ImageIO] is what causes uberjar to fail to terminate |
| 23:59 | akhudek | hm, or maybe it’s just the number of imports |