#clojure logs

2015-04-13

00:06Intensityjustin_smith: Hmm. Well the hash-map originally looks something like: {15 #{5 10}, 25 #{5}}, so it's a hash with sets as values. I provide the result of that map, where I still have the choice of "x" or "#{x}" there.
00:06IntensityEven when replacing conj with (fnil conj #{}), I still have the same issues.
00:09justin_smith,(reduce (fn [m [k v]] (update-in m [k] (fnil conj #{}) v)) {15 #{5 10} 25 #{5}} {1 3 5 7 25 42})
00:09clojurebot{15 #{5 10}, 25 #{5 42}, 1 #{3}, 5 #{7}}
00:09justin_smithoh wait, I can make that closer to your original, one moment
00:11justin_smith,,(reduce (fn [m [k v]] (update-in m [k] (fnil conj #{}) v)) {15 #{5 10} 25 #{5}} (map (juxt #(+ 5 %) identity) #{10 20 30}))
00:11clojurebot{15 #{5 10}, 25 #{20 5}, 35 #{30}}
00:12Intensityjustin_smith: Cool, tahnks for the suggestions. Does my use of (partial merge-with [something] hash-map) have an intrinsic limitation? It seems I just want the keys of the hash (which are themselves sets) to merge as a union.
00:12justin_smithIntensity: merge-with won't ever alter keys that weren't present in the original
00:12justin_smithyou need to update all keys
00:13justin_smithsome are merged, the others become sets
00:14justin_smiththe alternative would be to turn every value coming in into a set, unconditionally, then merge-with set/union I guess
00:14justin_smithbut I think the reduce is simpler
00:18Intensityjustin_smith: So it's that when I use merge-with, when the key didn't exist before, I have to pass in {10 #{5}}, but if the key did exist I have to pass in {10 5}? It does seem like reduce is simpler; I'm just trying to understand what you said about merge-with not altering keys not present in the original,
00:18justin_smithIntensity: merge-with only alters keys if they are present in two maps
00:18justin_smithall keys that are present in only one map, are unaltered
00:19Intensitysince if I'm doing the overall (partial merge-with conj...) I get something almost like what I want, but I have to conditionally provide the value of the hash as a number or as a set with a number in it.
00:19justin_smithIntensity: the way to do it with merge-with would be to provide all vals in sets
00:19justin_smithand have set/union be the merge function
00:22justin_smith,(merge-with clojure.set/union {15 #{5 10} 25 #{5}} (into {} (map (juxt #(+ 5 %) hash-set) #{10 20 30})))
00:22clojurebot#error{:cause "clojure.set", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.ClassNotFoundException: clojure.set, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6535]} {:type java.lang.ClassNotFoundException, :message "clojure.set", :at [java.net.URLClassLoader$1 run "URLClassLoader.java" 366]}], :trace [[java.net.URLClassLoader$1 run ...
00:22justin_smith,(require 'clojure.set)
00:22clojurebotnil
00:22justin_smith,(merge-with clojure.set/union {15 #{5 10} 25 #{5}} (into {} (map (juxt #(+ 5 %) hash-set) #{10 20 30})))
00:22clojurebot{15 #{5 10}, 25 #{20 5}, 35 #{30}}
00:23justin_smiththat does some work that the reduce based version doesn't have to do
00:23justin_smithcreating an unneeded hash-map, and some unneeded hash-sets
00:23Intensityjustin_smith: Thanks for the alternatives.
03:25dysfunis there transducers support for clojure 1.6 in a library?
03:26cfleming$mail sveri https://github.com/JetBrains/anko
03:26lazybotMessage saved.
03:35lxsameer_guys, what is the RubyonRails of Clojure :)) ?
03:36mpenetdysfun: if you mean "as a library" I dont think so. core.async as partial support for transducers
03:37mpenetdysfun: but I doubt it's what you're asking for
03:38dysfunmpenet: no, it's not. damn. this waiting forever for clojure 1.7 thing is a bit tedious.
03:39dysfunlxsameer_: there isn't one, but there are a variety of frameworks with varying levels of guidance on building things
03:39dysfuni used to be quite fond of luminus
03:40dysfunthey've changed it all recently though, i haven't tried the new one
03:40dysfunthe commonly done thing is to pull in whatever libraries you need and roll your own framework as you go along
03:42dysfunsome examples: url routing can be done with compojure, templating with selmer, sql database with korma
03:42mavbozolxsameer_, hoplon and carribou are the closest
03:45lxsameer_thanks guys
03:50chr15m1lxsameer_: orthoganol to your question, but if i was going to implement something webby from scratch I think I'd write an HTTP API in pure Clojure with the UI as a separate project in Reagent on ClojureScript that talks to the API. Completely different architecture to you typical Ruby on Rails or Django project.
03:53mavbozochr15m1, interesting, how do you handle SEO requirement? as far as i know, search engines still does not play nice with page generated by javascript in the browser.
03:53chr15m1mavbozo: yep, you are right. i am not sure there is a good solution. maybe a static-rendering pass in your build scripts.
03:53chr15m1mavbozo: maybe search engines need to get better. :)
03:55lxsameer_chr15m1: thanks
03:56chr15m1mavbozo: what we are doing is to look at what parts of our site need to be indexed and building those traditionally or as static HTML pages, and then the parts that are behind a login or otherwise not concerned with being indexed ("web app") we keep dynamic.
04:00rriehlechr15m1: on your orthogonal suggestion to chr15m1. You're spot on. I'm considering exactly that model for a Django project that will reach a tipping point at some point during its next release. Good to hear that others are thinking along the same lines.
04:00mavbozochr15m1, i'm hoping approach such as this becomes mature https://github.com/pleasetrythisathome/om-server-rendering
04:00mavbozobasically, use nashorn js engine to render react in the server first
04:00rriehles/chr15m1/xsameer_
04:01mavbozoso, the browser gets the react's fully rendered page, the js in the browser do the rest.
04:01chr15m1rriehle: we're using Django Rest Framework for the API.
04:02chr15m1mavbozo: that's awesome!
04:02mavbozonice for user experience. no empty blank page.
04:03rriehlechr15m1: I'm thinking of that too. I've got some time before having to do any heavy reimplementation. I'm happy that Django is modular.. provides for several alternatives.
04:08mavbozochr15m1, really awesome! we only need react rendering pipeline to generate user interface, either in browser or server. no additional infrastructure needed--just clojure and clojurescript (also java 1.8)
05:03f3ew`regex
05:04f3ew(help)
05:13oddcully,(doc re-matches)
05:13clojurebot"([re s]); Returns the match, if any, of string to pattern, using java.util.regex.Matcher.matches(). Uses re-groups to return the groups."
06:10jonathanjcore.async doesn't really prescribe a way for communicating errors, does it? what are some common ways of communicating errors via channels?
06:12mavbozojonathanj, i send exception inside a go block to a special channel
06:16jonathanjso you have a channel for data and a channel for errors?
06:17mavbozojonathanj, yes
06:17jonathanjmavbozo: how do you relate errors in the error channel back to the data that caused them?
06:20mavbozojonathanj, i use ex-info to create an exception info with additional specific data about where or what happens when those error occurs. then I put those exception info to the special error channel
06:25jonathanjmavbozo: nice, thanks
06:25mavbozojonathanj, of course, there's another alternative to handle exceptions in go-block, like this, http://martintrojer.github.io/clojure/2014/03/09/working-with-coreasync-exceptions-in-go-blocks/
07:57jonasenIs there a reason core.async 'closed?' predicate is not exposed in the api (https://clojure.github.io/core.async/). It is part of the Channel protocol: https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async/impl/protocols.clj#L23
08:48justin_smithjonasen: my first guess is that it is not a part of CSP
08:59tdammerssorry if this has been done to death, but what's the go-to parser-combinator lib?
09:02jonasentdammers: parsers are often written with https://github.com/Engelberg/instaparse
09:03tdammersjonasen: I'll look into it
09:04justin_smithjonasen: to follow up a bit on the CSP point - there are rigorous proofs of some stuff in CSP, and I think the idea is to provide only the functionality csp does (plus some things composed from those building blocks)
09:04hyPiRiontdammers: https://github.com/cgrand/parsley for combinators. Instaparse isn't combinator I think.
09:04tdammersinstaparse isn't combinator, no
09:05tdammerspassing grammar as a string literal is a bit less elegant than what I'd like ideally, too, but I'm willing to accept that
09:05tdammersparsley looks cleaner at first glance
09:08jonasenjustin_smith: thanks! I'm not that familiar with CSP core ideas
09:09jonasenother than both the reader and the writer blocks.. no one continues before the other is ready
09:11oddcullytdammers: you have seen the section about combinators at the instaparse GH page?
09:11oddcullytdammers: https://github.com/engelberg/instaparse#combinators
09:12tdammersoddcully: missed that part :D
09:12oddcullymore options is never bad ;)
09:13tdammerstrue
09:20jesus_coutoIs there any good clojure books/tutorials/videos to learn clojure as a programming beginner? Only did some basic tutorials on other languages and only know html and css. Thank you
09:21martinklepschjesus_couto: maybe http://www.braveclojure.com
09:21jesus_coutoI found this one http://clojurekoans.com/ but i am unsure if it is targeted to a beginner audience
09:21martinklepschalso potentially: https://aphyr.com/posts/301-clojure-from-the-ground-up-welcome
09:24jesus_coutomartinklepsch: Thank you. Will check it now
09:46sobelmy experience with learning clojure from brave/koans: good exercises if you need a nicely boxed problem to force you through lots of isolated pieces of learning. that method did not serve me. i only started learning once i committed to a small program of familiar type/complexity in clojure.
09:47sobelhaving a REPL to try little things as i integrated them into code was probably the biggest change to my usual coding style.
09:48sobelthe next big change was length of code i can reliably write, without bugs. a proper coding session for me means figuring out about how much i can code between test/fix cycles.
09:48oddcullyi just write them in the actual file and let them execute in the repl. yet the brave clojure were my first baby steps
09:48oddcullynext was the cookbook on GH
09:49sobel...this channel is invaluable for semi-technical questions
09:50oddcullyand my first "programs" where at codewars
10:44virmundihello. Is this an apporpriate place to ask a question about the library hiccup?
10:48justin_smithvirmundi: absolutely
10:49virmundiI need to add the defer and async attributes to a script tag. They are dangling attributes; they have no value. How can I do this?
10:49justin_smithvirmundi: that's the equivalent of async="async"
10:51virmundiok. did not know that. Thanks.
10:53justin_smithvirmundi: this SO answer says async="
10:53justin_smitherr
10:54justin_smithvirmundi: this SO answer says async="" is more correct http://stackoverflow.com/a/23752239/2258453
10:54svericfleming: thanks for the link, looks interesting :-)
10:54sveriAnyone knows if I can inline view references to other vars in intellij without switchting the namespace?
10:55virmundijustin_smith: thanks
11:02stompyjShould clojurescript questions go here, or in #clojurescript?
11:03bensustompyj: #clojurescript
11:03stompyjty
11:05m1dnight_Guys, can anyone point me in the direction of where I can find how to create an anonymous class in Clojure?
11:05m1dnight_I'm trying to translate something from java to clojure but im stuck on the following:
11:06m1dnight_https://www.refheap.com/99554
11:06noncomm1dnight_: does not (proxy) work for that?
11:06justin_smithm1dnight_: reify and proxy both generate anonymous classes
11:07justin_smithproxy if you need to inherit something concrete, reify for interfaces
11:08m1dnight_Aha! Exactly what i needed. Thank you guys :)
11:24engblomI hope I am not breaking any rule by asking an offtopic question during the idle period: I wonder if anyone here knows about any general computer science channel?
11:25sobelengblom: i would try it here
11:25sobelCS is hardly off-topic here
11:25justin_smithengblom: there's #programming but that's a bit noisy
11:25sobelyou'll get clojure-flavored answers most often, but..
11:26noncomhow do i say "not nil" in prismatic schema?
11:27engblomI think a general cs channel would be better fitted as the answer might not include programming. Tomorrow I will get 1.5h with a bunch of elementary school kids. I would need a fun idea related to computer science that fits inside of just 1.5h.
11:28justin_smithengblom: you could play "robot" and see if they can describe simple tasks accurately enough for you to carry them out
11:28justin_smiththis is probably better for younger kids
11:28engblomjustin_smith: They are about 14 years old...
11:28mpenetnoncom: you can use Object, or write a predicate (more readable)
11:28sobelsomething that exposes a deterministic behavior in something that usually seems like relative magic for kids comes to mind
11:28justin_smithengblom: that's not elementary school where I come from
11:29sobelengblom: expose something that is subject to common misunderstanding
11:29sobel14 is high school around here
11:29engblomHere around high school begins when you are 16.
11:30engblomsobel: Do you have any idea for a good misunderstanding?
11:30sobelengblom: probably not, and my cultural rooting is USA which doesn't necessarily translate to wherever you are
11:31sobelengblom: maybe you could tell a story about how computing has helped facilitate or solve a civil problem, or where significant technology is at the heart of something mundane
11:32sobelengblom: hope that helps
11:37engblomsobel: I think they would get bored.
11:38engblomA computer science quiz could maybe be one of the things to do. I appreciate if I get suggestion for questions
11:38zerokarmaleftengblom: if you're looking for something more kinetic, you could have kids carry out merge sort as a group
11:39engblomzerokarmaleft: Once I did something similar. They were even free to google for any sorting algoritm or inventing their own.
11:40justin_smithzerokarmaleft: even better, try various sorting algos, throw bogosort in there for comic relief http://en.wikipedia.org/wiki/Bogosort
11:40zerokarmaleftor whatever, the idea is that no matter how they start, the algorithm is stable and works every time
11:41justin_smithzerokarmaleft: I still think bogosort is amusing
11:42zerokarmaleftjustin_smith: that would probably work with kids too...at least for a time :D
11:42justin_smithheh
11:42justin_smith"this is probably the stupidest possible way to get these playing cards in order - let's start making some better ways to do it"
11:43zerokarmaleftthat idea btw is from simon peyton jones' work rejiggering the UK's primary education curriculum for computing
11:44hoppfullHello. Clojure seems like an interesting language.
11:44bensuhoppfull: preaching to the choir. if you are just starting, write your impressions
11:45hoppfullbensu: It's an aweful experience so far. Not the language itself. But it's a massive hassle to even get it working.
11:45bensuhoppfull: ask for help here, we'll get you going.
11:45hoppfullbensu: I'm from python so maybe I'm a bit spoiled.
11:46bensuhoppfull: have you installed leiningen?
11:46engblomI was just going to ask the very same :)
11:47engblomLeiningen makes everything super easy
11:47TEttingerif you don't have a JDK it could be tricky I guess
11:48hoppfullI have. And It's fine. I stripped away a whole bunch of unecassary stuff from a starting project.
11:48hoppfullI can't help but feel as if I'm not doing it right.
11:48engblomhoppfull: What OS are you using?
11:48hoppfullBut are we supposed to have a whole bunch of code and stuff just for managing our project?
11:49hoppfullWindows 8 I'm afraid.
11:49bensuhoppfull: for managing the project you have project.clj
11:49bensuhoppfull: ahhhh Windows...
11:49bensuhoppfull: it's hard
11:49hoppfullI know.
11:49hoppfullI like to develop on arch on my rpi but there doesn't seem to be any point in using clojure on rpi.
11:50engblomhoppfull: Why would it not be any point? There is even a gpio library for clojure.
11:50hoppfullMaybe I'm being silly but isn't the main reason we use clojure is to try to drag this industry, kicking and screaming into the next century?
11:51zerokarmaleftmore or less
11:51TEttingerwell for windows I can recommend the leiningen for windows installer
11:51bensuhopfull: that is one way to put it. the other one is that the point is to remove all "incidental complexity"
11:51hoppfullWith other languages I like to develop on the rpi becouse it puts limits on me. But I feel that when I try to learn clojure, I should learn how to utilize it on modern hardware.
11:51TEttingersince lein downloads the clojure version you specify in project.clj if you don't have it
11:52bensuhopfull: clojure is not very lean and when the choice is between expressiveness and efficiency, it chooses expressiveness
11:53hoppfullThank you all for your help! I'm sorry I was a little depressed when I came in here. I'm going to look into leiningen!
11:54TEttingerhoppfull, some gotchas I guess to initial dev: you should always have a project.clj . packages unfortunately need to comply with java stuff re:folder structure, there's a good walkthrough that gets linked a lot, I'll try to find it.
11:54engblomhoppfull: Clojure works well on rpi... but you need patience to load any clojure app. Once it is loaded, it is fast and good. On my rpi2, it takes 30s to reach REPL. On the older rpi it takes longer.
11:54TEttingeryou don't need the test folder if lein generates it
11:55sverihoppfull: I am using clojure in W8 without problems (besides one or two libraries that don't get the file locking right and test on linux)
11:55TEttingera lot of dev can be done with just the REPL
11:55TEttingerlein repl
11:55engblomOnce I wanted to quickly demonstrate a bit of clojure to a friend. Despite the leiningen installer for windows, I never got clojure to work on windows in that short time I had there.
11:56klyed2engblom: lol! Light table imo gets you up and running pretty fast
11:57TEttingerI primarily dev on windows, so I dunno what the problem is
11:57sveriengblom: I started a clojure course here at my office and had three guys with windows setup clojure and lighttable in like 15 minutes with download and everything (they had JDK installed already)
12:00TEttingeryeah if you were also setting up a dev environment for the first time period on windows, for any language, it could be tricky.
12:00TEttingerlight table makes that easier
12:00TEttingerstill need a JDK
12:02arrdeminstalling the JDK is hardly onerous tho
12:02engblomJRE is enough..
12:03engblomFor windows, both JDK and JRE can be easily installed from ninite.com
12:03engblomThe "difficult" part is setting the paths so you can run "java" directly from any directory
12:05sveriengblom: well, if that is regarded as difficult, uhm, its hard to argument against it :D
12:15noncommpenet: oh, right
12:15noncomObject
12:15noncomok
12:16noncomis anybody here fluent with neo4j cypher?
12:36justin_smitharrdem: just saw that you're flying out to clj/w - we should definitely get a drink while you're in town
12:37arrdemjustin_smith: for sure!
12:41pmonks@noncom: I've done a bit with it, but I wouldn't say I'm "fluent".
12:44pmonksSupposedly there's a #neo4j channel on Freenode that might be a better place for cypher questions, but it looks empty.
12:45pmonksOh never mind - I was just having trouble joining it - it's alive and well. ;-)
13:03sdegutisIs there a version of `for` that's analogous to `mapcat`, to replace the instances of (apply concat (for ...)) in my code?
13:04matthava`(defmacro forcat [[var seq] & body] `(apply concat (for [~var ~seq] ~@body)))
13:05matthavardmaybe idk I just typed that out it might not work
13:07sdegutisThat looks good. Why isn't it already in core?
13:14crack_userhello guys
13:18justin_smithhello
13:20hiredmanfor can already do concat
13:21hiredman(and it is better at it than applying concat)
13:21hiredman(for [var seq i var] i)
13:23matthavardHmm that's nifty
13:24matthava`,(for [a [[1 2 3] [4 5 6] [7 8 9]]] a)
13:24clojurebot([1 2 3] [4 5 6] [7 8 9])
13:24matthavard,(for [a [[1 2 3] [4 5 6] [7 8 9]] i a] i)
13:24clojurebot(1 2 3 4 5 ...)
13:24matthava`noice
13:25sdegutishiredman: very nice, thank you for that.
13:33augustlI have a bad habit of restarting my JVM when I make changes. Is this still the "de facto" reloaded workflow? http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded
13:34sdegutis,(for [xs (partition 3 (range 1 10)) i xs] i)
13:35clojurebot(1 2 3 4 5 ...)
13:36sveriaugustl: basically, yea. Also have a look at: https://github.com/stuartsierra/component If you are doing web development I put together a leiningen template which comes with components enabled and support for live reloading for cljs: https://github.com/sveri/closp you want to have a look on how to do it
13:38augustlsveri: tnx :)
13:39augustlI've tried something like that reloaded workflow, but my emacs seems to really act up if I get compilation errors so I ended up restarting the JVM anyway
13:39bensuaugustl: are you using cider's latest version?
13:39sveriaugustl: for this the reset functions works quite good
13:41augustlbensu: will investigate, tnx
13:42bensuaugustl: I run cider 0.9.0 on ubuntu with a reloaded workflow and the only reason I have to restart is when I delete a multimethod.
13:43augustlis it possible to reload code so that old code is deleted, instead of just evaling the new code?
13:43augustlif only code was an immutable value in Clojure too? :)
14:13noncomi'll just leave it here: https://screeps.com
14:27Vfelol@that link. I swear everytime I see something like that I just think of it like mechanical turk. Someone “gamified” a way to farm algorithim solutions.
14:29VfeMaybe I should build my next enteprise app like that, make a game that’s a series of challenges just to get people to code the fastest solutions for me. String is all together and get a very fast program…that’s completely unmaintainable.
14:41mavbozoVfe, Hey, you are the 'product'
14:43sdegutisAnyone have success using Boot instead of Leiningen for a simple web app with a test suite that needs to be uberjar'd for production?
14:43sdegutis(the app does, not the test suite)
16:12ncthom91hey all. Is it possible to use core.async channels to queue partially-applied functions?
16:13ncthom91i.e. (>! queue (partial f x y))
16:13ncthom91and then (let [f (<! queue)] (f))
16:24jack0Any idea about gsoc projects?
16:26jack0does anyone know which one might be selected?
16:27amalloyncthom91: you can put any object into a queue. there's no reason it couldn't be a function
16:27ncthom91amalloy cool, thanks
16:29jack0??
16:29lazybotjack0: Definitely not.
16:29clojurebot? is suddenly
16:29jack0Not even which has possibility? lazybot ?
16:30jack0Sorry
16:39bacon1989I don't even know what the contenders are
16:52TEttinger$seen bbloom
16:52lazybotbbloom was last seen quittingQuit: Textual IRC Client: www.textualapp.com 1 day and 18 hours ago.
16:52TEttingerI just found his https://github.com/brandonbloom/eclj project, and I'm curious
17:26dnolencfleming: does locals clearing work when debugging via the clojure.main REPL in Cursive?
17:27cflemingdnolen: You mean the button in the toolwindow? I'm not sure actually, possibly not - let me check
17:28cflemingdnolen: No, it doesn't work - currently it relies on a tooling connection, although I could change that. You'll just see the output of the command being executed.
17:29dnolencfleming: can I just set the command line system property?
17:29cflemingdnolen: And I'd have to query it at startup, which the user would see too. I should go through all those buttons and disable the ones that don't work.
17:29cflemingdnolen: Yeah, you should be able to
17:30m1dnight_Guys, how can I write "(map #(true) '(1 2 3))" but then, you know, working?
17:31m1dnight_I think (map (fn [x] true) '(1 2 3)) is a little verboser
17:31m1dnight_but is it the only optoin?
17:31cflemingdnolen: I was actually thinking about putting a button in the debug toolwindow, that can actually use the debug expression evaluation and should work irrespective of the type of REPL
17:32cflemingm1dnight_: (map (constantly true) '(1 2 3))
17:32cflemingm1dnight_: Or just '(true true true) :)
17:33m1dnight_oh snap, I typed map. It has to be filter.
17:33cflemingm1dnight_: In that case the answer is '(1 2 3) :)
17:33amalloym1dnight_: (filter (constantly true) xs) is just xs
17:33m1dnight_The context I'm using it in is (filter (if something #(true) predicate) list)
17:33m1dnight_okay thanks
17:33m1dnight_thats what I needed
17:33m1dnight_amalloy++
17:34cflemingm1dnight_: You'd be better of with (if something list (filter predicate list))
17:34cflemings/of/off/
17:35m1dnight_valid point. I knew it could have been an XY problem, thats why I stated the context :)
17:35m1dnight_Thanks cfleming
17:35cflemingnp
18:09sdegutisWhat's the latest and greatest way to write code thats both valid Clojure and ClojureScript?
18:09amalloydon't use any special forms other than (fn), and build everything back up from the lambda calculus
18:10sdegutisEven numbers?
18:11amalloywould alonzo church use numbers?
18:12amalloyman i dunno how to use cljs in real life, i am just making stuff up
18:12sdegutisI can't find it but someone did just that.
18:12amalloy$google coding with nothing ruby
18:12lazybot[Programming with Nothing] http://codon.com/programming-with-nothing
18:12amalloysomeone ported it to clojure as well
18:12sdegutisYES THAT
18:15sdegutisTHAT IS SO COOL.
18:18sobelpractical, too
18:19sdegutisIs.. is this just Haskell?
19:04daviid`hello
19:05daviid`i understand i'm going to ask about something probably caused by imagej more then clojure itself, but in case a clojure pro spot the problem, that be nice
19:06daviid`here is a code and an explanation of my side effect problem: http://paste.lisp.org/+35G5
19:33justin_smithdaviid`: I can't see how that println would change anything with that code
19:36amalloyjustin_smith: it realizes the elements of results before entering the loop
19:36daviid`justin_smith: [so many justin that my emacs does not complete your name, too nad!] i think it is a side effect, terrible side effect from imagej, which reuses its resultstable, how bad is that?? but even knowing, i can't get it tight
19:37daviid`i narrowed down a bit, let me paste a new version
19:38justin_smithamalloy: yeah, you are right, it's that for loop in get-bounding-boxes
19:38justin_smith*for comprehension
19:38justin_smith(dec justin_smith) ; for calling it a loop
19:38lazybotYou can't adjust your own karma.
19:41daviid`here: http://paste.lisp.org/+35G5 (1) renmed write-pp-... to save-hematite, (2) i have to scrap that portion of the initial image, doing it here instead of within the save-hematite procedure, better I think, and (3) the side effect is indeed get-max-area [which has to do some measure, hence reuse the resultstable...
19:42daviid`the above pasted code fails with the following exception:
19:44daviid`http://paste.lisp.org/+35G5/4
19:45daviid` [ i manally entered some \n to help you reading it of course
19:47daviid`so it processes partclies > 48 [the side of the bouding box], and does so for 0, 7, 14, 19, 27, 30 then crashes with this message "Column not defined: 11" which i don't understand: how could it work for some and not for others ?
19:47daviid`anyway, all due to this unique and reused results table from imagej of course
19:51daviid`there is no #imagej irc and #fiji-devel does not answer [till now]
19:52daviid`get-max-area semmes good to me, but you see it does not even clear its results -> 0 9057.0 7 9057.0 ... it always return the sme value ...
19:52daviid`oh well
19:53sdegutisIs there an alternative to Leiningen-profiles that's much less confusing and complicated?
19:54TEttingerapparently boot is getting usable? I haven't tried it
19:55justin_smithdaviid`: as amalloy points out, for is lazy, and the timing of when you consume those results is going to change things, right?
19:55TEttingerhttp://boot-clj.com/
19:56justin_smithTEttinger: I have it in my yaks to shave queue, along with cider with debugging support, and setting up the mac I'll likely be getting from my new job
19:56daviid`justin_smith: what shoud i do ? instead of for ?
19:56daviid`timing will change of course, they reuse the same table
19:56justin_smithdaviid`: you could put a doall around it to force eager evaluation
19:57TEttingerdoseq is meant for side effects in the first place
19:57justin_smithTEttinger: he uses the results though
19:57TEttingerah ok
19:57justin_smithTEttinger: just not fast enough for correctness yet
19:57TEttingerI just got here
19:58daviid`i use doseq instead of for right ?
19:59TEttingerdoseq discards results
19:59TEttingerdoall is correct here
19:59daviid`(doall (for ... ?
19:59TEttingeryes
19:59TEttinger(doc doall)
19:59daviid`let me try, tx
19:59clojurebot"([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."
20:06justin_smithlook at that, the doc string even mentions excactly why it should be used in this case
20:09daviid`justin_smith: TEttinger, tx, i just did not expect for to behave in a different way then it does in scheme [for-each], my mistake
20:09daviid`it works fine now, many thanks
20:09TEttingerah great!
20:09TEttinger(inc justin_pdx)
20:09lazybot⇒ 1
20:09TEttinger(inc justin_smith)
20:09lazybot⇒ 238
20:09TEttingerkarma shotgun
20:10justin_smithhaha
20:10justin_smithTEttinger: collateral karma
20:10TEttingeryep
20:20justin_smith,(apply + (take Double/Nan (repeat Math/PI)))
20:20clojurebot#error{:cause "Unable to find static field: Nan in class java.lang.Double", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to find static field: Nan in class java.lang.Double, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6535]} {:type java.lang.RuntimeException, :message "Unable to find static field: Nan in ...
20:21justin_smith,(apply + (take Double/NaN (repeat Math/PI)))
20:21clojurebot0
20:21amalloytake Double/NaN...you're a brave man
20:46sdegutisTEttinger: I looked into Boot and it looks like it might be simpler, but it seems to require a pretty seem knowledge of the JVM that I don't yet have.
21:05haywoodDoes anyone know how one would go about connecting this clojurescript node.js repl https://github.com/clojure/clojurescript/wiki/Quick-Start#nodejs-repl to emacs/cider?
23:23PURE_TASTESo I have a function of the form (map + c1 c2 c3 & colls), where all the colls are LazySeqs. It isn't working. I tried wrapping it in doall. Do I need to map doall?
23:27PURE_TASTE(map (doall (+ %&)) c1 c2 c3 & colls)
23:27PURE_TASTESomething like that except %& is not correct.
23:32amalloydo you want (apply map coll c1 c2 c3 colls)?
23:32amalloyit's not clear because you haven't explained what you want to do, just some wrong attempt, but that would be a reasonable thing to do
23:35PURE_TASTEresults (map (fn [& bits] (apply + bits)) padded-xor-lists)
23:35PURE_TASTE results (map (fn [& bits] (apply + bits)) padded-xor-lists)
23:35PURE_TASTE results (map (fn [& bits] (apply + bits)) padded-xor-lists)
23:35PURE_TASTE results (map (fn [& bits] (apply + bits)) padded-xor-lists)
23:35PURE_TASTE results (map (fn [& bits] (apply + bits)) padded-xor-lists)
23:35PURE_TASTE results (map (fn [& bits] (apply + bits)) padded-xor-lists)
23:35PURE_TASTE results (map (fn [& bits] (apply + bits)) padded-xor-lists)
23:35PURE_TASTE results (map (fn [& bits] (apply + bits)) padded-xor-lists)
23:35PURE_TASTE results (map (fn [& bits] (apply + bits)) padded-xor-lists)
23:35PURE_TASTESo I want to produce a new seq from a collection of seqs where each entry of the new seq is the sum of all of the corresponding entries from the collection.
23:36PURE_TASTEAh, I didn't mean to send that all. I'm using a webclient and was wondering why my pastes weren't working--they are.
23:37PURE_TASTE,(map + [1 2 3] [3 4 5] [5 1 2])
23:37clojurebot(9 7 10)
23:37PURE_TASTESo that works well enough. However, it doesn't work when instead of vectors I have lazyseqs.
23:37PURE_TASTESo I'm trying to figure that out and thought doall would be the way to go.
23:39PURE_TASTEAh, shoot amalloy. I think I do need to use apply in this case. That's probably what was going wrong.
23:39PURE_TASTEamalloy: thanks for catching my mistake.