#clojure log - Sep 10 2014

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:48 rpaulo: \

0:51 oops

1:07 jyu1: hello, a question about the compiler, for example (concat 1 [2]), it will raise an exception indicating 1 is not a iseq after evalution in the repl, looks to me, it will go through compiler.eval, but I cannot catch that exception in the eval method.

1:08 I am not sure if I miss something, anybody can help me understand the chain of invocation for the expression?

1:13 ncthom91: hey all. I'm working on a clojurescript project, and I want to test the clojure functions I write, but I can't figure out the directory structure

1:14 amalloy: jyu1: (concat 1 [2]) immediately (and successfully) returns a lazy seq, without ever "looking at" 1 or [2]. when you ask for the first item in that seq (eg by trying to print it at the repl), it explodes because 1 isn't a sequence

1:15 noonian: ncthom91: you will need to have :source-paths in your cljsbuild settings with the directories containing cljs and clj code

1:15 amalloy: thus, (try (concat ...)) doesn't throw an exception; by the time you try to print it, you're no longer inside the try/catch scope

1:15 ncthom91: noonian thanks, I do, I believe :P

1:16 noonian: the directory structure from those named directories should be my_lib/core.clj for a clj(s) ns my-lib.core

1:16 ncthom91: yep, got that much

1:16 then i have ./test/my_lib/test.clj

1:16 (where . is the root of my project directory)

1:17 noonian: you may have to have the test directory in cljsbuild's source paths

1:17 ncthom91: noonian even if I'm just using the normal `lein test` for my testing?

1:18 noonian: are the tests clojure or clojurescript code?

1:18 ncthom91: noonian i guess they'll probably be clojurescript

1:18 so I suppose I'll have to compile them before I test

1:19 noonian maybe I should just use a js testing framework? is that the common wisdom?

1:19 noonian: i actually haven't done much testing, but i think you need to add the clojurescript test lib to dev dependencies also

1:19 https://github.com/cemerick/clojurescript.test

1:19 i mean much testing in clojurescript :P

1:22 jyu1: @amalloy thanks

1:22 noonian: ncthom91: sorry, i'm a few beers in tonight as well hehe; i might not be much help

1:22 ncthom91: noonian heh no worries. You + a few beers = definitely more knowledgeable than I am

1:23 jyu1: amalloy: I add a catch clause with additional msg in the compiler.eval in the end, when I call (concat 1 [2]) , the additional msg will not shown, but (print (concat 1 [2]) does

1:24 noonian: ncthom91: i'd take a look at the clojurescript test readme, and it wont hurt anything to have the test dir in your :source-paths

1:26 you could add a leiningen alias that calls cemerick.cljs.test/test-ns on your test nss also, i'm not sure how integrated clojurescript.test is with leiningen

1:29 ncthom91: noonian this looks like the key: https://github.com/emezeske/lein-cljsbuild/blob/1.0.3/example-projects/advanced/project.clj#L71

1:30 jyu1: amalloy: looks (concat 1 [2]) does not call the compiler.eval but (print (concat 1 [2]) does

1:32 noonian: ncthom91: the :test profile will be active during cljsbuilds :test-commands i'm sure, but i think that is just telling cljsbuild where to output the js file so that the phantomjs html file can reference it

1:33 ncthom91: noonian well i have to build it before i test it, no?

1:36 noonian: ncthom91: i'm not sure, but at least if you need to test in a browser context. i think i'm probably doing more harm than good at this point though so i'm going to wish you good luck and pass out :p

1:38 dorkmafia: is there a way to define globals in clojure?

1:40 ivan: dorkmafia: any (def) in a namespace?

1:42 jlongster: what does it mean when a vector is in the call position? https://github.com/clojure/clojurescript/blob/master/src/cljs/clojure/core/reducers.cljs#L71

1:43 seangrove: Just lookup

1:43 ,([0 0 1 1 2] 3)

1:43 clojurebot: 1

1:44 ncthom91: hey guys, how do I import a namespace to get all of its functions?

1:44 something like https://github.com/emezeske/lein-cljsbuild/blob/1.0.3/example-projects/advanced/test-cljs/example/test/hello.cljs#L2

1:44 except I don't want to list everythin I need in the :only definition

1:44 rather just get it all by default

1:44 jlongster: seangrove: oh. that code calls it with an object (?) instance though? I don't understand that

1:44 it almost looks like that's a different way to define functions

1:45 coll & cf are the arguments

1:45 seangrove: Oh, sorry

1:45 That's just a way of defining different arities

1:45 Also that's how you get a docstring for a fn

1:46 A tiny bit strange

1:46 jlongster: seangrove: oh, I see. forgot about the multiple arities

1:46 seangrove: thanks. obviously have never quite sharpened my Clojure familiarity.

1:47 seangrove: jlongster: Ever done much Haskell/OCaml? Been diving into it alongside Glint recently

1:47 The "Let's build a browser engine engine in Haskell pt 2." was pretty cool to see the code compared to Rust

1:48 jlongster: seangrove: not much, but familiar with all the concepts. careful, don't get sucked in too much :)

1:48 which article was that? didn't see that one

1:48 I'd play with Rust first because it maps well with what I'd do with it: games

1:49 seangrove: http://hrothen.github.io/2014/09/08/lets-build-a-browser-engine-in-haskell-part-2/

1:49 Why the warning about getting sucked in - experience? :)

1:50 jlongster: seangrove: nah, but I know several people that once they started using good type systems, couldn't turn back

1:50 definitely worth getting to know though

1:51 seangrove: Heh, fair enough

1:53 jyu1: ...

1:55 will the repl generate classes in memory after evaluting forms?

2:00 amalloy: jyu1: of course. the only way to run any code on the jvm is to have it live in a class

2:03 jyu1: amalloy: so my understanding is wrong, the expression just call the expr's eval method instead of invoking the method of emitted classes in the repl env.

2:04 go to look the code again.

2:04 come back later

2:04 thanks

2:05 amalloy: calling .eval on an expression is not the "common case" for evaluating code. i don't totally understand when it's used, but almost all of the time the compile/run cycle is chosen instead

2:46 dorkmafia: what's the difference between [^String] and [#^String] ?

2:47 sm0ke: new vs old notation i guess

2:48 dorkmafia: oh ok

3:22 snowstalker: What is the best way to figure out the source of randomly new log messages in my clojure project, e.g. http://paste.lisp.org/+32UT

3:24 hiredman: the class name is in the log message

3:26 snowstalker: hiredman: Yes, but I'm not using the class name anywhere in my code, so is there a way to grep the source code of all the (lots of) dependencies listed in my project.clj ...

3:40 sm0ke: you can do ##(bean clojure.lang.Keyword)

3:40 lazybot: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "getProtectionDomain")

3:41 sm0ke: which which give you location of jar for the class

3:46 piranha: is there a shorter way than (ns ... (:require [my.prefix [one :as one] [two :as two]]))? I.e. at least shorten the prefix maybe...

3:46 TEttinger: ,(bean clojure.lang.Keyword)

3:46 clojurebot: {:enum false, :interfaces #<Class[] [Ljava.lang.Class;@3e4d49>, :declaredConstructors #<Constructor[] [Ljava.lang.reflect.Constructor;@876d42>, :simpleName "Keyword", :package #<Package package clojure.lang>, ...}

3:49 sm0ke: ,(keys (bean clojure.lang.Keyword))

3:49 clojurebot: (:enum :interfaces :declaredConstructors :simpleName :package ...)

3:50 jyu1: clojurebot: (: 1)

3:50 (concat [1] [2])

3:50 sm0ke: ,(:protectionDomain (bean clojure.lang.Keyword))

3:50 clojurebot: #<InvocationTargetException java.lang.reflect.InvocationTargetException>

3:51 TEttinger: jyu1: you can eval code by starting with a comma, like

3:51 ,(concat [1] [2])

3:51 clojurebot: (1 2)

3:51 jyu1: ,(thanks)

3:51 ,(thanks)

3:51 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: thanks in this context, compiling:(NO_SOURCE_PATH:0:0)>

3:51 jyu1: ,(print 'a)

3:51 clojurebot: a

3:52 TEttinger: that's a different comma! I'm wondering what that is

3:52 ,(int \,)

3:52 clojurebot: 65292

3:52 sm0ke: ,(-> clojure.lang.Atom .getProtectionDomain .getCodeSource ; .getLocation .getPath)

3:52 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

3:52 sm0ke: ,(-> clojure.lang.Atom .getProtectionDomain .getCodeSource .getLocation .getPath)

3:52 clojurebot: #<AccessControlException java.security.AccessControlException: access denied (java.lang.RuntimePermission getProtectionDomain)>

3:53 jyu1: (concat 2 [2])

3:53 ,(concat 2 [2])

3:53 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>

3:53 TEttinger: ,(doc concat)

3:53 clojurebot: "([] [x] [x y] [x y & zs]); Returns a lazy seq representing the concatenation of the elements in the supplied colls."

3:53 sm0ke: solid sandboxing

3:53 jyu1: ,(concat [2] [3])

3:53 clojurebot: (2 3)

3:54 TEttinger: ,(conj [1 2 3] 4)

3:54 clojurebot: [1 2 3 4]

3:54 jyu1: TEttinger: are you familiar with clojure compiler?

3:55 TEttinger: not the internals, no, but I know how to write clojure

3:57 jyu1: how do you deal with the un-friendly error message from clojure? do not tell me the line and column, it is not effective.

3:58 TEttinger: mostly experience with similar messages in earlier code.

3:59 NullPointerException means something is nil where it shouldn't be, and usually you're trying to call it like it's an object.

4:00 StackOverflowException means you have an infinite loop, usually, though freezing with no exception can also be that.

4:01 reader errors usually mean the parentheses don't match, like (+ 1 (/ 4 3)

4:01 there's common errors with Long and ISeq mixups when you try to call something like map or reduce that needs a collection, and you give it a number

4:03 jyu1, Typed Clojure fixes some of this by adding extra things that can be verified before your program runs

4:03 jyu1: :)have you tried?

4:03 TEttinger: that's one of the main motivations for making Typed Clojure, the better error messages. I haven't needed typed clojure though

4:07 jyu1: what editor are you using, I am using cursive

4:18 TEttinger: jyu1, I haven't written a large clojure program in a while, last I used was nightcode

4:25 Morgawr: are you still working on Cloister?

4:35 lvh: hm

4:36 http://grimoire.arrdem.com/1.6.0/clojure.core/fn/ insists that fn is a macro; but I thought it was a special form

4:36 opqdonut: see the source

4:36 it's a wrapper for the fn* special form

4:36 hyPiRion: lvh: fn is a macro, fn* is a spcial

4:38 opqdonut: the wrapper handles e.g. pre and post conditions

4:40 cfleming: The wrapper also handles destructuring - let is similar

5:23 piranha: what's the best way to mock my db connection?

5:24 hyPiRion: for testing?

5:25 usually I'd use with-redefs

5:26 piranha: hyPiRion: do you do with-redefs in each deftest separately?

5:27 hm, I also wonder what do you set it to? To some memory database?

5:27 that's the first time I'm writing tests for db-backend clojure application, sorry :)

5:27 I wonder if better way would be having :dynamic function to execute a query

5:28 so I won't need to have a database at all and could just mock responses...

5:29 hyPiRion: piranha: I'd usually load a clojure map, then use fixtures for the with-redef, and let the queries and such be things on the map itself

5:30 piranha: hyPiRion: hm, do you have an example? Not sure I understand correctly...

5:30 I would even say 'not sure I understand that' :)

5:30 hyPiRion: This very much depends on the tests you are creating though. It's not that easy for SQL databases for instance

5:30 piranha: yeah, I use pgsql

5:30 hyPiRion: piranha: gimme a sec, I'll make one

5:30 piranha: thanks!

5:33 TEttinger: (inc hyPiRion)

5:33 lazybot: ⇒ 45

5:35 piranha: TEttinger: inc is like an upvote?

5:36 TEttinger: $karma TEttinger

5:36 lazybot: TEttinger has karma 21.

5:36 TEttinger: $karma technikhil

5:36 lazybot: technikhil has karma 0.

5:36 TEttinger: $karma technomancy

5:36 lazybot: technomancy has karma 134.

5:36 TEttinger: hyPiRion is doing pretty well

5:36 $karma so

5:36 lazybot: so has karma -33.

5:37 TEttinger: someone used that nick and it messed up highlighting since it was a common word

5:37 technikhil: $karma lazybot

5:37 lazybot: lazybot has karma 29.

5:38 piranha: $karma piranha

5:38 lazybot: piranha has karma 0.

5:38 piranha: obviously

5:38 TEttinger: (inc piranha) ; for wanting to know more

5:38 lazybot: ⇒ 1

5:38 piranha: :))

5:39 snowstalker: hiredman: sm0ke Finally figured which library did it by running `ps | fgrep -i java` to get the CLASSPATH directories list and then going through each jar file whether it contains the PluginProxyUtil class, and figured out the jets3t library is using it, googling finally led me to http://www.jets3t.org/toolkit/configuration.html and adding a

