#clojure logs

2014-08-07

00:00ambrosebsthey mostly implement "flat" contracts, like even?, contains?
00:00ambrosebsand some higher-order function contracts
00:00ambrosebsit gets interesting when you want to constraint a channel to accept a function of certain input/output
00:01ambrosebsand then something deep inside the program goes wrong
00:02ambrosebsyou 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:02ambrosebserm, I'm sure I'll think of a better way of explaining that!
00:02ambrosebsin other words: preconditions/schema are just the beginning
00:05trptcolinsure
00:07danielcomptontechnomancy: can lein plugins be used as release tasks in lein release?
00:27hellofunkIn 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:38technomancydanielcompton: definitely
00:39danielcomptontechnomancy: 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:41notostracadanielcompton: moral of the story, never clean anything, especially binaries or the human body
00:42notostracaweird, some netsplits on quakenet and freenode within 4 minutes of each other
00:45amalloynotostraca: maybe some physicists just discovered electricity is impossible and it's rippling out to the internet
00:46gfixlernotostraca: is the pattern that of a standard shockwave pattern?
00:48notostracaheh
00:49notostracayeah we had an earthquake on the other side of a small lake (staying at a lakefront home) on 4th of july weekend
00:49notostracamy dog was TERRIFIED
00:49notostracaat the same time there was thunder and lightning
00:49notostracaand later fireworks
00:49notostraca"why did you bring me here human?"
00:49ambroseb_,(doc sequence)
00:49clojurebot"([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:50notostracatransducer!
00:50ambroseb_,*clojure-version*
00:50clojurebot{:interim true, :major 1, :minor 7, :incremental 0, :qualifier "master"}
00:50notostracaaaaaaa
00:50notostracasomeone change the title?
00:50notostracais it out yet?
00:50ambroseb_alpha-1 is out yes
00:50notostracaawesome
00:51notostracaI never upgraded to 1.6 because I didn't understand reducers yet, or why I should use them
00:51notostracaif 1.7 is improving on them, I think I should learn :)
00:53trptcolin,(sequence (map inc) (range 10))
00:53clojurebot(1 2 3 4 5 ...)
00:53trptcolinaww ambrosebs is using me as a repl from twitter isn't he
01:09notostraca,(sequence (map sequence) ["foo" "bar"])
01:09clojurebot((\f \o \o) (\b \a \r))
01:33danielcomptontechnomancy: is there a way to not sign a git tag when doing ["vcs" "tag"] ?
01:34danielcomptonIn a lein release
01:34RaynesWhy would you ever want to do a thing like that
01:35danielcomptonRaynes: gpg export laws
01:36notostracaall the syrian warlords love lein
01:46amalloyare 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:56mdeboardI'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:57mdeboardI have a k/v pair like {:showing :all} in app state, but when I try (:showing app-state), it's nil
01:57mdeboardI'm following the tutorail :(
01:57mdeboardtutorial too
01:57mdeboardobv i've hosed someting
02:07amalloymdeboard: 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:08mdeboardslave driver.
02:08mdeboardI am trying to get my code in some kind of order so i can paste it
02:08mdeboardwithout it being totally impossible to decipher
02:08amalloyit's possible you're missing a deref or something? maybe app-state is (atom {:x :y}), not just {:x :y}
02:09mdeboardhttps://gist.github.com/mattdeboard/e2e473558572a202d9e6 is the code
02:09amalloyyou 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:09amalloy(assuming here that type is a function that makes sense in cljs)
02:09mdeboardI'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:09mdeboardapp-state in the defmulti is a PersistentVector, not a MapCursor
02:10mdeboardThe dispatch is on line 87
02:10danielcomptonamalloy: I was meaning export laws for gpg
02:10mdeboardI was just passing `app`, but that wasn't working so I tried making a new map
02:18mdeboardI 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:19piranhaanybody can explain like I'm five why transducers are cool? :)
03:23SHODANpiranha, because they help you take over the world quicker
03:24piranhaSHODAN: that's what I understood as well, but how?
03:24piranhaThat's the main question, to be honest
03:24piranhathey look like a partial application of map/reduce and I honestly don't really understand implications or applicability
03:24SHODANthey do it by vaporizing the temporal plasma causes fluctuations in the quantum area
03:25piranhawhat's so cool about them that I wasn't able to do as good before...
03:25piranha:-)
03:25SHODANoops ;)
03:25SHODANdidn't read that through :)
03:34TEttingerpiranha, oh my god where are your parents?
03:34TEttingerwe need to get you into child protective services
03:37pyrtsapiranha: 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:38pyrtsaWhat 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:47TEttingerpyrtsa: !!!
03:49amalloyTEttinger: surely that's not news: reduce has had that feature since 1.5, and transducers are just combinators for reducing
03:49TEttingerI didn't realize what transducers did really
03:49TEttingeror reducers for that matter
03:52winkTEttinger: something with burritos, right?
03:52pyrtsaBurritos indeed. :)
04:09piranhapyrtsa: hm, that makes some sense
04:10piranhaTEttinger: redurers are easy - they are just same map/filter/reduce, but working in parallel
04:12TEttingercool
04:12clgvpyrtsa: wink: what's taccos then?
04:13pyrtsaI suppose reducers are like tacos.
04:15hyPiRionSo now for the winning question: What would (sequence ((filter even?) (map #(* 3 %))) [1 2 3]) return?
04:16pyrtsahyPiRion: An error! (You forgot the comp.)
04:16hyPiRionpyrtsa: no, and that's the problem :p
04:16pyrtsaBut the point of course is that the composition is read left-to-right, unlike with ordinary functions in (comp f g).
04:16pyrtsahyPiRion: Ouch!
04:16hyPiRionI get (3 6 9)
04:17clgvyeah, (->> seq (map inc) (filter even?)) gbeing equivalent to ((comp (map inc) (filter even?)) seq) is quite puzzling
04:17pyrtsaclgv: See what hyPiRion wrote. That bug will come and bite us.
04:17clgvpyrtsa: yes.
04:18amalloypiranha: "in parallel" is far from the most interesting part of reducers
04:18pyrtsaI mean, the fact that its a bug of our own and the library doesn't warn us of it.
04:18piranhaamalloy: hm, what's the most interesting part?
04:18clgvpyrtsa: hyPiRion: but there is no easy fix with respect to how transducers are currently implemented since they are regular functions
04:18amalloymore 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:19hyPiRionclgv: I know, but it's easy to be confused
04:19piranhaah...
04:19pyrtsaI 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:19clgvhyPiRion: that's what I thought immediately when reading the blog post
04:20clgvI first thought they had a separate namespace like reducers
04:22hyPiRionpyrtsa: I find it a bit strange. They could've just added mapt, filtert, etc. to avoid that
04:22pyrtsaYep.
04:24clgvhyPiRion: or a separate namespace like for reducers
04:24hyPiRionclgv: right, that would work too
04:24clgvwell I guess the intention of that alpha release and the announcement was to get discuission ;)
04:25Bronsaexceptions with transducers are going to be fun
04:26clgvBronsa: yeah, it would help to be able to name the result functions, I guess. similar to (fn myname [] ...)
04:26amalloyclgv: 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:27AeroNotixCan anyone ELI5 http://blog.cognitect.com/blog/2014/8/6/transducers-are-coming ?
04:27clgvamalloy: you think the extra namespace leads to less usage for core.reducers?
04:28amalloyclgv: 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:28clgvI am curious what would be the reasons. I didn't get that expression with usual libraries
04:29clgvamalloy: but map without a seuqence will also be completely different than with a sequence, right?
04:29pyrtsaTo 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:30amalloyyes. but i can use the new map without having to lose compatibility with code that uses the old one
04:31clgvamalloy: humm without a concrete example for demonstration, I just have to believe that claim for now
04:31amalloyor disbelieve! i'm just some guy on the internet
04:32hyPiRionAeroNotix: (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:32clgvamalloy: you have gained "some" credibility for me from reading your posts & co ;)
04:33AeroNotixhyPiRion: so the benefit is that it works with different datastructures other than sequences?
04:33lpvbhow do I (doseq [x coll index (range (count coll))] ) like I intended? It looks like it's doing it in a nondeterministic way
04:34hyPiRionAeroNotix: Right, it can be used for core.async and core.reducers. It can be lazy (like map) or eager (like reduce/reducers).
04:34AeroNotixhyPiRion: the blog post made it ten times more confusing than that. Is that all there is to it?
04:34sm0keis rich becoming a benevolent dictator?
04:35sm0kewhy are there no CIP kind of thing? Clojure Improvement Proposal?
04:35amalloy[[x coll] (map-indexed list coll)] would be one way
04:36hyPiRionAeroNotix: That's the core of it, as far as I understand
04:36AeroNotixhyPiRion: that definitely could've been expressed better
04:36clgvsm0ke: that's called jira ;)
04:36sm0kewhere is the jira for this?
04:36sm0ketranducers
04:36hyPiRionAeroNotix: yeah, it's usually like that :p
04:37clgvsm0ke: I dont know whether that has a ticket yet
04:37clgvsm0ke: is there a design page yet?
04:37mercwithamouthany cool projects going on?
04:37sm0kemercwithamouth: clojure community is confused on what is this tranducers
04:38lpvbamalloy: thanks
04:38amalloywhether it has a ticket yet? there will never be a ticket saying "add transducers to clojure"; rich has done it already
04:38sm0keat least the mass of it
04:39mercwithamouthsm0ke: thats hot...
04:39Glenjaminmy 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:40clgvGlenjamin: yeah, read that as well. the implementation does not quite reflect "extracted" though ;)
04:40Glenjaminconsolidated perhaps :)
04:41hyPiRionGlenjamin: "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:41hyPiRionAlthough your wording was way more precice
04:41Glenjaminheh
04:42hyPiRionWonder how many years it'll take before Go supports the same thing.
04:48djcoinDoes anyone have an opinion on D (being used at facebook for example) that has macros, has functional idioms etc.?
05:01lpvbshould I (defn -main [& args] ... 0)
05:01lpvbdoes clojure do return codes
05:03mpenetlpvb: java does, (System/exit 0)
05:08Bronsaamalloy: http://dev.clojure.org/jira/browse/CLJ-1494
05:11Glenjamin,(mapcat inc)
05:11clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$map$fn__4338>
05:26hellofunkany 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:27TEttingerhellofunk, a lazy seq of lazyseqs maybe?
05:27hellofunkTEttinger 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:28hellofunkthe fn I complement in is a set, using set-as-function
05:28TEttinger,(doall (map identity (repeat 3 5)))
05:28clojurebot(5 5 5)
05:29amalloy(doall x) always returns x. if you give it a lazy seq, you get a lazy seq back
05:29amalloyit's one that's had its elements evaluated, but it's still a lazy seq
05:30hellofunkamalloy 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:30gws,(doc doall)
05:30amalloyhellofunk: uhhhh, well that's kinda the whole point. if it were lazy it wouldn't have a name starting with do
05:30clojurebot"([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:31hellofunkamalloy no my point is that the docs suggest it is realizing the whole seq, therefore not returning it in a lazy form
05:31amalloyit is realizing the whole seq
05:31hellofunkamalloy but you are saying that it could return a lazy seq, even though it is realizing the whole seq?
05:31gwsand then it's returning the head of the lazy seq :)
05:31amalloybut the object is still a lazy sequence: in clj-jvm, its class is LazySeq
05:32amalloyit's a LazySeq whose elements are all realized; it doesn't by some magic transmute itself into a vector or whatever
05:32hellofunkok, so how to convert a lazy seq into a non-lazy seq? call seq on it?
05:33amalloyyou are not understanding what "lazy seq" means
05:33amalloyit is a sequence whose elements might, or might not, actually exist in memory
05:33amalloya lazy seq with all elements in memory is "not lazy" in the sense that you mean, but it is still a lazy seq
05:34hyPiRionhellofunk: it's not a question of converting a lazy seq into a non-lazy seq, but rather how to realise the lazy seq
05:35hellofunkok, 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:36hellofunkthis answer from Rich is throwing me off: http://stackoverflow.com/questions/1641626/how-to-convert-lazy-sequence-to-non-lazy-in-clojure
05:38hellofunklooks like in my case it is as simple as doing (into [] ...) to convert iit
05:38amalloyhellofunk: 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:38hellofunkamalloy how did I answer the question myself?
05:39amalloyyou called doall. that is literally all you need. the sequence's items are therefore all in memory
05:39hyPiRionhellofunk: "Just because the seq has type LazySeq doesn't mean it has pending evaluation"
05:39amalloythere is no "un-lazying" more thorough than that
05:40amalloyhow 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:40hellofunkamalloy 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:41amalloyyou 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:42hellofunkamalloy 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:03hellofunki found it necessary to upvote that question just so Rich wasn't stuck with a rep of 666
06:03visofhi
06:05visofwhen 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:06visofcan anybody suggest anything about this problem?
06:11clgv,(clojure-version)
06:11clojurebot"1.7.0-master-SNAPSHOT"
06:11clgvah wow ^^
06:11clgv,(map inc)
06:11clojurebot#<core$map$fn__4338 clojure.core$map$fn__4338@125b4d>
06:13alexyakushev,(transduce (comp (map inc) (filter even?)) + 0 (range 10))
06:13clojurebot30
06:14alexyakushevCool
06:14alexyakushev(->> (range 10) (filter even?) (map inc) (reduce + 0))
06:14alexyakushev,(->> (range 10) (filter even?) (map inc) (reduce + 0))
06:14clojurebot25
06:15Bronsaalexyakushev: that's not the same
06:15alexyakushevBronsa: I get it now
06:15Bronsa,(->> (range 10) (map inc) (filter even?) (reduce + 0))
06:15clojurebot30
06:15alexyakushevI thought comp applies arguments in the reverse order
06:15alexyakushevDuh
06:15visofcan anybody help?
06:16Bronsait does, that behaviour is just a result of how transducers compose
06:16alexyakushev,((comp inc #(* 2 %)) 10)
06:16clojurebot21
06:16alexyakushevBronsa: OK, so that is something to be careful about
06:17Bronsayeah, you just have to remember to compose transducers as if you were using ->> rather than comp
06:18alexyakushevCan't say I like it:(
06:19Glenjamin,(doc comp)
06:19clojurebot"([] [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:21alexyakushevFirst it was "return type is based on arity", now comp works in different order if it works with transducers
06:21alexyakushevAnd the former has already leaked leading to creation of "flatmap" because mapcat already has varargs
06:22Bronsaalexyakushev: http://dev.clojure.org/jira/browse/CLJ-1494
06:23alexyakushevThis might break existing code
06:23Bronsano
06:23Bronsa(mapcat f) has never worked, I explain that in the description
06:23alexyakushevYeah, right, sorry
06:24alexyakushevGot it confused with concat
06:25alexyakushevAnyway the whole thing seems crutchy. Reducer functions lived perfectly in their own namespace, why couldn't transducers?
06:25lvhman I dislike jira
06:26alexyakushevEspecially since the transducer operations are the only one left necessary (so that operations on reducers and channels can be removed)
06:26lvhalexyakushev: 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:26lvhyeah I don't get the channel one
06:26lvhI understand why you want to apply a transducer to a channel
06:27lvhI don't udnerstand why it has to be in the place of the buffer arg
06:28Glenjamin,(do (require core.async) (doc core.async/chan))
06:28clojurebot#<CompilerException java.lang.ClassNotFoundException: core.async, compiling:(NO_SOURCE_PATH:0:0)>
06:28Glenjamin,(do (require 'core.async) (doc core.async/chan))
06:28clojurebot#<FileNotFoundException java.io.FileNotFoundException: Could not locate core/async__init.class or core/async.clj on classpath: >
06:29Glenjaminhttp://clojure.github.io/core.async/#clojure.core.async/chan <- the buffer is the second arg, transducer is the third - was buffer third before?
06:29alexyakushevlvh: 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:29lvhGlenjamin: 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:29lvhcould just be a bug in the blog post
06:30lvhor maybe I just misread, of course :)
06:30alexyakushevlvh: I doubt anyone will initially write the algorithm with transducers. Rather write in generic way, then rewrite to transducers
06:32alexyakushevSay, how do you execute ,(map inc (range 5)) with transducers?
06:32alexyakushev,(into () (map inc) (range 5))
06:32clojurebot(5 4 3 2 1)
06:32alexyakushevAnd oops
06:34alexyakushev,(sequence (map inc) (range 5))
06:34clojurebot(1 2 3 4 5)
06:35pyrtsa,(into [] (map inc) (range 5))
06:35clojurebot[1 2 3 4 5]
06:50clgv,(source into)
06:50clojurebotSource not found\n
06:50clgv,(doc into)
06:50clojurebot"([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:50clgvuh oh
06:51scape_i think that's not wise, to have xform in between the two. seems confusing as an overloaded argument
06:55scape_,(doc filter)
06:55clojurebot"([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:55sveriHi, 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:59scape_,(doc reduce)
06:59clojurebot"([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:59clgvsveri: if you dont find anything else, you hack it by jurst removing the cronjob when it is triggered
06:59visofcan i cast types in java inside clojure?
06:59scape_,(reduce (filter even) (range 5))
06:59clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: even in this context, compiling:(NO_SOURCE_PATH:0:0)>
06:59scape_,(reduce (filter even?) (range 5))
06:59clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/filter/fn--4361>
07:00pyrtsa,(sequence (filter even?) (range 5))
07:00clojurebot(0 2 4)
07:00scape_oh
07:01visofhow can i cast in clojure?
07:01Bronsavisof: what do you need that for?
07:02visofwhen 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:02visofBronsa: which is should be something like ((OrientBaseGraph) graph)
07:04Bronsavisof: OrientGraph doesn't extend OrientBaseGraph
07:04BronsaI'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:05visofBronsa: so what do you suggest?
07:05BronsaI don't know, I don't know that library
07:05Bronsayou need to use the right object, clojure has nothing to do with that
07:05llasramvisof: Check your versions? What version of blueprints do you have?
07:06visofllasram: 2.5.0
07:06visofBronsa: the right object as in doc should be OrientGraph which i use
07:07visofllasram: what i have in project [com.tinkerpop.blueprints/blueprints-core "2.5.0"]
07:08Bronsavisof: 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:09Bronsaah I see nevermind
07:09visofBronsa: check this section Methods inherited from class com.tinkerpop.blueprints.impls.orient.OrientBaseGraph
07:10Bronsavisof: it shouldn't really necessary to cast, but try ^OrientBaseGraph graph
07:11llasramvisof: Since there's doc-confusion, you could use reflection to see exactly what methods are present
07:11Bronsavisof: also try (filter #(= "createKeyIndex" (.getName %)) (seq (.getMethods (class graph))))
07:12Bronsallasram: lol ^
07:12svericlgv: Hm, I am afraid thats the way I will have to do it
07:12llasramBronsa: 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:15clgvsveri: but maybe you overlooked a one shot job option?
07:15visofBronsa: (#<Method public void com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.createKeyIndex(java.lang.String,java.lang.Class,com.tinkerpop.blueprints.Parameter[])>)
07:15Bronsavisof: yeah you see, the method signature is different
07:16Bronsayou need to provide another argument, an array of Parameters, whatever that needs to be
07:16Bronsavisof: you can try using (object-array [])
07:17visofbrixen: ClassCastException Cannot cast [Ljava.lang.Object; to [Lcom.tinkerpop.blueprints.Parameter; java.lang.Class.cast
07:17Bronsaerr (into-array Parameter [])
07:18Bronsathat should make the method call work, next you need to figure out what that param actually is
07:18Bronsavisof: 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:19Bronsavisof: 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:20visofBronsa: okay, thank you very much, i'm appreciating
07:21svericlgv: 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:22llasramsveri: Do you want to schedule the event to run at some arbitrary point in the future, or right away?
07:23visofBronsa: is should be something like this (.createIndex graph "name" Vertex (Parameter. "type" "UNIQUE")) ?
07:23visofwhen 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:24llasramsveri: 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:24visofi have imported the Parameter using (import 'com.tinkerpop.blueprints.Parameter)
07:24llasramvisof: You still need an array of parameters, not just a single parameter
07:25llasramThe Java varargs syntax is a Java illusion over the JVM reality
07:25Bronsavisof: (into-array Parameter [(Parameter. ..) ..])
07:27Bronsa(into-array [(Parameter. ..) ..]) works too
07:51sverillasram: thank you, that looks interesting, are the schedules as exact as the quartz library?
07:52sveriI found out that akka for instance looses some milliseconds over a long period of time
07:53llasramsveri: er, no idea
07:54llasramOOC, what are you trying to do at a higher level?
07:55sveriok, thank you :-)
08:44mpenet,(let [x (Exception. "foo)] (with-out-str (.printStackTrace x)))
08:44clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
08:45mpenet,(let [x (Exception. "foo")] (with-out-str (.printStackTrace x)))
08:45clojurebot""
08:45mpenet*out* vs *err*, nevermind
08:48ddellacostasomeone 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:48ddellacostaI forget her name
08:48annapawl`that would be me :)
08:49ddellacostaannapawl`: oh, hey! I was looking for your post
08:49ddellacostaannapawl`: can you give me the link? I couldn't find it through my lame googling
08:49annapawl`ddellacosta: http://annapawlicka.com/common-mistakes-to-avoid-when-creating-an-om-component-part-1/
08:49lvhhow do I work around >!, <! needing to be in a go block?
08:50lvhI want to *use* them from a go-block; I'm just defining helper fns
08:50ddellacostaannapawl`: awesome, thanks. Great stuff btw, very necessary. We need more Om info out there...
08:50llasramlvh: You don't. They need to be within the lexical scope of the go block for the code re-writing to work
08:51llasramlvh: You should be able to write helper macros using them, but you generally shouldn't need to even that
08:52annapawl`ddellacosta: thx :) these were just the most common mistakes of mine. will do a longer post once i have a bit more time
08:52ddellacostaannapawl`: would like to read it!
08:53lvhllasram: okay, so moral of the story don't define helper fns that do that
08:53lvhgotcha :p
09:13TimMcWake up and smell the [Object object]!
09:13SagiCZ1wink: what would taht be
09:13mdeboardlol
09:13mdeboard@ TimMc
09:15TimMc(Huh, I got the capitalization wrong.)
09:15mdeboardIt's Javascript
09:15mdeboarddon't worry about it
09:15TimMcheh
09:15mdeboardit all evalutes to null anyway
09:16mdeboardi mean the cover of the "Secrets of the Javascript Ninja" book features a Samurai
09:16winkthere's a book for that? I thought that must be an Ed Hardy-branded pink Kindle with only one PDF on it
09:17mdeboardhttp://www.manning.com/resig/ :P
09:17mdeboardsecrets of the javascript samurai doesn't have the same ring
09:18winkmdeboard: http://puppetlabs.com/sites/default/files/1316713879_castle_reaction_0.gif
09:18mdeboardit's all kabuki theater
09:18mdeboardhaha
09:47llasrammdeboard: but does it have the same 5 rings to it?
10:04blunteHello 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:04mdeboardsounds aboutright
10:04blunteHowever, 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:05mdeboardif-let ?
10:05blunteI 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:05mdeboard,(doc if-let)
10:05clojurebot"([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:05blunteHmm I'll take a look.
10:06TimMcor when-let
10:09Bronsai wish clojure had a cond-let too
10:13pyrtsaOr my silly little "ret". https://gist.github.com/pyrtsa/1af9fdd56267a3631b0c (Must invent a better name for it.)
10:14blunteI 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:14bluntereally I just want to bail out of the function if the first step returns 0 results.
10:14Bronsalooks interesting pyrtsa, (or (ret [..] ..) (ret [..] ..)) would works fine as a cond-let
10:16TimMcblunte: lexical bindings that you no longer need will be dropped (made available for GC.)
10:17pyrtsablunte: So my ret can be used like (ret [a (...) b (...) _ (...) c (...)] expr) where each (...) may optionally return (reduced foo).
10:18Glenjaminyou could extract the later steps into a function
10:18Glenjamin(let [thing (func)] (if (zero? (count thing)) thing (expand-thing thing)))
10:22blunteall interesting ideas. I'm thinking/looking. Thanks :)
10:49mdrogalisI 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:51puredangerit's an interesting consequence of the transducer model - there is statefulness "inside the machine"
10:51mdrogalispuredanger: Right. I guess Rich was alright with that trade-off. *Shrug*
10:51pyrtsa Yeah, it doesn't show to the outside because the iteration only ever happens once for one result.
10:52mdrogalisArtistic license I guess.
10:52pyrtsaModulo recomputations (with another atom instance) of course.
10:52puredangeryes - use sequence to get a lazy (cached) sequence
10:53pyrtsamdrogalis: 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:53puredanger(recursion not actually being nice w/o TCO in Java of course) :)
10:53pyrtsaExactly.
10:54mdrogalispyrtsa: Good point.
10:55pyrtsaI 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:55alandipert_maybe we can switch to Atomic{Boolean,Integer} if we need the perfs
10:56pyrtsa...mutation and jumping between several classes, inner classes, and source files making it a tad hard to follow.
10:56puredangermdrogalis: this same pattern comes up in reducers with take/drop
10:57mdrogalispuredanger: Ah, okay. I never really grok'ed how reducers worked the first time.
10:58mdrogalisThe day of wreckoning has come for me :P
11:01tbaldridgemdrogalis: 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:02mdrogalistbaldridge: 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:02pyrtsaMutable state may only be problematic if it leaks to the outside somehow.
11:02tbaldridgemdrogalis: 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:02mdrogalisUnfortunately there are a lot of ways to spring a leak.
11:03tbaldridgeexample?
11:03Glenjaminthere's a lack of introspection capability in this case
11:03mdrogalisI don't mean with respect to this, tbaldridge. Just in general
11:03tbaldridgemdrogalis: ah right
11:04sveriWhen 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:04tbaldridge(inc puredanger)
11:04pyrtsaE.g. Haskell uses local mutable state a lot.
11:04lazybot⇒ 6
11:04mdrogalissveri: Kind of like how memoize works.
11:04pyrtsaMemoization leaks memory though. It can be very problematic on a long-running JVM.
11:05sveripyrtsa: is that because of the memoization technique? or an implementation detail?
11:05Glenjaminit seems to me like this approach, as with pretty much all function composition, just leads to a lack of visibility
11:05tbaldridgepyrtsa: not true, you can have multiple ways to clear the cache
11:05mdrogalispyrtsa: Right. My point being how it accrues local state, but outsiders dont see it
11:05pyrtsasveri: It's because there's nothing cleaning up the memoised state.
11:06Glenjaminwhich you can either call information hiding, or a mystery
11:06tbaldridgeGlenjamin: 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:06pyrtsatbaldridge: Ok, cool. But with the classic (def f (memoize (fn [...] ...))) you do have a leak.
11:07tbaldridgepyrtsa: yeah, core/memoize is kindof a simplistic approach
11:07tbaldridgepyrtsa: see https://github.com/clojure/core.cache for better examples
11:08Bronsapyrtsa: there's core.memoize
11:08tbaldridgepyrtsa: core.cache has things like TTL, FIFO, soft refs, etc.
11:09Bronsacore.memoize has a memo-clear! + is backed by core.cache which has all the things tbaldridge said
11:09pyrtsatbaldridge: That's useful. Can you share the memory pool of core.cache between multiple memoized functions?
11:09pyrtsa(Or take the above question for core.memoize.)
11:11Bronsapyrtsa: the answer should be yes to both
11:15puredangerthere 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:16pyrtsaAgreed.
11:23vermasearching 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:23puredangerlein search helps you find deps
11:24puredangerI don't think there's anything to actually add deps automatically though
11:24vermahmm, ok, thanks puredanger
11:27trptcolinverma: 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:28vermatrptcolin, oh sweet
11:28vermatrptcolin, is there an existing pluing which uses that?
11:29trptcolinhttps://github.com/technomancy/leiningen/blob/da00e756859c6d104d5de4786a578c2d9d3fa85f/src/leiningen/release.clj
11:30trptcolinnot technically a plugin but a plugin would take a similar approach
11:30vermatrptcolin, sure, taking a look
11:32novaloopi'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:32Bronsanovaloop: for the same reason why (binding [x "hello"] (fn [] x)) won't
11:33novaloopoh i see, the call stack within the binding is completed when the fn is returned
11:34Bronsaright
11:34novaloopthank you!
11:34Bronsayou need to capture the value in the lexical scope if you need it
11:42novaloopis there a reason reify doesn't work from within a macrolet (from clojure.tools.macro)? (macrolet [] (reify Object (toString [_] "hello"))) ;; ClassCastException
11:42Bronsanovaloop: can you paste the whole stacktrace?
11:43Bronsa(in a pastebin)
11:43Bronsanovaloop: anyway, c.t.macro/macrolet does some lexical transformations that break a number of things for different reasons
11:44BronsaIIRC clojure.core/case breaks inside a macrolet aswell
11:44novaloophttp://pastebin.com/NAPZYbkT
11:46novaloopok 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:46Bronsayeah
11:47Bronsamacrolet should be implemented as a special form, being implemented as a macro has some shortcomings
11:50schmeeI have a lazy-seq which calls a bunch of functions with print statements in them
11:50schmeebut the REPL spits out all the prints when the call finished, instead of doing it continuously
11:50schmeeis there any way to make it print while doing the processing?
11:51novaloopso 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:52lijnenHi all! I'm trying to include dependencies (quil with cljx) into cljs-in-cljs. Anybody experience with this?
11:52novaloopi guess i could generate the whole reify code from a macro
11:53nbeloglazovlijnen, could you elaborate?
11:55lijnennbeloglazov: 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:55Bronsalijnen: is cljs-in-cljs still a thing? I though nobody was working on it anymore
11:57lijnenBronsa: it's not really active no, but it's my only option.
11:58lijnennbeloglazov: Bronsa: managed to get this far: http://cl.ly/image/1i0h2n1r2A1M. The next step is quil: http://cl.ly/image/0r1J3U1g3k3K
12:00schmeeI'm confused regarding lazy-seq
12:00schmeewhy are these two versions of the same function not equivalent? https://gist.github.com/schmee/f17febda78242bc15dac
12:01schmeeI'm sure it's something obvious I'm missing
12:01mdrogalisb
12:01mdrogalisWhoops, sorry.
12:03pyrtsaschmee: The first one is lazy on each iteration step, the latter only for the first one.
12:04pyrtsaschmee: 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:05schmeepyrtsa: 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:07pyrtsaNot really, I don't think so.
12:07schmeealright, thanks for clearing things up!
12:07pyrtsa(cons x expr) evaluates expr before returning, after all.
12:08pyrtsa(That is, it doesn't force a lazy sequence, of course, if expr evaluates into one.)
12:09clgv$seen lpetit
12:09lazybotlpetit was last seen quitting 15 weeks ago.
12:09clgv$seen laurent
12:09lazybotI have never seen laurent.
12:09clgv$seen laurentpetit
12:09lazybotlaurentpetit was last seen quitting 24 weeks ago.
12:10mhalversonI'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:12Bronsaeh, there should already be a ticket for that
12:13mhalversonbronsa: hm, I couldn't find one in the clojure bug tracker (searching for issues with defrecord in the title)...
12:18Bronsamhalverson: http://dev.clojure.org/jira/browse/CLJ-1457 might be the same issue, not sure
12:20mhalversonBronsa: that's not the same issue I'm seeing (though of course it might have the same root cause)
12:20Bronsamhalverson: I'm suggesting it hash the same root cause
12:20Bronsahas*
12:21mhalversonBronsa: ah I see. I don't know enough about dynamic classloaders to have an intuition about this stuff...
12:23mhalversonBronsa: I think the right action is to file a separate issue, since it's a separate symptom. Does that sound right?
12:24Bronsamhalverson: 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:24mdeboardWith cljs+om, how do you replace the subtree under say <div id="foo"> with something else?
12:24mhalversonBronsa: sweet, thanks!
12:25mdeboardThe 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:30bhenryHey 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:30mdeboarddnolen_: 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:30mdeboardbhenry: partition-by?
12:30Bronsamhalverson: this is interesting http://sprunge.us/cDjj?clj
12:30mdeboard,(doc partition-by)
12:31clojurebot"([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:31bhenryMediumDivision: 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:32bhenryshoot that was for mdeboard not MediumDivision sorry
12:32mhalversonBronsa: indeed! I think I'll add that snippet to the issue description... something funny is afoot with record redefinition
12:32mdeboard,(doc sort-by)
12:32clojurebot"([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:33bhenryit's a combination of remove and filter. it's like (list (filter pred seq) (remove pred seq))
12:33rdsckHi!
12:33rdsckHow can I convert a sequence of byte-arrays to an InputStream?
12:35llasramrdsck: http://docs.oracle.com/javase/6/docs/api/java/io/ByteArrayInputStream.html ?
12:37rdsckllasram: Thank you! You mean I just do (.ByteArrayInputStream my_buf) and that is it?
12:37rdsckllasram: But I have not one buf, I have a sequnce of them
12:38rdsckllasram: and I need to convert (on-the-fly) the sequence to the stream
12:38llasramrdsck: Then also http://docs.oracle.com/javase/6/docs/api/java/io/SequenceInputStream.html
12:40mhalversonBronsa: issue is here, if you care to chime in http://dev.clojure.org/jira/browse/CLJ-1495
12:41rdsckllasram: thank you! it looks really nice. You mean I just can do (SequenceInputSream. (for [i (range 10000)] (ByteArrayInputStream. (get_buf i))) ?
12:41rdsckllasram: Is that correct?
12:41meliponehello!
12:41meliponehow can I get the number of cores on my machine with clojure?
12:42rdsckmelipone: (.availableProcessors (Runtime/getRuntime))
12:42llasramrdsck: Close... Looks like SequenceInputStream tokes an Enumeration for some reason, so you'll need to adapt to an Enumeration somehow
12:42llasramcommon-collections has some stuff for that
12:42meliponerdsck: thanks!
12:43llasrams,tokes,takes, <- Freudian slip
12:43technomancywho was talking about people installing leiningen that don't know how the $PATH works the other day? https://twitter.com/mitdasein/status/497220920637796352
12:44llasramwat
12:44Bronsamhalverson: I updated the description with a minimal case of my snippet
12:44dnolen_mdeboard: unmount / remount
12:45dnolen_mdeboard: or have component inside that app div that you replace
12:45technomancyllasram: my position is that you should probably learn how your OS works before learning clojure fwiw
12:45mhalversonBronsa: thanks for the sundry little improvements -- looks better :)
12:46mdeboarddnolen_: Ok, I'll do some reading. Hearing you on cognicast over the weekend got me fired up to learn om.
12:46dnolen_mdeboard: this really a React question - whatever works for React works for Om
12:46dnolen_mdeboard: cool!
12:46mdeboardyes 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:46llasramtechnomancy: 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:47TimMcD-:
12:47technomancyI ... wow.
12:47dnolen_mdeboard: it probably worth it to just understand React first
12:47TimMcI don't want any eunuchs on my machine!
12:47dnolen_Om is easy as pie if you get React
12:47mdeboardok, I'll change direction then and do that, thanks
12:47technomancyI 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:48mdeboardtechnomancy: yeah, linux is really kind of an advanced language
12:48TimMctechnomancy: Learning a whole stack at once is always rough -- it's not even clear where the layers separate.
12:48llasramYeah... There is a tension between "some things really are basic" vs "we must protect the Priesthood of the Machine God!"
12:49llasramBut some things really are basic
12:49mdeboardDeus est machina
12:49TimMcex
12:49TimMcOh! Pun.
12:49mdeboardgod IS the machine
12:49rdsckllasram: thank you! so I need something like enumeartion-seq but inversed, right?
12:49llasramLatin pun :-)
12:49technomancyit's not that he shouldn't be learning clojure, it's just that at this level there are more important things to learn.
12:51llasramrdsck: 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:52llasramBut is simple, so you could just write one which could go straight from seq -> Enumeration
12:53llasramMan, SequenceInputStream still doesn't work on an Iterator/Iterable even in Java 8
12:53llasramCrazytown
12:54rdsckllasram: thank you very much! I don't know yet how could I write such convertor
12:54llasramOH!
12:54llasramrs0: Actually, I'm insane: http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#enumeration(java.util.Collection)
12:54llasramEr, ^^ rdsck
12:55llasram,(enumeration-seq (java.util.Collections/enumeration (seq [1 2 3])))
12:55clojurebot(1 2 3)
12:55rdsckllasram: So you mean that that is that easy
12:56llasramLayers of indirection are sacrifices before the deus est machina
12:56rdsckllasram: I just need (java.util.Collections/enumeration my-sequence)
12:56llasramExactly
12:56rdsckllasram: that is perfect!
12:56rdsckllasram: Thank you very much!! I will go to my repl. Thank you once again!!
12:57llasramnp
13:12PigDudeany 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:13PigDude(this is on a mac)
13:26cflemingPigDude: I'm the Cursive dev
13:26cflemingWhich keymap do you have selected?
13:26cflemingIt might be bound to CMD-W
13:26PigDudeoh hi cfleming :)
13:26cflemingHi :)
13:26PigDudeindeed, it is!
13:27cflemingOk - confusingly there are two OSX keymaps
13:27cflemingI'm using the one called OSX 10.5+ or something similar
13:27PigDudeoh, I see
13:27PigDudeI'm using the Mac OS X one
13:28cflemingIf 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:28cflemingNot that that ever happened hundreds of times to me, of course.
13:28PigDudehaha
13:29PigDudethanks cfleming, i'm going to use the 10.5 map, i wasn't even aware of it
13:32cflemingNo worries, it's a bit confusing for sure.
13:32cflemingAll the Cursive doc assumes the 10.5 map, too
13:32cflemingThat's your issue in the tracker, right?
13:34irctchello
13:35irctcis it possible to create a Var through def that is the result of a function? Somehow this doesn't work for me
13:35PigDudecfleming: yea, sorry, i'll close it :)
13:35irctc(def eps (Math/ulp 1.0)) or (def eps Math/ulp 1.0) both trigger errors
13:36cflemingNo worries, it's a fair issue :)
13:36verma,(def eps (Math/ulp 1.0))
13:36clojurebot#'sandbox/eps
13:36PigDudenow somebody else will find it
13:36PigDudeand know the solution
13:36verma,(Math/ulp 1.0)
13:36clojurebot2.220446049250313E-16
13:36vermairctc, seems to work
13:37irctchmmm strange... must be gorilla repl then I guess
13:39lpvbdo maps preserve order when seq'd?
13:42lpvbI guess not
13:42klzzvnany idea why core.match can't match on classes? https://gist.github.com/klzzvn/1c15abbbdb420d3f945c
13:42irctcman, two jehova's witnesses just rang the bell
13:43irctcfirst time this ever happened to me
13:43lpvbso should I use a vector of vectors when I want an ordered map
13:43irctcone of the two women physically recoiled when I told her that I am an atheist
13:44technomancydid you tell them you already beat final fantasy VII
13:44p_lirctc: :D
13:44technomancyoh wait that's jenova's witness never mind
13:44hiredmanklzzvn: that is very weird behaviour, but it is also different from the usage shown in the readme
13:44hiredmanklzzvn: the usage in the readme puts [] around the matches
13:45klzzvnhiredman: yeah, but it says it can work without [] for one column matches
13:45klzzvnhiredman: anyway, the behaviour is the same, even with []
13:45hiredmanbummer
13:45irctcI 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:46p_lI need to finish it, recently grabbed (finally) a legal copy off Steam :)
13:46irctcDamn, this makes me wanna play a JRPG like Suikoden or Wild Arms
13:46vermalpvb, sorted-map?
13:46p_lback then, it used to crash on me because Windows NT
13:47lpvbverma: thanks forgot about that completely
13:47verma,(into (sorted-map) {:b 1 :a 2})
13:47clojurebot{:a 2, :b 1}
13:47irctcI think I owned it on PS1
13:47lpvbverma: actually I just wanted to preserve the order I put them in
13:48technomancywe 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:48lpvbverma: array-map?
13:48vermalpvb, array-map may be then
13:48technomancywhich was actually pretty great
13:48vermalpvb, yes :)
13:49verma,(seq (array-map :b 1 :c 2 :a 4))
13:49clojurebot([:b 1] [:c 2] [:a 4])
13:50vermadoes github show DMCA notices outside US as well? can anyone check? https://github.com/popcorn-official/popcorn-app
13:51ToxicFrogverma: shows up in Canada too
13:52vermaToxicFrog, thanks
13:54klzzvnverma: europe/croatia also
14:01vermaklzzvn, thanks
14:01TimMcirctc: That JW must've been a n00b. I can only imagine the responses they get over the course of a month.
14:04lpvbshould I (defn -main [& args] ... 0)? Does clojure do return codes?
14:06puredangerI think you have to (System/exit <num>) if you want to affect the JVM return code
14:08hyPiRionlpvb: (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:12TimMclpvb: 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:14TimMc(that way I can call the run fn from the REPL and not have to worry about killing the REPL too!)
14:16jlongsterI'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:17dnolen_jlongster: you to :refer merge but if you do that you also need to exclude cljs.core/merge
14:17dnolen_s/you/you need
14:18jlongsterdnolen_: aah. google searching showed confusion with cljs.core/merge so should have known
14:18jlongsterthanks
14:19dnolen_jlongster: better than :refer-clojure :exclude is
14:19dnolen_(async/merge [c1 c2])
14:20dnolen_so it's clear what is going on
14:20jlongsterdnolen_: agreed, will do that
14:39vermait 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:41technomancyverma: I agree; it sucks
14:42technomancyon 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:42amalloyi 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:43technomancywasn't clojure 1.2 the last time something from contrib made it into actual clojure?
14:44amalloyi dunno. 1.2 was very early days for me
14:44trptcolinreflect was 1.3
14:44jlongsterattempting 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:44vermawell, I didn't think of the release cycle stuff so it makes a little more sense now
14:44technomancyverma: core.match was really unstable until a year or so ago iirc
14:46vermatechnomancy, 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:47technomancyit's a drag though
14:47technomancya day when you can't use pattern matching is like a day without music
14:47vermaI 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:48amalloymusicalDay MatchedPatterns = True; musicalDay _ = False
14:49technomancyverma: now that lein 2.4 has the change task, it should be a lot easier to write plugins that add deps for you
14:49vermaI think it would be fun to work on a lein plugin for lein add deps --save like how node does
14:49vermatechnomancy, yeah, I was made aware of that earlier today
14:50vermaI'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:52technomancysounds like a plan
14:53PigDudehm, clojure wraps bigints in its own class, so i can't call (.toByteArray 1203981209381238N)
14:53PigDudeanyone know a way around that?
14:53gfredericks,(.toByteArray (big-integer 1203981209381238N))
14:53clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: big-integer in this context, compiling:(NO_SOURCE_PATH:0:0)>
14:53gfredericks,(.toByteArray (biginteger 1203981209381238N))
14:53clojurebot#<byte[] [B@4f8ad5>
14:54PigDudeoh, thanks gfredericks ! i didn't see (biginteger)
14:55PigDude,(String. (.toByteArray (biginteger 1203120938N)))
14:55clojurebot"G�+*"
14:55PigDudehm.. is that right?
14:55gfrederickswhat should it be?
14:55PigDudeI wanted to encode in hex
14:55PigDude(I know that shouldn't do it)
14:55gfredericksnot sure what your question is then
14:56PigDudei guess it is how to convert clojure bigint to hex
14:56gfredericksa hex representation of what?
14:56amalloy$google java bigint hex
14:56lazybot[Java convert a HEX String to a BigInt - Stack Overflow] http://stackoverflow.com/questions/4316645/java-convert-a-hex-string-to-a-bigint
14:56vermawhy can't I find org.clojure/core.match on clojars?
14:56jlongsterhm, still can't get this to work... does this not make sense, dnolen_? https://gist.github.com/jlongster/412d4616d3042288ea90
14:56PigDude(f 255N) => "ff"
14:56PigDudefor instance
14:57gfredericksverma: contrib libraries aren't published to clojars
14:57vermagfredericks, is there anywhere else they are indexed?
14:57PigDudethis does not work for bigintegers
14:57gfredericksPigDude: I don't think toByteArray would give you that
14:57gfredericks,(seq (.toByteArray (biginteger 255N)))
14:57clojurebot(0 -1)
14:57amalloy,(.toString (biginteger 255N) 16)
14:57clojurebot"ff"
14:58PigDude,(.toString (biginteger 251231231235N) 16)
14:58clojurebot"3a7e8c5d03"
14:58vermaguess here, https://github.com/clojure
14:58PigDude,(.toString (biginteger 251231231212312313235N) 16)
14:58clojurebot"d9e88a1b51de7bd93"
14:58amalloysecond result of the google search i suggested
14:58cbpverma: maven central
14:58vermaoh
14:58vermanice
14:58PigDudehm on my machine those are showing out of range exceptions
14:58PigDudeamalloy: that was what i was trying first but it fails here
14:58gfredericks,(.toString (biginteger -3N))
14:58clojurebot"-3"
14:58gfredericks,(.toString (biginteger -3N) 16)
14:58clojurebot"-3"
14:58puredangerverma: http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.clojure%22
14:58PigDudeI get IllegalArgumentException Value out of range for int: 212312312312355 clojure.lang.RT.intCast (RT.java:1115)
14:59vermapuredanger, yeah got it
14:59vermathanks
14:59amalloydid 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:59gfredericksaw man the vengeful ones are the worst
14:59PigDudeamalloy: oh, you know what i was doing wrong? not wrapping in (biginteger)
15:00puredanger,Integer/MAX_VALUE
15:00clojurebot2147483647
15:00gfredericksMax Value would be a cool name for a person
15:01PigDudethanks, really helpful
15:02gfrederickswhat are better names for these things? https://github.com/gfredericks/referee/blob/master/src/com/gfredericks/referee.clj
15:04amalloyEither/Right/Left. you know you want it
15:04gfredericksnooooooo
15:05gfredericksalso I want to know what technomancy would have done instead of protocol/records
15:05llasramgfredericks: I'd have done protocols/reify
15:06gfrederickseh?
15:06gfredericksfor more opaque printings?
15:06llasramNo need for a named type, especially a record. The instances are entirely defined by their implementations, which makes them perfect for `reify`
15:10vermait'd be nice if I could use something similar them for pattern matching, like haskell :P
15:11vermawell, not hard to brew up your own using maps though
15:11mthvedtnamed types look a lot nicer in stack traces
15:12mthvedtor when printing
15:13vermaderef'ing a Failure rethrows the exception? hmmm
15:14gfrederickssimilar to how futures behave
15:14gfredericksit doesn't have to be deref that does that, but something should do that
15:15vermaoh, interesting
15:16amalloygfredericks: delays do it too, as of like 1.6 i think
15:16gfredericksamalloy: what on earth did they do prior?
15:17amalloyhorrible things. you may find the jira ticket i filed amusing
15:17amalloyhttp://dev.clojure.org/jira/browse/CLJ-1175
15:18gfredericksHUH.
15:19puredanger…and you will know us by the trail of our delayed exceptions
15:21vermaoooh ^:once, sounds risky and fun
15:22SegFaultAXIs 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:22amalloySegFaultAX: the latter
15:23amalloyexcept 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:25gfredericksevery time I patch the java code it takes a lot of concentration to maintain whatever style is there
15:25jlongsterdnolen_: nm, figured out my merge question
15:25gfredericksnot to mention to avoid committing 200 trailing-whitespace changes
15:25SegFaultAXHah
15:26boxedthe 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:26amalloygfredericks: i have that problem in clojure.core too
15:27boxed(inc python)
15:27lazybot⇒ 2
15:27SegFaultAXboxed: I wouldn't necessarily call it sloppy.
15:27boxed:P
15:27Glenjaminthere might be something helpful on the git blame for the comment
15:27Glenjaminor not
15:27boxedwanna bet? :P
15:30amalloyboxed: search for the comment //*/ and see if you can figure out why it's there, as an exercise
15:30SegFaultAXamalloy: "I've commented out, the reason why is left as an exercise for the reader"
15:31gfredericksclojurebot: clojure is left as an exercise for the reader
15:31clojurebotIk begrijp
15:32arrdemthe reader is also an exercise for the reader...
15:32gfredericksexercise is an exercise for the reader
15:32gfredericksin fact X is a Y for Z is true for all X,Y,Z
15:33cbpo man //*/
15:39boxedamalloy: the place I saw had no comments for miles and miles around
15:40amalloyokay...did you figure out what the //*/ is for?
15:41Jaoodamalloy: to comment comments?
15:43amalloyJaood: //*/ is a lexer trick which closes an open /* comment-block if it's inside one, and does nothing if it's outside
15:43amalloyso 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:44gfrederickslol
15:44gfrederickswhy on earth would you need to consciously do that
15:44boxedC comments aew so broken :/
15:45amalloygfredericks: look at the giant mess of commented-out code in clojure.lang, and the answer will be resolved in your mind
15:45gfredericksI retract the question
15:47Jaoodamalloy: any specific file in clojure.lang?
15:48amalloyJaood: not really. Compiler, RT, Utils, are all probably pretty bad
15:48Jaoodok, compiler.java has it at the top :)
15:50boxedchecked in commented out code at work triggers an immediate walk-over-to-desk-ask-for-wtf
15:55dnolen_all the transducers work in Clojure is now landed in ClojureScript https://github.com/clojure/clojurescript, have fun
16:07technomancyboxed: I could imagine that being used as a cry for help
16:07technomancyo O ( "the amount of commented out code is kinda like my emotions right now--hella crazy" )
16:07technomancyhttp://achewood.com/index.php?date=08212002
16:08gfrederickstechnomancy: you're suggesting clojure is rhickey's cry for help?
16:09michaelrhi
16:09technomancyno I mean in the context of a walk-over-to-desk-on-commented-code policy
16:09amalloytechnomancy: new game: start each .clj file with #_#_#_#_ and a bunch of ns forms, let people guess what your dependencies are
16:10michaelrhow would I easily update emacs-live to the latest?
16:11michaelrto get the latest cider
16:12technomancymichaelr: I'd recommend using the standard package manager for that
16:12michaelrtechnomancy: for cider or for emacs-live?
16:12technomancymichaelr: for everything in emacs, but in this case for cider
16:12michaelrhum hum..
16:12technomancyemacs-live has this bizarre NIH package-like system that isn't particularly well documneted
16:13michaelrheh
16:13michaelrtechnomancy: 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:13michaelrwhen all I want currently is to try the new cider..
16:17kschradermichaelr: emacs-live is just a git repo, you can update it from within the .emacs.d directory, I think
16:18michaelrkschrader: I've tried git submodule update --recursive
16:18michaelrafter trying git pull
16:18michaelr(it didn't work)
16:20llasramFinally 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:24kschraderhmmm
16:24kschraderif you haven't done any customization to Live you could just move the directory over and install it again
16:25michaelryeah, i think i'll do that
16:25michaelrall my customizations are in .emacs-live.el
16:36gfredericksdon't worry, I just used a Fn as a key in a hash-map
16:36rweirare there any easy-to-understand articles on reducers?
16:37rweirnow transducers are here I feel like I'm two steps behind
16:37lpvbrweir: how about http://vimeo.com/45561411
16:38rweirvideos :/
16:38rweirlpvb, I'll have a look, thank you
16:38lpvbit's a talk by rich though
16:38rweirah, well, complaint retracted :)
16:39puredangerrweir: if you have comments on http://clojure.org/reducers and what more would help there, I'd be happy to get that feedback
16:39hiredmanhttp://ce2144dc-f7c9-4f54-8fb6-7321a4c318db.s3.amazonaws.com/reducers.html is my favorite reducers write up (likely because I wrote it)
16:39rweirhiredman, with such an easy to remember url!
16:39rweirpuredanger, thanks!
16:39puredangerhiredman: nice! I hadn't seen that! and +1 on that awesome url
16:40hiredman:)
16:40puredangerlooks like a core.async version or something
16:40rweirall 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:40puredangerRich'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:41rweiryeah
16:41rweirthey're like revelations lacking in commandments
16:41hiredmanpuredanger: 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:41puredangerha
16:42rweirpossibly part of the problem is I translate "seq" to "iterable in python" and that gets the operation sense backwards
16:42puredangerI hear there is a healthy chunk on reducers in the Joy of Clojure 2nd ed but haven't seen it yet
16:42puredangerand I have a chunk on the Clojure book I'm working on for pragmatic
16:42rweirah, I didn't even think to look in there
16:42rweirah cool, what's the...target market for your book?
16:43puredangerthe 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:43puredangertentatively called Clojure Applied
16:43rweirah nice
16:43puredangerBen Vandgrift is my co-author
16:43amalloyhow about Clojurin' Action?
16:43SagiCZ1sorry to jump in so late.. but just my 5 cents.. i really did not enjoy Joy of Clojure
16:43puredangerthat might be too similar to an existing book :)
16:44amalloyi feel like the clojure book space doesn't have enough confusingly-similar names
16:44SagiCZ1it felt like to hard for a beginner and too easy for an experienced..
16:44puredangeramalloy: yeah, was thinking we should call it Programming in Clojure :)
16:44SagiCZ1how about "Thinking in Clojure"
16:44SagiCZ1or.. "Clojure Effective"
16:44rweirSagiCZ1, 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:45puredangerwe thought about Thinking but publisher was worried of similarities to other Thinking in books
16:45SagiCZ1rweir: and what would you recommend as one step before that? i went through the clojure-koans already...
16:45puredanger4clojure?
16:45clojurebot4clojure is the place to go for Clojure exercises
16:45puredangeror exercism.io
16:45rweirSagiCZ1, I read much of the o'reilly book, and tried 4clojure
16:45SagiCZ1what is 4clojure?
16:45rweir(also writing a lot of clojure code at work)
16:45amalloy$google 4clojure
16:45lazybot[4clojure – Welcome!] https://www.4clojure.com/
16:46rweiralas we're all beginners but skilled enough to tell :|
16:46SagiCZ1at work i am being overwhelmed with Java EE.. so sad :(
16:46SagiCZ1amalloy: thanks for the link
16:46puredangerSagiCZ1: You mean @Sad
16:47SagiCZ1puredanger: sorry i dont get it.. why not "sad"? :)
16:47puredangerisn't everything annotations in JEE?
16:47SagiCZ14clojure looks like a next step to koans.. i like it
16:47SagiCZ1puredanger: oh i get it now.. yes.. its horrible.. i spend 80% of my time writing boilerplate code
16:47SagiCZ1then i write something in clojure and i cant believe it can work with so few lines of code..
16:48puredangerSagiCZ1: it's literally 100% glue code somehow. like gluing glue together to other glue with glue.
16:48puredangerwell, at least the last time I did it that's how it felt
16:48SagiCZ1puredanger: i dont even know where the actual logic executes anymore
16:48puredangerOracle HQ
16:49SagiCZ1puredanger: 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:53michaelryeahh well
16:53michaelrit was a waste of time
16:53michaelrI didn't get to try the new cider
16:53michaelremacs live would not cooperate
16:54technomancy(inc amalloy) ; belatedly but that was classic
16:54lazybot⇒ 153
16:55michaelrdid I miss something :)
16:55SagiCZ1can i look at some solutions to 4clojure problems?
16:56puredangerI think you have to turn on the code golf mode
16:56puredangerand then follow people.
16:56puredangeralthough I followed chouser and his answers made me cry
16:57SagiCZ1i can turn that on when i register i guess?
16:57puredangerdunno, it's been a few years :)
16:57rweirpretty much all of them are googlable if you're really stuck
16:58puredangerI think here: http://www.4clojure.com/league
16:59amalloyyou can follow people without having to opt-in to the league, as far as i can remember
16:59puredangerhttp://www.4clojure.com/users - follow people there
16:59puredangeramalloy: totally possible
16:59amalloyi can't imagine why i'd have made the two depend on each other
17:00SagiCZ1neither of you is there :D
17:00puredangeroh, did you work on it? I am stupid.
17:00amalloypuredanger: yes, more of it is mine than anyone else's, and it's running on my server :)
17:00puredangeramalloy: well thank you, it's great.
17:00puredanger(inc amalloy )
17:00lazybot⇒ 5
17:01puredangerwat
17:01amalloyyou're apparently the first person to think my username ends with a space
17:01amalloy*fifth
17:01puredangerah :)
17:01puredanger(inc amalloy)
17:01lazybot⇒ 154
17:01SagiCZ1wait what..
17:01puredangerbetter. my client added that
17:01SagiCZ1symbol can end with a space?
17:02puredanger,(symbol "sure why not ! ")
17:02clojurebotsure why not !
17:02amalloySagiCZ1: the inc/dec system isn't real clojure. it's a hacky parser
17:02amalloyalthough it is true that you can construct symbols that the reader couldn't have read
17:02SagiCZ1amalloy: ofc.. im blind
17:02technomancyshould have gotten a gsoc project to upgrade lazybot's inc/dec to use the reader
17:02technomancystretch goal: juxt support
17:04SagiCZ1amalloy: can i control the "Run" button with keyboard shorcut?
17:04amalloytab+RET probably
17:05amalloyprobably doesn't work if you leave the javascript editor mode on; i turn that junk off
17:05SagiCZ1just makes tab in the editor :) .. k dont worry about it
17:07SagiCZ1amalloy: anyway.. very nice website :)
17:08amalloyyou're welcome, SagiCZ1. i do love teaching
17:09dnolen_ClojureScript 0.0-2301 going out for those of you that want to try reducers from ClojureScript
17:09dnolen_the work involved porting a bit of Java so likely some edge cases, error reports welcome
17:12tuftsweet =)
17:12mdeboardyeah, wow
17:13jjwattdnolen_: woa. neat. do they use webworkers?
17:13mdeboarddnolen_: working through a small react project.. you were right, om makes much more sense now.
17:13dnolen_s/reducers/transducers
17:14dnolen_jweiss: er I meant transducers and no
17:14dnolen_mdeboard: glad to hear it
17:14mdrogalisdnolen_: That was fast :)
17:15dnolen_mdrogalis: well porting the Clojure was easy copy and past
17:15tufti'm thinking my first clojurescript project could be a window manager for os x using https://github.com/pd/zephyros
17:15dnolen_the Java bits were a bit fiddly as usual
17:15mdrogalisdnolen_: Yeah. Still, good job. Appreciated.
17:16dnolen_mdrogalis: it'll be even cooler when we get cljs.core.async sync'ed up
17:18jjwattawesome. I hadn't seen rich's newer blog post about transducers (http://blog.cognitect.com/blog/2014/8/6/transducers-are-coming)
17:20mdrogalisdnolen_: Yup. I think that'll be a nice show of power.
17:32SagiCZ1,(take 2 (repeatedly rest '(:a :b :c :d :e)))
17:32clojurebot#<ClassCastException java.lang.ClassCastException: clojure.core$rest cannot be cast to java.lang.Number>
17:33SagiCZ1,(repeatedly 3 rest '(:a :b :c :d :e))
17:33clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core/repeatedly>
17:34TEttinger,(repeatedly 3 #(rest '(:a :b :c :d :e)))
17:34clojurebot((:b :c :d :e) (:b :c :d :e) (:b :c :d :e))
17:34hiredman,(doc iterate)
17:34clojurebot"([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
17:34TEttinger,(take 3 (iterate rest '(:a :b :c :d :e)))
17:34clojurebot((:a :b :c :d :e) (:b :c :d :e) (:c :d :e))
17:34SagiCZ1i think i want reduce maybe
17:34TEttingerhiredman beat me to it :)
17:34SagiCZ1reduce 3 times
17:35TEttingerwhat are you trying to do?
17:35hiredman,(doc reductions)
17:35clojurebot"([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:35SagiCZ1nth
17:35SagiCZ1withouth nth
17:35SagiCZ1dont tell me the solution though
17:35amalloyah, for 4clojure
17:35TEttingerah, yeah
17:35TEttingerthere's lots of ways to do that
17:36SagiCZ1i am only looking for the pretty solutions
17:36TEttingermy favorite is #(`[~@%] (`[~@%&] (+)))
17:36TEttingerwhich is not a pretty solution
17:36SagiCZ1holy crap
17:36TEttingerit's a swearjure example
17:37SagiCZ1it actually works
17:37TEttinger,(#(`[~@%] (`[~@%&] (+))) [:! :? :*] (+))
17:37clojurebot:!
17:37TEttinger,(#(`[~@%] (`[~@%&] (+))) [:! :? :*] (*))
17:37clojurebot:?
17:37SagiCZ1https://en.wikipedia.org/wiki/Brainfuck
17:38TEttingerit won't make sense to explain it without reading hyPiRion's article
17:38TEttingerhttp://www.hypirion.com/musings/swearjure this won't make sense either probably
17:38TEttingerswearjure is a fun toy
17:39SagiCZ1look 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:39TEttingerheh, I can explain how that example works now
17:39TEttingerit's creating a vector from the first arg
17:40TEttingerand it's using the second arg as an argument to it
17:40TEttinger,([0 1 2 3] 0)
17:40clojurebot0
17:40TEttinger,([0 1 2 3] 1)
17:40clojurebot1
17:40TEttingernow if you can reproduce that behavior in a fn, you're done
17:41TEttingerremember, a lot more things in clojure can be used as fns that you would expect
17:41SagiCZ1#((vec %1) %2)
17:41amalloyman, 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:41lazybotclojure.lang.ArityException: Wrong number of args (0) passed to: sandbox5671$eval11415$fn
17:41amalloywell, whatever. you get what i meant
17:42SagiCZ1,(#((vec %1) %2) (range 10) 5)
17:42clojurebot5
17:42TEttingerwoo
17:42SagiCZ1is that correct?
17:42amalloydoes 4clojure think so?
17:42SagiCZ1vec makes vector from list and "vector" makes vector from its arguments right?
17:43TEttingerthat'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:43TEttingeryes
17:43SagiCZ1amalloy: clojure4 says its ok
17:43TEttingervec also works on most collections
17:44SagiCZ1,(vec {:a 0 :b 5 :c 4})
17:44clojurebot[[:c 4] [:b 5] [:a 0]]
17:44SagiCZ1,(vector {:a 0 :b 5 :c 4})
17:44clojurebot[{:c 4, :b 5, :a 0}]
17:45SagiCZ1how would i get [:a 0 :b 5 :c 4] ?
17:45SagiCZ1,((comp vec list) {:a 0 :b 5 :c 4})
17:45clojurebot[{:c 4, :b 5, :a 0}]
17:45SagiCZ1,((comp flatten vec) {:a 0 :b 5 :c 4})
17:45clojurebot(:c 4 :b 5 :a ...)
17:45amalloyflatten :(((((((
17:46Bronsa, (vec (mapcat identity {:a 0 :b 5 :c 4}))
17:46clojurebot[:c 4 :b 5 :a ...]
17:46amalloyyou want ##(apply concat{:a 0 :b 5 :c 4})
17:46lazybot⇒ (:a 0 :c 4 :b 5)
17:46SagiCZ1,(doc concat)
17:46clojurebot"([] [x] [x y] [x y & zs]); Returns a lazy seq representing the concatenation of the elements in the supplied colls."
17:46amalloymapcat seq or mapcat identity also works, but it just looks awkward to me
17:46SagiCZ1amalloy: i dont get it
17:47SagiCZ1amalloy: unless..
17:47SagiCZ1amalloy: unless "apply" applies foo to both keys and values in a map
17:48SagiCZ1i 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:48metellusSagiCZ1: it's because one "element" of a map is a key/value pair
17:49metellusso it's like ##(apply concast [[:a 0] [:b 5] [:c 4]])
17:49lazybotjava.lang.RuntimeException: Unable to resolve symbol: concast in this context
17:49TEttinger4clojure is awesome
17:49SagiCZ1so it translates it to: ##(concat [:a 0] [:b 1] [:c 2])
17:49lazybot⇒ (:a 0 :b 1 :c 2)
17:49metellusso it's like ##(apply concat [[:a 0] [:b 5] [:c 4]])
17:49lazybot⇒ (:a 0 :b 5 :c 4)
17:49Bronsaamalloy: I'm so used to mapcat that I often forget how it's implemented. apply concat is definitely better there
17:49metellusyeah, SagiCZ1
17:50SagiCZ1metellus: thank you
17:51SagiCZ1TEttinger: 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:52SagiCZ1sorry for my English btw..
17:53TEttingerSagiCZ1, yep, after you get out of the early 4clojure problems they let you use everything to solve trickier things
17:54SagiCZ1TEttinger: yeah i would expect that
18:42joshheadis it now recommended to depend on lein-cljsbuild plugin from profiles.clj and not project.clj? (:plugins [[lein-cljsbuild "1.0.3"]])
18:47joshheadI misread something in the readme, I think I was just confused
19:05justin_smithjoshhead: in case you haven't figured it out yet, you can define per-project plugins in project.clj
19:08joshheadjustin_smith: Yep I've got it.
19:14dnolen_just cut ClojureScript 0.0-2307, same as 0.0-2301 just *way* faster for transducer and reducer based code
19:16loonanyone answer a question on how "seq map" gets the order it returns?
19:17loon(seq map) rather
19:17loontrying to figure out what order (keys map) returns
19:18metellusthe order isn't guaranteed
19:18amalloyloon: arbitrary
19:19loonamalloy: hmm, ok
19:19loonamalloy: thanks
19:19loonmetellus: thanks
19:22cbp`!die
19:23mdeboardfinally
19:31scape_lol
19:52mdeboardIs there a consensus wrt clojurescript and routing vs. explicit event-handling?
19:52mdeboardI'm doing event handling in reactjs to handle page loading and what have you... but I guess they fulfill different needs
19:52Glenjaminmdeboard: i tend to trigger an event, that updates the url
19:53Glenjaminand also use that URL to drive my page state
19:53Glenjaminthe URL is just another prop that your top-level component uses to decide what to do
19:53mdeboardI tried using react-router library but it seems like it pretty fundamentally changes how react works
19:54mdeboardor, maybe, it changes how you're supposed to write the funcs
19:54Glenjamini have a router that gives me a component class reference when given the current URL
19:56mdeboardYeah I was using secretary in cljs/om, seems to work pretty good
19:56mdeboardbut react-router is like an indirection layer, it's kind of weird.
19:57Glenjaminreact-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:58mdeboardYeah, I guess I'm just not getting it
20:00mdeboardseems like a good and proper abstraction though.
20:15joshheadI'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:16joshheadpossibly the transducer stuff is not in core.async cljs yet?
20:17dnolen_joshhead: no there yet
20:17dnolen_er, not there yet
20:17joshheadah okay, thanks dnolen_
20:18dnolen_joshhead: might give it a go tomorrow if I have time if someone else doesn't get to it first
20:18joshheadI'll check for it again soon :)
20:23mdeboardelixir has really cool pipeline func
20:24mdeboardapropos of nothing
20:49vermatechnomancy, lein change :dependencies identity doesn't seem to restore quotes around version numbers
21:05mdeboardGlenjamin: What did you mean by 18:52 <Glenjamin> and also use that URL to drive my page state
21:05mdeboardwere you talking react or om
21:05mdeboardif the former I'll ask in #react
21:34tuft_is there a way to get test.check to include some additional values in failure output?
21:34tuft_hmm, wonder if it would do a regular let binding inside my for-all stuff
21:35tuft_nope =)
21:35tuft_that could be handy
21:41xeqituft_: you could use (gen/return ...) as a generator in the forall
22:48akhudekhmm, lein is suddenly freezing indefinitely when creating an uberjar
22:49brehautthats often an indication that you have some code running in a top level that shouldnt be
22:49brehaut(ie, something beyond an ns form or a def)
22:50akhudekyeah, though I’ve checked for this and havent’ found it yet :-/
22:50akhudekwill look again
22:50brehautcould even be a def (rather than defn) if it, eg, creates a blocking service or something
22:51akhudekprobably only a def right?
22:52brehauti mean something like (def webserver (ring/run-jetty …))
23:07akhudekhmm, it’s lein-environ
23:10akhudekor maybe not
23:15maxnomoonHello, guys. Can anyone help with some code review on a simple game logic?
23:16maxnomoonI tried exercims.io, but they seem to be focused on simple exercises and there aren't many folks there.
23:16arrdemthrow up a refheap and someone may criticize
23:16arrdem~ask
23:16allenj12_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:17allenj12_i thought about just looping an incremented number and subtracting and adding till i find a matching number.. but it seems messy
23:18maxnomoonI'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:18maxnomoonHowever that makes diffucult generating different gender based on some ratio.
23:18allenj12_maxnomoon: you should refheap your code and comment your question
23:19danielcomptonWhat'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:20arrdemdanielcompton: mapcat's the common one. (reduce concat (map f seq)) is equivalent tho..
23:21danielcomptonarrdem: what do other communities call it? I'm trying to name a function that takes a value and returns a sequence
23:22maxnomoonhttps://www.refheap.com/89033 I need some help with general tips on how to approach that kind of a problem.
23:28TEttingerdanielcompton: disperse, spread, enlarge (contrasted with reduce)
23:42justin_smithdanielcompton: from value to sequence could be generate or iterate
23:43acagle1exit
23:43amalloydanielcompton: 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:44amalloyarrdem: never write (reduce concat ...) - you want apply concat instead
23:44danielcomptonI think unfold is the generic term
23:45danielcomptonThe opposite of fold (reduce)
23:55akhudekwow, importing [javax.imageio ImageIO] is what causes uberjar to fail to terminate
23:59akhudekhm, or maybe it’s just the number of imports