2015-04-13
| 00:06 | Intensity | justin_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:06 | Intensity | Even when replacing conj with (fnil conj #{}), I still have the same issues. |
| 00:09 | justin_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:09 | clojurebot | {15 #{5 10}, 25 #{5 42}, 1 #{3}, 5 #{7}} |
| 00:09 | justin_smith | oh wait, I can make that closer to your original, one moment |
| 00:11 | justin_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:11 | clojurebot | {15 #{5 10}, 25 #{20 5}, 35 #{30}} |
| 00:12 | Intensity | justin_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:12 | justin_smith | Intensity: merge-with won't ever alter keys that weren't present in the original |
| 00:12 | justin_smith | you need to update all keys |
| 00:13 | justin_smith | some are merged, the others become sets |
| 00:14 | justin_smith | the alternative would be to turn every value coming in into a set, unconditionally, then merge-with set/union I guess |
| 00:14 | justin_smith | but I think the reduce is simpler |
| 00:18 | Intensity | justin_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:18 | justin_smith | Intensity: merge-with only alters keys if they are present in two maps |
| 00:18 | justin_smith | all keys that are present in only one map, are unaltered |
| 00:19 | Intensity | since 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:19 | justin_smith | Intensity: the way to do it with merge-with would be to provide all vals in sets |
| 00:19 | justin_smith | and have set/union be the merge function |
| 00:22 | justin_smith | ,(merge-with clojure.set/union {15 #{5 10} 25 #{5}} (into {} (map (juxt #(+ 5 %) hash-set) #{10 20 30}))) |
| 00:22 | clojurebot | #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:22 | justin_smith | ,(require 'clojure.set) |
| 00:22 | clojurebot | nil |
| 00:22 | justin_smith | ,(merge-with clojure.set/union {15 #{5 10} 25 #{5}} (into {} (map (juxt #(+ 5 %) hash-set) #{10 20 30}))) |
| 00:22 | clojurebot | {15 #{5 10}, 25 #{20 5}, 35 #{30}} |
| 00:23 | justin_smith | that does some work that the reduce based version doesn't have to do |
| 00:23 | justin_smith | creating an unneeded hash-map, and some unneeded hash-sets |
| 00:23 | Intensity | justin_smith: Thanks for the alternatives. |
| 03:25 | dysfun | is there transducers support for clojure 1.6 in a library? |
| 03:26 | cfleming | $mail sveri https://github.com/JetBrains/anko |
| 03:26 | lazybot | Message saved. |
| 03:35 | lxsameer_ | guys, what is the RubyonRails of Clojure :)) ? |
| 03:36 | mpenet | dysfun: if you mean "as a library" I dont think so. core.async as partial support for transducers |
| 03:37 | mpenet | dysfun: but I doubt it's what you're asking for |
| 03:38 | dysfun | mpenet: no, it's not. damn. this waiting forever for clojure 1.7 thing is a bit tedious. |
| 03:39 | dysfun | lxsameer_: there isn't one, but there are a variety of frameworks with varying levels of guidance on building things |
| 03:39 | dysfun | i used to be quite fond of luminus |
| 03:40 | dysfun | they've changed it all recently though, i haven't tried the new one |
| 03:40 | dysfun | the commonly done thing is to pull in whatever libraries you need and roll your own framework as you go along |
| 03:42 | dysfun | some examples: url routing can be done with compojure, templating with selmer, sql database with korma |
| 03:42 | mavbozo | lxsameer_, hoplon and carribou are the closest |
| 03:45 | lxsameer_ | thanks guys |
| 03:50 | chr15m1 | lxsameer_: 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:53 | mavbozo | chr15m1, 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:53 | chr15m1 | mavbozo: yep, you are right. i am not sure there is a good solution. maybe a static-rendering pass in your build scripts. |
| 03:53 | chr15m1 | mavbozo: maybe search engines need to get better. :) |
| 03:55 | lxsameer_ | chr15m1: thanks |
| 03:56 | chr15m1 | mavbozo: 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:00 | rriehle | chr15m1: 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:00 | mavbozo | chr15m1, i'm hoping approach such as this becomes mature https://github.com/pleasetrythisathome/om-server-rendering |
| 04:00 | mavbozo | basically, use nashorn js engine to render react in the server first |
| 04:00 | rriehle | s/chr15m1/xsameer_ |
| 04:01 | mavbozo | so, the browser gets the react's fully rendered page, the js in the browser do the rest. |
| 04:01 | chr15m1 | rriehle: we're using Django Rest Framework for the API. |
| 04:02 | chr15m1 | mavbozo: that's awesome! |
| 04:02 | mavbozo | nice for user experience. no empty blank page. |
| 04:03 | rriehle | chr15m1: 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:08 | mavbozo | chr15m1, 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:03 | f3ew | `regex |
| 05:04 | f3ew | (help) |
| 05:13 | oddcully | ,(doc re-matches) |
| 05:13 | clojurebot | "([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:10 | jonathanj | core.async doesn't really prescribe a way for communicating errors, does it? what are some common ways of communicating errors via channels? |
| 06:12 | mavbozo | jonathanj, i send exception inside a go block to a special channel |
| 06:16 | jonathanj | so you have a channel for data and a channel for errors? |
| 06:17 | mavbozo | jonathanj, yes |
| 06:17 | jonathanj | mavbozo: how do you relate errors in the error channel back to the data that caused them? |
| 06:20 | mavbozo | jonathanj, 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:25 | jonathanj | mavbozo: nice, thanks |
| 06:25 | mavbozo | jonathanj, 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:57 | jonasen | Is 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:48 | justin_smith | jonasen: my first guess is that it is not a part of CSP |
| 08:59 | tdammers | sorry if this has been done to death, but what's the go-to parser-combinator lib? |
| 09:02 | jonasen | tdammers: parsers are often written with https://github.com/Engelberg/instaparse |
| 09:03 | tdammers | jonasen: I'll look into it |
| 09:04 | justin_smith | jonasen: 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:04 | hyPiRion | tdammers: https://github.com/cgrand/parsley for combinators. Instaparse isn't combinator I think. |
| 09:04 | tdammers | instaparse isn't combinator, no |
| 09:05 | tdammers | passing 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:05 | tdammers | parsley looks cleaner at first glance |
| 09:08 | jonasen | justin_smith: thanks! I'm not that familiar with CSP core ideas |
| 09:09 | jonasen | other than both the reader and the writer blocks.. no one continues before the other is ready |
| 09:11 | oddcully | tdammers: you have seen the section about combinators at the instaparse GH page? |
| 09:11 | oddcully | tdammers: https://github.com/engelberg/instaparse#combinators |
| 09:12 | tdammers | oddcully: missed that part :D |
| 09:12 | oddcully | more options is never bad ;) |
| 09:13 | tdammers | true |
| 09:20 | jesus_couto | Is 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:21 | martinklepsch | jesus_couto: maybe http://www.braveclojure.com |
| 09:21 | jesus_couto | I found this one http://clojurekoans.com/ but i am unsure if it is targeted to a beginner audience |
| 09:21 | martinklepsch | also potentially: https://aphyr.com/posts/301-clojure-from-the-ground-up-welcome |
| 09:24 | jesus_couto | martinklepsch: Thank you. Will check it now |
| 09:46 | sobel | my 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:47 | sobel | having a REPL to try little things as i integrated them into code was probably the biggest change to my usual coding style. |
| 09:48 | sobel | the 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:48 | oddcully | i just write them in the actual file and let them execute in the repl. yet the brave clojure were my first baby steps |
| 09:48 | oddcully | next was the cookbook on GH |
| 09:49 | sobel | ...this channel is invaluable for semi-technical questions |
| 09:50 | oddcully | and my first "programs" where at codewars |
| 10:44 | virmundi | hello. Is this an apporpriate place to ask a question about the library hiccup? |
| 10:48 | justin_smith | virmundi: absolutely |
| 10:49 | virmundi | I 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:49 | justin_smith | virmundi: that's the equivalent of async="async" |
| 10:51 | virmundi | ok. did not know that. Thanks. |
| 10:53 | justin_smith | virmundi: this SO answer says async=" |
| 10:53 | justin_smith | err |
| 10:54 | justin_smith | virmundi: this SO answer says async="" is more correct http://stackoverflow.com/a/23752239/2258453 |
| 10:54 | sveri | cfleming: thanks for the link, looks interesting :-) |
| 10:54 | sveri | Anyone knows if I can inline view references to other vars in intellij without switchting the namespace? |
| 10:55 | virmundi | justin_smith: thanks |
| 11:02 | stompyj | Should clojurescript questions go here, or in #clojurescript? |
| 11:03 | bensu | stompyj: #clojurescript |
| 11:03 | stompyj | ty |
| 11:05 | m1dnight_ | Guys, can anyone point me in the direction of where I can find how to create an anonymous class in Clojure? |
| 11:05 | m1dnight_ | I'm trying to translate something from java to clojure but im stuck on the following: |
| 11:06 | m1dnight_ | https://www.refheap.com/99554 |
| 11:06 | noncom | m1dnight_: does not (proxy) work for that? |
| 11:06 | justin_smith | m1dnight_: reify and proxy both generate anonymous classes |
| 11:07 | justin_smith | proxy if you need to inherit something concrete, reify for interfaces |
| 11:08 | m1dnight_ | Aha! Exactly what i needed. Thank you guys :) |
| 11:24 | engblom | I 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:25 | sobel | engblom: i would try it here |
| 11:25 | sobel | CS is hardly off-topic here |
| 11:25 | justin_smith | engblom: there's #programming but that's a bit noisy |
| 11:25 | sobel | you'll get clojure-flavored answers most often, but.. |
| 11:26 | noncom | how do i say "not nil" in prismatic schema? |
| 11:27 | engblom | I 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:28 | justin_smith | engblom: you could play "robot" and see if they can describe simple tasks accurately enough for you to carry them out |
| 11:28 | justin_smith | this is probably better for younger kids |
| 11:28 | engblom | justin_smith: They are about 14 years old... |
| 11:28 | mpenet | noncom: you can use Object, or write a predicate (more readable) |
| 11:28 | sobel | something that exposes a deterministic behavior in something that usually seems like relative magic for kids comes to mind |
| 11:28 | justin_smith | engblom: that's not elementary school where I come from |
| 11:29 | sobel | engblom: expose something that is subject to common misunderstanding |
| 11:29 | sobel | 14 is high school around here |
| 11:29 | engblom | Here around high school begins when you are 16. |
| 11:30 | engblom | sobel: Do you have any idea for a good misunderstanding? |
| 11:30 | sobel | engblom: probably not, and my cultural rooting is USA which doesn't necessarily translate to wherever you are |
| 11:31 | sobel | engblom: 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:32 | sobel | engblom: hope that helps |
| 11:37 | engblom | sobel: I think they would get bored. |
| 11:38 | engblom | A computer science quiz could maybe be one of the things to do. I appreciate if I get suggestion for questions |
| 11:38 | zerokarmaleft | engblom: if you're looking for something more kinetic, you could have kids carry out merge sort as a group |
| 11:39 | engblom | zerokarmaleft: Once I did something similar. They were even free to google for any sorting algoritm or inventing their own. |
| 11:40 | justin_smith | zerokarmaleft: even better, try various sorting algos, throw bogosort in there for comic relief http://en.wikipedia.org/wiki/Bogosort |
| 11:40 | zerokarmaleft | or whatever, the idea is that no matter how they start, the algorithm is stable and works every time |
| 11:41 | justin_smith | zerokarmaleft: I still think bogosort is amusing |
| 11:42 | zerokarmaleft | justin_smith: that would probably work with kids too...at least for a time :D |
| 11:42 | justin_smith | heh |
| 11:42 | justin_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:43 | zerokarmaleft | that idea btw is from simon peyton jones' work rejiggering the UK's primary education curriculum for computing |
| 11:44 | hoppfull | Hello. Clojure seems like an interesting language. |
| 11:44 | bensu | hoppfull: preaching to the choir. if you are just starting, write your impressions |
| 11:45 | hoppfull | bensu: It's an aweful experience so far. Not the language itself. But it's a massive hassle to even get it working. |
| 11:45 | bensu | hoppfull: ask for help here, we'll get you going. |
| 11:45 | hoppfull | bensu: I'm from python so maybe I'm a bit spoiled. |
| 11:46 | bensu | hoppfull: have you installed leiningen? |
| 11:46 | engblom | I was just going to ask the very same :) |
| 11:47 | engblom | Leiningen makes everything super easy |
| 11:47 | TEttinger | if you don't have a JDK it could be tricky I guess |
| 11:48 | hoppfull | I have. And It's fine. I stripped away a whole bunch of unecassary stuff from a starting project. |
| 11:48 | hoppfull | I can't help but feel as if I'm not doing it right. |
| 11:48 | engblom | hoppfull: What OS are you using? |
| 11:48 | hoppfull | But are we supposed to have a whole bunch of code and stuff just for managing our project? |
| 11:49 | hoppfull | Windows 8 I'm afraid. |
| 11:49 | bensu | hoppfull: for managing the project you have project.clj |
| 11:49 | bensu | hoppfull: ahhhh Windows... |
| 11:49 | bensu | hoppfull: it's hard |
| 11:49 | hoppfull | I know. |
| 11:49 | hoppfull | I like to develop on arch on my rpi but there doesn't seem to be any point in using clojure on rpi. |
| 11:50 | engblom | hoppfull: Why would it not be any point? There is even a gpio library for clojure. |
| 11:50 | hoppfull | Maybe 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:51 | zerokarmaleft | more or less |
| 11:51 | TEttinger | well for windows I can recommend the leiningen for windows installer |
| 11:51 | bensu | hopfull: that is one way to put it. the other one is that the point is to remove all "incidental complexity" |
| 11:51 | hoppfull | With 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:51 | TEttinger | since lein downloads the clojure version you specify in project.clj if you don't have it |
| 11:52 | bensu | hopfull: clojure is not very lean and when the choice is between expressiveness and efficiency, it chooses expressiveness |
| 11:53 | hoppfull | Thank 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:54 | TEttinger | hoppfull, 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:54 | engblom | hoppfull: 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:54 | TEttinger | you don't need the test folder if lein generates it |
| 11:55 | sveri | hoppfull: 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:55 | TEttinger | a lot of dev can be done with just the REPL |
| 11:55 | TEttinger | lein repl |
| 11:55 | engblom | Once 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:56 | klyed2 | engblom: lol! Light table imo gets you up and running pretty fast |
| 11:57 | TEttinger | I primarily dev on windows, so I dunno what the problem is |
| 11:57 | sveri | engblom: 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:00 | TEttinger | yeah if you were also setting up a dev environment for the first time period on windows, for any language, it could be tricky. |
| 12:00 | TEttinger | light table makes that easier |
| 12:00 | TEttinger | still need a JDK |
| 12:02 | arrdem | installing the JDK is hardly onerous tho |
| 12:02 | engblom | JRE is enough.. |
| 12:03 | engblom | For windows, both JDK and JRE can be easily installed from ninite.com |
| 12:03 | engblom | The "difficult" part is setting the paths so you can run "java" directly from any directory |
| 12:05 | sveri | engblom: well, if that is regarded as difficult, uhm, its hard to argument against it :D |
| 12:15 | noncom | mpenet: oh, right |
| 12:15 | noncom | Object |
| 12:15 | noncom | ok |
| 12:16 | noncom | is anybody here fluent with neo4j cypher? |
| 12:36 | justin_smith | arrdem: just saw that you're flying out to clj/w - we should definitely get a drink while you're in town |
| 12:37 | arrdem | justin_smith: for sure! |
| 12:41 | pmonks | @noncom: I've done a bit with it, but I wouldn't say I'm "fluent". |
| 12:44 | pmonks | Supposedly there's a #neo4j channel on Freenode that might be a better place for cypher questions, but it looks empty. |
| 12:45 | pmonks | Oh never mind - I was just having trouble joining it - it's alive and well. ;-) |
| 13:03 | sdegutis | Is there a version of `for` that's analogous to `mapcat`, to replace the instances of (apply concat (for ...)) in my code? |
| 13:04 | matthava` | (defmacro forcat [[var seq] & body] `(apply concat (for [~var ~seq] ~@body))) |
| 13:05 | matthavard | maybe idk I just typed that out it might not work |
| 13:07 | sdegutis | That looks good. Why isn't it already in core? |
| 13:14 | crack_user | hello guys |
| 13:18 | justin_smith | hello |
| 13:20 | hiredman | for can already do concat |
| 13:21 | hiredman | (and it is better at it than applying concat) |
| 13:21 | hiredman | (for [var seq i var] i) |
| 13:23 | matthavard | Hmm that's nifty |
| 13:24 | matthava` | ,(for [a [[1 2 3] [4 5 6] [7 8 9]]] a) |
| 13:24 | clojurebot | ([1 2 3] [4 5 6] [7 8 9]) |
| 13:24 | matthavard | ,(for [a [[1 2 3] [4 5 6] [7 8 9]] i a] i) |
| 13:24 | clojurebot | (1 2 3 4 5 ...) |
| 13:24 | matthava` | noice |
| 13:25 | sdegutis | hiredman: very nice, thank you for that. |
| 13:33 | augustl | I 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:34 | sdegutis | ,(for [xs (partition 3 (range 1 10)) i xs] i) |
| 13:35 | clojurebot | (1 2 3 4 5 ...) |
| 13:36 | sveri | augustl: 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:38 | augustl | sveri: tnx :) |
| 13:39 | augustl | I'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:39 | bensu | augustl: are you using cider's latest version? |
| 13:39 | sveri | augustl: for this the reset functions works quite good |
| 13:41 | augustl | bensu: will investigate, tnx |
| 13:42 | bensu | augustl: 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:43 | augustl | is it possible to reload code so that old code is deleted, instead of just evaling the new code? |
| 13:43 | augustl | if only code was an immutable value in Clojure too? :) |
| 14:13 | noncom | i'll just leave it here: https://screeps.com |
| 14:27 | Vfe | lol@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:29 | Vfe | Maybe 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:41 | mavbozo | Vfe, Hey, you are the 'product' |
| 14:43 | sdegutis | Anyone 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:43 | sdegutis | (the app does, not the test suite) |
| 16:12 | ncthom91 | hey all. Is it possible to use core.async channels to queue partially-applied functions? |
| 16:13 | ncthom91 | i.e. (>! queue (partial f x y)) |
| 16:13 | ncthom91 | and then (let [f (<! queue)] (f)) |
| 16:24 | jack0 | Any idea about gsoc projects? |
| 16:26 | jack0 | does anyone know which one might be selected? |
| 16:27 | amalloy | ncthom91: you can put any object into a queue. there's no reason it couldn't be a function |
| 16:27 | ncthom91 | amalloy cool, thanks |
| 16:29 | jack0 | ?? |
| 16:29 | lazybot | jack0: Definitely not. |
| 16:29 | clojurebot | ? is suddenly |
| 16:29 | jack0 | Not even which has possibility? lazybot ? |
| 16:30 | jack0 | Sorry |
| 16:39 | bacon1989 | I don't even know what the contenders are |
| 16:52 | TEttinger | $seen bbloom |
| 16:52 | lazybot | bbloom was last seen quittingQuit: Textual IRC Client: www.textualapp.com 1 day and 18 hours ago. |
| 16:52 | TEttinger | I just found his https://github.com/brandonbloom/eclj project, and I'm curious |
| 17:26 | dnolen | cfleming: does locals clearing work when debugging via the clojure.main REPL in Cursive? |
| 17:27 | cfleming | dnolen: You mean the button in the toolwindow? I'm not sure actually, possibly not - let me check |
| 17:28 | cfleming | dnolen: 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:29 | dnolen | cfleming: can I just set the command line system property? |
| 17:29 | cfleming | dnolen: 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:29 | cfleming | dnolen: Yeah, you should be able to |
| 17:30 | m1dnight_ | Guys, how can I write "(map #(true) '(1 2 3))" but then, you know, working? |
| 17:31 | m1dnight_ | I think (map (fn [x] true) '(1 2 3)) is a little verboser |
| 17:31 | m1dnight_ | but is it the only optoin? |
| 17:31 | cfleming | dnolen: 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:32 | cfleming | m1dnight_: (map (constantly true) '(1 2 3)) |
| 17:32 | cfleming | m1dnight_: Or just '(true true true) :) |
| 17:33 | m1dnight_ | oh snap, I typed map. It has to be filter. |
| 17:33 | cfleming | m1dnight_: In that case the answer is '(1 2 3) :) |
| 17:33 | amalloy | m1dnight_: (filter (constantly true) xs) is just xs |
| 17:33 | m1dnight_ | The context I'm using it in is (filter (if something #(true) predicate) list) |
| 17:33 | m1dnight_ | okay thanks |
| 17:33 | m1dnight_ | thats what I needed |
| 17:33 | m1dnight_ | amalloy++ |
| 17:34 | cfleming | m1dnight_: You'd be better of with (if something list (filter predicate list)) |
| 17:34 | cfleming | s/of/off/ |
| 17:35 | m1dnight_ | valid point. I knew it could have been an XY problem, thats why I stated the context :) |
| 17:35 | m1dnight_ | Thanks cfleming |
| 17:35 | cfleming | np |
| 18:09 | sdegutis | What's the latest and greatest way to write code thats both valid Clojure and ClojureScript? |
| 18:09 | amalloy | don't use any special forms other than (fn), and build everything back up from the lambda calculus |
| 18:10 | sdegutis | Even numbers? |
| 18:11 | amalloy | would alonzo church use numbers? |
| 18:12 | amalloy | man i dunno how to use cljs in real life, i am just making stuff up |
| 18:12 | sdegutis | I can't find it but someone did just that. |
| 18:12 | amalloy | $google coding with nothing ruby |
| 18:12 | lazybot | [Programming with Nothing] http://codon.com/programming-with-nothing |
| 18:12 | amalloy | someone ported it to clojure as well |
| 18:12 | sdegutis | YES THAT |
| 18:15 | sdegutis | THAT IS SO COOL. |
| 18:18 | sobel | practical, too |
| 18:19 | sdegutis | Is.. is this just Haskell? |
| 19:04 | daviid` | hello |
| 19:05 | daviid` | 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:06 | daviid` | here is a code and an explanation of my side effect problem: http://paste.lisp.org/+35G5 |
| 19:33 | justin_smith | daviid`: I can't see how that println would change anything with that code |
| 19:36 | amalloy | justin_smith: it realizes the elements of results before entering the loop |
| 19:36 | daviid` | 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:37 | daviid` | i narrowed down a bit, let me paste a new version |
| 19:38 | justin_smith | amalloy: yeah, you are right, it's that for loop in get-bounding-boxes |
| 19:38 | justin_smith | *for comprehension |
| 19:38 | justin_smith | (dec justin_smith) ; for calling it a loop |
| 19:38 | lazybot | You can't adjust your own karma. |
| 19:41 | daviid` | 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:42 | daviid` | the above pasted code fails with the following exception: |
| 19:44 | daviid` | http://paste.lisp.org/+35G5/4 |
| 19:45 | daviid` | [ i manally entered some \n to help you reading it of course |
| 19:47 | daviid` | 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:47 | daviid` | anyway, all due to this unique and reused results table from imagej of course |
| 19:51 | daviid` | there is no #imagej irc and #fiji-devel does not answer [till now] |
| 19:52 | daviid` | 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:52 | daviid` | oh well |
| 19:53 | sdegutis | Is there an alternative to Leiningen-profiles that's much less confusing and complicated? |
| 19:54 | TEttinger | apparently boot is getting usable? I haven't tried it |
| 19:55 | justin_smith | daviid`: as amalloy points out, for is lazy, and the timing of when you consume those results is going to change things, right? |
| 19:55 | TEttinger | http://boot-clj.com/ |
| 19:56 | justin_smith | TEttinger: 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:56 | daviid` | justin_smith: what shoud i do ? instead of for ? |
| 19:56 | daviid` | timing will change of course, they reuse the same table |
| 19:56 | justin_smith | daviid`: you could put a doall around it to force eager evaluation |
| 19:57 | TEttinger | doseq is meant for side effects in the first place |
| 19:57 | justin_smith | TEttinger: he uses the results though |
| 19:57 | TEttinger | ah ok |
| 19:57 | justin_smith | TEttinger: just not fast enough for correctness yet |
| 19:57 | TEttinger | I just got here |
| 19:58 | daviid` | i use doseq instead of for right ? |
| 19:59 | TEttinger | doseq discards results |
| 19:59 | TEttinger | doall is correct here |
| 19:59 | daviid` | (doall (for ... ? |
| 19:59 | TEttinger | yes |
| 19:59 | TEttinger | (doc doall) |
| 19:59 | daviid` | let me try, tx |
| 19:59 | clojurebot | "([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through the successive nexts of the seq, retains the head and returns it, thus causing the entire seq to reside in memory at one time." |
| 20:06 | justin_smith | look at that, the doc string even mentions excactly why it should be used in this case |
| 20:09 | daviid` | 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:09 | daviid` | it works fine now, many thanks |
| 20:09 | TEttinger | ah great! |
| 20:09 | TEttinger | (inc justin_pdx) |
| 20:09 | lazybot | ⇒ 1 |
| 20:09 | TEttinger | (inc justin_smith) |
| 20:09 | lazybot | ⇒ 238 |
| 20:09 | TEttinger | karma shotgun |
| 20:10 | justin_smith | haha |
| 20:10 | justin_smith | TEttinger: collateral karma |
| 20:10 | TEttinger | yep |
| 20:20 | justin_smith | ,(apply + (take Double/Nan (repeat Math/PI))) |
| 20:20 | clojurebot | #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:21 | justin_smith | ,(apply + (take Double/NaN (repeat Math/PI))) |
| 20:21 | clojurebot | 0 |
| 20:21 | amalloy | take Double/NaN...you're a brave man |
| 20:46 | sdegutis | TEttinger: 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:05 | haywood | Does 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:23 | PURE_TASTE | So 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:27 | PURE_TASTE | (map (doall (+ %&)) c1 c2 c3 & colls) |
| 23:27 | PURE_TASTE | Something like that except %& is not correct. |
| 23:32 | amalloy | do you want (apply map coll c1 c2 c3 colls)? |
| 23:32 | amalloy | it'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:35 | PURE_TASTE | results (map (fn [& bits] (apply + bits)) padded-xor-lists) |
| 23:35 | PURE_TASTE | results (map (fn [& bits] (apply + bits)) padded-xor-lists) |
| 23:35 | PURE_TASTE | results (map (fn [& bits] (apply + bits)) padded-xor-lists) |
| 23:35 | PURE_TASTE | results (map (fn [& bits] (apply + bits)) padded-xor-lists) |
| 23:35 | PURE_TASTE | results (map (fn [& bits] (apply + bits)) padded-xor-lists) |
| 23:35 | PURE_TASTE | results (map (fn [& bits] (apply + bits)) padded-xor-lists) |
| 23:35 | PURE_TASTE | results (map (fn [& bits] (apply + bits)) padded-xor-lists) |
| 23:35 | PURE_TASTE | results (map (fn [& bits] (apply + bits)) padded-xor-lists) |
| 23:35 | PURE_TASTE | results (map (fn [& bits] (apply + bits)) padded-xor-lists) |
| 23:35 | PURE_TASTE | So 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:36 | PURE_TASTE | Ah, 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:37 | PURE_TASTE | ,(map + [1 2 3] [3 4 5] [5 1 2]) |
| 23:37 | clojurebot | (9 7 10) |
| 23:37 | PURE_TASTE | So that works well enough. However, it doesn't work when instead of vectors I have lazyseqs. |
| 23:37 | PURE_TASTE | So I'm trying to figure that out and thought doall would be the way to go. |
| 23:39 | PURE_TASTE | Ah, shoot amalloy. I think I do need to use apply in this case. That's probably what was going wrong. |
| 23:39 | PURE_TASTE | amalloy: thanks for catching my mistake. |