5:39 jets3t.properties file with `httpclient.proxy-autodetect=false` in the resources directory solved the problem :)

5:41 H4ns: hi. how would i express javax.xml.validation.SchemaFactory.class.getName() in clojure?

5:42 TEttinger: ,(.getName javax.xml.validation.SchemaFactory/class)

5:42 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to find static field: class in class javax.xml.validation.SchemaFactory, compiling:(NO_SOURCE_PATH:0:0)>

5:43 TEttinger: ,(.getName (.class javax.xml.validation.SchemaFactory))

5:43 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: class for class java.lang.Class>

5:43 TEttinger: oh!

5:43 H4ns: i suppose that something very javaesque is going on there.

5:43 TEttinger: ,(.getName javax.xml.validation.SchemaFactory)

5:43 clojurebot: "javax.xml.validation.SchemaFactory"

5:43 H4ns: ah. that looks good. but why?

5:44 TEttinger: you don't need the .class since javax.xml.validation.SchemaFactory is already a literal for a type of class

5:44 H4ns: ah, ok, understood. thanks!

5:46 hyPiRion: piranha: https://www.refheap.com/90048

5:46 H4ns: i hate it that almost everything that i try in clojure just works. i mean, where is the struggle? i need to procrastinate even more so that i don't appear to be too productive.

5:49 notostraca: (inc H4ns)

5:49 lazybot: ⇒ 2

5:50 hyPiRion: piranha: That one should be a fully working clojure test. I tried to include comments, as it's a bit long.

5:50 well, long in the sense of not being 2 lines.

5:50 piranha: sure :)

5:51 I see

5:52 hyPiRion: I was too lazy to create functions which take db as a first parameter, so it's global in my app

5:52 %)

5:52 which sucks, but makes it faster to develop... I guess I'll try working with with-redefs-fn

5:52 hyPiRion: piranha: that works as well. If it's a dynamic variable, you can just use binding

5:53 piranha: well my url of a database is a dynamic variable

5:53 hyPiRion: ah

5:53 piranha: but that means I'll need to use some in memory database for that to work

5:53 plus probably it won't work exactly like pgsql

5:53 which sucks :\

5:53 hyPiRion: right

5:54 piranha: now I'm trying to decide if I need to redef my low-level functions (like query/execute) or higher-level (create-user/get-session/etc)

5:54 I probably don't need to test them, so it's going to be ok... I hope

5:55 hyPiRion: right

5:55 If you really want to test the database properly, I think there's no way around working against an actual postgres db

5:56 piranha: hyPiRion: thanks for the example :)

5:56 yeah I guess so

5:56 so it's better to just test api to have fast tests

5:56 hyPiRion: you're welcome

5:56 piranha: (inc hyPiRion) ; I guess :)

5:56 lazybot: ⇒ 1

5:56 piranha: woah what

5:57 why 1?

5:57 hyPiRion: $karma hyPiRion) ; I guess :

5:57 lazybot: hyPiRion) has karma 0.

5:57 hyPiRion: hrm

5:57 piranha: I'm not sure I understand

5:57 why did it take closing bracket as a part of a name?

5:57 hyPiRion: piranha: lazybot is not exactly bulletproof

5:58 piranha: :)

5:58 (inc hyPiRion)

5:58 lazybot: ⇒ 46

5:58 piranha: hm

5:58 $karma piranha

5:58 lazybot: piranha has karma 1.

5:58 piranha: $karma piranha)

5:58 lazybot: piranha) has karma 0.

5:58 piranha: $karma hyPiRion)

5:58 lazybot: hyPiRion) has karma 0.

5:58 piranha: $karma hyPiRion) ; test

5:58 lazybot: hyPiRion) has karma 0.

5:58 piranha: ah!

5:58 damn, I understand it now

5:58 it's been my smiley

6:00 hyPiRion: https://github.com/Raynes/lazybot/blob/master/src/lazybot/plugins/karma.clj#L69 <- I guess that regex is broken

6:01 piranha: hyPiRion: I think it needs ? right after \)

6:01 or [^)]+ instead of .+

6:01 ignore first message plz :)

6:03 hyPiRion: amalloy_: your karma regex isn't working properly, go fix

6:04 TEttinger: $karma hyPiRion) ; I guess :

6:04 lazybot: hyPiRion) has karma 0.

6:05 TEttinger: #"^\((inc|dec|identity) (.+?)\)(\s*;.*)?$" ; should work

6:06 hyPiRion: ooh

6:06 (identity hyPiRion) ; I guess :)

6:06 lazybot: hyPiRion) ; I guess : has karma 1.

6:06 hyPiRion: there you go

