#clojure logs

2015-11-06

01:57jonathanjhow do i run my tests with cider?
01:57jonathanjM-x cider-test-run-tests doesn't actually seem to have done anything
03:08jonathanjin Python there is a count() function that returns an iterator that produces a number one greater than the last: counter = count(); print next(counter); print next(counter) # => 0 1
03:08jonathanji thought this would be straightforward in clojure but apparently not so, do i need to use an atom?
03:09jonathanj(i'm writing code where i can replace the function that generates IDs, so i can replace (uuid/v4) with something predictable)
03:09Kneiva,(take 10 (iterate inc))
03:09clojurebot#error {\n :cause "Wrong number of args (1) passed to: core/iterate"\n :via\n [{:type clojure.lang.ArityException\n :message "Wrong number of args (1) passed to: core/iterate"\n :at [clojure.lang.AFn throwArity "AFn.java" 429]}]\n :trace\n [[clojure.lang.AFn throwArity "AFn.java" 429]\n [clojure.lang.AFn invoke "AFn.java" 32]\n [sandbox$eval25 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eva...
03:09jonathanjKneiva: i think you need a starting value
03:10jonathanjKneiva: but so i'm not quite sure how you turn that into something that when *called* produces the next value
03:10Kneiva,(take 10 (iterate inc 0))
03:10clojurebot(0 1 2 3 4 ...)
03:13jonathanji think this is what i want: (defn count [n] (let [counter (atom n)] #(swap! counter inc)))
03:15Kneivaah, of course
03:16Kneivabut do you need the state?
03:16jonathanjwell, i want to be able to pass a value in place of (uuid/v4) and get predictable results
03:16jonathanj(constantly 5) would do something but unfortunately then it's a bit hard to verify identity
03:18jonathanji don't know how else to write it
04:13McDougalIs clojure mature for web dev or is the community more focused on data processing, machine learning, etc?
04:14poweredclojurescript is an solid choice for web dev
04:14poweredlots of libraries are available
04:15McDougalThats for front end, I was thinking ref server side
04:20the_nonameguygfredericks: thx!
04:21qsysserver side: clojure, surely mature enough, client side: (compiled) clojurescript.
04:24qsysring seems to be popular for server side stuff, I like vert.x, which is something very different (and for the latest version, clojure is not supported yet, although it's rather easy to just call clojure from Java)
04:24McDougalgsys: Is clojure more performant on vertx?
04:24McDougalHo about security in clojure web apps?
04:26the_nonameguythis is the most common lib for that: https://github.com/cemerick/friend
04:28qsys'more performant' looks somewhat euh... vague. clojure is very performant, so it depends what you're planning. I wouldn't say 'more performant'. I'm just used to using vert.x and never tried ring (and such).
04:29qsyscompojure is another one, by the way: http://www.lispcast.com/what-web-framework-should-i-use
04:30qsysso well, the usual problem: you have (too many?) choices :p
04:31McDougalThankyou, I'l try out compujure as a starting point
04:31the_nonameguyit really depends on what you are trying to achieve
04:32qsysor just google web dev clojure :) http://www.luminusweb.net/
04:32qsysso yeah, what d'you want to do?
04:55poweredis there a shorter way to do: (map (fn [a b] [a b]) coll-a coll-b) ?
04:58danneupowered: (map vector coll-a coll-b)
04:59poweredthanks that makes sense
05:04danneuMcDougal: i recommend compojure. simple layer built on top of Ring. check out `lein new compojure hello-world` to generate a small boilerplate to work off of
05:21mpenetThere are a lot of very performant/flexible ring based adapters, just pick what you like best depending on your needs
05:22mpenetfor raw "perf" numbers, they were a few benchmark where some clj adapters were tested and they were doing very good
05:24mpenetex: netty or undertow based adapters seems to shine in these kind of benchmarks
05:25mpenetThen you can use compojure or whatever framework you want, as long as it's ring compatible.
05:37owlbirdhow to solve module circular dependencies? (app.a/f1) call (app.b/f1), and (app.b/f1) call (app.a/f2) ?
05:38oddcully,(doc declare)
05:38clojurebot"([& names]); defs the supplied var names with no bindings, useful for making forward declarations."
05:41mpenetwont work accross namespaces with vars that call each other
05:41oddcullyah didn't pay attention to that
05:42mpenetyou need to refactor your code so this doesn't happen
05:42oddcullyso the answer to that is: fix your code?
05:42mpenetyup, it's very often a code smell anyway
05:43owlbirdBy putting all functions in one ns, and name them like a-f1, a-f2, b-f2 ?
05:43AeroNotixor a third module with the dependencies of both, if you can
05:43mpenetthat
05:45starlordcould someone recommend a good websocket client library? Aleph perhaps?
05:46mpenetaleph or jet both have decent jvm based clients
05:46starlordgreat, thanks!
05:49the_nonameguySente has a client: https://github.com/ptaoussanis/sente
05:51mpenetonly js based for the client part if I recall tho
06:20thangappanI tried to connect clojure web application with mysql database but it's not working..iam new to clojure.Do anyone know this?
06:21triplecloneshi, any recommendations on finding freelance devs who work with clojure?
06:24mavbozothangappan, how it didn't work? please provide more context such as used library, error stacktrace
06:24oddcullythangappan: "is not working" is a wide field. could put the error/exception on refheap?
06:31xeqitripleclones: If you're looking for someone locally I'd start at a meetup, otherwise post an ad on https://groups.google.com/forum/#!forum/clojure, in here, or at http://clojurians.net in the jobs room.
06:33tripleclonesxeqi thanks i'll get it together and post here cheers.
06:52qsystripleclones: local or not? I might be interested :p.
07:07tripleclonesqsys doesnt have to be local
07:11dnolenClojureScript 1.7.170 released! https://groups.google.com/forum/#!msg/clojurescript/AiCARjGT2Mg/J2TdxtHgBAAJ
07:24gfredericksdnolen: I just upgraded cljs in the test.check codebase to see if anything would happen -- afaict, the dev build went fine and the test passed, but then the advanced build crashed
07:25dnolengfredericks: you really should trying pre-releases if I mention those :)
07:25dnolengfredericks: but I'm skeptical at the moment - lots of people ran the pre-releases on non-trivial projects without issue.
07:26gfredericksyeah it might just be something about the config in test.check
07:26gfredericksor me running on a really old node?
07:26dnolento debug advanced builds
07:26dnolen:pseudo-names true :pretty-print true
07:27dnolenit should be pretty clear what the code is breaking on then.
07:27dnolengfredericks: also are you using cljsbuild to build?
07:27gfredericksyeah
07:27dnolenthe post above is very clear about needing to use edge tooling for this release
07:27gfredericksoh okay sorry
07:27gfredericksdisregard
07:36gfredericksdnolen: yeah it all passes w/ the cljsbuild snapshot
07:37dnolengfredericks: cool
07:50gfrederickswould love feedback from test.check users about this; am planning on working on it today http://dev.clojure.org/jira/browse/TCHECK-81
08:16Glenjamingfredericks: as (bind) is arguably more complex anyway, i'd be tempted to only sugar (fmap)?
08:16Glenjamini dunno whether it's because of the name, but i always do custom generators as an fmap over an existing generator
08:21gfredericksGlenjamin: bind is necessary for some things, and it's what you expect as a user from a variant of let
08:21gfredericks(because let lets (ha!) you use previous bindings (ha!) which implies bind)
08:44GlenjaminOh, gen/let wouldn't behave like let unless it used bind?
08:45GlenjaminThe examples you provided look great, I guess the whole point is I no longer care if it's bind or fmap
08:50gfredericksright -- and that's actually the one thing that feels messy to me from a design perspective, so I care about how useful it would be to real users
08:50gfredericksit feels messy because of this, which I guess I should link to in the ticket: https://brehaut.net/blog/2013/duck_wrapping
08:51gfredericksoh wait I already did
08:51gfrederickswtg past me
09:37Glenjamingfredericks: don't think of it as fmap/bind, think of it as "i want a generator that does this please"
09:38Glenjamindoes fmap generalise to bind? could it just always bind?
09:44hyPiRionGlenjamin: Yes. fmap f coll = coll >>= (return . f)
09:48tomjackis an om.next query like [{:foo [:bar1]} {:foo [:bar2]}] a user error?
11:36soleadoI get an error, "contains? not supported on type: clojure.lang.LazySeq" passing the results of `(doall (map #(f %) coll)`. Why is that? I thought `doall` realizes the lazy sequence?
11:38soleadoe.g. `(contains? (doall (map inc [1 2 3])) 1)`
11:39justin_smithsoleado: contains? isn't supported on lazy-seq, it doesn't do what you probably think it does
11:39justin_smithsoleado: contains? only works on the keys of associative types, and seqs are not associative
11:39justin_smith,(contains? [:a :b :c] 1)
11:39clojurebottrue
11:39justin_smithbecause it has an item at index 1
11:39justin_smith,(contains? [:a :b :c] :a)
11:39clojurebotfalse
11:40justin_smithbecause it has no index keyed by :a
11:40justin_smith,(.contains [:a :b :c] :a)
11:40clojurebottrue
11:40justin_smiththat's a java method, and actually checks if the collection has an = item, and is probably what you want
11:41soleadoI understand and I'd be happy with this result:
11:41soleado(contains? [:a :b :c] :a)
11:41justin_smithsoleado: :a is not a key on a vector
11:41justin_smithso it does not contain it, according to contains?
11:41justin_smithcontains? does not check contents, only associative keys
11:42justin_smithwhich is why (contains? [:a :b :c] 1) returns true - it has an item at key 1
11:42soleadojustin_smith: thanks, I understand, but that's not what I'm asking
11:43justin_smithwhat are you asking?
11:43soleadomy question is why I'm getting a "lazy-seq not supported" error instead of a true/nil
11:43justin_smithsoleado: lazy-seqs don't have keys
11:43justin_smiththey are not associative collections
11:43justin_smithso contains? can't do anything with them
11:44justin_smithI think it would be better if contains? had a different name, like "has-key?"
11:44justin_smithbut too late for that now
11:44sdegutis,(sort-by (juxt (comp - first) second) [[1 2] [2 1] [3 3] [2 3] [3 2]])
11:44clojurebot([3 2] [3 3] [2 1] [2 3] [1 2])
11:44sdegutisCool.
11:45oddcullysoleado: doall just realizes the whole thing. but it does not change the type
11:45oddcullyat least that is my interpreation of things
11:46oddcullysoleado: if you want contains? in the way described, maybe do an (into [] (map...)) instead?
11:49soleadoSo nevermind `contains?` :-) Why is this still a LazySeq? `(doall (map keyword ["a" "b" "c"]))`
11:49justin_smithdoall doesn't change the type
11:50snowelljustin_smith: Especially since I am constantly wanting to do (contains? [2 4 6] 2)
11:50snowellWhich will return true in that case, but for entirely the wrong reason
11:51justin_smithsnowell: (.contains [2] 2), of course
11:51snowell...I'll just be over here
11:51mavbozojustin_smith, i thought core.async has 2 thread pools. the pool with 42 + x for c.a/go and the unbounded pool for c.a/thread . I was wrong again.
11:52justin_smithmavbozo: right, but I wasn't using thread :P
11:52justin_smithmavbozo: but that is the tool that solves my problem, of course
11:54bluezoneTHANKS A LOT GUYS. Now I can't sleep anymore. Every time I close my eyes I see parenthesis all over the place :( Language is too sexy for my eyes
11:57mavbozojustin_smith, yeah, c.a/thread doesn't make differences in your mongo case either
11:57{blake}bluezone: The real shift comes when you STOP seeing parentheses. Then you'll know you're One Of Us.
11:57justin_smithmavbozo: right, well, it makes it slightly less painful but does not solve it
11:59justin_smithnow I am doing an audit of our usage of core.async, and seriously considering replacing mongo with a table in postgres with a string key and byte-array value, and encoding that byte-array with transit :P
12:36Glenjaminjustin_smith: i think that's a solid plan: mongo query perf is pretty bad on unindexed keys, so it's not like you can really actually query the json properly
12:37Glenjaminalthough new postgres i think has json column, json functions and function indexes
12:53the_nonameguyis it possible to write a fn with an example use like this?
12:53the_nonameguy(source-2 clojure.lang.Keyword clojure.lang.IFn)
12:53the_nonameguywhich would display the protocols implementation for the given type
12:54the_nonameguylike source does for plain fn-s
13:03{blake}How does Clojure not have an .indexOf for vectors?
13:06justin_smith,(.indexOf [:a :b :c] :b) ; {blake}
13:06clojurebot1
13:07{blake}justin_smith: That's not Clojure. =P
13:07justin_smith{blake}: that's clojure
13:07gfredericksweelllll
13:07gfredericks,(.indexOf [1 2 3] 2N)
13:07clojurebot1
13:07gfrederickshmm
13:07{blake}Heh.
13:08gfredericks,(.indexOf [1N 2N 3N] 2)
13:08clojurebot1
13:08gfrederickshow does that wark
13:08justin_smithgfredericks: equality
13:08justin_smith,(= 1 1N)
13:08clojurebottrue
13:08gfredericksoh I forgot this was clojure.lang code being run
13:08gfredericksfor some reason
13:08justin_smithgfredericks: see, it's clojure
13:08gfredericksyeah okay it's all fine
13:09justin_smithif it didn't use a .equals or .equiv defined by clojure, then I'd agree it wasn't clojure
13:09{blake}justin_smith: It's invoking a Java object method, yes? Wouldn't work in ClojureScript? Might or might not work in .NET?
13:10justin_smith{blake}: sure, but that's the case for much of the language
13:10{blake}I mean, there's a clojure.string/capitalize, fercryinoutloud.
13:11{blake}So, I'm surprised by the absence of an index-of.
13:11gfredericksI think you're supposed to not want to use it
13:11gfredericksbut I still want to use it sometimes
13:12{blake}gfredericks: What, .indexOf? Well, I'm open to alternatives. Given a symbol, I want to cycle to the next item in the collection (with wrapping).
13:12{blake}This is user driven.
13:15strtokanyone using the clj-slackbot? i get java.security.AccessControlException when trying.
13:16gfredericks{blake}: sometimes there are alternate data structures. like it sounds like you could easily create a map that tells you what the next thing is
13:16gfredericks,(def things '[item1 item2 item32 item5])
13:16clojurebot#'sandbox/things
13:17gfredericks,(def next-item (->> things (concat things) (partition 2 1) (take (count things)) (into {})))
13:17clojurebot#error {\n :cause "clojure.lang.Symbol cannot be cast to java.util.Map$Entry"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.util.Map$Entry, compiling:(NO_SOURCE_FILE:0:0)"\n :at [clojure.lang.Compiler$InvokeExpr eval "Compiler.java" 3661]}\n {:type java.lang.ClassCastException\n :message "clojure...
13:17{blake}gfredericks: Yeah. I actually did that the other day. It just seems like more work than should be necessary.
13:17gfredericks{blake}: the upside is you don't have to think about indexes
13:17gfrederickswhy the hell didn't my code work
13:17{blake}I always have this problem with SQL, too. Sometimes order is significant.
13:18gfrederickswe're still dealing with ordering
13:18gfredericksjust not indexes
13:18gfredericks,(def next-item (->> things (concat things) (partition 2 1) (take (count things))))
13:18clojurebot#'sandbox/next-item
13:18gfredericks,next-item
13:18clojurebot((item1 item2) (item2 item32) (item32 item5) (item5 item1))
13:18gfredericksoh vectors
13:18gfredericksthanks conj
13:18gfredericks,(def next-item (->> things (concat things) (partition 2 1) (map vec) (take (count things))))
13:18clojurebot#'sandbox/next-item
13:18gfredericks,next-item
13:18clojurebot([item1 item2] [item2 item32] [item32 item5] [item5 item1])
13:18gfredericksbaaah
13:18{blake}lol
13:18gfredericks,(->> things (concat things) (partition 2 1) (map vec) (take (count things)) (into {}))
13:18clojurebot{item1 item2, item2 item32, item32 item5, item5 item1}
13:18{blake}Friday
13:18gfredericksthere we go
13:19gfredericksso it's easy to make a map like that one, and to do it in a way where you never refer to indexes
13:19{blake}gfredericks: Yeah, it's not bad. I'm just not sure I buy this indexes-considered-harmful stuff. =P
13:19gfredericksyeah I'm on the fence
13:20gfredericksthey don't seem necessary for this case though; and my code even handles the cycling in a less special-casey kind of way
13:20{blake}It also seems processor intensive. The way I did this--I forget who put this in the chat--but it was with an order function: (zipmap s (range)).
13:21{blake}It's slick but I'm just making a map every time.
13:21gfredericksthat should be the same amount of work as mine
13:21gfredericksmine just makes a map
13:22{blake}Right. So why wouldn't I just use a map, other than feeling that a vector should be treatable as a map? I can say nth, after all, so why not itemth?
13:25mgaare_,(zipmap (drop-last things) (drop 1 things))
13:25clojurebot{item1 item2, item2 item32, item32 item5}
13:25mgaare_oh but you want a cycle
13:29mgaare,(zipmap things (-> things (rest) (vec) (conj (first things)))
13:29clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
13:29mgaaredoh
13:29mgaarewell, that's the idea
13:30{blake}mgaare: So, just add it to the back when we run out? Heh.
13:30TEttinger,(nth (cycle things) 15)
13:30clojurebot#error {\n :cause "Unable to resolve symbol: things in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: things in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: things in t...
13:31TEttinger,(def things '[item1 item2 item32 item5])
13:31clojurebot#'sandbox/things
13:31TEttinger,(nth (cycle things) 15)
13:31clojurebotitem5
13:31mgaareahhh cycle, of course
13:31TEttingerinfinite lazy seq
13:31mgaaremight be a little nicer to use
13:32mgaare,(zipmap things (rest (cycle things)))
13:32clojurebot{item1 item2, item2 item32, item32 item5, item5 item1}
13:33{blake},things
13:33clojurebot[item1 item2 item32 item5]
13:33kungiHow can I split build configurations for lein cljsbuild in dev and production. Production should be activated when compiling an uberjar.
13:34mgaareah, and just using cycle handles the original request more elegantly too
13:35Glenjaminis there anything in core I can use to put vars / locals in a map with keys of the same name?
13:35Glenjamin(??? name key val) -> {:name name :key key :val val}
13:37mgaareI don't think so, but you could do something like #(zipmap (map keyword %) %)
13:43noncomjustin_smith: oh wow, core async + mongo sabotage
13:43{blake}justin_smith: Oh, yeah, did you get that figured out?
13:43noncomi even afraid to imagine what you had to go through to find that out...
13:44{blake}It was a mix of async and mongo? *gets nervous*
13:45justin_smithheh
13:45justin_smithnoncom: yourkit, it's like magic
13:46justin_smithmgaare: I think Glenjamin wants the name of the binding mapped to the bound value - iirc something in flatland/useful does this
13:46Glenjaminof course, flatland/useful does everything :)
13:46justin_smithGlenjamin: I think this does what you want https://github.com/flatland/useful/blob/develop/src/flatland/useful/map.clj#L9
13:47Glenjamini'm noticing i'm doing this a fair bit when passing context to (ex-info)
13:47Glenjaminyup, that's the one
13:47mgaaremm, I see
13:51Glenjaminand is there a variant of (get) which throws on unknown keys?
13:51TEttingerjustin_smith: dammit yourkit... here I am trying out JVM profilers last updated in 2007
13:52TEttinger,(get {:a 1 :b 2} :a)
13:52clojurebot1
13:52TEttinger,(get {:a 1 :b 2} :c)
13:52clojurebotnil
13:52TEttingerhm
13:52TEttingernth fails with vectors...
13:52TEttingerbut get doesn't with maps
13:53TEttinger,(nth [1 2] 3)
13:53clojurebot#error {\n :cause nil\n :via\n [{:type java.lang.IndexOutOfBoundsException\n :message nil\n :at [clojure.lang.PersistentVector arrayFor "PersistentVector.java" 157]}]\n :trace\n [[clojure.lang.PersistentVector arrayFor "PersistentVector.java" 157]\n [clojure.lang.PersistentVector nth "PersistentVector.java" 161]\n [clojure.lang.RT nth "RT.java" 846]\n [sandbox$eval73 invokeStatic "NO_SOURCE...
13:53justin_smith,(nth [1 2] 3 :not-found)
13:53clojurebot:not-found
13:53TEttingeryeah, that's a good example
13:53bluezoneTheses docs http://clojure-doc.org/ are so much better than the living clojure book
13:53justin_smithdifferent defaults, but you can get the same behavior
13:55Glenjamin(if (contains? @conf name) (get @conf key-name) (throw (ex-info "Unknown config key" {:name name})))
13:56justin_smith(get {:a 0} :b (lazy-seq (throw (Exception. "boom")))) ; works, but is a hack
13:56Glenjaminheh
13:57justin_smithbut the lazy-seq means no throw happens if the key is found
13:57justin_smithbut also means no exception if you don't use the return value :P
13:59noncomjustin_smith: hmmm! yourkit... i heard of it.. i think i'll try learning more of it
14:00noncommaybe it will come to use one day
14:00noncomfor me too
14:03TEttingernoncom: if your company is paying for it I would use it like there's no tomorrow
14:04justin_smithTEttinger: or start / contribute to a healthy and useful open source project
14:05TEttingerI have no idea what yourkit considers useful, haha
14:05oddcullyjustin_smith: why bother, if nomcoms company would pay for tettingers version?
14:05TEttingerhaha
14:05TEttingerright, I mixed up your and I
14:09justin_smithTEttinger: sometimes I forget which guy I am too, I get myself mixed up with gfredericks all the time and I'm all like "wait, I thought I was supposed to live in Chicago?"
14:10TEttingerI can't remember which time zone the noisesmith is in
14:10justin_smithhipster central
14:11noncomTEttinger: yeah its probably payed
14:26phaseNicd
14:26phaseNiwhoops
14:28bluezoneWhat's the difference between a keyword and a symbol? A keyword doesn't have to be explicitly defined with def?
14:28Bronsabluezone: a keyword is more like a string than like a symbol
14:29bluezonemmm i see
14:29Bronsakeywords are self-evaluating
14:29Bronsabut like symbols, they have an (optional) namespace and name component
14:29Bronsaand like symbols, they are also functions
14:32TimMcbluezone: Keywords are generally intended to represent themselves, usually as lookup keys or sometimes as sentinals or out-of-band values.
14:33TimMcbluezone: Symbols are generally intended to be bound to values in a program, or represent them.
14:34TimMcSymbols are most often seen in compilation or related contexts, and keywords are usually seen in data.
14:53bluezoneNot sure If I grasped it yet, i am missing terminology. But will move on for now, seems to only be used as keys and certain actions (like :as in require)
14:54bluezonehttps://www.refheap.com/111431 In this example why aren't they forced to (declare do-it) before making the call to (do-it) ?
14:54bluezoneThe example is under the heading "Layout of functions" here http://clojure-doc.org/articles/tutorials/introduction.html#functions-defining-your-own
14:55justin_smithbluezone: certain functions or macros treat keywords specially - because they are looking for that keyword
14:55bluezoneah okay
14:55justin_smithso it's like a pseudo-syntax
14:57oddcullybluezone: this (to me) makes no sense. you can not call (do-it) even if you would declare it
14:57oddcully,(declare do-it)
14:57oddcully,(do-it)
14:57clojurebot#'sandbox/do-it
14:57clojurebot#error {\n :cause "Attempting to call unbound fn: #'sandbox/do-it"\n :via\n [{:type java.lang.IllegalStateException\n :message "Attempting to call unbound fn: #'sandbox/do-it"\n :at [clojure.lang.Var$Unbound throwArity "Var.java" 43]}]\n :trace\n [[clojure.lang.Var$Unbound throwArity "Var.java" 43]\n [clojure.lang.AFn invoke "AFn.java" 28]\n [sandbox$eval47 invokeStatic "NO_SOURCE_FILE" 0]\n...
14:57bluezoneI think you need to put it in the same line
14:58bluezone,(declare do-it) (do-it)
14:58clojurebot#'sandbox/do-it
14:58justin_smithbluezone: no, that just works accidentally
14:58bluezone,(do-it) (declare do-it)
14:58clojurebot#error {\n :cause "Attempting to call unbound fn: #'sandbox/do-it"\n :via\n [{:type java.lang.IllegalStateException\n :message "Attempting to call unbound fn: #'sandbox/do-it"\n :at [clojure.lang.Var$Unbound throwArity "Var.java" 43]}]\n :trace\n [[clojure.lang.Var$Unbound throwArity "Var.java" 43]\n [clojure.lang.AFn invoke "AFn.java" 28]\n [sandbox$eval93 invokeStatic "NO_SOURCE_FILE" 0]\n...
14:58oddcullyno i't does not know, what to run
14:58justin_smithbluezone: clearly what they meant in the example is (declare doit) (defn foo [] (doit)) (defn doit [])
14:58justin_smiththat works
14:59justin_smithbut what they have on that page is broken
14:59bluezone,(declare do-it) (do-it) ;; <- is that okay?
14:59clojurebot#'sandbox/do-it
14:59oddcullyno
15:00oddcully"one line" does not matter here
15:01bluezone,(declare do-it) (do-it "fanculo"]) (defn do-it [x] (println x))
15:01clojurebot#'sandbox/do-it
15:01justin_smithbluezone: clojurebot is not a repl, it ignores everything after the first form
15:01bluezoneo
15:02justin_smith,:foo (/ 1 0) (println "this doesn't happen")
15:02clojurebot:foo
15:02mgaareevidence: it ignored unmatched ] in (do-it "fanculo"]) ;)
15:02bluezoneOkay I shall try in repl i suppose
15:03oddcullyyou will get the error with the "unbound fn"
15:03bluezoneyeah I saw that ^_^
15:03oddcullyunless you have defined that fn beforehand at any point in your repl
15:03justin_smithbluezone: declare is for putting things in function definitions that are not yet defined, but you still need to define the thing before the function is called or you get an error
15:06bluezoneso you can use (delcare func) (defn test [] (func)) (defn func [] (println "abc")) . But you can't do (delcare func) (func) (defn func [] (println "abc")) ?
15:07bluezoneSeems odd to me that you could use the function inside a function definition, but you can't call it if it hasn't been defined above the call
15:08amalloybluezone: forms are evaluated sequentially
15:08amalloyhow could (func) be evaluated if you haven't supplied a definition?
15:08bluezoneyeah the definition is below :( but what's the point of declare then?
15:09bluezoneJust so you can use (func) in another function definition before declaring (defn func [] () ) ?
15:09oddcullyit's a forward declaration
15:10johannbestowroushey guys im working with a coworker to get lein up and running on his computer
15:10johannbestowrousand he's running into an issue similar to this gist https://gist.github.com/brandonbloom/d3598b6f2e4ef493ed56
15:10bluezoneI blame them for confusing me with their terrible example :)
15:10johannbestowrousanyone have any familiarity with this issue?
15:11amalloyjohannbestowrous: looks to me like his project.clj has junk in it?
15:11amalloymaybe
15:11johannbestowroushey amalloy--no project.clj, literally just running lein repl
15:12bluezonemaybe your lein is 32 bit? ^_^ random guess
15:12oddcullybluezone: ignore that example. it is wrong and makes no sense
15:13amalloyjohannbestowrous: honestly that's a pretty weird error to me. maybe upgrade lein? like i got 2.5.2 months ago so i'm a little confused why someone who's starting out is on 2.5.1
15:13oddcullyjohannbestowrous: maybe bork in ~/.lein/profiles.clj?
15:13johannbestowrousgood call
15:14oddcullyalso isn't that java there ancient?
15:14oddcullyerm sorry... that is not _your_ error
15:15johannbestowrousoddcully
15:15johannbestowrousexcellent excellent excellent
15:15johannbestowrousi owe you a beer :)
15:15johannbestowrousfixed his profiles.clj :)
15:16bluezoneI e-mailed the docs author :)
15:17oddcullyjohannbestowrous: cheers!
15:21johannbestowroushell everyone who offered help gets a beer
15:26PMunchHi I want to use map on a set of data (read from a file) with a function that takes in two arguments (one which is the element, the other which is constant). What I've done is to create an anonymous function #(func % 10) which I try to use in the map but I've getting an error Wrong number of args. What gives?
15:27TEttingerPMunch: that fn always takes one arg
15:27TEttingerthe #() I mean
15:28PMunchTEttinger, yes and that's all it gets from map isn't it?
15:28PMunchhttp://pastebin.com/7uEhdBrN << complete code
15:28TEttingerthanks
15:30PMunchTEttinger, keep in mind I'm fairly new to Clojure so that code might be quite horrible..
15:30TEttingerno no, it actually looks fine
15:30TEttingerso stack-hash takes two args?
15:32TEttingerPMunch, that really doesn't look like "fairly new to clojure" style code. my first clojure program used ref everywhere
15:33xeqiand there isn't any nested defns
15:33PMunchHaha, I took some time with it the first time around. Used it for a school project to write a distributed hash map running on a cluster, but that's the only time I've used it
15:34TEttingernice
15:34TEttingerso what does stack-hash's arglist look like?
15:34PMunch[in size]
15:34TEttingerand that isn't in another set of square brackets, right?
15:35PMunchIt's basically a function that hashes the input and places in a bucket within size
15:35PMunchNo
15:35TEttingerok
15:35PMunchhttp://pastebin.com/ZU7xHY1T
15:36PMunchThere's the stack-hash function (poor name I know, it's a hashing algorithm I got from stackexchange..)
15:36TEttingerso what error does it throw, and does it have a meaningful line number?
15:36xeqiPMunch: (stack-hash (str first-four)) only recurses with one argument
15:37PMunchShit, just realised -_-
15:37PMunchSorry, my bad. I've been struggling for so long to get the file reading right I just assumed the error was there..
15:38PMunchAnd sorry if swearing isn't allowed..
15:38TEttingerno worries
15:38TEttingeryou may want to make that recur like you do earlier
15:39PMunchThe whole function? What would the benefit be over recursing like I do now? Or is it just idiomatic?
15:40PMunchHmm, I guess I could let n and mask be the same by doing it that way. No need to recompute them..
15:40justin_smithPMunch: (fn foo [] (foo)) uses stack, (fn foo [] (recur)) does not
15:40timvisheris there a way to take an arbitrary clojure structure that i can quote and pretty print it?
15:40timvisherit has 'seqs' embedded in it
15:40justin_smithtimvisher: I assume there is a problem with clojure.pprint/pprint ?
15:40timvisherit's a logged ring response from ring.middleware.logger if you're familiar with it
15:41PMunchjustin_smith, really? I thought it did and that recur was simply a different way of doing it. Neat!
15:41justin_smithPMunch: no automatic TCO in clojure, only explicit
15:42timvisherjustin_smith: oh duh. i didn't think to pass the quoted form to pprint. i kept trying to pass the unquoted form. :facepalm:
15:42TEttinger,(map seq [1 2 3 4] [10 20 30 40])
15:42clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/seq--4116>
15:42TEttinger,(map list [1 2 3 4] [10 20 30 40])
15:42clojurebot((1 10) (2 20) (3 30) (4 40))
15:42TEttinger,(str (map list [1 2 3 4] [10 20 30 40]))
15:42clojurebot"clojure.lang.LazySeq@1e56653"
15:42TEttinger,(pr-str (map list [1 2 3 4] [10 20 30 40]))
15:42clojurebot"((1 10) (2 20) (3 30) (4 40))"
15:43justin_smithyeah, pr-str helps, but pprint already does the equivalent of pr-str, recursively
15:43TEttingerah
15:43TEttingerthat does appear to recurse by two levels though
15:44TEttinger,(pr-str (map #(seq %&) (map list [1 2 3 4] [10 20 30 40]) (map list [1 2 3 4] [10 20 30 40])))
15:44clojurebot"(((1 10) (1 10)) ((2 20) (2 20)) ((3 30) (3 30)) ((4 40) (4 40)))"
15:45drorbemetHi, what's an easy way to eval a string of clojure code from emacs lisp when using cider?
15:45justin_smithanother underappreciated gem is clojure.pprint/print-table
15:45justin_smith(for lists of hash-maps)
15:46justin_smiths/lists/sequable
15:46mikerod_@drorbemet cider-read-and-eval
15:46mikerod_specifically
15:46mikerod_M-x cider-read-and-eval
15:47mikerod_if you want to do it in minibuffer that is
15:47mikerod_or perhaps you wanted to do it not in minibuffer?
15:59drorbemetmikerod_: yes, I want to pass clojure code directly to cider-read-and-eval. I just tried that without success. Now I am looking at cider-eval-region trying to learn from it (cider-interactive-eval nil nil (list start end)) ... but I don't know jet how to pass a string instead of a region.
16:00mikerod@drorbemet to me it looks like most of the API there is tailored towards the interactive eval
16:00drorbemetmikerod_: So I am missing cider-eval-string I guess.
16:00mikerodthat is just my preliminary thoughts though
16:01justin_smithdrorbemet: iirc there is a function with "send" in the name that takes a string...
16:02drorbemetmikerod: yes to me it looks like that too ... maybe I sould send an issue to the cider developers
16:02drorbemetjustin_smith: oh, let me check
16:02mikerodyou could probably just call the nrepl-client stuff directly too
16:02mikerodthat may be undesirable
16:03drorbemetjustin_smith: there are a lot of functions with "send" in their names
16:05justin_smithyeah, sorry I can't remember more specifically
16:05drorbemetmikerod: whell I am starting a cider repl via cider-jack-in and then I want to eval some code that I don't want to put into a file ... maybe should I just give up and put it in a file
16:06mikeroddrorbemet: yeah, there are ways to implement it yourself, but not sure how to reuse the most out of cider for it
16:07justin_smithdrorbemet: cider-eval-defun-at-point
16:07drorbemetmikerod: I'll ask the cider people, thanks for discussing the issue though, have a nice day
16:08justin_smithdrorbemet: oh, you want to type the code into the minibuffer?
16:08justin_smithdrorbemet: in that case cider-read-and-eval
16:09drorbemetjustin_smith: cider-read-and-eval and cider-eval-defun-at-point do not take a string as an argument, I want to call elisp code from the command line
16:10justin_smithdrorbemet: ahh, right - look at the functions in cider-client.el
16:10justin_smithdrorbemet: also, it's a common enough thing in elisp code to create a "temp buffer" that the user can't see, and put a string in it, for functions that want a buffer
16:11mikerodI don't even understand how cider-read-and-eval can take forms that are not readable in elisp
16:11mikerodmagic
16:11mikerodexample
16:11mikerod#{1}
16:11drorbemetjustin_smith: ah, ok thanks for that hint. I found that to cumbersome at first, but right in emacs thats the way to go.
16:11justin_smithmikerod: because the minibuffer is not an elisp repl
16:12mikerodI was trying to see if you could just break out the read-from-string part and than pass that form through to what wants a form
16:12mikerodoh
16:12justin_smithmikerod: you can make an elisp repl with ielm, it's handy for when you want to debug elisp code
16:12justin_smithM-x ielm that is
16:13mikerodjustin_smith: this is interesting
16:13mikerodI'll have to look at this some more
16:13drorbemetmikerod: cider-eval-region gets close I think
16:16justin_smithdrorbemet: there's also this, plus a function that handles the result as a callback https://github.com/clojure-emacs/cider/blob/master/cider-client.el#L451
16:17justin_smithwho knows what the data you get back is, but it shouldn't be too hard to experiment
16:17justin_smithoh, and even simpler, the sync version https://github.com/clojure-emacs/cider/blob/master/cider-client.el#L463 should do exactly what you expect
16:24drorbemetjustin_smith: I tested those, now I figured that I want to see the output in the cider repl buffer. Both functions don't do that. I will return to cider-load-file I guess.
16:26justin_smithdrorbemet: a callback can totally do that
16:28drorbemetjustin_smith: ok, but then I have a new dependency in my emacs config ... which I was trying to avoind
16:29drorbemetjustin_smith: It's ok I will bend around it :-)
16:33PMunchHmm I'm having some trouble porting this hashing algorithm from Python. I would say they are the same but they don't give the same results.. Clojure version: http://pastebin.com/hzgQWTXS
16:33PMunchPython version: http://pastebin.com/utAnsngp
16:34PMunchI've tested that the last_four thing gives the same numbers and that the n is the same for both..
16:34PMunchBut the Clojure version seems to put a lot more (about 3x intended) into one bucket..
16:41TEttingerPMunch: I suspect it may have to do with the behavior of math in clojure having some different defaults
16:43PMunchTEttinger, could be..
16:44justin_smithPMunch: what's up with stack_hash, which full_hash calls in the python version?
16:46justin_smithPMunch: one thing to check out is that clojure assumes vals are 64 bits (long not int, double not float)
16:48PMunchjustin_smith, It does?
16:48justin_smith,(type (+ Integer/MAX_VALUE 1)) ; PMunch - also, auto-promotes
16:48clojurebotjava.lang.Long
16:48justin_smithPMunch: yes
16:48justin_smithPMunch: it strongly prefers 64 bit numbers
16:48justin_smith,(type 1)
16:48clojurebotjava.lang.Long
16:49TEttinger,(Long/highestOneBit 5)
16:49clojurebot4
16:50TEttinger,(dec (* 2 (Long/highestOneBit 5)))
16:50justin_smithTEttinger: oh, that would simplify his code wouldn't it
16:50clojurebot7
16:50TEttingeryeah I use it or methods like it a fair amount in java
16:50PMunchHmm, I think one of the reasons might be that Python reads in newlines as part of a line..
16:51justin_smithoh yeah, line-seq doesn't give you the newlines either
16:51TEttinger,(Long/numberOfTrailingZeros (Long/highestOneBit 5))
16:51clojurebot2
16:51TEttinger,(inc (Long/numberOfTrailingZeros (Long/highestOneBit 5)))
16:51clojurebot3
16:52TEttinger,(Math/ceil (/ (Math/log 5) (Math/log 2)))
16:52clojurebot3.0
16:52TEttingerah, that might be another gotcha
16:52TEttingerceil returns a double
16:52TEttingerit doesn't in all languages
16:52justin_smithTEttinger: but it's only used in the pow call right?
16:53TEttingeryeah, which is where...
16:53PMunchHmm, I stripped the newline in python and while I get different results they are still better distributed..
16:53TEttinger,(int (- (Math/pow 2 (Math/ceil (/ (Math/log 5) (Math/log 2)))) 1))
16:53clojurebot7
16:54TEttinger,(dec (* 2 (Long/highestOneBit 5)))
16:54clojurebot7
16:54TEttingerI think this might be a bit simpler/mor efficient
16:55TEttingeralso, PMunch, what's the difference between stack_hash and full_hash in the python?
16:56PMunchIt's basically the same
16:56PMunchYou can change that line to: return full_hash(str(Hv),N)
16:56PMunchAnd it does the exact same thing
16:57TEttingerbut full_hash takes 3 args
16:57TEttingerassuming there's an 'n' in there somewhere
16:58TEttingerand I realy have no idea what this does: first_four = int(to2sCompStr(Hv,64)[64-n:],2)
17:00PMunchIt selects the 4 least significant bits of Hv
17:02PMunchOkay, I have now found one word that classifies differently "you" over 30 buckets. It starts of equal, both evaluating to 31, then on the second go clojure gives hash 1630 while Python gives hash 1449834469
17:03TEttinger,(reduce #(mod (+ (* %1 31) (int %2)) 2147483647) 0 "alpha") ; Hv = (Hv*31+ord(c))%2147483647
17:03clojurebot92909918
17:03TEttinger,(reduce #(mod (+ (* %1 31) (int %2)) 2147483647) 0 "you") ; Hv = (Hv*31+ord(c))%2147483647
17:03clojurebot119839
17:03TEttinger,(reduce #(mod (+ (unchecked-multiply-int %1 31) (int %2)) 2147483647) 0 "you") ; Hv = (Hv*31+ord(c))%2147483647
17:03clojurebot119839
17:04PMunchYea, that's the first round
17:04PMunchThe four least significant bits makes that number 31
17:04PMunch ,(reduce #(mod (+ (unchecked-multiply-int %1 31) (int %2)) 2147483647) 0 "31") ; Hv = (Hv*31+ord(c))%2147483647
17:04clojurebot1630
17:04PMunchPython gives 1449834469
17:05TEttingerwait wait
17:05TEttinger "31")
17:06TEttingerare you feeding the number back as a string?
17:06justin_smithTEttinger: yup - it's in the code
17:06TEttingeralso 31 is...
17:06PMunchTEttinger, yes that's because I used a hashing algorithm for strings..
17:06TEttinger,(Integer/toBinaryString 31)
17:06clojurebot"11111"
17:06PMunchI should probably change that
17:06TEttinger31 is 5 bits all 1
17:06PMunchYes
17:07PMunchOh sorry, I was working with 4 bits before. I meant 5 least significant bits
17:07TEttingeroh ok
17:07PMunchSo it seems like it is actually Python which is doing something weird. But somehow it ends up more right..
17:08justin_smithwhich "unchecked-multiply-int" ?
17:08PMunchOooooh
17:08PMunchFound the bug..
17:08TEttingerjustin_smith: hm?
17:09PMunchIn clojure I do (recur (str first-four)), while in Python it is full_hash(str(Hv),N)
17:09justin_smithTEttinger: sorry, meant "why"
17:10TEttingerI thought we were expecting 32 bit precision
17:10PMunchSo it wasn't related to Clojure at all. Sorry guys for wasting your time
17:10TEttingerto match python
17:10TEttingerno prob
17:11PMunchBut you had some good ideas on improving the bit checking algorithm so it wasn't all for nothing
17:17TEttinger,(defn stack-hash [in size] (let [mask (* 31 (Long/highestOneBit size)) Hv (reduce #(mod (+ (unchecked-multiply %1 31) (int %2)) 2147483647) 0 in) first-five (bit-and Hv mask)] (if (< first-five size) first-five (recur (str Hv) size))))
17:17clojurebot#'sandbox/stack-hash
17:17TEttinger,(stack-hash "you")
17:17clojurebot#error {\n :cause "Wrong number of args (1) passed to: sandbox/stack-hash"\n :via\n [{:type clojure.lang.ArityException\n :message "Wrong number of args (1) passed to: sandbox/stack-hash"\n :at [clojure.lang.AFn throwArity "AFn.java" 429]}]\n :trace\n [[clojure.lang.AFn throwArity "AFn.java" 429]\n [clojure.lang.AFn invoke "AFn.java" 32]\n [sandbox$eval52 invokeStatic "NO_SOURCE_FILE" 0]\n ...
17:17TEttinger,(stack-hash "you" 5)
17:17clojurebot4
17:17TEttingerI don't know what size should be
17:17TEttinger,(stack-hash "you" 31)
17:17clojurebot16
17:19TEttinger,(defn stack-hash [in size] (let [mask (* 31 (Long/LowestOneBit size)) Hv (reduce #(mod (+ (unchecked-multiply %1 31) (int %2)) 2147483647) 0 in) first-five (bit-and Hv mask)] (if (< first-five size) first-five (recur (str Hv) size))))
17:19clojurebot#error {\n :cause "No matching method: LowestOneBit"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.IllegalArgumentException: No matching method: LowestOneBit, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6891]}\n {:type java.lang.IllegalArgumentException\n :message "No matching method: LowestOneBit"\n :at [clojure...
17:19TEttinger,(defn stack-hash [in size] (let [mask (* 31 (Long/lowestOneBit size)) Hv (reduce #(mod (+ (unchecked-multiply %1 31) (int %2)) 2147483647) 0 in) first-five (bit-and Hv mask)] (if (< first-five size) first-five (recur (str Hv) size))))
17:19clojurebot#'sandbox/stack-hash
17:19TEttinger,(stack-hash "you" 31)
17:19clojurebot5
17:19TEttingerhm
17:20TEttinger,(stack-hash "you" 1024)
17:20clojurebot0
18:01Trioxinquestion: Let's say I want to be able to make use of multiple cores and the full power of GPUs, is OpenCL the best route? This would be for machine learning algorithms.
18:02TrioxinOpenCL seems to be the easiest route. That's what i mean by best (Most portable across all architectures)
18:03TrioxinOr would it be best to just use the JVM for the CPU cores and openGL for GPU processing?
18:03Trioxinbut then again I'm using two different things at that point for 1 algorithm whereas openCL...
18:05rhg135u8n-o oh7o .7ohq. cy6 cq,qc"
18:05rhg135err, wrong dhan
19:16domokatoif two threads force a delay at the same time, is the delay body invoked twice?
19:16justin_smithdomokato: you could try, but my strong guess is no
19:19justin_smithdomokato: looks good to me https://www.refheap.com/111441
19:21domokatothanks!
19:21domokatowhere is the parallelization in your code, though?
19:21justin_smiththe futures
19:22domokatooops
19:22domokatomissed those
19:23justin_smithyou can try the same function calls, but eg. add (Thread/sleep (rand-int 300)) into the doseq before the @d
19:24justin_smithI am not sure where sleeps would maximize the collission possibility actually, now that I think about it - maybe (delay (Thread/sleep (rand-int 300)) (swap! undelay inc))
19:29McDougaljustin_smith: Are you using any external libs to beef up security in Caribou?
19:30justin_smithsure, bcrypt
19:30justin_smith(for one)
19:31McDougalHow about csrf?
19:32justin_smithno, that one would be a good reason to bring in friend or buddy yourself
19:32McDougalGotcha, am using Buddy
19:32McDougalAnd yesql
19:47TEttingerdomokato: futures are awesome, especially for the kind of thing you're making
19:48domokatoTEttinger: yeah, i'm using them in a few places
19:48TEttingerin a game I partly made, that was 100% clojure, I would generate a level and do some expensive calcs on it before the player reached it, in another thread due to futures
19:49TEttingerI'm currently making that approach easy enough to do for java devs with my current lib
19:49TEttinger(it would be easier in clojure)
19:53domokatonice
19:53domokatoi'm using them for my ai calculations
19:53domokatofor each agent
19:58Trioxindomokato, Tettinger, Have you guys used OpenCL? I'm wanting to do machine learning calculations with it.
19:59TEttingerI wanted to at one point, but the lib I'm making has android as a target. it's crazy how much google wants to keep openCL off of phones
20:00TEttingerTrioxin: it's true that a good GPU is extremely powerful at certain tasks
20:00TrioxinTettinger, a google search is showing results for doing it on android
20:00TEttingernot officially. look up nexus opencl
20:00Trioxintettinger, well I want to use both cpu cores and gpu and would rather use 1 thing to do it
20:01Trioxingoal would be to deploy to all desktop and mobile platforms using the JVM and cordova
20:01TEttingerhttp://streamcomputing.eu/blog/2013-08-01/google-blocked-opencl-on-android-4-3/
20:02TEttingerif you can find a way to use cpu and gpu on both desktop and mobile platforms, will you tell me please?
20:03Trioxinso this is just for nexus and they've blocked it in favor of some other thing
20:04Trioxinrenderscript
20:04Trioxinopencl seems like a no brainer. wtf
20:04Trioxinand i don't think the current version is in cuda
20:04Trioxinbut 1. something
20:08Trioxindoesn't sounds like fun to have to use GL along with something else for CPU cores to perform the same computations
20:08TEttingerTrioxin: there's a hare-brained set of excuses in here https://code.google.com/p/android/issues/detail?id=36361
20:10Trioxintettinger, "If you need "maximum control and speed", you should probably be pursuing custom hardware/software for your use-case."
20:10Trioxinlike that?
20:10Trioxinloll
20:11Trioxinmakes no sense
20:11Trioxinand fragmentation. isn't that sort of a principal of a linux-based OS?
20:12TEttingeryeah, their solution is just going to cause fragmentation
20:12TEttingerif you have Mali or certain other GPUs, you can use OpenCL
20:12TEttingerif you don't, you can't
20:13Trioxinand the solution then is to use renderscript? or GL?
20:13Trioxinon mobile are the cpu and gpu cores separate?
20:25TEttingerTrioxin: man... I haven't found a solution that's very good. there's the old way of GPGPU stuff using pixel shaders to do calculations
20:32esegHey everyone, how can I destructure a vector into parts while still binding a name to the whole data structure, like as patterns in haskell?
20:37Frozenlock,(let [[a b :as v] [1 2 3 4 5]] {:a a :v v})
20:37clojurebot{:a 1, :v [1 2 3 4 5]}
20:38Frozenlockdestructuring tutorial https://gist.github.com/john2x/e1dca953548bfdfb9844
20:39esegthanks guys
22:14Trioxintettinger, meh. but I guess on desktop and server it should be okay with CL? maybe? except nvidia doesn't support latest versions?
22:22TEttingerOpenCL should be perfect for desktop
22:22TEttingerit will be supported on windows, mac, linux, with intel, AMD, or NVIDIA GPUs
22:23justin_smithTEttinger: have you tried using jocl from clojure?
22:25TEttingerno
22:25Trioxintettinger, I think not the current version on nvidia though due to them wanting to promote cuda?
22:25TEttingerCUDA is technically a better choice if you know what hardware you're running on
22:25TEttingerbut you don't know that if distributing an app
22:26Trioxinsays nvidia supports 1.2
22:26Trioxincl 1.22
22:26Trioxin1.2*
22:27Trioxinthe point for me is that if I'm computing something with openCL I don't have to write any extra code for the CPU than the GPU right?
22:28Trioxinother than maybe some settings but don't have to modify the code for the computation?
22:43TEttingerI think so yeah
23:02bluezoneBroadcasting my failures. Can't figure out a null pointer exception -.- https://www.livecoding.tv/bluezone/
23:02bluezoneYou are welcome to make fun of me
23:17FrozenlockNice
23:17FrozenlockWith music!
23:18bluezone^_^
23:21justin_smithbluezone: eventually, first sequ is nil
23:21bluezoneyeah I tried to avoid that in the and statement hmm
23:21justin_smith,(odd? nil)
23:21clojurebot#error {\n :cause "Argument must be an integer: "\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Argument must be an integer: "\n :at [clojure.core$even_QMARK_ invokeStatic "core.clj" 1359]}]\n :trace\n [[clojure.core$even_QMARK_ invokeStatic "core.clj" 1359]\n [clojure.core$odd_QMARK_ invokeStatic "core.clj" 1362]\n [clojure.core$odd_QMARK_ invoke "core.clj" -1]\n [sandbox...
23:22Frozenlockbluezone: Montréal?
23:22justin_smith(mod nil 2)
23:22bluezoneFrozenlock: Yeah ^_^
23:22justin_smith,(mod nil 2) ; this is your error, bluezone
23:22clojurebot#error {\n :cause nil\n :via\n [{:type java.lang.NullPointerException\n :message nil\n :at [clojure.lang.Numbers ops "Numbers.java" 1013]}]\n :trace\n [[clojure.lang.Numbers ops "Numbers.java" 1013]\n [clojure.lang.Numbers remainder "Numbers.java" 173]\n [clojure.core$mod invokeStatic "core.clj" 3448]\n [clojure.core$mod invoke "core.clj" -1]\n [sandbox$eval49 invokeStatic "NO_SOURCE_FILE"...
23:22Frozenlockbluezone: Sherbrooke :-D
23:23justin_smithnow you have an infinite loop I think
23:24bluezoneyeah hmm
23:24justin_smithyou know how to fix that though I am sure
23:28bluezonecan't believe it's taking me this long lol
23:28justin_smithnotice that all those prints have your answer in them
23:28justin_smithwhy didn't it exit?
23:29justin_smith,(rest ())
23:29clojurebot()
23:31justin_smithbluezone: or more to the point, how do you make it stop when you have the answer?
23:31bluezonehmmm
23:32bluezonesomething is not right here ^_^
23:32bluezoneIt needs to stop when sequ is empty
23:32justin_smithbluezone: so, don't you need another if to see if you are done?
23:37justin_smithbluezone: very close
23:37justin_smithbluezone: check your if scope...
23:38bluezoneOh my god :D
23:39bluezonethis takes some getting used to I guess :) Thanks
23:40bluezoneNot sure why the and statement wasn't working there mhmm
23:40Trioxinmaybe I'll just take the easy way out and use a node opencl implementation
23:40Trioxinand a webkit frontend
23:41TEttingerTrioxin: that wouldn't be much help if there's no OpenCL drivers on a phone
23:41justin_smithbluezone: you need three conditions!
23:41Trioxindidn't mean for phone
23:41TEttingeroh ok
23:41TEttingeryou mentioned cordova at one point
23:41justin_smithone if can't do it
23:41Trioxinyeah I suppose I'd have to port to their crap
23:41TEttingerrenderscript, le ugh
23:42Trioxinfor mobile
23:42Trioxinyea
23:42bluezonejustin_smith: I thought I only had two :O
23:42justin_smithbluezone: even (keep going) odd (keep and keep going) empty (done)
23:42justin_smithso you need at least two ifs
23:42justin_smithor a cond
23:46bluezoneNot sure hmm
23:47justin_smithbluezone: there are tree conditions to check for
23:47justin_smithright?
23:47clojurebotright is not wrong
23:47justin_smitheven, odd, done
23:47bluezoneyeah but even and odd is checked by 1 form
23:47justin_smithOK, so you need how many ifs?
23:48justin_smithalso you don't need that (do ...)
23:48bluezoneI would need 2 ifs, but why can't I put the conditions together with (and x x )
23:48bluezoneand then just use 1 if
23:48justin_smithbluezone: because that's still only one condition with two branches
23:48justin_smithyou need three branches
23:48bluezoneurghh I'm so stupid :D
23:49bluezoneI see it
23:49bluezoneJust not use to reasoning in this lisp style
23:49justin_smithwhile you are at it, look at the doc for cond on clojuredocs
23:51justin_smithbluezone: sorry, I might have jumped too far ahead with cond - cond replaces nested ifs
23:51justin_smithso you use it instead of if
23:55thomseyHey friends, I'm messing around with seesaw & nothing I do will make (timer) fire it's callback. Has the API changed since the docs were updated last?
23:57TEttingerthomsey, what does your callback look like?
23:57thomsey(fn [e] (print "works"))
23:58bluezoneREEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEKT
23:58thomseybcuz I didn't (fn [e] (print "works") e)
23:58thomsey?
23:58bluezonejustin_smith: Thanks so much :)
23:59justin_smithbluezone: np - one other small thing - you can define multiple arities for one function (and that way combine odd-num-seq and _odd-num-seq into one definition)