6:06 TEttinger: ,(re-find "(inc hyPiRion) ; I guess :)" #"^\((inc|dec|identity) (.+?)\)(\s*;.*)?$")

6:06 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.util.regex.Pattern>

6:06 TEttinger: ,(re-find #"^\((inc|dec|identity) (.+?)\)(\s*;.*)?$" "(inc hyPiRion) ; I guess :)")

6:06 clojurebot: ["(inc hyPiRion) ; I guess :)" "inc" "hyPiRion" " ; I guess :)"]

6:08 hyPiRion: so much highlighting

6:17 piranha: I actually wonder if I should start using component or something similar

6:36 visof: hi

6:37 can map over a tree which give me another tree?

6:39 clgv: visof: you want something like the functions in "clojure.walk"

7:20 haksior: hi there. i'm trying to play a bit with testing of compojure app using emacs/cider. having newly generated app (lein new compojure-app hello-world) and tests of handler.clj I'm getting "Wrong type argument: listp, "test-app" hitting C-c , (run tests for namespace). Any clue why?

7:24 clgv: haksior: looks like the emacs side since clojure has no "listp" so it's probably cider

7:24 or any other emacs plugin that intervenes

7:36 jcromartie: how can I easily see the order in which namespaces are loaded?

7:36 without adding (println "loading" *ns*) to every file...

7:36 clgv: jcromartie: require has an iption

7:37 ,(doc require)

7:37 clojurebot: "([& args]); Loads libs, skipping any that are already loaded. Each argument is either a libspec that identifies a lib, a prefix list that identifies multiple libs whose names share a common prefix, or a flag that modifies how all the identified libs are loaded. Use :require in the ns macro in preference to calling this directly. Libs A 'lib' is a named set of resources in classpath whose contents...

7:37 clgv: &(doc require)

7:37 lazybot: ⇒ "([& args]); Loads libs, skipping any that are already loaded. Each argument is either a libspec that identifies a lib, a prefix list that identifies multiple libs whose names share a common prefix, or a flag that modifies how all the identified libs are loaded. Use ... https://www.refheap.com/90052

7:37 clgv: jcromartie: (require 'my-parent.ns :verbose)

7:37 jcromartie: excellent

7:38 thanks

7:38 gotta work around all of the Leiningen loading stuff too...

7:39 :repl-options, :main, :aot

7:39 clgv: you want to use this on "lein repl" or "lein run"?

7:39 jcromartie: you can bind *loading-verbosely* to true in your project.clj

7:40 jcromartie: ah ha

7:40 clgv: jcromartie: :global-vars {*loading-verbosely* true}

7:41 I am not sure if it works with "lein run" but "lein repl" is supposed to work with that config

7:43 jcromartie: this is basically undocumented?

7:44 lnostdal: hi guys, anyone had any experience running clojure on arm? e.g. chromebook and similar? ..i'm asking because i'm considering an energy-efficient laptop / ultrabook while traveling

7:44 clgv: jcromartie: what exactly?

7:46 jcromartie: :verbose is document in `require`, *loading--verbosely* is not really documented in connection. :global-vars is documented in leiningen's sample project.clj - so the bits are mostly documented in their places, but your entire use case is not documented afaik - capture it in a blog post :)

7:47 jcromartie: it's hard to find any documentation about *loading-verbosely*

7:47 seems more like it's bound to true by the system, not for users to bind

7:47 http://www.clodoc.org/doc/clojure.core/*loading-verbosely*

7:47 but I could be wrong

7:48 clgv: oh right it is private and thus an implementation detail...

7:48 jcromartie: so this is weird

7:48 clgv: that's probably an error with respect to tooling

7:49 you can trick it via :global-vars {#'clojure.core/*loading-verbosely* true}

7:49 jcromartie: I've removed the :main, :aot, and :repl-options from my project.clj but it is still loading code from source when I run lein repl

7:49 hm I see

7:49 are there any other things that could trigger loading code in "lein repl" ?

7:49 oh

7:50 I do have a "user" ns

7:50 in one of my source directories

7:50 clgv: user.clj?

7:50 yeah that might be the reason, I never tried but I think there is a convention that a user.clj is loaded on repl startup

7:53 piranha: hm

7:54 anybody here ever used pgsql jdbc driver to pass arrays to postgresql?

7:54 I understand that I need to extend vector with jdbc/ISQLValue protocol

7:54 but then it seems pgsql driver wants me to use conn.createArrayOf(type, java-array) to create an array

7:54 and I don't have connection there

7:56 mikker: Any good examples of open source compojure apps that implement some kind of authentication?

7:57 I'm looking for some inspiration

8:05 AeroNotix: When I am in a lein repl instance of a project through CIDER. How would I add a new dependency to the project without needing to restart the repl?

8:06 clgv: AeroNotix: pomegranate (or another similar lib whose name I forgot)

8:06 AeroNotix: clgv: thought so

8:06 clgv: mikker: we used friend

8:07 r4vi: AeroNotix: alembic

8:08 mikker: clgv: yea, saw that. Though I'd do something simpler myself

8:08 Just to get to know clojure better along the way

8:11 clgv: mikker: ah you only asked for learning purposes

8:12 mikker: Learning and eventually using :)

8:12 I'm reading up on friend now. Can't hurt.

8:12 clgv: mikker: we have it in 2 non-public projects for form-based authentication

8:44 did anyone try to just use the warm-up functionality of "criterium"?

11:07 magopian: i'm trying to understand https://github.com/clojure/core.async/blob/master/examples/walkthrough.clj#L57

11:07 what is the use for the go block here, as we're anyway using <!! ?

11:08 couldn't we just do (assert (= "hello" (<!! c))) ?

11:08 tbaldridge: magopian: the example is showing how to use the go macro, and then its showing that go returns a value via a channel. You wouldn't want to write code like that IRL

11:09 magopian: tbaldridge: ok, it's just the example, thanks ;)

11:09 btw, thanks "in advance" for your videos (i've downloaded them all, and will watch them soon ;)

11:10 (it's a long path, i started looking at om, then at core.async, then the video from swannodette (the cognitect webinar on core.async), then the introductory blog post from Rich, then those examples, next are your videos :)

11:10 (and trying at the same time to grok transducers, thanks to cgrand who gave us an informal hangout on "transducers from scratch" :)

11:11 all that for my poor little noob brain, i hope i'm not leaking brain cells through my ears

11:14 aconbere: So... kind of weird question... I've been using jdbc for a bunch of things. But one of the databases I use (RedShift) is REALLY REALLY slow if I use prepared statements.

11:14 so I've had to end up preparing my sql statements in code, and I'm trying to find out if someone has made a light weight sql library that will make safe sql strings for me

11:15 it doesn't look like with clojure.jdbc that I have any option except for using prepared statements

11:16 gdeer81: aconbere, did you look at some of the SQL abstractions like Korma or Honey SQL?

11:17 aconbere: gdeer81: I did, but I'm hoping to not end up in a DSL for writing SQL

11:20 ghadishayban: honeySQL has worked very well for us

11:21 it doesn't try to do anything ORMey

11:22 aconbere: ghadishayban: I think also I might be riding a fringe here because RS is so non-performant with parameterized queries

11:22 looking at honey sql it looks like it actually generates parameterized jdbc statements

11:25 ghadishayban: is RS that non-performant?

11:26 aconbere: ghadishayban: the difference in the performance sensitive queries I'm running between using a parepared statement and a formated string are on the order of 15 minutes

11:26 (where the formatted string option runs in about 20s)

11:27 clgv: aconbere: is RedShift a reasonable choice then at all?

11:27 ghadishayban: interesting, that sounds like a bug

11:27 aconbere: clgv: well... running the query in 20s with a formatted string is certainly an option

11:27 but prepared statements are off the table for us :)

11:28 clgv: but a db where you cannot use prepared statements efficiently?

11:28 aconbere: clgv: why is that a deal breaker for you?

11:28 ghadishayban: can always generate the q sans prepared statement with any of the options

11:28 aconbere: ghadishayban: yeah, so that's what we do

11:28 nothing that we run takes arbitrary user input

11:28 but it makes all of us ... squirmy

11:29 thus my question about safe sql string generation

11:29 it looks like my best bet is maybe using owasp/esapi and just generating escaped strings

11:29 ghadishayban: assuming you set Forward_only and read_only

11:30 clgv: isnt even that spreadsheet thingy, called mysql, able to do performant queries via prepared statements?

11:30 aconbere: clgv it is, but it's less happy with my very large datasets :)

11:30 arrdem: gdeer81: o/

11:30 clgv: I didnt want to recommend using it. just putting it into perspective. why exactly do you use redshift?

11:31 aconbere: clgv: we use redshift as an analytics database, we have many many terabytes of data in it, and we almost exclusively run ugly analytics type queries on it

11:31 so group bys with CTE's and the works

11:32 it's not clear to me exactly why RS is choking on prepared statements this way

11:32 it's engine is a modified Postgres engine and one would think it would be fine

11:32 its

11:32 bleh

11:32 gdeer81: arrdem, oh hai

11:33 clgv: aconbere: maybe it is really some kind of bug?

11:34 aconbere: clgv: my best bet is that something about how they parameterize queries and potentially even my inputs to it is causing a cache miss on the query plan

11:34 arrdem: gdeer81: to belatedly answer your question school work allowing I was planning on clojurecupping. thinking about comming up again?

11:36 gdeer81: arrdem, I was hoping to come up for at least one day but I might have to be totes-remote this year

11:37 arrdem: gdeer81: if you need a place to crash in ATX I've got an appartment this year. all remote would be... interesting.

11:38 aconbere: clgv: I mean, I'm not thrilled by this, but i'm pretty thrilled so far by the value that RS provides per dollar versus running our own vertica cluster of the same size

11:41 gdeer81: arrdem, with hangouts and skype and the myriad of telecommuting tools available I don't think remote teammates will be an issue. And hopefully this year we can limit the scope of our entry

11:41 arrdem: gdeer81: lol yes

11:45 clgv: aconbere: but I'd check possible error sources that are connected with the poor performance of prepared statements.

11:47 abp: (clojure.tools.reader.edn/read-string (pr-str #"\.")) throws ExceptionInfo Unsupported escape character: \.

11:47 that's a bug right?

11:47 clgv: ,(read-string (pr-str #"\."))

11:47 clojurebot: #"\."

11:48 arrdem: abp: the edn reader doesn't include patterns AFAIK

11:48 abp: the clojure reader does

11:48 aconbere: clgv: yeah, a good reminder. I can easily create the test case and send it to our rep.

11:49 arrdem: abp: https://github.com/edn-format/edn

11:49 abp: note that there is no "pattern" type in there

11:49 clgv: ,(do (require '[clojure.edn :as edn]) (edn/read-string (pr-str #"\.")))

11:49 clojurebot: #<RuntimeException java.lang.RuntimeException: No dispatch macro for: ">

11:49 abp: arrdem: yes, damn

11:50 clgv: ,(edn/read-string (pr-str (str #"\.")))

11:50 clojurebot: "\\."

11:50 clgv: ,(re-pattern (edn/read-string (pr-str (str #"\."))))

11:50 clojurebot: #"\."

11:51 clgv: abp: you could work around it ^^

11:51 arrdem: clgv: but then you introduce an out of band schema... "this thing is really a pattern but we can't encode that"

11:51 abp: arrdem: Happens when sending certain error structures generated by prismatic/schema to other web services, i.e. schemas containing regexes

11:52 arrdem: {:op :pattern :payload my-string}

11:55 clgv: arrdem: if you actually can work around it surely depends on the application and I did not suggest to replace it literally for scenarios where an automatic recognition of the pattern must happen...

11:56 abp: arrdem, clgv: maybe i just wrap the regexes to produce specific errors.

11:57 arrdem, clgv: Thanks anyway

11:58 mmitchel_: I have a ring app that i'm building using the "lein ring uberwar" command. In the resulting war, I'm seeing WEB-INF/classes and WEB-INF/lib -- I see the clojure.jar in lib, but also see all of the class files in WEB-INF/classes -- Is there anyway to have "lein ring uberwar" not include those class files in the war file?

11:59 elarson: I have a general functional programming question that I'm hoping will be helpful understanding common idioms in clojure

11:59 justin_smith: mmitchel_: an uberwar is meant to be standalone

12:00 mmitchel_: and why shouldn't it pre-compile?

12:00 joegallo: elarson: i grant you permission to ask it

12:00 mmitchel_: justin_smith: hmm, so maybe I should be doing "lein ring war" instead?

12:00 mdeboard: Saruman would approve

12:00 justin_smith: mmitchel_: why do you object to those class files?

12:01 mmitchel_: justin_smith: because we're thinking that it's causing an "out of file descriptors" exception. We've found that increasing the ulimit fixes the problem, but we don't want to have to do that obviously

12:01 elarson: I have a program that takes a big csv and writes bunch of files smaller files. in python I would create an object and maintain a list of the files created for later. I was trying to write the same thing using only functions and I'm thinking about writing a function that resets the current file and returns a new file handle, a new csv writer and the list of files. that seems like a horrible API though so I'm curious how others might

12:01 refactor that code

12:03 justin_smith: mmitchel_: you could edit the uberwar, it is a zip file. But certain things need to be available to the app container as class files - it won't be a trivial thing to make it work. You'd probably need to make a shim with a .class that loads the rest from .clj files. And would this really help with the file descriptor count issues?

12:04 elarson: hmm... I suppose one obvious change would be to return a map with the new filename, handle and csv writer. that would be better

12:04 joegallo: elarson: what determines the point where you switch to another file?

12:05 clgv: elarson: yeah something like (defn dosth [fileconfig, data] ) -> returns fileconfig should work

12:05 lavokad: nnect


12:05 elarson: joegallo: at this point I'm just using the number of rows.

12:05 mmitchel_: justin_smith: ugh :) thanks for the info. I'll have to look into this more I think

12:06 elarson: joegallo: it is a really wide csv (5k+ columns) and turns it into a entity-attribute-value format

12:07 joegallo: is there a naming scheme or something for the smaller files?

12:07 elarson: so each row size becomes pretty similar across the entire file.

12:07 mmitchel_: justin_smith: so is there a way to know what class files are required?

12:07 elarson: joegallo: yeah, it just adds a number before a .csv.gz

12:08 joegallo: k, gonna hack on a gist for a minute

12:08 justin_smith: mmitchel_: I don't know off the top of my head. You need a .class file that the container can load and invoke, and you can make that do whatever you like to load all your clojure code

12:09 TimMc: This is a perfectly reasonable way to type-hint an argument, right?

12:09 (fn [v] (rx.Observable/from ^Iterable (repeat v v)))

12:09 justin_smith: mmitchel_: there is documentation online on manually constructing an uberwar, and it will have more details than I can remember.

12:10 TimMc: I'm encountering a case where the type hint is being lost and the Object version of the method is being called instead...

12:10 I thought it was Midje, but after some macroexpansion I'm wondering if this is a Clojure compilation thing.

12:10 justin_smith: TimMc: you mean type hint a return value, right? and shouldn't the fn be hinted, not the value you are returning?

12:11 TimMc: Type-hint an argument.

12:11 joegallo: elarson: https://gist.github.com/joegallo/1d795d9a613795dab9fe i've named things terribly on purpose, and kept it all pretty vague

12:11 but that's something like the shape of what i'd probably do

12:11 justin_smith: TimMc: ahh, so the fn isn't the point, got it

12:11 TimMc: rx.Observable/from has several variations, among which are (Object) and (Iterable).

12:12 Yeah, sorry, it's an oerly large code extract.

12:12 *overly, ugh

12:12 clgv: justin_smith: mmitchel_: you'd need something similar to org.timmc/lein-otf

12:12 TimMc: clgv: Which is currently broken but totally easy to replicate per-project.

12:12 clgv: TimMc: still works over here. what is broken?

12:13 justin_smith: mmitchel_: https://github.com/timmc/lein-otf yeah, this looks like it would help

12:13 TimMc: Last I saw, it was failing to inject a :main or something.

12:13 I don't know if it's worth fixing -- it's more of a pattern than a plugin.

12:13 justin_smith: well, you don't need a :main for an uberwar anyway :)

12:14 ncthom91: hey all. I keep getting this error and I'm not sur what it means: " Only one :require form is allowed per namespace definition"

12:14 technomancy: these days it's easy to avoid AOT in uberjars; just put clojure.main as your entry point and use the -m option

12:14 only place it doesn't work is if you need the jar to do something sensible with no args

12:15 clgv: TimMc: oh right it somehow points to clojure's main

12:15 ncthom91: nvm, got it ;)

12:15 TimMc: Some lein change broke it, I guess.

12:15 matthoffman: justin_smith: TimMc: mmitchel_: but we're talking about a war here, right? No main necessary.

12:16 mmitchel_: war yes

12:16 CookedGryphon: Hey, does anyone know how I can read edn data which has some #<JavaClass > bits in it without completely falling over

12:16 justin_smith: matthoffman: yeah, that's wwhat I just said :)

12:16 TimMc: CookedGryphon: regular expressions?

12:16 CookedGryphon: urgh

12:17 justin_smith: wait, if it contains #<...> it isn't valid edn is it?

12:17 TimMc: Hacking in a reader for #<, perhaps?

12:17 CookedGryphon: justing

12:17 justin_smith: the point of #< is to mean unreadable

12:17 CookedGryphon: justin: no, if it's #blah something then it is

12:17 yeah, and that's fine, how do I get the rest of the message

12:17 *or* how to I output only readable things

12:17 TimMc: I mean, the real answer is "you don't".

12:17 matthoffman: justin_smith: True, sorry :)

12:18 TimMc: CookedGryphon: Cheshire with an emitter for Object?

12:18 But that's not EDN, sorry.

12:18 tree-walking, maybe

12:19 CookedGryphon: Surely it could just give it to me as a symbol or something?

12:19 justin_smith: CookedGryphon: you could make an extension of pr-str that returns a readable placeholder for unreadable forms

12:20 CookedGryphon: justin_smith: what would I extend? Would I have to do it for each unreadable form I knew about?

12:21 it's really really annoying that there isn't a edn/write which is guaranteed round-trippable with edn/read

12:21 clgv: TimMc: how did it work before?

12:21 TimMc: the namespace was written into the manifest right?

12:21 TimMc: clgv: Yeah, and inject its own loader ns into :main in the project map.

12:22 clgv: TimMc: the difference between the two builds is that Main-Class in the manifest does now point to clojure.main instead of my :main

12:23 TimMc: A per-project DIY version would be simpler and just involve creating a second namespace that does (defn -main [& args] (require 'my.real.ns) (apply @(resolve 'my.real.ns/-main) args))

12:23 clgv: TimMc: hm yeah probably

12:23 TimMc: had that before for a different project

12:30 elarson: joegallo: thanks! that makes it extremely clear why I'd rather be using clojure ;)

12:32 joegallo: elarson: i couldn't stop until i used a threading macro. and the loop was bugging me.

12:32 updated the gist

12:35 elarson: joegallo: what part is using threading macro?

12:35 joegallo: (->> ...) is the threading macro

12:35 elarson: ah ok, that is what I thought

12:35 does it do each step in a thread or the whole thing?

12:36 * elarson reads up on ->>

12:36 joegallo: it allows you to write a nested s-expression (the evaluates from the inside out) into a series of sequential s-expressions that read from the top to the bottom

12:36 clgv: elarson: no, no java-threads are involved

12:36 noonian: elarson: it's not about os threads, it will pass the result of the cal to some-lazy... as the first argument to partition-all and the result of that as the first arg to map-indexed

12:37 justin_smith: CookedGryphon: just spitballing here - what about a tree walker that returns the pr-str version by default, except for the collections, where it recurses, and catches unreadables (unreadable objects will always match a simple regex) and replacing them with placeholders

12:37 joegallo: (a (b (c (d e f)))) becomes (->> (d e f) (c) (b) (a)) which may seems horrible and confusing at first, but later i promise you'll fall in love with it

12:37 it's like sushi

12:38 Fare: -> and ->> are great

12:38 J_Arcane: I'm not sure I understand why you would want to do that?

12:39 justin_smith: J_Arcane: they can make code much more readable

12:39 joegallo: there's a certain conceptual readability that sometimes flows from it

12:39 Fare: I also have (defmacro <- "Nesting macro" ([] nil) ([x] x) ([x & y] `(~@x (<- ~@y)))) ;; like UIOP:NEST in CL

12:39 elarson: joegallo: yeah, I tried using -> the other day and it was pretty nice.

12:39 hiredman: (->> foo (map f) (filter g) (mapcat h))

12:39 hfaafb: because it represents the pipeline of data transformations in a more linear way, outside in rather than inside out

12:39 elarson: core.async has also completely ruined my desire to play with go ;)

12:40 mdrogalis: elarson: Glad I'm not the only one ;[

12:40 J_Arcane: Ahhh. OK, I see what you mean now, I think I misunderstood the description.

12:40 justin_smith: hfaafb: more left-to-right rather than inside out

12:40 joegallo: https://gist.github.com/joegallo/b5e6bd2346cd261016be J_Arcane elarson

12:40 Jaood: comp beats both :P

12:40 joegallo: slightly better example

12:40 justin_smith: Jaood: good luck using comp with macros and interop, -> / ->> handle those nicely

12:41 Jaood: yeah, you can use lambdas but... otherwise, agreed, comp is great

12:42 joegallo: justin_smith: comp is great, and imma let you finish, but juxt is one of the best functions OF ALL TIME

12:42 justin_smith: (inc juxt)

12:42 lazybot: ⇒ 13

12:42 Fare: Where would I go to get <- standardized?

12:42 noonian: lol

12:42 justin_smith: Fare: nail your theses to the clojure jira door

12:42 Jaood: justin_smith: yeah, some people just abuse -> / ->> to much

12:43 mdrogalis: justin_smith: Like nailing jello to a tree.

13:24 danneu: dont forget about as->

13:25 feel like a gambler when i use ->/->> without knowing the position i need for every fn i'm gonna thread

13:25 arrdem: Fare: what does <- do?

13:26 splice of x splice of y...

13:27 llasram: It seems conceptually to be (comp ->> reverse)

13:28 But you know, not literally that because macros

13:28 Fare: arrdem: it's nesting things a bit in reverse of ->

13:28 danneu: id rather just see (as-> thing _, (foo 42 _), (bar _ 42))

13:29 Fare: so (<- (let [a c]) (match [x] [some pattern]) (when (some-condition)) ...)

13:29 it's great to avoid nesting of 10+ binding forms.

13:30 and vast indentation to the right

13:30 TimMc: I'm sure that's in the swiss-arrows lib.

13:31 Fare: TimMc: nice. I'll google it

13:32 nope, I don't see anything like it

13:32 in https://github.com/rplevy/swiss-arrows

13:33 oh wait it has a <<-

13:34 so yes, it has it

13:40 clgv: Fare: why not just use `as->` ?

13:44 * TimMc defines <-?-> https://gist.github.com/timmc/68ca16d306ee264b409e

13:45 J_Arcane: I have achieved clojure enlightment, apparently.

13:45 Fare: :-)

13:45 justin_smith: (inc TimMc)

13:45 lazybot: ⇒ 70

13:45 Fare: clgv: where is it defined?

13:46 justin_smith: $source as->

13:46 lazybot: Source not found.

13:46 justin_smith: Fare: clojure.core, 1.5+

13:47 Fare: very different http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/as-%3E

13:47 clgv: Fare: clojure.core

13:48 Fare: but it removes the need for <<-

13:48 olasuka: i am using generative testing, to cover some macros i am developing, and part of the macro is interning a symbol to the namespace that is calling the macro.

13:48 Fare: my <- or swiss-arrows/<<- allows you to nest arbitrary binding forms

13:49 justin_smith: olasuka: that is an intentional behavior of `(), if you use that construct

13:49 olasuka: the issue is that clojure.core, is of course present, and when a symbol such as '*' is generated, I am getting errors of the overwriting of the symbol

13:49 arrdem: TimMc: I challenge you to find a use of that that's correct and meaningfu

13:49 *meaningfull.

13:49 Fare: so you can define and/or use as many of them as you like, and never had to indent your code to the right

13:49 olasuka: is there any way to supress the behavior, or to ignore certain classes of errors during the testing?

13:50 Fare: all the advantages of python blocks with none of the disadvantages.

13:50 arrdem: Fare: ah nice

13:50 olasuka: I know that would be an issue, once the code is run, but the writer would be aware of the issue.

13:50 justin_smith: olasuka: wait, what is the specific exception or error you are getting?

13:50 TimMc: arrdem: Turn on AOT and run lein compile, tests until tests pass. No need to fiddle about with choosing an arrow!

13:51 arrdem: TimMc: you monster

13:51 olasuka: :justin_smith the error is not with the test itself, but this...

13:51 Fare: in CL, I've seen so many "generalized binding" packages that tried to combine "all" the binding forms in one thing, none of these macros supported all the things you wanted, because none of them supported your own macros, unless you rewrote them, or used complex extension mechanisms.

13:51 <- has a trivial extension mechanism

13:52 olasuka: WARNING: * already refers to: #'clojure.core/* in namespace: athena.dsl.types.nodes.model-eval, being replaced by: #'athena.dsl.types.nodes.model-eval/*

13:52 Fare: and doesn't require you to learn a new syntax.

13:52 olasuka: CompilerException java.lang.NullPointerException, compiling:(:30:1)

13:52 justin_smith: olasuka: why are you trying to def the symbol *

13:52 clgv: Fare: ah btw the threading macros in clojure.core were rewritten without recursive calls to themselves

13:52 olasuka: this is produced by a generative testing suite. clojure.test.generative

13:52 Fare: clgv: what does that change?

13:53 olasuka: justin_smith: so any string is produced to test the code

13:53 clgv: Fare: it immediately expands to the full form. I dont remember the exact reasons therefore.

13:54 Fare: maybe they needed it due to composition.

13:54 olasuka: justin_smith: so, i end up with minimal failure cases that look like this: (init * "" A :adapa)

13:54 justin_smith: where init is the macro definition

13:55 justin_smith: the astersik is getting converted to an interned symbol for reference later in the code

13:56 justin_smith: normal usage would be: (init TEST-MODEL "the doc string" MODEL-NAME :server-type)

13:56 justin_smith: and this would produce a TEST-MODEL symbol, useable in the code, that is the construction of a java class provided by a subsumed java API

13:59 justin_smith: olasuka: seems the sensible thing would be to blacklist symbols bound directly in the testing namespace from the generated inputs

13:59 olasuka: I don't know how that's done in test.check though

14:00 olasuka: justin_smith: i was hoping to avoid that route, as it would entail me filtering and redefining the basic generators, but it may be the only option... I am looking into overring the intern warning, but that could produce some really unexpected behavior.

14:02 justin_smith: thanks... I think I am going to do that... create a filter on the generator to exclude all clojure.core symbols

14:02 justin_smith: thanks

14:02 justin_smith: (remove (set (keys (ns-refers *ns*))) generated)

14:03 olasuka: justin_smith: hmm...

14:03 justin_smith: that will remove all items that are refered in the current ns from the sequence generated

14:03 you may need to add 'name' in there for string coercion

14:05 olasuka: justin_smith: thanks... i like the idea, the problem, is that if I say override '*' i will end up with a re-defined '*' so (* 1 2) is an error... that is going to produce so erratic behavior. i think your first pass was right on... i am going to need to exclude the sysmbols from being produced in the test set.

14:05 justin_smith: thanks again for the feedback, i appreciate it.

14:06 justin_smith: my above one liner will work, if you have a sequence containing the potential generated symbols

14:09 olasuka: justin_smith: maybe I am mis-understanding the behavior, but it would seem that a symbol, such as '*' would be removed from the ns? so later, either I would have a re-definintion of the symbol, or no symbol at all... is that correct?

14:09 justin_smith: olasuka: no no

14:10 that removes any matching symbols from a list of symbols

14:10 assuming you have some mechanism for filtering the symbols used by your generator

14:10 olasuka: justin_smith: ahh, right... I see it... you are using the ns symbol set as the comparision source, and excluding those values...

14:11 justin_smith: ,(remove (set (keys (ns-refers *ns*))) '[* + foo - str bar])

14:11 clojurebot: (foo bar)

14:11 olasuka: justin_smith: from the newly created values

14:11 justin_smith: right, see above

14:11 olasuka: justin_smith: yeah... nice

14:11 justin_smith: that has the added benefit of unique definition

14:12 justin_smith: cool...thanks.

14:12 justin_smith: np

14:13 amalloy: Jaood: i think there's just "abusing arrows" and "using arrows too much". abusing them too much is weird

14:14 justin_smith: I find abusing them just enough quite productive

14:14 amalloy: (further, i don't think there's any such thing as using arrows too much. any number of uses is lovely, as long as no one use is an abuse. adding more arrows doesn't make previous ones a bad idea)

14:15 olasuka: except the first one, that went into my knee... that was a bad idea

14:15 amalloy: whoops, i just fell into a time machine to 2012

14:15 olasuka: welcome back... we've missed you

14:16 or we will miss you... i get confused...

14:21 holo: /Users/ccfontes/hy/venv/bin/hy

14:21 oh sorry guys, wrong # :)

14:25 TimMc: Anyone know of a way to get Cheshire to default to toString for otherwise non-JSON-encodable objects?

14:29 justin_smith: TimMc: what about (add-encoder java.lang.Object #(.toString %))

14:31 amalloy: justin_smith: that's a funny way to write (add-encoder Object str)

14:32 justin_smith: amalloy: and it's also incorrect in either form

14:32 playing with it now seeing how this works

14:32 amalloy: is it? i don't know what cheshire's encoder api is like

14:33 justin_smith: yeah, your function gets two args, a thing to write to and the object to be written

14:33 amalloy: i'm a bit dubious that toString is actually a good encoding more than like 10% of the time, really; the cases where it does work you probably wouldn't mind listing by hand rather than defaulting to Object

14:33 TimMc: justin_smith: Here's the problem: I don't want that to be a permanent, global thing.

14:33 justin_smith: TimMc: ahh, tricky

14:34 amalloy: TimMc: cheshire.core/remove-encoder...?

14:34 justin_smith: too bad there isn't a way to bind an encoder locally

14:34 TimMc: It's a hack, so I'd really only want it in this one dynamic scope where lack of exceptions is more important than correctness and round-trippability.

14:35 csd_: How can I do something like `for` where the input is a vector of vectors of unknown length? I.e. I want to use for to iterate across all subvectors but I don't know how many there will be ahead of time.

14:35 amalloy: csd_: that's basically a cartesian product

14:36 which lives in clojure.math.combinatorics

14:36 csd_: oh good call

14:42 amalloy: TimMc: if you want to try something other than cheshire, clj-json does support dynamically-scoped encoders

14:42 TimMc: Ah, thanks.

14:42 I think my other alternative is mucking about in the guts of the JSONable protocol...

14:43 It looks like I could maybe bind the protocol?...

14:43 amalloy: TimMc: binding protocols doesn't work well at all. don't do it

14:44 TimMc: (def ^:dynamic *cheat-mode* false) (extend-type Object JSONable (encode [this encoder] (when-not *cheat-mode* (explode)) (encode (str this) encoder)))

14:44 would be an amusing approach

14:44 TimMc: o.O

14:44 I *like* it!

14:44 amalloy: the main problem is that you prevent anyone *else* from setting up a temporary cheat mode

14:44 so you might make *cheat-mode* a function instead of a boolean, which is how to cheat

14:47 Fare: that's where interface-passing style can help

14:47 the protocol is in a separate interface object, not in the data object

14:47 ncthom91_: hi guys. I'm writing some nodejs in clojurescript, and I'm finding that "(.readFileSync fs fixture-path "utf8")" gets compiled such that .readFileSync becomes something like .Pc

14:47 and obviously node's fs doesn't have a method "Pc"

14:48 how do I prevent that rewrite at compile time?

14:52 noonian: ncthom91_: do you have :target :nodejs in your cljsbuild compiler settings?

14:52 ncthom91_: noonian yep

14:52 noonian: you probably need to use js/fs

14:53 if its normally a global in nodejs

14:53 amalloy: Fare: sure. that's obviously more flexible. but it's more expensive too, and i think cheshire is right to opt for the fastest approach, with json encoding often being an actual bottleneck

14:53 ncthom91_: noonian it's not, i have "(def fs (nodejs/require "fs"))" at the top of my file

14:53 (and i've tried js/require instead of nodejs/require)

14:55 noonian: ncthom91_: i think you just need to turn off advanced compilation, cljsbuild docs say its unneccesary and that if you want it you need to supply your own externs file for the nodejs api

14:55 Fare: amalloy: it's not necessarily more expensive, if the bottleneck is in the processing rather than the dispatch

14:55 noonian: Note using advanced compilation on Node.js targets is unnecessary. If for some reason it is desirable you must supply externs for the Node.js APIs

14:55 from https://github.com/clojure/clojurescript/wiki/Quick-Start

14:57 ncthom91_: noonian interesting, didn't know that. I changed it to :simple but I still get the same method-name-rewrite problem

14:57 noonian: ncthom91_: make sure you clean out the old generated js and restart lein cljsbuild if you are using auto

14:58 maybe just try whitespace

14:58 according to https://developers.google.com/closure/compiler/docs/compilation_levels simple renames local variables and expressions to make them shorter

14:59 DaReaper5: Hey I got a kinda basic question: I am doing this: (list [1 2] (if something [3 4])) This I believe is wrong, how do i conditionally include something in this (list ?

15:00 noonian: (into [1 2] (if something [3 4] [])) would work

15:00 llasram: ,(concat [1 2] (if true [3 4] [5 6]))

15:00 clojurebot: (1 2 3 4)

15:00 llasram: ,(concat [1 2] (if false [3 4] [5 6]))

15:00 clojurebot: (1 2 5 6)

15:00 llasram: ,(concat [1 2] (if false [3 4]))

15:00 clojurebot: (1 2)

15:01 amalloy: ,`[1 2 ~@(if true [3 4] [5 6])] works too

15:01 clojurebot: [1 2 3 4]

15:01 llasram: amalloy: Awww. Was just about to add that one :-)

15:01 DaReaper5: i want this: ( [1 2] [3 4] )

15:01 amalloy: DaReaper5: can you think of how to adjust the suggested solutions to that goal?

15:01 DaReaper5: But I keep getting "java.lang.ClassCastException: clojure.lang.ArraySeq cannot be cast to clojure.lang.IFn"

15:02 noonian: ,(into (list [1 2]) (if true [[3 4]]))

15:02 clojurebot: ([3 4] [1 2])

15:02 amalloy: DaReaper5: that exception generally means you are dribbling parentheses all over the page

15:03 noonian: ,(concat (list [1 2]) (if something [[3 4]]))

15:03 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: something in this context, compiling:(NO_SOURCE_PATH:0:0)>

15:03 noonian: ,(concat (list [1 2]) (if true [[3 4]]))

15:03 clojurebot: ([1 2] [3 4])

15:03 DaReaper5: amalloy: hey amalloy, thanks again for your help the other day. I think... noonian might have the answer for me. Brb

15:03 ncthom91_: noonian you were right. I had to clear out the cached build files, and set optimizations to :simple

15:03 thanks :D

15:03 noonian: ,(list (into [[1 2]] (if true [[3 4]])))

15:03 clojurebot: ([[1 2] [3 4]])

15:03 noonian: grumble

15:03 DaReaper5: lol

15:04 noonian: ,(apply list (into [[1 2]] (if true [[3 4]])))

15:04 clojurebot: ([1 2] [3 4])

15:04 noonian: thats probably how i would do it

15:05 into with lists adds at the front since it will use conj

15:05 amalloy: noonian: apply list is bizarre. just call seq

15:05 SagiCZ1: in java i could use "return" to return a result from a function (method) and the rest was not executed.. in clojure most of the expressions return the last thing they evaluate, but then the execution continues. how would i simulate return statement from java? see example

15:06 ,(let [x 10] (when (> x 5) x) (println "yo"))

15:06 clojurebot: yo\n

15:06 SagiCZ1: here i would expect the form to return 10

15:06 noonian: amalloy: yeah, but seq probably wont return a list :P

15:06 amalloy: noonian: who cares?

15:06 DaReaper5: i care?

15:06 amalloy: SagiCZ1: just don't do it. use if/cond/whatever to structure your function such that you don't enter into code paths you don't want to run

15:06 DaReaper5: maybe?

15:07 SagiCZ1: amalloy: ok, thats the idiomatic ways i presume?

15:07 noonian: amalloy: i just didn't want to make any assumptions about DaReaper5's requirements, but you're right normally you shouldn't have to care

15:07 amalloy: DaReaper5: i sincerely doubt it. there are cases where you need specifically a list instead of of a general seq, but they are not common and i wouldn't expect someone having trouble conditionally concatting a list to be in one

15:08 noonian: SagiCZ1: let returns the last value in the body of the form which is (println "yo") in that case and returns nil

15:08 amalloy: SagiCZ1: it's the only way. there is no such thing as early return

15:08 SagiCZ1: thanks guys

15:09 the functions actually might look a bit cleaner without the early returns

15:09 amalloy: they usually do, as it turns out. a miracle of nature

15:17 SagiCZ1: when you are using < > where do you put the constant and where the symbol?

15:17 (> x 10) or (< x 10) ?

15:18 TimMc: I almost always use <

15:18 justin_smith: SagiCZ1: dym (> x 10) or (< 10 x)

15:19 Bronsa: I always use < too

15:19 TimMc: because then I see < and think "the following are in ascending order"

15:19 (descending order is just weird)

15:20 justin_smith: TimMc: prio-queue

15:21 SagiCZ1: makes sense.. i was using "constant always first" and i have already made some nasty bugs.. A > B is way more natural

15:26 TimMc: SagiCZ1: By the way, you can also do (< 0 x 10)

15:26 amalloy: TimMc: always using < seems weird. surely there are places where it's more natural to say "if X is greater than 10" rather than "unless 10 is less than X"

15:27 TimMc: amalloy: Oh, I'm sure there are exceptions. Let me check some codebases...

15:28 amalloy: i just surveyed some of my old code and it looks five of my eight comparisons use < or <=, the other three being >

15:28 csd_: Any tips on how to troubleshoot java.lang.OutOfMemoryError: Java heap space?

15:28 justin_smith: csd_: a profiler will show you what is using the most memory

15:29 amalloy: csd_: don't def infinite sequences

15:29 dbasch: csd_: that's an extremely generic error, what is causing it?

15:29 justin_smith: csd_: one common culprit is holding onto the head of lazy seqs

15:29 amalloy: (this is hardly the only cause, but i'd say about 75% of the time that's the reason)

15:29 SagiCZ1: TimMc: thanks for tip!

15:29 clojurebot: It's greek to me.

15:29 TimMc: 51 vs 14 on < vs >

15:30 SagiCZ1: how do you come up with those numbers so fast

15:30 csd_: dbasch: http://pastebin.com/XJH0NAQx

15:30 working on http://www.4clojure.com/problem/108

15:30 TimMc: but about even on random open source projects I happened to have lying around

15:30 justin_smith: csd_: mapcat identity is a weird way to say apply concat

15:30 TimMc: SagiCZ1: grep '(<' -nr work/ --include='*.clj' | wc -l

15:31 SagiCZ1: TimMc: i see.. hax

15:31 TimMc: sure

15:31 olasuka: SagiCZ1: grep -ir '<' . | wc -l

15:31 SagiCZ1: ;)

15:31 olasuka: too late

15:31 TimMc: olasuka: I think -i just makes it slower there, and nothing else.

15:31 amalloy: TimMc: that can catch some weird outliers, like an old project i worked on defines a << operator. i'd be a little more careful, like `grep -P '\(<[\s=]' ...`

15:32 SagiCZ1: let me take my Windows and go sit in the corner quietely

15:32 TimMc: amalloy: I did it first without the wc and actually skimmed the results.

15:32 olasuka: yeah, that is probably true... habit

15:33 amalloy: anyway, 51/14 is pretty extreme

15:33 AeroNotix: You can't loop/recur in a defrecord's methods?

15:33 justin_smith: csd_: in that paste, you are piling up calls to lazy-seq

15:34 csd_: also, that's a lot of unforced concat usage you are piling up too

15:34 csd_: justin_smith: i know... sorta just kept sticking them trying to get the code to run

15:34 amalloy: AeroNotix: sure you can

15:35 justin_smith: when you wrap a lazy-seq in a lazy-seq etc (or a concat on a concat etc.) this builds up unforced thunks - and you can blow the stack once the top one is finally forced

15:35 or the heap if your settings are strict enough or you go crazy enough with the stacking...

15:35 dbasch: csd_: lazy-seq of filter does nothing useful

15:35 justin_smith: dbasch: it will use extra resources, maybe someone wants that :)

15:36 dbasch: justin_smith: yes, that's useful like being morbidly obese is useful

15:36 csd_: dbasch: figured.. evidence of desperation

15:36 justin_smith: csd_: these things are what are driving up your heap usage

15:37 amalloy: TimMc: when i run your script over only the projects i've actually worked on, it comes out to a remarkably balanced 274/280

15:37 AeroNotix: amalloy: not sure why it was telling me I couldn't then

15:37 whatever

15:37 technomancy: (inc <)

15:37 lazybot: ⇒ 1

15:38 amalloy: justin_smith: c'mon, the excess calls to lazy-seq are not going to be so much of a problem he blows the heap. he's got to have an infinite seq in there somewhere

15:39 justin_smith: amalloy: well, the code in the 4clojure problem supplies him with infinite seqs, yeah

15:40 dbasch: csd_: what is min-s supposed to do?

15:40 csd_: the code in the pastebin actually doesnt have the infinite sequence tests in it

15:41 dbasch: for seqs where their first element are the smallest elements in the seq of seqs, min-s returns `rest` of those seqs

15:41 justin_smith: csd_: you don't need to explicitly create any lazy sequences yourself - if the input is lazy, you just need to use it in a way that doesn't force that whole thing

15:41 dbasch: csd_: have you tried it? I suspect it doesn't work

15:43 csd_: never mind, that part works

15:43 justin_smith: csd_: why mapcat across all your inputs? how do you even know if something is present in all of them after doing that?

15:44 dbasch: csd_: but I pasted your code into my repl and I get a different error

15:45 csd_: justin_smith: it's just my way of doing a partial flatten to get rid of the new list element that the results of filter are put in

15:47 justin_smith: csd_: I'm not going to just answer the puzzle for you, but there is a much simpler solution to this puzzle that requires like 10% as much code - this code is a lot more complex than the problem is

15:47 ok, more like 33%, but still

15:48 technomancy: amalloy_lunch: "are these numbers presented in increasing order" seems like a more common question to ask than decreasing.

15:49 just like + is more common than -

15:49 abaranosky: Canvassing for votes for my clojure.core patch, that adds convenience arities for core ns functions. Any upvotes gretly appreciated :) http://dev.clojure.org/jira/browse/CLJ-1519

15:50 justin_smith: abaranosky: markdown ate your * on *ns*

15:50 abaranosky: hmmm gretly turns out not to be an alternate spelling for greatly :)

15:50 justin_smith: thanks. I'll try to edit the ticket.

15:51 justin_smith: `*ns*` should fix it

15:51 abaranosky: justin_smith: thanks, fixed

15:51 I used backslashes

15:51 justin_smith: that's another option

15:52 markdown often confuses me

15:54 TimMc: Jira uses markdown?

15:56 justin_smith: TimMc: not totally certain, but it clearly turned *ns* into to <b>ns</b>

15:57 SagiCZ1: hey.. why does this print true? when the expression is equal to one of the cases.. it shouldnt print true, right? https://www.refheap.com/90065

15:59 justin_smith: what is the type of KeyEvent/VK_RIGHT ?

15:59 SagiCZ1: int

15:59 llasram: SagiCZ1: Because `case` doesn't evaluate its dispatch values

15:59 SagiCZ1: and .getKeyCode returns int

15:59 hiredman: ,(doc case)

15:59 clojurebot: "([e & clauses]); Takes an expression, and a set of clauses. Each clause can take the form of either: test-constant result-expr (test-constant1 ... test-constantN) result-expr The test-constants are not evaluated. They must be compile-time literals, and need not be quoted. If the expression is equal to a test-constant, the corresponding result-expr is returned. A single default expression can foll...

15:59 hiredman: "The test-constants are not evaluated

15:59 "

15:59 SagiCZ1: i dont need them to be evaluated

15:59 they are just constants

16:00 hiredman: ,(type 'KeyEvent/VK_RIGHT)

16:00 clojurebot: clojure.lang.Symbol

16:00 justin_smith: the values are not being resolved

16:00 hiredman: ^- what you get without evaluation

16:00 SagiCZ1: o u mean the symbols are not resolved?

16:00 well that's useless then ...

16:00 hiredman: that is a process that takes place in evaluation/compilation

16:01 llasram: SagiCZ1: For this sort of situation, I use a macro like https://gist.github.com/llasram/1287230

16:01 SagiCZ1: llasram: and without your macro i would have a better luck with something like cond, right<

16:01 ?

16:01 llasram: Yes

16:01 justin_smith: or even condp

16:02 llasram: justin_smith: That's "something like cond" ;-)

16:02 justin_smith: ,(condp = 1 0 :? 1 :ok 2 :?)

16:02 clojurebot: :ok

16:02 justin_smith: llasram: indeed

16:02 SagiCZ1: (doc condp)

16:02 clojurebot: "([pred expr & clauses]); Takes a binary predicate, an expression, and a set of clauses. Each clause can take the form of either: test-expr result-expr test-expr :>> result-fn Note :>> is an ordinary keyword. For each clause, (pred test-expr expr) is evaluated. If it returns logical true, the clause is a match. If a binary clause matches, the result-expr is returned, if a ternary clause matches, its result-fn, which m

16:03 SagiCZ1: god, i hate these docs.. could be in finnish as far as i am concerned

16:04 justin_smith: ~finnish

16:04 clojurebot: excusez-moi

16:04 justin_smith: I hoped to get the "it's greek to me" response

16:04 SagiCZ1: justin_smith: heh

16:10 llasram: They are better in the original Klingon.

16:10 noonian: (inc llasram)

16:10 lazybot: ⇒ 38

16:24 ticking: dnolen_: do you think it'd make sense to have an "inline sourcemaps" compiler opt, to embed a base64 encoded, sourceContents filled, source map into the output?

16:25 dnolen_: ticking: already exists

16:25 ticking: dnolen_: awesome, seems undocumented :D

16:27 airj1012_: I haven't been on IRC in YEARS, is there a good channel to ask questions about general technology?

16:27 Not sure if this is a good starting place or not.

16:27 technomancy: it is the second-best channel to do so

16:28 airj1012_: Awesome, well I have a question about the new iPhone, more specifically about the 20 LTE bands.

16:28 technomancy: oh, it's probably a terrible place for that?

16:28 I thought you meant more like PLT stuff

16:28 amalloy: technomancy assumes "general technology" means clojure, because what could be more general

16:29 technomancy: amalloy: technologies for generals. robot armies, submarines, lasers, etc.

16:29 airj1012_: Do the bands only provide better download/upload speeds or do they provide better connection too? Also will they cause additional strains on the existing network? I can't say that I've ever paid attention to the bands before because I don't think Apple has ever mentioned them,

16:29 amalloy: airj1012_: i don't really know where a good place for that is. surely there's an IRC channel, although i don't know what it is. you could try reddit

16:29 or hacker news

16:29 airj1012_: OK, thanks

16:30 technomancy: amalloy: actually I thought it would be more a philosophical discussion about the progress of technology in general and how it affects the development of societies

16:30 so let's talk about that instead of iphones

16:30 ticking: iphones are the doom of our society

16:30 technomancy: that too

16:30 amalloy: thank god the apple watch is here to save us

16:31 ticking: amalloy: I cant wait for apple to build guard towers to protect us, also called the "apple watch" leading to some customer confusion

16:31 technomancy: ticking: they did it with iBooks, why not

16:34 dnolen_: ticking: oh sorry didn't read closely enough, yeah not a compiler option but that's what the browser REPL does

16:34 ticking: don't really see the value of that for regular source

16:34 ticking: dnolen_: its hidden within :output-to :print right?

16:35 dnolen_: ticking: there's no complier option, it's a feature of browser REPL only

16:36 ticking: dnolen_: ah I see, this line got my hopes up :) https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/closure.clj#L849

16:36 dnolen_: ticking: that's just the separate file case

16:38 ticking: dnolen_: to bad thanks :D, as for the use case, I'm currently integrating cljs into gorilla repl to make it more interactive, having source maps embedded means that one can export the file and still debug it later :D

16:38 dnolen_: ticking: you can off course cobble this together yourself

16:38 ticking: dnolen_: but I agree, its a rather weird edge case

16:39 dnolen_: yeah build it already, was just wondering if it would be usefull in cljs

16:39 dnolen_: ticking: we have it where people actually asked for it https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/repl.clj#L94

16:43 ticking: dnolen_: ah yeah to bad, there is a lot of good stuff in .repl that would be really handy in .closure :/

16:44 dnolen_: I don't think a sourcemap is generated at all for code passed in a vector to closure/build

16:48 dnolen_: ticking: it's possible, most people don't pass code in vector, they just pass the source directory

16:49 ticking: yeah, I really like the define once compile anywhere approach of mathematica though ;)

16:51 SagiCZ1: i want to generate values but i need the generator function to know what the last value was.. any ideas?

16:52 llasram: SagiCZ1: `iterate`

16:52 SagiCZ1: llasram: i think thats exactly what i need

16:52 thank you

16:56 arohner: what are people using for cronjobs & queues these days?

17:08 GENSYM_9001: clojurebot: bang |is| I do not think there is a hard definition of what ! means as a suffix. ~puredanger

17:08 clojurebot: Ik begrijp

17:09 noonian: very generally it means "watch out!"

17:09 arrdem: noonian: and yet we have things like alter-var-root which should carry ultimate warning status that aren't -!'d

17:12 noonian: yeah, i think it is kind of historical and ! originally mean unsafe in a transaction

17:12 mdrogalis: arrdem: I like how technomancy and I both have libraries that solely revolve around using alter-var-root. They need a Use with Extreme Caution label on GitHub.

17:12 noonian: but now they are adding more ! fns just to mean scary

17:13 arrdem: mdrogalis: :D

17:13 justin_smith: noonian: I vote to switching over to ☠

17:13 arrdem: mdrogalis: sometimes you do, in fact, need to harnes a dragon

17:13 justin_smith: UTF8's DANGER SIGN?

17:13 mdrogalis: arrdem: How to Train Your Var.

17:13 arrdem: hehe

17:14 mdrogalis: my vars have all learned this vanishing trick :D

17:14 mdrogalis: Haha

17:15 noonian: justin_smith: lol

17:15 pandeiro: is there an example of using jetty's built-in websocket support from clojure when deploying as a war?

17:15 ie, can someone translate [this](http://www.eclipse.org/jetty/documentation/current/jetty-websocket-server-api.html) for a java-challenged person like myself?

17:15 justin_smith: (☠set☠ unsafe-thing even-more-unsafe-value)

17:16 noonian: pandeiro: might be interested in https://github.com/lynaghk/jetty7-websockets-async

17:17 arrdem: see... when we start talking about -! my mind starts wandering in the direction of the IO monand and inferred, enforced purity..

17:18 pandeiro: noonian: thanks i should read that and this maybe https://github.com/sunng87/ring-jetty9-adapter

17:18 dbasch: justin_smith: perhaps set‽

17:19 justin_smith: ⸘set‽ a-la espanol

17:26 arrdem: should ":::" be ":user/:" ?

17:26 mdrogalis: Has anyone attempted to use Drools in Clojure before?

17:27 It looks like this is gonna hurt ;[

17:27 amalloy: arrdem: that should be an invalid token

17:29 hiredman: mdrogalis: I started looking at writing rules in clojure at one point, but I never got very far, it is a big system so you end up spending a lot of time reading docs and code

17:30 hugod: mdrogalis: you might take a look at https://github.com/rbrush/clara-rules

17:30 mdrogalis: hiredman & hugod: I saw Clara, developed by one person so I'm not sure if I can take it to production for my client.

17:31 I think I need to put these guys on Datomic datalog. Drools like incredibly painful.

17:31 looks*

17:32 hiredman: there is or was a jess based lisp like (definitely not a lisp internally) dsl for writing drools rules

17:32 mdrogalis: Ran into that one, too. Not sure if its being actively developed anymore. Seems a bit aged.

17:39 cfleming: arrdem: BTW for your matching problem, have you considered datalog of some type?

17:40 arrdem: cfleming: I've thought about it and I need to really learn/play with datalog first. that was just a hack I threw together in class.

17:40 cfleming: arrdem: Yeah, I don't know datomic well enough to know how well it would work, but I know people have tried to use it for similar things (like codeq)

17:41 Bronsa: https://github.com/clojure/tools.analyzer/blob/master/src/main/clojure/clojure/tools/analyzer/ast/query.clj#L83-L93

17:42 arrdem: cfleming: Bronsa already played with pushing ASTs into datomic for pattern matching. I can't say I'm hot for writing a compiler atop a nonfree db tho.

17:42 lol and he beats me to it with the link

17:43 cfleming: arrdem: Yeah, I can understand that. A free datalog implementation would be great, even if it's not as performant as datomic.

17:43 arrdem: No idea what's out there, such a thing might exist.

17:43 arrdem: cfleming: there's already one for Clojure I just haven't mucked with it yet.

17:43 cfleming: Bronsa: how did you like datomic for AST use?

17:44 Bronsa: cfleming: I've just played around with it for a couple of days when I made that

17:46 cfleming: unfortunately the non-free aspect of datomic means that I'm never going to use it in a library so I'm not even going to bother trying that out to do something complex enough

17:50 peeja: Anyone have experience getting fireplace.vim to connect to a browser-connected Piggieback repl?

17:50 thesaskwatch: Can't find out what is purpose of "when" if "if" can be used for this same cause?

17:50 technomancy: thesaskwatch: when has an implicit `do`

17:50 thesaskwatch: technomancy: thanks

17:50 peeja: I can get it to spawn a headless repl, but not connect to a running browser-connected one.

18:14 cfleming: Bronsa: Yeah, fair enough

18:20 talios: cfleming - hola. Ran into some old posts of yours from 2011 talking about writing a Mirah plugin for IntelliJ - did you actually do anything with that back in the day?

18:21 cfleming: talios: Hola! No, I didn't, sadly.

18:21 talios: I decided that ruby syntax was a bug, not a feature.

18:21 talios: I'd be using Kotlin for similar things these days.

18:22 talios: hah :)

18:23 I'd love to - but the rest here are hell bent of clojure-all-the-things, even if they don't fit :)

18:23 cfleming: talios: Hehe, I have no comment. And I couldn't possibly sanction the use of any other language plugins :-)

18:24 talios: I'm still waiting on an IJ14 build :)

18:24 cfleming: Sigh, yeah, I know - I'm lazy.

18:24 I'll do it soon.

18:24 I hate supporting EAP builds.

18:26 talios: is the documentation around IJ plugins any better these days? I've not looked in awhile

18:26 cfleming: talios: Nope. Fortunately I have a mole at Jetbrains, if not I'd spend half my life trying to figure things out.

18:27 Having a mole gets that down to around a quarter or so.

18:27 technomancy: is kotlin also designed for zero runtime overhead?

18:27 talios: :) It's a shame the wiki doesn't get maintained more for the OpenAPI

18:27 technomancy - there's a small runtime lib with the core classes/annotations etc.

18:27 cfleming: technomancy: Not quite I think, but it's pretty low.

18:28 talios: there's also a minimal stdlib. that was one of the nice things with Mirah

18:28 cfleming: Yeah, I liked that about Mirah

18:28 technomancy: mirah has literally zero

18:28 at least when I looked at it

18:28 cfleming: I have no idea how stable Mirah is these days - I always liked the idea.

18:29 talios: It came to mind after spotting http://sjhannah.com/blog/?p=331 - a new Mirah plugin for Netbeans. And a screencast showing writing iPhone apps.... in Mirah

18:29 cfleming: How did they do that? Does Mirah compile to Java or bytecode?

18:30 talios: cfleming - mirah goes to bytecode, with the option of generating .java files on disk

18:31 cfleming: Ok, did they use j2objc?

18:31 talios: There's also a simple maven plugin - https://github.com/mirah/maven-mirah-plugin - the language itself doesn't appear to have changed much ( if at all ) since it's last release

18:31 cfleming: When was that?

18:31 talios: cfleming - for the iOS stuff? Not sure - it's using http://www.codenameone.com/

18:32 cfleming - oh wow - 08-Aug-2014 the the last mirah deploy to maven central.

18:32 interesting

18:32 I wonder whats actually changed.

18:34 turbofail: so i just found out the process control computer for the chernobyl plant was called "SKALA"

18:41 talios: lolz

18:42 cfleming: talios: So does Mirah have no stdlib?

18:42 talios: cfleming - nope.

18:42 cfleming: Interesting.

18:42 Doesn't everyone end up re-implementing map and filter, then? Or are there non-standard stdlibs?

18:43 talios: map and that seem to be build into the language

18:44 * tadni_ finds it odd that he can't seem to find Android applications in Clojure.

18:44 tadni_: You'd think this would be a natural next step.

18:44 cfleming: talios: hmm, not sure I like that - I think I'd prefer a (small) stdlib, to be honest.

18:44 tadni_: startup time is the issue.

18:45 tadni_: There are some efforts underway to fix that - 1.7 will hopefully be a bit better.

18:45 tadni_: I suppose that's why one might see a play-clj game on Android too ... load times can be partially justified.

18:46 talios: mmm, didn't realize Mirah had macros. nice,.

18:47 cfleming: talios: Ruby syntax *and* macros - the worst of all possible worlds for editor support :-)

18:47 technomancy: also the compiler had to boot all of jruby

18:47 with no incremental compilation support or caching

18:48 cfleming: Yeah, I think compile time is an issue for Kotlin too right now, I don't think it's incremental yet.

18:48 Although they're targeting Java compile speed and incremental compilation, so sooner or later it should be nice.

18:50 technomancy: yeah... I was briefly interested in Mirah because it seemed it might make mobile development less painful... but it's going to take a lot more than a programming language to do that

18:51 talios: cfleming - it's faster than Scala's compiler :) But I also think thats in large part to people doing multi-module builds all the time with the type checker is forced to infer everything. I'd imagine .jar dependencies would also be resolved.

18:52 cfleming: Faster than Scala's compiler?!?! Way to set the bar low...

18:53 technomancy: Faster compilation times than Scala; better language semantics than Java, less cryptic error messages than Clojure--this language has it all.

18:55 aperiodic: technomancy: don't forget a richer numeric type system than javascript

18:57 talios: technomancy - it has no Eclipse support, so Kotlin will still fail )

18:58 * technomancy won't lose any sleep over it

18:58 * talios gives technomancy erjang to play with

18:58 technomancy: nom

18:59 talios: I saw it pop up again last week - didn't think it was still being maintained

18:59 technomancy: it's a very impressive project for a one-man show

18:59 cfleming: Erjang? I think so.

18:59 That it's being maintained, that is.

19:00 It's amazing how well the lightweight threads work on the JVM.

19:00 talios: a lot of these languages are - I really like the look of yeti as well ( altho, I don't like the if/elif style syntax ) for a nice ML style JVM language. Still only 1-2 people.

19:00 cfleming: There's actually a new release of OCaml-Java out there too.

19:00 talios: and sadly never published to maven-central, someone even wrote a maven plugin for it, also unpublished. so kinda hard to just "hey lets try this"

19:01 cfleming: Relatively recently.

19:01 talios: cfleming - nice, the last few updates have been interesting. Interop is still an issue I find.

19:01 technomancy: talios: org.clojars.talios/yeti =)

19:01 cfleming: talios: have you tried it?

19:02 talios: cfleming - only to the point of Hello World :) and looking at what code it generates. The later releases now let you NOT include the prelude/stdlib in the generated code ( they all kinda presume static linking, non-modular jar based things ).

19:04 cfleming - calling OUT to the java may be fine (ish). but real interop is a two-way story IMHO. If you can't generate JDK annotations somehow, you're hurting interop.

19:04 cfleming: talios: Yeah, I suffer a bit in Clojure too TBH

19:05 talios: took a long while to get annotation support in clojure, still not sure I entirely like the syntax for it - but there's not much you can do there really.

19:07 cfleming: I'm a man of simple needs - I'd just like to be able to generate a named class that extends an abstract class.

19:07 Without resorting to gen-class.

19:08 noonian: whats wrong with resorting to gen-class, i thought extending existing classes was the whole reason its in clojure

19:08 cfleming: It is, but it's awful to use.

19:09 I'd like something like deftype.

19:09 amalloy: i don't really use gen-class. if i want to create a class that's not easy in clojure, i just do it in java within the same project, along with producing an interface that my clojure code can reify to cooperate in the process

19:09 talios: cfleming - (nsclass) as a macro would be nice - but er, how do you import it - unless you have a nested (ns) call :)

19:10 cfleming: amalloy: Yeah, I create Java classes and then call into Clojure from there

19:10 amalloy: I ended up doing it so much I added support to Cursive for it - I'd still prefer some better interop forms for that though.

19:10 juliobarros: Is there an idiomatic way to replace an item in a vector based on a predicate? I have a vec of records and I get an updated one and want to find and swap out the item based on the id. Have a fn working with keep-indexed but want to see if that is written somewhere already.

19:11 technomancy: is the awfulness of gen-class just that it requires AOT?

19:11 (if so, how is a java class any better?)

19:11 cfleming: I spoke to Rich about it at EuroClojure, he seemed open to forms similar to deftype and reify that allow class extension, perhaps in an interop-specific namespace.

19:12 amalloy: technomancy: a java class is better because it includes something more palatable to a java consumer: some java source code

19:12 cfleming: technomancy: No, the awfulness of gen-class is mostly the syntax.

19:12 aperiodic: technomancy: it's more than just that. how it actually maps to a java class & interacts with e.g. protected fields is confusing

19:12 cfleming: aperiodic: right, and very easy to get wrong.

19:12 clojurebot: It's greek to me.

19:12 technomancy: amalloy: I've never actually wanted that; I've only used it when interoping with APIs that make the questionable design choice of requiring a named class

19:13 noonian: how much of a pita is it to add some java source files to an existing leiningen project?

19:13 technomancy: I mean I can see how that'd be useful in a very specific set of circumstances

19:13 amalloy: noonian: like a micro-pita

19:13 technomancy: but I wouldn't summarize that as "gen-class is awful"

19:13 cfleming: technomancy: questionable or not, tons of Java libs require it, especially if you're integrating with a framework.

19:13 hiredman: it is though

19:13 noonian: amalloy: nice, i can usually handle the micro ones

19:14 talios: AOT for life baby

19:14 amalloy: technomancy: as someone who works with java developers regularly, i need that a lot more often than i need to deal with something that wants a named class

19:14 like, i define some interfaces in java, and one stub class for calling clojure functions which reify those interfaces

19:14 and then, tada, two-way interop

19:14 technomancy: "gen-class syntax is awful, so I'll use java syntax instead" doesn't make any sense either

19:15 cfleming: technomancy: sure it does.

19:15 noonian: lol

19:15 * talios had a thought of a clojure macro that generated .java files for those stubs :)

19:15 talios: that, or a guice module

19:16 cfleming: To extend an abstract class, generally I need less code to do it in Java and call into Clojure than with gen-class.

19:16 SegFaultAX: It makes sense if you think of it like: it's going to be awful no matter what, so at least I can make it natively awful.

19:16 technomancy: "I don't like oatmeal, so I'll eat dirt instead"

19:16 amalloy: i just can't ever read "guice" without imagining it pronounced as "gwice"

19:16 aperiodic: technomancy: it's more "I don't want to force everyone to learn how gen-class maps to a java class, I'll just write a java class instead"

19:16 technomancy: aperiodic: I get that sometimes social considerations trump technical ones, sure

19:17 cfleming: Plus if you're talking Java consumers, you can Javadoc a stub class.

19:18 technomancy: which is the oatmeal, and which is the dirt, is the question.

19:19 talios: cfleming - can't you use deftype tho?

19:19 cfleming: talios: Only if it's an interface, and even then I can't use it because deftype'd classes don't require their namespaces on class init.

19:20 talios: About half the things I need to implement are abstract classes, no joy there.

19:20 amalloy: honestly building named classes with gen-class is less pleasant than doing it in java, imo. use clojure for what it's good at, and java for what it's good at

19:20 talios: cfleming - true. that require bug is one that shoudl really be fixed. import should implicitly require imho - somehow.

19:21 cfleming: amalloy: Right, exactly.

19:21 talios: cfleming - a variant of (proxy) that let you add arbitrary methods would be good.

19:21 cfleming: talios: there's a Jira, it's slated for 1.7 I think.

19:22 I'd like a fast version of proxy too, since I never actually use the proxying features (i.e. reify, but allowing extension).

19:22 aperiodic: technomancy: the problem with gen-class is that it is an abstraction around java classes that is complicated and for which there exists no payoff for learning, other than you can create a java class in clojure in a way that is harder to understand than just creating the java class in java.

19:23 amalloy: it just occurred to me: is there even a version of reify in java that allows implementing multiple interfaces? i know you can use a local named class, or new up an anonymous instance of a single interface, but i don't know of a way to anonymously implement several interfaces

19:23 aperiodic: also it brings AOT in all its transitive goodness along for the ride

19:23 cfleming: amalloy: I don't think so, no.

19:23 noonian: guice rhymes with grease right?

19:24 technomancy: aperiodic: that's not a fair comparison, a java class that calls clojure code also requires AOT

19:24 talios: aperiodic - IMHO, if you're doing heavy java interop, embrace AOT.

19:24 technomancy: (or runtime resolution, which would also not require AOT in gen-class)

19:24 pdk: what context noonian

19:24 or do you mean guise

19:24 amalloy: we were talking about google gwice earlier, pdk

19:24 rhymes with rice

19:26 noonian: ah

19:26 thanks

19:26 i've mainly seen the word guice in stacktraces when using pallet

19:26 aperiodic: technomancy, talios: alright, strike the AOT point then (though sometimes you're just gluing together other java components and writing the java class can let you avoid AOT entirely)

19:26 amalloy: noonian: it's actually supposed to be pronounced like juice

19:27 technomancy: aperiodic: I don't see the point of avoiding non-transitive AOT though

19:27 amalloy: but that pronunciation is so silly i pick other vowel sounds instead

19:27 technomancy: I mean, there are problems with reloading, sure. but they're the same problmes you have with a raw java class.

19:27 noonian: huh, kind of like the Oneders

19:28 amalloy: you mean the oh-nedders?

19:28 aperiodic: technomancy: you still end up with a transitively-compiled clojure.core at the very least, right?

19:29 technomancy: aperiodic: that's unavoidable =)

19:29 noonian: amalloy: yep :)

19:29 technomancy: clojure.core is always AOT'd

19:29 talios: IMHO the only real problem with AOT is you end up with binary compatibility issues, landing you in the same camp of scala was. And depending on your runtime environment ( say OSGi ) - you almost always need to AOT first anyway to save pain.

19:30 technomancy: talios: it leads to really painful reloading problems if you use protocols

19:30 aperiodic: ok, totally strike the AOT point then

19:31 talios: technomancy - doh. mind you - hot swapping code in the JVM gives you gnarly problems at the best of times too

19:31 justin_smith: talios: thus tools like jrebel, right?

19:32 technomancy: talios: this is exactly the problem vars were designed to solve

19:32 they do an awesome job

19:32 it's everything-that-isn't-a-var that sucks at it

19:33 talios: justin_smith - you say that llike jrebel actually works 100% :)

19:33 technomancy: literally the only reason vars exist

19:33 llasram: Narm. Why does melpa-stable list packages for which it does not actually have packages :-(

19:33 justin_smith: talios: I have no idea whether it even works, actually

19:33 technomancy: I feel like if people really understood vars, they would be more hesitant to reach for other things.

19:34 talios: justin_smith - for the most part it does, tho I've heard some nasty stories for some of its integration. I see they also killed their live-rebel project, with an interesting analysis of the failed commercial project

19:35 cfleming: talios: I don't think JRebel would work with Clojure anyway, since you'd end up with the reloaded class in different DynamicClassLoaders.

19:35 talios: true

19:36 cfleming: I don't know how it handles multiple loaded versions of a class with the same FQN.

19:37 technomancy: it would be interesting to construct a type that had a reified notion of schema change over time

19:37 so you could have multiple versions of it resident at once with declaratively-generated conversion functions between any two versions

19:39 cfleming: technomancy: at my last job we implemented something fairly similar to that on top of OSGi.

19:39 It's basically a nightmare.

19:39 technomancy: it sounds like it would be horrible for classes that conflate data and behaviour

19:40 cfleming: Even just for data it's pretty bad, if there are dependencies between the data in more than one object.

19:40 technomancy: erlang has a very primitive version of this with code_change, but it only works with a maximum of two versions at a time

19:40 (because it only exists in order to support hot-deploys)

19:41 tbaldrid_: technomancy: Joe Armstrong admitted in some talk recently that that was a GC issue and that if they had it to do over again it would be unlimited.

19:41 technomancy: tbaldrid_: huh, interesting

19:41 tbaldrid_: GC or something related to some implementation detail of the VM like the number of bits in some flag or something

19:42 technomancy: implementation details like "it was the 80s; it seemed like a good idea at the time"

19:44 justin_smith: yet another connection between excessive usage of hairspray, spandex, cocaine, and erlang

19:56 ncthom91: hi all. How do you use `with-redefs-fn` on a method of an object?

19:56 hiredman: you don't

19:56 ever

19:57 ncthom91: hiredman for real?

19:57 hiredman: with-redefs* are for mocking/stubbing/etc in tests

19:57 ncthom91: yep, that's what i'm using it for

19:57 amalloy: specifically, for mocking clojure functions

19:57 and methods on objects are not clojure functions

19:57 hiredman: right

19:58 there you go

19:58 ncthom91: ah. I'm working in clojurescript and I was planning on mocking out node's `fs.readFile`

19:58 is there a sane way to do that?

19:59 justin_smith: ncthom91: by using a wrapper that is a proper function (thin wrapper) and mocking that?

19:59 hiredman: ah, clojure script is another kettle of fish

19:59 it may just work

19:59 fs.readFile is a global function?

19:59 ncthom91: justin_smith that's a possibility

20:00 hiredman not quite, i have `(def fs (js/require "fs"))` at the top of my file

20:03 also, would anyone be willing to help me try to understand core.async? I have a simple read-file function (http://pastebin.com/ypB4ty3Y) and I'd like to switch it to use the async `readFile` rather than the sync one

20:04 dnolen_: ncthom91: hm, looks like that would just work

20:04 ncthom91: using with-redefs-fn in CLJS that way

20:04 ncthom91: dnolen_ oh sweet

20:04 dnolen_: ncthom91: you can write a generic Node.js callback adapter since all functions work the same way

20:05 it can take a normal Node.js function and return a channel returning fn instead

20:05 you just have to choose how to handle errors, in the case of Node.js I would probably just write the error value onto the channel

20:05 basically the same thing that people do to adapt Node.js fns to promises

20:07 ncthom91: dnolen_ so, a few questions: If I use `with-redefs-fn`, how do I reference the fs.readFile method without calling it?

20:07 (I'm a hardcore clojure & clojurescript newb)

20:07 dnolen_: fs.readFile

20:07 ncthom91: oh. really?

20:08 dnolen_: yes

20:11 cfleming: dnolen_: The next drop of Cursive has your indentation fix.

20:14 ncthom91: dnolen_ hiredman so this passes: http://pastebin.com/5HF9heSW :)

20:14 throws an exception for some reason, but still passes

20:19 dbasch: ncthom91: you're missing parentheses around is

20:37 ncthom91: hm.. jk, it wasn't working. This warning is currently getting me: WARNING: Use of undeclared Var bundleup.test/with-redefs-fn at line 12 test/bundleup/test.cljs

20:38 think it has to do with that i'm using cemerick's clojurescript test library

20:52 yedi_: so with transducers, why is the transduce function necessary?

20:52 why not just use into, and then reduce the result

20:52 is it only for sugar?

20:53 justin_smith: yedi_: why into anything?

20:53 why create a structure that you immediately discard?

20:53 llasram: If anything its the `into` version somewhat superfluous

20:54 yedi_: hm, good point

20:58 man transducers seem both incredibly simple, easy to use and mad useful

21:01 llasram: I mostly agree. I'm a bit worried there might be practical composibility issues, and do think the addition as new arities of existing functions is pretty warty

21:01 yedi_: warty yes, though its kinda cool that it just works

21:01 i have a question regarding the end of this: http://gigasquidsoftware.com/blog/2014/09/06/green-eggs-and-transducers/

21:02 she makes the sam-i-am-chan and then makes another channel that reduces the elements sent through the sam-i-am-chan

21:02 why do you need to create the reduce channel?

21:03 won't the channel only ever have one element go through it, since everything that comes through the initial channel gets reduced into what will come out the reduce-channel

21:03 or is it more like

21:04 it reduces everything that has been sent into the channel and only keeps a buffer of one element, once you take! from the reduce channel it starts again with a new result

21:04 and reduces all the new stuff coming in to that new result

21:04 (not sure if any of that made sense)

21:11 amalloy: yedi_: do you mean the result-chan? there's no reduce-chan in that article

21:12 and yes, there will only ever be one thing written to the result-chan. you create that channel so that you can read that one value. how else would you propose doing it?

21:13 yedi_: yea i mean the result-chan

21:20 hiredman: https://gist.github.com/hiredman/d6ea3e30be757fef6da6 vroom

21:24 llasram: Nanoseconds, sweet

21:26 justin_smith: llasram: all the timings there are in microseconds?

21:26 llasram: justin_smith: look again

21:27 Oh, phhhft

21:27 Standard deviation nm

21:27 It's been a long day, he excuses

21:27 justin_smith: loop looks pretty good in those microbenchmarks

21:30 hiredman: sure, but loop lacks composiblity

21:30 justin_smith: right, it's a clumsy tool

21:31 Rosnec: I'm in the mood to watch a good ~1h talk by Rich Hickey

21:31 any suggestions?

21:32 hiredman: in theory I should be able to write a double-filter and slap it in there

21:33 write some macros to generate transducer combinators for a given type and then generate them for all the jvm primitives

21:35 dbasch: Rosnec: http://thechangelog.com/rich-hickeys-greatest-hits/

21:35 Rosnec: dbasch: awesome

21:36 I think I'll watch hammock driven development

21:39 amalloy: heh. the disassembly for (loop [] (recur)) makes me chuckle. public Object invoke(); 0 goto 0; 3 areturn

21:39 justin_smith: amalloy: nice

21:40 amalloy: it couldn't really be otherwise, i guess, it just seems funny that (a) 0 goto 0 is an allowed instruction, and (2) you still have to return afterwards so that the verifier doesn't complain

21:41 or anyway i presume the verifier is the reason that this silly areturn is there. maybe the clojure compiler just adds it for good measure

21:43 justin_smith: also, the fact that it is annotated to return Object

21:43 I guess everything in Clojure does

21:43 *almost

21:45 dbasch: justin_smith: that's probably why the areturn is there

21:49 amalloy: the weird thing, dbasch, is it seems to me like that areturn should actually be illegal: there's nothing on the stack to return. compare to #(loop []), which reads like: 0 aconst_null; 1 areturn

21:50 justin_smith: I guess everything is permitted for instructions that won't actually get invoked (but then, why is the instruction there?) http://i143.photobucket.com/albums/r151/ll_Crayola_ll7/Emotes/iiamicon2.gif

21:58 dbasch: amalloy: I guess it depends on the interpretation of "If the method returns a reference type, it must do so using an areturn instruction, and the type of the returned value must be assignment compatible (JLS §5.2) with the return descriptor (§4.3.3) of the method."

21:59 what is the sound of an infinite loop in a method that claims to return Object?

22:43 wildnux: hi, can i create two funtions with same name and same number of arguments but for different types of arguments in clojure?

22:44 like overloaded methods in java?

22:45 llasram: wildnux: Not exactly, but you can create one function with multiple argument arities

22:45 yedi_: i'm trying to play an audio file from the browser in clojurescript leveraging this: https://developer.mozilla.org/en-US/docs/Web/API/HTMLAudioElement

22:45 llasram: wildnux: And you *could* create a multimethod which dispatched based no the number of arguments, although that would be unusual

22:46 yedi_: I tried doing '(def m1 (Audio. "resources/metronome.wav"))', but the Audio. fn is undefined

22:46 anyone come across this b4?

22:46 wildnux: llasram: multimethods needs protocol or some structure right?

22:47 llasram: i just want a simple function which works on multiple types of entites

22:52 llasram: wildnux: Can you be more specific about what you're trying to do?

22:54 wildnux: llasram: just a simple example, i want to write a funtion "in?" which can take one element or a list/vector/seq of elements

22:55 llasram: it should check if that element is present in the specified seq for the first case, it should check if all the elements in the list is present in the seq in the second one

22:56 llasram: wildnux: What you're describing is still kind of ambiguous. The Java-style dispatch where the search element(s) would dispatch based on type (collection or not) would require a multimethod or explicit checks in Clojure

22:57 But you can easily dispatch on different arities, something like:

22:57 wildnux: llasram: aah

22:57 llasram: (defn in? ([coll x] ..) ([coll x & xs] ...))

22:57 (minus the fact that that would be an unusual argument order)

22:58 The latter sort of definition frequently lends itself to a recursive definition, which via `recur` can compile to a tail-recursive form

22:59 wildnux: llasram: can i pass a list to a vararg function?

23:00 llasram: I know that's just an example, but do also consider that higher order functions and function composition make that sort of thing less useful

23:00 If you have the single-element version of `in?` (which is basically `contains?`)

23:00 wildnux: llasram: contains? does not work as 'expected' for list :D

23:01 llasram: Er, yeah, sorry -- injecting confusion. `contains?` is for maps and sets, guaranteeing O(1) look-up

23:01 wildnux: llasram: one more question,

23:01 i wrote in? and all-in? (for list)

23:01 llasram: List to a var arg function... You mean `apply`?

23:02 wildnux: llasram: what will be the best way to write a funtion which loops on a list and then returns the matching one based on the funtion passed

23:02 llasram: If I understand you correctly, usually `some` or `(comp first filter)`

23:02 wildnux: like (defn find-matching #(...) bigseq tosearchlist)

23:03 llasram: that should return the list of matching ones

23:03 llasram: Not completely following. Could you provide an exact example of argument and what you'd expect the result to be?

23:03 arguments even

23:04 wildnux: llasram: (find-matching #(= % %) [1 2 3 4 5] [1 2 5 0 11] ) should return (1 2 5)

23:05 jtackett: hey how do you bold something in a text area?

23:05 like the code for bold in a string

23:06 llasram: wildnux: So the intersection of the distinct elements in the two collections?

23:06 wildnux: llasram: yes :D

23:06 llasram: And in the order the appear... in the second collection?

23:06 wildnux: llasram: does not matter

23:06 jtackett: there is a function called intersection

23:07 llasram: ,(require '[clojure.set :as set])

23:07 clojurebot: nil

23:07 wildnux: llasram: (find-matching #(= % %) [1 2 3 4 5] [1 2 9 10 5 0 11] ) can also return (1 2 5)

23:07 llasram: ok

23:07 llasram: wildnux: What's the `#(= % %)` for? (which BTW is pretty much the same on its own as just `=`)

23:08 ,(set/interection (set [1 2 3 4 5]) (set [1 2 5 0 11]))

23:08 clojurebot: #<CompilerException java.lang.RuntimeException: No such var: set/interection, compiling:(NO_SOURCE_PATH:0:0)>

23:08 llasram: ,(set/intersection (set [1 2 3 4 5]) (set [1 2 5 0 11]))

23:08 clojurebot: #{1 2 5}

23:08 llasram: Spelling helps

23:08 metellus: ,(clojure.set/intersection (set [1 2 3 4 5]) (set [1 2 5 0 1]))

23:08 clojurebot: #{1 2 5}

23:08 llasram: If you have one large sequence, you can also do the same thing manually:

23:08 metellus: oh, llasram just did that

23:09 wildnux: llasram: the #(= % %) was just an example

23:09 llasram: ,(filter #{1 2 3 4 5} '[1 2 5 0 11 lots more])

23:09 clojurebot: (1 2 5)

23:09 llasram: wildnux: Well, yes -- but of what? :-)

23:09 wildnux: llasram: i want to be able to find anything that matches

23:10 llasram: wildnux: That's the part I'm trying to understand. You want to define your own custom match predicate, which might be different from (hash) equality?

23:11 If so, then you're stuck doing the Cartesian product of your two sequences and applying your match function to (asymptotically) every pair

23:12 wildnux: llasram: i will give you a real world example, I have two list of records (or objects or whaterver), now i want to find the intersection between those two lists where somefuntion (eg: any element of list 1 is square of any element of list 2)

23:12 llasram: yes

23:16 llasram: ,(defn find-matching [f es coll] (filter #(some (partial f %) es) coll))

23:16 clojurebot: #'sandbox/find-matching

23:16 llasram: ,(find-matching #(= %2 (* %1 %1)) [16 25] (range 20))

23:16 clojurebot: (4 5)

23:16 llasram: So like that then?

23:25 ncthom91: hey all. I'm working on a node/cljs project and trying to get a simple core.async read-file example going per http://bryangilbert.com/code/2013/07/19/escaping-callback-hell-with-core-async/. So far, I've got http://pastebin.com/Ms72g8Y3, but the return value is #<[object Object]> rather than the file contents and I'm confused about what i'm doing wrong

23:35 seancorfield: yogthos do you hang out in #clojurescript or just here?

23:36 yogthos: seancorfield: mostly here, I suppose I should join cljs as well :)

23:36 seancorfield: now you're maintaining some popular cljs libraries :)

23:37 yogthos: seancorfield: oh oh! :)

23:38 wildnux: llasram: how can we remove whitespaces from the middle of a string? like 'Ihave spaces \t\n in the string" to "ihavespacesinthestring"

23:39 jaju: yogthos: thanks for your cool libraries!

23:40 yogthos: glad they're getting some use :)

23:40 jaju: seancorfield: thanks for the nice write-up on your move to reagent

23:40 Jaood: is reagent still being maintained?

23:40 jaju: yogthos: I find your libraries very much useful and good guides for learning nice tricks too!

23:40 seancorfield: btw, took me a while to realize that reagent-form doesn't inherently create a :form tag and/or submit event stuff yogthos

23:41 jaju look at Whoops/reagent which is up to date

23:41 yogthos: wildnux: you can just use replaceAll (.replaceAll "Ihave spaces \t\n in the string" " " "")

23:41 jaju: No updates to reagent in a while I can see - but I had no issues moving my react dependency to 0.11.1

23:41 Thanks Sean! I will.

23:41 seancorfield: holmsand has said he will incorporate PRs and make a new release "in a few weeks"

23:41 yogthos: seancorfield: oh right, I tried to leave as much of it up to the user as possible

23:42 seancorfield: Whoops has incorporated all the PRs from holmsand's repo to make a 0.4.3 release with React.js 0.11.1

23:42 wildnux: yogthos: :D yeah.. i suppose i can do that :::::

23:42 yogthos: jaju: glad to hear it, most of it tends to come from stuff I end up doing at work, it's nice to be able to open source so much stuff :)

23:43 wrt to Reagent maintenance, I do recall Dan mentioned that he'd be happy if more people jumped on the project

23:44 it definitely looks like it's becoming a very important cljs lib and a lot of people are using it for production apps now

23:45 jaju: I started with reagent because i couldn't grok Om - I am not a JS guy. Reagent was immediately useful and found myself becoming productive. But over time, I was wondering why it wasn't appearing to pick up. Reagent-form and the recent discussions on the mailing list made me quite relieved :)

23:48 yogthos: I think stuff like Reagent is exactly what's needed for demonstrating why cljs is so great, it's extremely intuitive and you can pick it up in minutes

23:49 I'm training a co-op student at work right now, she's never done any Clojure before and was able to start doing stuff with it in days

23:49 Jaood: yogthos: you need know a compojure rest api tutorial to complement the single paga apps tutorials ;)

23:50 s/know/now

23:50 yogthos: Jaood: good call, compojure-api would be my recommendation currently https://github.com/metosin/compojure-api

23:50 I'll try put something together about using it

23:51 Jaood: awesome

Logging service provided by n01se.net