#clojure log - Jun 19 2013

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

0:00 puredanger: oops :)

0:06 murtaza52: thanks, that worked

0:17 futile: So...

0:17 uhh

0:24 murtaza52: I have an io operation that I want to perform an another thread. No state sync/sharing is needed. Also I dont need any return value. The operation is a blocking op which will continue indefinitely. What clojure concurrency construct should I use ?

0:24 correction - perform in another thread.

0:26 callen: murtaza52: future? start a new process?

0:26 futile: so, uhh..

0:27 ive been writing some blogs :(

0:27 like this one: https://gist.github.com/evanescence/5811570

0:27 murtaza52: start a new process. The process is actually just waiting for file system events, and then performing some operation.

0:28 futile: all cuz of callen

0:31 anyone know of a better blog-hosting service than gist?

0:31 callen: futile: don't put that shit on me. If I had my choice, you'd stop using this channel as a venue to talk about yourself.

0:31 futile: callen: you were all like "blogging is a good thing bla bla bla"

0:32 callen: I was far from the only one

0:32 futile: you.. were the only one who.. who believed in me...

0:32 :')

0:33 callen: I don't believe in you at all

0:33 futile: callen: what? you dont think i exist!?

0:35 ok fine

0:38 tomjack: futile: your blog post suggests to me that somehow I'm going to get the public API right, which is odd given that I'm so prone to getting the solution wrong

0:38 alexbaranosky1: anyone know how to access the length of an array in Clojure?

0:38 futile: tomjack: no but thats a separate problem entirely

0:38 alexbaranosky1: arrays have a .length property… but not sure how to access it

0:38 brehaut: ,(.length (int-array 1 2 3))

0:38 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core$int-array>

0:39 brehaut: fail

0:39 tomjack: alength

0:39 futile: tomjack: i tried to say that, if you make it generic enough, itll be good enough for the time being. at least, a lot longer than the raw solution itself would be

0:39 alexbaranosky1: thanks tomjac

0:39 mabes: does nrepl.el or perhaps, more generally, nrepl itself have an option to truncate large data structures? right now I'm working with a large map that kills my repl if I accidentally evaluate it

0:40 futile: mabes: C-c C-c to stop evaluating it, and then i just (pprint) it

0:41 mabes: hmm.. pprint is printing the entire thing too (I toggled pprint with nrepl)

0:42 futile: oh

0:42 nm

0:42 tomjack: (set! *print-length* 10) (set! *print-level* 3) or whatever

0:43 mabes: tomjack: great, thanks!

0:43 tomjack: https://www.refheap.com/c0e9a0bac5e7e996fd361cc43

0:44 (for yasnippet..)

0:48 futile: another new blog post: https://gist.github.com/evanescence/5811714

0:49 this is fun

1:19 murtaza52: I have a fn which I am calling in a (future f). The fn is a blocking one, ie it listens for events and executes an action on the event. So it never actually returns back, thus the thread never terminates.

1:20 How do I terminate it explicitly, when my program doesnt want it any longer ?

1:24 futile: liked your post

1:25 bbloom: murtaza52: don't use a future. use more traditional java concurrency primitives

1:26 murtaza52: clojure doesn't try to provide a complete concurrency story. java already has a good concurrency story, which clojure simply enhances and extends w/ a focus on immutability

1:26 creating a thread or using an executor pool or anything like that is A-OK :-)

1:27 murtaza52: thanks bbloom: let me look up on java threads.

1:28 dnolen_: core.match 0.2.0 beta3 goin out

1:28 bbloom: murtaza52: you can also consider a clojure agent

1:29 dnolen_: while i'm sharing papers with you. you might also like this one: http://okmij.org/ftp/papers/DDBinding.pdf

1:29 dnolen_: discusses the interaction between dynamic binding and delimited continuations

1:29 dnolen_: bbloom: yeah I have that as well

1:29 bbloom: cool

1:30 dnolen_: bbloom: one day, I need to upgrade my foo before I understand all that

1:30 bbloom: supposed delimited continuations give you everything that monads do

1:30 supposedly

1:30 bbloom: and a whole bunch of other cool stuff too

1:31 tomjack: everything? :(

1:32 bbloom: tomjack: presumably AND MORE :-P

1:33 tomjack: http://okmij.org/ftp/ is the place to start for delimited continuations & lots of other cool stuff

1:33 tomjack: yeah I've delved some

1:33 is the DDBinding the one with the 'more than monads' claims?

1:34 bbloom: tomjack: no

1:34 dnolen_: tomjack: see Representing Monads by Filinski

1:34 http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.43.8213

1:34 bbloom: dnolen_: you beat me by 5 seconds :-)

1:35 tomjack: my ":(" is just that, presumably, we're talking about operational semantics when we say "everything that monads do"?

1:35 that that paper is in ML makes me wonder if that's not right though

1:36 bbloom: what? ML can't have monads? :-P

1:36 brehaut: it makes sense intuitively as monads are often used for building different computation mechanisms, and continuations were used in scheme to model all the computation there

1:36 dnolen_: tomjack: that makes no sense

1:37 tomjack: to be clear, the "that" that I wonder about is my claim that we're just talking about operational semantics

1:38 i.e. the fact that the paper is in ML seems promising

1:38 dnolen_: tomjack: vs what?

1:42 tomjack: I took the claim to mean something like "delimc is operationally as powerful as algo.monads", which would ignore the utility of monads with a typechecker. but presumably the stuff in the "representing monads" paper is typechecked... reading now

1:44 bbloom: to be clear, the delimc library isn't quite a complete implementation of delimited continuations. for one, the macros only operate lexically

1:45 dnolen_: I don't even know what means, it's not like you can verify monad laws in Haskell. You're just checking type classes.

1:45 tomjack: sure, substitute for hypothetical implementations in a hypothetical dynamic language :)

1:52 bbloom: in any case, i still think monads, while somewhat interesting, are basically goblty gook that will be a footnote on the future history of computer science :-)

1:52 http://blog.sigfpe.com/2008/12/mother-of-all-monads.html

1:56 tomjack: hmm http://blog.melding-monads.com/2009/12/20/are-continuations-really-the-mother-of-all-monads/

2:01 I suspect this is relevant http://www.cs.ox.ac.uk/ralf.hinze/Kan.pdf

2:01 but I haven't managed to understand it yet :(

2:08 dnolen_: tomjack: interesting paper, good even for the citations

2:11 tomjack: btw, the B on page 2 is Logic

2:12 (I guess that is roughly clear from the explanatory text around it, but it is exactly Logic = LogicT Identity)

2:14 "every monad is isomorphic to a codensity monad" - so, yes, it is the mother?

2:40 dnolen_: trying to generalize enforceable constraints https://www.refheap.com/ce433aed08b777aa628c4f039

2:40 (def enforce-constraint-fns (atom {}))

2:40 this makes me unhappy

2:40 but seems like what ckanren does :(

2:46 (alter-var-root #'enforce-constraints composeg ...) :(

3:02 borkdude: https://www.refheap.com/15904

3:06 ddellacosta: woah, haven't looked at python in a while

3:09 borkdude: I made a typo, the else if not indented correctly, which gives a surprising result

3:09 ddellacosta there's a better way to do this in python, but I was just making an example for some sheet

3:09 ddellacosta: ah. I'm totally out of practice with Python...

3:11 tomjack: frequencies([{}]) :(

3:11 murtaza52: how do I terminate a thread. I can start it by (.start (Thread. my-fn)). I have a blocking thread which will continue indefinetely and will not return

3:11 Thus how do I terminate it explicitly from my code ?

4:10 samrat: this future seems to be swap!-ing an atom's value even after I cancel it: https://www.refheap.com/15905

4:10 amalloy: future-cancel is not a reliable operation, and certainly not a timely one

4:11 samrat: amalloy: what should I do instead then?

4:11 clgv: samrat: you can ensure correct behavior by querying an abort criterion in the loop. an atom with a bool would work

4:11 amalloy: any number of things. you could have the future checking some "stop" atom that you modify, so that it can shut itself down

4:11 you could do something more sophisticated than a future, like use a java executor and submit tasks to it

4:12 you could restructure your program so that it doesn't depend on global mutable state being influenced by multiple threads

4:16 you could write a function like atomic-counter that produces a lazy, infinite sequence of random points and some information about them (eg, are they in a circle), and delegate to seque the inconvenience of managing the thread

4:17 samrat: amalloy: this doesn't seem to work: https://www.refheap.com/15906

4:19 clgv: samrat: that due to the loop body is wrapped in an implicit `do` and thus the code after the when is executed. wrap the `when` around the whole body and negate its test

4:20 samrat: https://www.refheap.com/15907

4:21 samrat: you could even skip the `loop` since your function has no parameters you can simply `recur` to the function

4:21 samrat: amalloy: thanks. that works

4:22 amalloy: I'll also read up on seque

4:22 loz: hi, i have a problem

4:22 * clgv is not amalloy ;)

4:22 amalloy: personally i like the seque approach. modeling your computation as lazy sequences is often a lot nicer in clojure

4:22 and it's something i often don't realize i can do in a particular context

4:22 samrat: clgv: ah, sorry. anyway thanks

4:23 loz: my compiled clojurescript doesnt work, browser says "goog is not defined"

4:23 i found that goog is some how related to google closure

4:23 but i cant find what library do i need

4:30 Morgawr: loz: shouldn't it be included in the output of cljs? I mean, what's your optimization flag? :none :whitespace :simple or :advanced?

4:31 borkdude: is there a template which gives me ring, compojure and hiccup, but nothing more?

4:31 and clojure of course

4:32 loz: Morgawr: i use simple now, but does what matter?

4:32 borkdude: and some convenicne like functions to start the webserver

4:33 callen: borkdude: I can show you a template that uses all of that, except clabango in the place of hiccup.

4:34 borkdude: callen luminus?

4:34 callen: borkdude: a more developed app that started as luminus

4:34 borkdude: callen I mean a leiningen template

4:35 haha, if I type in Eclipse/CCW in the template field "luminus +hiccup" it crashes

4:36 Morgawr: loz: no, it shouldn't really. With simple optimization you're running into the google closure compiler but it's not a big deal (problems can surface with either :none or :advanced). I don't know why it's not finding the goog namespace, it's weird. What's your require code?

4:36 borkdude: hmm, it's pretty serious, eclipse doesn't even start anymore with an error msg about my workspace

4:37 callen: lol eclipse.

4:37 loz: Morgawr: should closure library come with clojurescipt? after bootstrap?

4:38 Morgawr: where are two closure jars, but what about js code for client?

4:39 Morgawr: loz: I'm not 100% sure but I think it should. I mean, part of the ClojureScript core (cljs.core) use (:require goog.something)

4:39 when you compile your clojurescript project, everything is put inside a single .js file (unless you use :none optimization, then you'll have multiple files) and that file is placed in the output directory you chose in your leiningen project.clj

4:40 borkdude: callen yeah, it's pretty funny, although probably it's CCW to blame not to validate this field ;)

4:40 Morgawr: you just need to include that single .js file into your website as any other normal javascript script file

4:40 loz: Morgawr: the problem is i dont have leiningen project, i need to compile it by myself

4:41 Morgawr: you should really use leiningen

4:41 borkdude: ah, the "compojure-app" template by yogthos|away is exactly what I searched

4:41 Morgawr: it's the standard way of doing things with Clojure(script), I don't know how to help without Leiningen since I've never done it without

4:41 loz: Morgawr: i just want to use clojurescript in rails

4:43 Morgawr: eh, I'm not a huge expert with the whole build process, sorry. Hopefully somebody is able to help you more

4:45 loz: my submission to clojure-dev was denied..

4:55 ddellacosta: loz: did you figure out your issues? Clojurescript does indeed include Google Closure libs so it's possible something strange is going on in your code

4:56 loz: ddellacosta: i think i dont understand what happens on cljs compiling

4:57 ddellacosta: how are you compiling/running/etc. ?

4:57 using lein cljsbuild, or no?

4:57 Morgawr: he's not using leiningen

4:57 loz: i wrote cljs file, then i run cljsc to compile it

4:58 ddellacosta: okay, and does it compile okay?

4:58 loz: i get output + cljs/core.js

4:58 yep

4:58 ddellacosta: but, when you load it up in a browser it breaks?

4:58 loz: yes, ReferenceError: goog is not defined

4:59 ddellacosta: hmm

4:59 loz: when i try to use closure's calcdeps.py on it, it says Exception: Duplicate provide (goog.string)

4:59 do i ever need to do this?

5:00 ddellacosta: i think i must mention that _just_ cljs code works ok, im trying to use dummy now

5:00 dommy*

5:00 ddellacosta: oh, okay

5:00 vijaykiran: loz: http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html

5:00 ddellacosta: can you put your code in a refheap or gist or something and show me?

5:00 loz: sure, wich one?)

5:00 vijaykiran: loz: see Using external libraries

5:01 loz: vijaykiran: thx, ill take a look at it

5:02 ddellacosta: vijaykiran: I'm not sure that applies to dommy, which is a CLJS lib

5:02 loz: vijaykiran: dommy is clojurescript lib

5:02 ddellacosta: (but, nice link, super useful…bookmarking)

5:02 loz: I'm not sure how you would generate this without lein, I've just never done it

5:02 vijaykiran: Ah, true

5:03 loz: in that case - I'd suggest using a "project" :)

5:03 it will also help us reproduce your problem easily

5:03 loz: ddellacosta: my js code is simple - https://www.refheap.com/15909

5:04 it compiles with dommy in classpath

5:04 but results contain these "goog" objects

5:05 ddellacosta: well, goog is included by default--it's part of CLJS

5:05 Morgawr: You're using dommy macros, how do they expand? Because in ClojureScript macros are a bit delicate, you need to (:require ) all the libs/namespaces required by the macros (I think)

5:06 loz: ddellacosta: but what should i do after - where is goog are defined?

5:06 ddellacosta: goog is defined in the compiled code

5:06 it is part of the namespace that is defined by default, as Clojurescript includes the goog namespace as a dependency

5:07 so something is broken

5:07 loz: like

5:07 goog.global = this;

5:07 goog.DEBUG = true;

5:07 goog.LOCALE = "en";

5:07 goog.provide = function(name) ?

5:07 first lines of my compiled file

5:07 ddellacosta: I'm not sure how external *clojurescript* dependencies are included as part of the build process outside of using leiningen's cljsbuild plugin, so I'm not sure I can help you too much

5:07 hotwoofy: anyone know if you can have a subselect inside a where clause in clojureql? for example, to calculate an aggregate in the subselect, and then use that to filter rows in another query, without executing two different queries.

5:08 ddellacosta: yes, exactly

5:08 loz: hm so why do i get undefined in browser..

5:10 ddellacosta: does order of scripts including matter?

5:10 ddellacosta: loz: most definitely--you'll need to include the compiled clojurescript file first

5:11 hmm, I suppose that if you build with cljsc and get no errors re: dommy, it should be fine

5:11 trying proof of concept now myself

5:12 loz: some progress at least! ReferenceError: dommy is not defined

5:13 ddellacosta: does cljsc include library code into resulting js?

5:13 i just supposed things going so

5:13 ddellacosta: this is what I'm trying to determine--as I said, I don't know how it behaves with external CLJS libs

5:14 the link that vijaykiran sent explains how to include 3rd-party JS libs however

5:18 wow, I can't even get bootstrap to work...haha

5:21 loz: sorry, I'm having really, really strange issues getting cljs even set up

5:21 I use it entirely via lein cljsbuild these days however, so I never run into the issues you talk about

5:22 loz: you just need to run bootstrap and tweak script for classpaths :D

5:22 ddellacosta: loz: naw, it's something very strange--curl isn't...running.

5:22 really not sure what is up

5:22 loz: classpaths are hardcoded, so you cant add your own, i think lein uses pure java command to compile

5:23 ddellacosta: but anyways, if you can run the cljs file without dommy, but then when you compile it in it is broken, then it seems like something may be not getting included

5:23 a simple thing to check is just to open up the compiled js file and do a grep for dommy

5:23 that will answer your question if that is getting compiled in or not by default

5:23 I suspect it is, actually, if you don't get complaints during compilation

5:23 otherwise it would throw a lot of warnings/errors

5:24 loz: i did grep, found only my calls to dommy

5:24 so looks like i need to compile it too

5:24 ddellacosta: hmm

5:24 okay

5:25 well, it should all get compiled down to one file

5:26 there is nothing here that specifies how to compile 3rd-party cljs libs in

5:26 https://github.com/clojure/clojurescript/wiki/Quick-Start

5:29 loz: ddellacosta: should? i just add dommy to classpath, maybe i should add it to compile files?

5:29 ddellacosta: what do you mean, add to compile files?

5:30 loz: from cljsc:

5:30 # Compile a single cljs file or a directory of cljs files into a single JavaScript file.

5:30 i must check it

5:30 ddellacosta: I mean, you can try compiling dommy that way

5:30 I don't know what dependencies *it* has though

5:31 I mean, this is an interesting experiment, but this is not the way that most people are compiling clojurescript

5:31 so if you want to learn about how cljs compilation works, then you'll learn a lot this way I suppose, if you're willing to dig into it

5:32 but if you just want this to *work*, then I would highly recommend setting up lein and a project

5:32 it will make it much smoother

5:32 loz: i will end up with a gem for rails wich will do everything, so ppl will be able to write cljs in rails

5:35 ddellacosta: loz: good luck then. :-) All I can suggest then is to see how cljsbuild does it. https://github.com/emezeske/lein-cljsbuild/blob/master/plugin/src/leiningen/cljsbuild.clj#L38

5:49 loz: ddellacosta: how do you think, is this a bug? dommy/macros is _clj_ file, instead of cljs..

5:49 https://github.com/Prismatic/dommy/tree/master/src/dommy

5:52 jonasen: loz: clojurescript macros are written in clojure, not clojurescript

5:52 loz: okey then

5:53 how should i include paths with spaces into classpath? can i use " or ' ?

5:53 or should i?

6:55 Josh_: how do i create a directory with clojure.java.io api ?

6:56 Zamarok: Is clojure.math.numeric-tower the library everyone uses? Or is there an "official" one?

7:02 clgv: Zamarok: those github libs in the "clojure" group are the official ones

7:09 loz: wtf, compiled dommy requires goog wich is in my compiled js wich requires dommy

8:37 Zamarok: clgv: thanks

8:37 One more question: can a namespace include a number? Like 'my.namespace.12' for instance.

8:38 cause that would really help me organize things

8:41 ahh it can, answered my own question.. nevermind

8:51 TimMc: Zamarok: It probably will not be usable from Java.

8:59 clgv: Zamarok: numbers are fine - the dot is a problem.

9:19 xpe: Zamarok: I use the Apache Commons math libraries quite a bit

10:23 TimMc: clgv: What?

10:23 clgv: TimMc: ?

10:23 TimMc: How are dots problems?

10:23 clgv: in classnames

10:24 they are already separators in packages

10:24 TimMc: But Zamarok was asking about namespaces, not classnames.

10:25 clgv: ah he wants one to start with a number. that could be problematic...

10:25 namespaces are classes

10:25 TimMc: ish

10:25 The last segment in a namespace becomes... 1, maybe 2 classes.

10:26 clgv: yeah actually more than one class ;)

10:26 TimMc: foo.bar.baz gets you something like baz.class and baz__init.class

10:26 futile: so, um

10:26 if you start writing a blog, how/where do you tell people about it?

10:27 i.e. https://gist.github.com/evanescence

10:29 clgv: a blog in gist form?

10:30 hyPiRion: futile: the easiest is probably github pages

10:30 I tend to use it for documentation, but if you don't use gh-pages for that, then you get http://username.github.io which is relatively easy to remmeber

10:31 TimMc: futile: Write search-bait.

10:31 futile: TimMc: nobody will find my stuff via google

10:31 hyPiRion: the problem is how/where to tell people about it, not how they're gonna get to it

10:31 hyPiRion: ah

10:31 futile: clgv: gist is awesome for writing blogs

10:31 hyPiRion: Was a bit quick there

10:31 TimMc: futile: Nonsense. Have you ever had a blog before?

10:32 futile: clgv: it has all the features i need: markdown formatting, pagination, shows snippets on the index page, etc

10:32 TimMc: lots, nobody found them via google.

10:32 TimMc: :-(

10:32 hyPiRion: If you spends some time with Jekyll, you can get some pretty lush formatting and some google analytics in as well (if you're keen on that)

10:33 mikerod: Maybe this is a dumb question: If you start an nRepl server with clojure.tools.nrepl.server/start-server, is it important that you call clojure.tools.nrepl.server/stop-server before terminating the process that the was running the server?

10:33 clgv: Zamarok: namespaces starting with a numbers might cause problems. class names must not start with numbers in java. if the jvm enforces that and not only the compiler you have more than an interop problem. ;)

10:33 hyPiRion: (That's what gh-pages uses to render data)

10:33 futile: hyPiRion: yeah, although thats not as fast/easy as gist

10:33 (inc gist)

10:33 lazybot: ⇒ 1

10:33 hyPiRion: true

10:33 TimMc: (inc refheap)

10:33 lazybot: ⇒ 1

10:34 TimMc: FIGHT

10:34 hyPiRion: oh yeah, refheap has markdown too these days

10:34 well, it'd be hard to connect it into a blog of some sort

10:34 futile: right, gist has gist-preview, pagination, etc

10:35 Will (inc hyPiRion) work mid-sentence?

10:35 guess not

10:36 hyPiRion: Well, speaking of getting users

10:37 clgv: $karma futile

10:37 lazybot: futile has karma 2.

10:37 clgv: $karma gist

10:37 lazybot: gist has karma 1.

10:37 hyPiRion: Hacker News is a good source if you're a masochist.

10:37 futile: $help

10:37 lazybot: You're going to need to tell me what you want help with.

10:37 hyPiRion: $help karma

10:37 lazybot: hyPiRion: Checks the karma of the person you specify.

10:37 futile: anyone wanna post my blog to hackernews?

10:38 i cant, im banned from it

10:38 (dont ask)

10:38 hyPiRion: oh, I was just about to

10:38 but okay :)

10:38 clgv: haha, ooops.

10:38 llasram: xpe: Re: you mentioning Apache Comomns Math, have you used the commons-math optimization algos from Clojure?

10:38 futile: :)

10:38 any of you have experience writing lazybot plugins?

10:39 llasram: xpe: I was trying to figure them out, but it looks like they're in their third? round of back-to-back redesigns, and I couldn't figure out which interfaces were actually deprecated

10:39 hyPiRion: I am certainly sure Raynes has experience with that.

10:39 It's not that difficult though, futile. Have a look at the source code and you can get a rough indication on how to do it

10:39 futile: I've been looking through existing plugins,

10:40 but I can't tell if it has the ability to find text within text, like (inc hyPiRion) as a substring instead of the whole string

10:40 Oh, looks like it does. Yay.

10:40 clgv: you can do ##(inc 1)

10:40 lazybot: ⇒ 2

10:41 hyPiRion: have a look at how it handles double and triple question marks. like this???

10:41 lazybot: hyPiRion: Yes, 100% for sure.

10:41 clgv: should he look for such jokes??

10:41 lazybot: clgv: Definitely not.

10:42 futile: hyPiRion: oh thanks!

10:42 hyPiRion: np

10:42 clgv: I think that wont work ##(inc hyPiRion)

10:42 lazybot: java.lang.RuntimeException: Unable to resolve symbol: hyPiRion in this context

10:44 futile: sweet, yesno.clj helps

10:50 Is there a better way to do ##(first (shuffle [1 2 3]))

10:50 lazybot: ⇒ 2

10:51 futile: ,(first (shuffle [1 2 3]))

10:51 clojurebot: 3

10:51 futile: ,(-> [1 2 3] shuffle first)

10:51 clojurebot: 1

10:51 futile: meh

10:52 hyPiRion: futile: rand-nth

10:52 ,(rand-nth [1 2 3])

10:52 clojurebot: 1

10:52 hyPiRion: ,(rand-nth [1 2 3])

10:52 clojurebot: 1

10:52 hyPiRion: ,(rand-nth [1 2 3])

10:52 clojurebot: 3

10:53 futile: ,(for [_ (range 0 10)] (rand-nth [1 2 3]))

10:53 clojurebot: (2 2 3 1 1 ...)

10:53 futile: ah

10:53 hyPiRion: ,(repeatedly 10 #(rand-nth [1 2 3]))

10:53 clojurebot: (1 1 3 1 3 ...)

10:54 futile: you're good at this

10:55 hyPiRion: http://clojure.org/cheatsheet is good to have

10:56 dnolen_: shakes his fist an Lein JVM opts

10:56 core.match is now looking as fast as I remember

10:57 Morgawr: mmm.. clojurescript question. I have a library that uses a .js file (for "low level" functions) that I have marked with :externs in my project.clj. I install this library with "lein install" and then I use it in another project, however the compiled result can't see the .js file (I assume it's not getting inside the .jar). How can I make it work?

10:58 dnolen_: ridiculously fast

10:58 futile: done.

10:58 hyPiRion: ive been using that for about 9 months now :P

10:59 is flatland in here? i hope i can get this lazybot plugin merged soon

10:59 hyPiRion: ~flatland

10:59 clojurebot: Pardon?

11:00 vijaykiran: ~seen vijaykiran

11:00 clojurebot: vijaykiran was last seen in #clojure, 0 minutes ago saying: ~seen vijaykiran

11:00 vijaykiran: ~seen flatland

11:00 clojurebot: No entiendo

11:00 hyPiRion: futile: https://github.com/flatland?tab=members

11:00 futile: oh

11:01 first things first, gotta figure out how pull requests work in the New Github

11:01 XPherior: Is there any way to refer to 'this' when using proxy?

11:03 clgv: XPherior: just use 'this'

11:04 XPherior: clgv: Huh, I'm not sure why I didn't expect that to work. Thanks man.

11:04 futile: hey amalloy_ can you merge https://github.com/flatland/lazybot/pull/88 ?

11:04 clgv: XPherior: because it is implicitely defined (unhiegenic macro) which is usually discouraged in clojure

11:04 Morgawr: so, nobody knows how to package a .js file with a clojurescript .jar so it can be used as part of the clojurescript library? :(

11:05 XPherior: That's also called an anaphoric macro, right, clgv?

11:05 hyPiRion: XPherior: yes, that's right

11:05 XPherior: Learning things today. :)

11:06 futile: i hope clojure will merge my lava pull request one day

11:06 * futile :(

11:07 clgv: futile: lava?

11:07 futile: clgv: https://github.com/clojure/clojure/pull/6

11:08 all the tests still passed

11:08 clgv: futile: that wont be merged at all. you have to make a Jira ticket with a patch. to be accepted you need to have signed the CA

11:08 futile: clgv: oh! that's why they didn't merge my pull request!

11:09 hyPiRion: yeah, totally why

11:09 clgv: ah just reading it right now....

11:10 well, some people that really wanted to contribute made that wrong assumption about contributing to clojure via pull request - so I thought I should let you know...

11:13 ToBeReplaced: if i have a file (ns temp (:gen-class)) (defn -main [] (println *ns*) and I uberjar it and run, *ns* is printed as clojure.core ... how can i get #<Namespace temp>?

11:14 Morgawr: dnolen_: when I create a .jar for a clojurescript library (with lein install), does it package the .js files I add with :libs too? Because I have :libs ["pathto/myfile.js"] but when I require the correct namespace (I used goog.provide() in the JS file) from the project that uses that library, it says it can't find it

11:14 ToBeReplaced: i think i'm asking; how can i get the name of the class that we are calling the -main of?

11:14 clgv: ToBeReplaced: (the-ns 'temp) should work

11:14 hyPiRion: ToBeReplaced: Humm, try out (def my-ns *ns*) and (println my-ns) instead. *ns* is a dynamic var, so it's changing at runtime

11:15 Morgawr: like, I have ProjectA is a library using fileB.js and I install ProjectA as .jar to be used by ProjectC but ProjectC can't see fileB.js (or its namespace)

11:18 ToBeReplaced: hyPiRion: yes that works; any thought if i need only the name ("temp") instead of the namespace? I have a function that would be useful for individual apps as their main, but it needs to be able to get or recover the name of the application if none is passed in

11:20 ex. (defn -main (template-main)).. template-main may need a name for reporting, ex. (-> *ns* ns-name name), but that won't work for the obv reasons

11:21 hyPiRion: ToBeReplaced: I'm not sure if there's any way except (def my-ns-name (-> *ns* ns-name name)). I haven't been using namespaces in creative ways really, I just know the basics of how they work.

11:22 ToBeReplaced: hyPiRion: cheers, thanks

11:22 hyPiRion: As in, I'm 100% sure there are solutions, but I don't know which one is the most idiomatic/best.

11:22 np

11:24 llasram: ToBeReplaced, hyPiRion: if you dig into the implementation of tools.logging, it preserves the namespace for each logging invocation so that it can emit it in log messaages

11:24 (spoiler alert: the solution is macros)

11:25 clgv: yeah you capture the namespace at macroexpansion time as well

11:25 +can

11:37 Morgawr: I feel like I am missing a step here, I can't figure out how to ship a .js file included to a clojurescript .jar

11:39 * futile pings Raynes

11:42 clgv: Morgawr: might the treatment of js-files by leiningen be similar to the one of native dependencies?

11:43 dnolen_: Morgawr: dunno, never package CLJS with lein

11:43 Morgawr: I rarely know the answer to such questions since I mostly hack on the compiler

11:43 Raynes: futile: wat

11:43 It's too early for pings.

11:44 Morgawr: I see

11:44 it's just that it seems that the .js file is forgotten when adding everything inside a .jar

11:45 Raynes: futile: lol

11:45 futile: This would be far too annoying to actually use, but lol, nice work.

11:46 dnolen_: Morgawr: if no one answers here ask on the ClojureScript google group, tons of people there who probably know the answer better than I.

11:46 Morgawr: dnolen_: alright, thanks. I'll keep looking and testing

11:48 Raynes: There are things dnolen_ does not know?

11:48 My whole life has to be restructured now. :(

11:49 futile: Raynes: what if i made it have to have a prefix of the word "good"?

11:49 Raynes: ie "good morning" would trigger it but "yesterday morning we..." wouldnt

11:50 Raynes: Maaaaaaaaaybe.

11:50 I'll see what amalloy_ thinks when he gets into work. He's usually likes this kind of stuff.

11:51 Jesus, I'm shaking like scared puppy.

11:51 Freezing to death and I'm not even that cold.

11:51 I hate mornings.

11:51 futile: ,(for [msg ["good morning" "yesterday morning we fixed a bug" "good evening everyone" "the evening is boring"]] (re-find #"(?i)\bgood\b (morning|afternoon|evening|night|day)\b" msg))

11:51 clojurebot: (["good morning" "morning"] nil ["good evening" "evening"] nil)

11:53 hyPiRion: Raynes: Oh hey, with Instaparse we could probably make lazybot even more sentient

11:53 Raynes: Have at it. I want him to make me breakfast.

11:53 futile: Raynes, amalloy_: updated the pull request to require "good " before the thing

11:54 * Raynes vibrates

11:54 Raynes: I really need a space heater.

11:54 hyPiRion: Raynes: man, it sounds like you're living in Norway

11:54 Raynes: Or to never get up at 8AM ever again.

11:54 $conditions 90025

11:54 lazybot: Last Updated on June 19, 8:49 AM PDT; Scattered Clouds; Dewpoint: 59 F (15 C); Precipitation today: 0.00 in (0 mm); Temperature: 65.4 F (18.6 C); Windchill: NA; Wind speed: 5.0mph; Wind gust: 0mph; URL: http://www.wunderground.com/US/CA/West_Los_Angeles.html.

11:54 futile: $conditions 60098

11:54 lazybot: Last Updated on June 19, 10:43 AM CDT; Clear; Dewpoint: 54 F (12 C); Precipitation today: 0.00 in (0 mm); Temperature: 70.9 F (21.6 C); Windchill: NA; Wind speed: 2.0mph; Wind gust: 10.0mph; URL: http://www.wunderground.com/US/IL/Woodstock.html.

11:55 Raynes: Yeah, it isn't even cold. It's just that when I wake up early I always freeze to death. No clue why. I don't think it has ever mattered what the temperature is.

11:55 futile: Raynes: you might be dead?

11:55 Raynes: It's a distinct possibility.

11:55 futile: sixth-sense style

11:55 hyPiRion: futile: that wouldn't explain the shaking though

11:56 futile: hyPiRion: yeah it would, dont ghosts shiver and quiver and stuff?

11:56 Raynes: Also this passing through walls stuff that has been getting on my nerves lately.

11:56 hyPiRion: I hate when that happens.

11:56 futile: lol

11:56 ok back to work. bye

11:56 Raynes: Goodbye.

11:57 futile: when i look at Rails stacktraces.. i wonder "what the heck were these guys doing? this is way too many abstractions"

11:57 gzmask: .(doc set!)

11:58 futile: when i look at Clojure + ring + compojure stacktraces im like "oh right, thats pretty much all my code. sweet."

11:58 gzmask: ,(doc set!)

11:58 clojurebot: Pardon?

11:58 hyPiRion: $doc set!

11:58 futile: ,set!

11:58 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: set! in this context, compiling:(NO_SOURCE_PATH:0:0)>

11:58 gzmask: I guess it's clojurescript lol

11:58 gfredericks: &(doc set!)

11:58 lazybot: java.lang.SecurityException: You tripped the alarm! set! is bad!

11:58 gfredericks: alarm! set! is bad!

11:59 futile: haha

11:59 technomancy: ...and you should feel bad

12:00 Raynes: technomancy: Dear God, why did I never think of adding that to the error message?

12:00 futile: oh wow, i recognize those names: http://clojure-log.n01se.net/date/2011-04-08.html

12:00 clgv: $conditions 10838

12:00 lazybot: Location not found.

12:00 futile: wow, i made that joke 2 years ago?

12:00 (clojure -> lava)

12:01 Raynes: futile: Why are you claiming it now? :o

12:01 futile: cuz its me?

12:01 Raynes: WHERE'S YOUR PRUF

12:01 futile: look at the name "steven degutis" in https://github.com/clojure/clojure/pull/6/commits

12:01 in every commit

12:02 Raynes: Your name is Steven Degutis?

12:02 futile: yes. look at https://groups.google.com/forum/?fromgroups#!topic/clojure/AdSrnNe_anw

12:02 see it there too

12:02 clgv: Raynes: where do you get the code for "$conditions" from on that website?

12:02 Raynes: Gonna need to see a driver's license.

12:02 technomancy: how did that pull request get closed twice?

12:02 futile: technomancy: magic

12:02 hmm, that is weird

12:02 Raynes: clgv: Where do i get the code for it?

12:02 I got it from my brain.

12:03 clgv: Raynes: I searched my city their - but I dont know where the code might be listed on the result page...

12:03 futile: Raynes: i also wrote zephyros https://github.com/mattgemmell/zephyros/commits/master

12:03 Raynes: clgv: You mean the number I used?

12:03 clgv: Raynes: yeah

12:03 Raynes: That's a zip code.

12:03 Postal code.

12:03 clgv: $conditions D-89073

12:03 lazybot: Location not found.

12:03 futile: which was based on appgrid: https://github.com/biohazardffm/grs/tree/master/AppGrid

12:04 Raynes: It's weird about non-US places.

12:04 I'll be back shortly. Gotta head out. Buddy is picking me up soon.

12:04 clgv: $condition Ulm, Germany

12:04 hyPiRion: clgv: you forgot an s

12:04 clgv: $conditions Ulm, Germany

12:04 lazybot: Last Updated on June 19, 5:55 PM CEST; Mostly Cloudy; Dewpoint: 63 F (17 C); Precipitation today: 0.00 in (0 mm); Temperature: 90.2 F (32.3 C); Windchill: NA; Wind speed: 0.0mph; Wind gust: 0mph; URL: http://www.wunderground.com/global/stations/10838.html.

12:05 tomjack: wow :(

12:05 clgv: ah thats it^^

12:05 hyPiRion: man

12:05 clgv: roasting in my office. someone please turn me ^^

12:06 futile: time to put on my UX hat

12:06 charliekilo: $conditions Pearl City, Hawaii

12:06 lazybot: Location not found.

12:06 charliekilo: $conditions Pearl City, USA

12:06 lazybot: Location not found.

12:07 charliekilo: $conditions Maui, USA

12:07 lazybot: Last Updated on June 19, 5:36 AM HST; Clear; Dewpoint: NA; Precipitation today: -999.00 in (-25375 mm); Temperature: 74 F (23.3 C); Windchill: NA; Wind speed: 6mph; Wind gust: 9.0mph; URL: http://www.wunderground.com/US/HI/Maui.html.

12:07 hyPiRion: wow, -25375 mm rain is low

12:09 gtrak: sounds REALLY dry, hope they're ok

12:09 dignati: Hi there, Im a little bit struggling to process a coll right now. Mainly I need to map an apply call. Is there some function or macro already doing this?

12:09 gtrak: map an apply?

12:09 Morgawr: don't want to spam, but I posted my question in the ClojureScript google group: https://groups.google.com/forum/?fromgroups#!topic/clojurescript/EXqcjyRbALc in case anyone feels like helping out ;)

12:10 hyPiRion: dignati: ##(map #(apply + %) [[1 2 3] [4 5 6] [7 8 9]]) ?

12:10 lazybot: ⇒ (6 15 24)

12:10 dignati: gtrak: Yeah, like (map #(apply fun %) coll)

12:11 gtrak: where each item in the coll is args for fun?

12:11 dignati: hyPiRion: Okay, I did that. just wanted to ask if there is already a function in clojure.core doing that

12:11 gtrak: exactly like hyPiRion showed

12:11 gtrak: partial apply fun?

12:12 saves a classdef

12:12 hyPiRion: gtrak: it's slower though. Not that any of these things usually matter.

12:12 gtrak: like: ##(map (parital apply +) [[1 2 3] [4 5 6] [7 8 9]])

12:12 lazybot: java.lang.RuntimeException: Unable to resolve symbol: parital in this context

12:12 gtrak: like: ##(map (partial apply +) [[1 2 3] [4 5 6] [7 8 9]])

12:12 lazybot: ⇒ (6 15 24)

12:13 gtrak: slower?

12:13 hyPiRion: yeah

12:13 gtrak: why?

12:13 clojurebot: why not?

12:14 hyPiRion: $source partial

12:14 lazybot: partial is http://is.gd/buxpVi

12:14 gtrak: hyPiRion: 3 args or less should be just as fast

12:14 i can see the concat mattering

12:15 hyPiRion: I have usually considered it slower, and that's what I've registered too

12:15 gtrak: hrm

12:15 hyPiRion: That's biased though, but I feel pretty sure it is, as it's varags vs constant arg size.

12:16 gtrak: yea... dunno. function-literal instantiation vs a single dynamic call should be negligible

12:16 hyPiRion: (partial apply +) => (fn [& args] (apply apply + args)) vs (fn [%] (apply + %))

12:16 Morgawr: yeah, calling apply to call apply seems a bit redundant, the syntax doesn't change much from map #() and map (partial ..), might as well go with the one that performs faster (at least theoretically, benchamrking may be necessary to prove anything)

12:17 gtrak: ah, you're concerned with the arglist seq

12:17 kittylyst: Are any of the Monger developers online?

12:17 I have a question about repsets

12:19 futile: ,()

12:19 clojurebot: ()

12:19 futile: ,(())

12:19 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList$EmptyList cannot be cast to clojure.lang.IFn>

12:19 futile: ,[()()]

12:19 clojurebot: [() ()]

12:19 futile: !

12:20 Johnny Five!!!

12:23 So regarding writing a website that doesn't work very well with JS disabled:

12:24 it seems like the only people who have JS disabled are self-important know-it-alls who think they're smarter than everyone else anyway, right?

12:24 So they're gonna hate my site regardless, even if I have JS enabled, because something is sure to be done wrong.

12:24 i.e. maybe I didn't fully conform to XHTML5-transitional with CSS3 for Opera or something

12:25 gtrak: futile: just use flash

12:27 TimMc: futile: No, there are plenty of other people who will hate you. Suck it up and code it right.

12:27 Graceful fallbacks aren't that hard to write.

12:28 Or yeah, go whole hog and use FutureSplash.

12:28 gtrak: 'graceful' he says.. this is the internet

12:28 TimMc: It's all relative.

12:29 ToxicFrog: If you use Flash, I will hold you down while everyone who uses a screen-reader, netbook, or 64-bit OS makes you gargle chainsaws

12:29 hyPiRion: Graceful fallbacks are a relative term.

12:29 futile: i can do graceful

12:29 hyPiRion: is*

12:29 * futile receives grace via the sacraments <3

12:29 TimMc: >_>

12:29 gtrak: the best I can hope for non-surprising and maybe neatr.

12:29 neat*

12:29 hyPiRion: But according to google analytics, 100% of the people visiting my site uses JS, so I don't have to consider fallbacks :)

12:30 TimMc: hyPiRion: :-P

12:30 "No one has yet complained about our sealed-shut suggestion box!"

12:30 hyPiRion: Well

12:31 I don't use JS for anything else than analytics

12:31 ohpauleez: TimMc: Ha!

12:31 :)

12:31 TimMc: futile: Quick list of problems with JS-only: Accessibility, search engines, broken JS code, other devs, people using NoScript (for privacy and security)...

12:31 futile: Unless you're writing http://fuckyeahpsychedeliccats.tumblr.com/ in which case go to town.

12:34 gtrak: the only thing accessible about that site is me considering the location of their shrooms.

12:37 ckoch786: Anyone know if it is possible to run a repl on a running jvm and manipulate objects like you would in a debugger?

12:37 gtrak: ckoch786: yes, I do it all the time

12:37 or do you mean embedding into a java app? I've done that too, a spring WAR thing

12:38 ckoch786: yeah I want to embedded it so I can manipulate data on the fly

12:38 gtrak: ckoch786: something somewhere needs to start up an nrepl server, in my case I created a servlet-listener to do the job

12:38 supersym: if I'd want to find all occurences where a function is used (in a lein project), including the file and line number, what would be a good method? Do I reflect, or use a package hooked to OS and grep?

12:38 ckoch786: can you point me to some examples/docs

12:39 can I embed it into java apps?

12:40 gtrak: ckoch786: looking through old gists, but here's a starting point: https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/server.clj

12:40 ckoch786: you'll need to gen-class something for java to see, or use the clojure runtime directly to resolve vars.

12:41 ckoch786: this is how I did it with swank a long time ago: https://gist.github.com/gtrak/3122677

12:42 nrepl won't be much different

12:42 justin_smith: supersym: grep / find users is one thing, but what about finding cases where the function is captured by a closure with a different name and that closure is accessed elsewhere?

12:42 ckoch786: gtrak, thanks

12:45 gtrak: binding the servlet-context to a namespace var gave me an entry point into the java app, in my case, I replaced some spring beans with clojure versions (using reify and such) that caught stuff flowing through and let me play with it.

12:48 rasmusto_: gtrak: fresh spring bean salad

12:48 ParahSailin: hm, trying to import a jar file-- im putting it in the classpath but it's not finding it when i import

12:49 gtrak: import... a jar file... cannot parse

12:50 ParahSailin: import a class from a jar file...

12:50 akells`: I'm writing an HTTP server for learning purposes. I'm at the point where I would need to be saving POST data. Do atoms seem like a proper way to try to handle storing that data?

12:50 ParahSailin: you guys dont get to be so pedantic about typing

12:51 gtrak: akells`: atoms are about mutation, you'll need some sort of data structure?

12:51 akells`: gtrak: yeah, I'm in need of some sort of data structure. any suggestions?

12:52 gtrak: I threw together something with atoms very ignorantly, and its looking like I was wrong to think they'd do what I want

12:52 gtrak: not sure, I glanced at Grizzly at one point, I think there's some map of nio selectors to request-threads somewhere

12:53 tomjack: akells`: I don't think you've told us what you want

12:53 akells`: well I appreciate the input

12:53 tomjack: sorry. I want a way to store some data that I'm receiving through a POST request, so that I can then serve that data up again

12:54 tomjack: 'store' as in durably? if the web server gets killed and restarted, you still want the data around?

12:54 akells`: I've parsed the POST request and have a hash-map now that contains all of the POSTed data. if the server its killed, the data can go away

12:55 ParahSailin: does clojure handle overloaded constructors from a java class file?

12:56 gtrak: ParahSailin: not really, you should cast the args

12:56 cast... I mean coerce I guess

12:56 tomjack: akells`: ah, ok. atom sounds good to me

12:57 gtrak: selecting a constructor via reflection can get ambiguous, I had a bug from this

12:58 akells`: tomjack: okay. would you mind taking a peek at this bit of code I've written? https://code.stypi.com/hxk1rpqs

12:59 tomjack: that's rather odd

13:00 akells`: I must admit I wrote it while not knowing very much at all about atoms

13:00 tomjack: if they storage map maps data -> data, you have to already know the data to get the data out

13:00 which makes it kinda useless

13:00 the other thing is, yeah, you're abusing atoms

13:00 gtrak: not useless, it makes it act like a set :-), but probably not what he wants

13:01 tomjack: you can't @ and then use this in a swap!/reset!

13:01 and you can't try to do a swap! and then a reset! and expect it to be atomic

13:01 post-data and put-data should both just be a single swap!

13:03 example there for post-data

13:03 XPherior: I've always wondered about this.. (def x (agent nil)) (send x #(println "Hey"))

13:03 Where's the output go from nrepl? I'd expect inside the repl

13:03 akells`: thanks tomjack. so the @ is unnecessary in this case?

13:04 supersym: justin_smith: thats not really an issue I think, mostly would use them for their side-effects... to be more concrete, I was looking for a bit more advanced (todo ...) than just ;; TODO stuff

13:04 anyway I just realized I can use meta-data... that has the info I'd need

13:04 tomjack: put-data is going to be like (swap! storage-map (fn [storage] (-> storage (dissoc previous-data) (assoc new-data new-data))))

13:04 (just noticed #(merge % {new-data new-data}) is just #(assoc % new-data new-data))

13:05 CaptainLex: How would I go about having a macro take branches based on the prefix of a variable name?

13:05 tomjack: it's not really that the @ is unnecessary (it is), it's actually wrong

13:05 akells`: oh, okay

13:05 tomjack: if you @ and then use the result to swap!/reset!, the atom may have changed since you @, breaking atomicity

13:05 gtrak: CaptainLex: (case prefix ...)?

13:05 tomjack: only a single swap! or reset! will be atomic

13:06 dnolen_: CaptainLex: convert the symbol to a string and use a regex + some conditional as suggested by gtrak

13:06 tomjack: the fn passed to swap! gets the current value of the atom as an arg, which you can use instead of @

13:06 futile: woot, UXing like a pro

13:06 tomjack: something like that

13:06 CaptainLex: dnolen_ and gtrak: Thank you!

13:07 tomjack: to me it would seem to make more sense to use a separate key

13:07 akells`: I see tomjack

13:08 ParahSailin: is there a better repl? im using jline but i have to mentally keep track of backspaces if i make a mistake

13:08 hyPiRion: ParahSailin: are you using `lein repl`

13:08 ?

13:08 akells`: thank you so much tomjack, you've set me on a good path. it is much appreciated

13:08 tomjack: not sure how you plan to use these though

13:09 ParahSailin: leiningen?

13:09 clojurebot: http://github.com/technomancy/leiningen

13:09 hyPiRion: ParahSailin: Yeah, the repl which is bundled with leiningen.

13:10 Are you using Leiningen by the way?

13:10 ParahSailin: ah, i was just using java -cp

13:10 tomjack: akells`: e.g. could be that an atom is not what you want after all :), hard to say without knowing what you're really trying to do. if you're basically using it as an in-memory database, I think it makes sense

13:13 futile: (let [children (for [child-key (:child-keys parent)] (find-by-key child-key)] ...)

13:13 O postgres, how I long for thee.

13:15 tomjack: s/in-memory database/in-memory kvstore/

13:16 futile: tomjack: (i wasn't responding to you btw, in case you thought so)

13:19 ParahSailin: is there a better way to hack a jar file into the -classpath of lein repl than manually grabbing the actual java command and editing it?

13:20 gtrak: yes, install it in your local maven repo and add a dependency to project.clj

13:20 Raynes: cemerick: You need to get off the JS, man.

13:20 I know some great rehab facilities if you ever want to get clean.

13:21 TimMc: ~repeatability

13:21 clojurebot: repeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability

13:21 TimMc: ParahSailin: ^

13:29 futile: Any of you guys use Clojure + ClojureScript in the same webapp?

13:30 I'm thinking this will go well with ajax to make a site very neat.

13:30 dnolen_: futile: lots of folks do that

13:30 futile: (well not ajax, acljsj really)

13:31 dnolen_: oh wait this is a mailing list question

13:31 sorry

13:31 Raynes: futile: I've considered it for refheap

13:31 But I can't justify moving the reasonably trivial javascript over to clojurescript.

13:32 And adding a compilation step

13:32 ParahSailin: ok, having trouble make it use the correct overloaded constructor now

13:32 futile: I'm mostly wondering about how you usually set it up, like if you just have a normal Clojure project that happens to have a small Cljs section too, or if they're two separate projects, or what

13:32 dnolen_: futile: not specific enough to be mailing list question ;)

13:32 futile: ParahSailin: HA! nice name!

13:33 dnolen_: maybe I should just try doing the clojurescript-getting-started guide first

13:33 then i can find out what my questions really are

13:33 dnolen_: futile: probably

13:33 futile: thx dnolen_

13:33 (inc dnolen_)

13:33 lazybot: ⇒ 1

13:33 futile: $karma dnolen

13:33 lazybot: dnolen has karma 9.

13:33 futile: o

13:33 meh not my problem

13:36 Raynes: (inc dnolen)

13:36 lazybot: ⇒ 10

13:36 Raynes: futile: He doesn't actually have to be here.

13:36 futile: (dec dnolen_)

13:36 lazybot: ⇒ 0

13:36 Raynes: (inc ilikecherrypieandghostpeppers)

13:36 lazybot: ⇒ 1

13:36 futile: all fixed

13:36 Raynes: no i get it dont worry

13:36 Raynes: merge plz kthx

13:37 Raynes: futile: Alan isn't here yet.

13:37 futile: o rite

13:37 sorry forgot

13:37 well not really but thats the shorter answer

13:37 Raynes: Within 2 hours he'll be here and I can solicit advice.

13:37 futile: meh no rush

13:37 bbloom: SegFaultAX: my semver rant as promised: http://www.brandonbloom.name/blog/2013/06/19/semver/

13:39 * Raynes hugs bbloom

13:39 jweiss: is there a lib where i can emit valid html just like clojure.data.xml?

13:39 Raynes: jweiss: hickory

13:39 bbloom: Raynes: heh. aw /me hugs back. is that an approval of my point of view? :-P

13:39 Raynes: bbloom: I saw "semver" and "rant" in the same sentence.

13:40 bbloom: Raynes: heh, that sums it up

13:40 futile: enough commas already bbloom

13:40 * Raynes punches futile in the gut.

13:40 technomancy: bbloom: isn't semver a classic Postel's Law thing?

13:40 futile: "Sadly, this is rarely, if ever, true." - I was taught to write this way in college but now I find it really hard to read, /cc bbloom

13:41 Raynes: bbloom: guarentees is not a word, fwiw.

13:41 I hate that word so much.

13:41 I can never remember how to spell it.

13:41 tomjack: bbloom: what's the thesis?

13:41 futile: "Sadly, it's never true. Well okay maybe sometimes."

13:41 That's how I'd do it :D

13:41 bbloom: Raynes: whoops. did spell check but forgot to commit/push it!

13:42 tomjack: I think I agree with everything you said but it doesn't seem to change how I feel about semver

13:42 bbloom: futile: i'm not you :-P

13:42 Raynes: I, disagree, futile. More, commas, are, better.

13:42 futile: bbloom: it's not about me or you though.. it's about a virus, a writing style that everyone thinks is professional and fancy but is really just hard to read.

13:43 bbloom: technomancy: how does postel's law apply here?

13:43 futile: But everyone emulates it anyway because that's how they read smart people writing, and they want to sound smart, so it spreads like wildfire.

13:44 bbloom: futile: is that the only sentence you have a problem with in my post? informal speech/tone generally involves a lot of commas…..

13:44 futile: bbloom: "However, statistically speaking, ..."

13:45 bbloom: *shrug* ok, i'll consider/analyze my comma usage in the future, just, for, you, buddy

13:45 TimMc: futile: "Want" has nothing to do with it. People absorbthe writing styles of what they read.

13:45 futile: bbloom: "individuals and projects use SemVer, or something like it, to good effect."

13:45 TimMc: yea doth I know, sir.

13:45 technomancy: bbloom: I mean that just because you can't trust The World to work that way doesn't mean it's not a good idea to do your best on it when you can.

13:45 bbloom: personally, i like extra punctuation for the same reason i like parenthesis in lisp: explicit grouping is a good idea

13:46 futile: bbloom: not when it makes it feel like stuttering when I read it

13:46 technomancy: bbloom: more interesting to me actually is deconstructing the idea that you can have bugfixes that don't break backwards-compatibility

13:46 futile: bbloom: anyway I've only had this opinion in the past year or so, ever since I've started reading books translated from french or latin into English a few hundred years ago

13:47 they're really, really hard to read. And it's not necessary either. I could easily rearrange the sentences and it reads much more natural.

13:47 bbloom: technomancy: are you suggesting that producing==stamping-versions and accepting==resolving-dependencies ?

13:47 technomancy: bbloom: right; exactly

13:47 hyPiRion: technomancy: Well yeah, in theory that doesn't make sense, because one could depend on that specific bug.

13:47 technomancy: hyPiRion: right; nearly every release includes breaking changes by definition

13:47 TimMc: hyPiRion: Citation: The Win32 library.

13:48 hyPiRion: technomancy: different semantics at least.

13:48 technomancy: hyPiRion: but we don't act as if that were true; we construct this notion of intended behaviour that you're supposed to be coding against, even though it's almost never defined

13:48 futile: bbloom: in Ruby that would really be person.address.residents, much closer to the threading macro than C's or Python's version

13:48 ot

13:48 bbloom: technomancy: personally, i always depend on precise commits for production systems

13:48 futile: the only feature I wish gist had was an RSS feed

13:48 TimMc: bbloom: What I'd like is something that suggests a new set of dependencies (based on semver) that I can then go and investigate.

13:48 hyPiRion: technomancy: yeah, that's the issue

13:48 futile: then my gists would be a full-fledged blog

13:49 technomancy: hey check out my blog https://gist.github.com/evanescence

13:49 :D

13:49 hyPiRion: Well, issue and issue.

13:49 technomancy: futile: you misspelled blagh

13:49 futile: blarg!

13:49 technomancy: futile: lol @ go

13:49 futile: ty

13:50 my fav one is "Lock up your solutions"

13:50 well, right after the "Go 1.1" one

13:50 jcromartie: can someone help me understand how a Clojure fn is a valid java.util.Comparator?

13:50 it just is

13:51 #(isa? (class #()) java.util.Comparator)

13:51 tomjack: jcromartie: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/AFunction.java#L46

13:51 jcromartie: ,(isa? (class #()) java.util.Comparator)

13:51 clojurebot: true

13:51 supersym: damn I could be paranoid.. but is #linguistics filled with only bots >< Some answers and sentences they utter... I don't know.

13:51 hyPiRion: jcromartie: if it returns something truthy, then the comparator returns +1 or something, wheras if it returns falsey it returns -1

13:51 jcromartie: er, never mind

13:52 hyPiRion: or 0

13:52 I don't rmemembe.r

13:52 bbloom: jcromartie: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/AFunction.java#L46

13:52 jcromartie: I completely glossed over java.util.Comparator right there in ,(ancestors (class #()))

13:52 hyPiRion: Oh what, that has to be the best attempt at writing "remember" I have ever done.

13:52 jcromartie: I was mistaken

13:52 hyPiRion: I think that's a new JRPG

13:53 hyPiRion: jcromartie: what? "rmemembe.r" or "remember"?

13:53 jcromartie: "rmemembe.r"

13:54 kidding of course

13:54 hyPiRion: I wouldn't be surprised

13:55 futile: whoa!

13:55 gists even have comments!

13:55 ok gist is literally the best blog engine ive used so far

13:55 maybe it *does* have RSS? then i'd be all set!

13:55 supersym: oh this cleverbot is pretty nice though... I see gfredericks mentioned him once in teh irc logs

13:56 hyPiRion: jcromartie: http://www.youtube.com/watch?v=a0g8bwYzMyU

13:56 Tropby: Moin.

13:57 supersym: How do we get world peace?

13:57 They world will now the result of all this information processing in due time.

13:57 not so smart though...

13:59 cemerick: anyone have any idea why Google Closure would produce a conditional here? https://gist.github.com/cemerick/5816340

14:01 supersym: damn...it speaks dutch. Thats wicked tho

14:02 dnolen_: cemerick: nothing to do with Closure that's an optimization for Clojure fns when used higher order

14:02 ClojureScript rather

14:03 cemerick: is that causing an issue in your case? (Math.seedrandom doesn't exist in JS anyway)

14:04 cemerick: dnolen_: Confused. Nothing higher order there. emitted.js is what cljs emits AFAICT; the conditional only appears after advanced compilation.

14:04 yeah, Math.seedrandom is provided by a lib

14:04 jcromartie: hyPiRion: hahaha, it broke the CC system

14:04 cemerick: It's not causing an issue; I just noticed it in the process of making that library compatible with gclosure advanced

14:05 hyPiRion: jcromartie: yeah. heh

14:05 It's not a surprise though :p

14:05 futile: i like how sometimes after 0.0 seconds of making a request to github, it immediately comes back to the page that says "this page is taking way too long to load"

14:05 nginx misconfiguration methinks

14:05 dnolen_: cemerick: well the optimization was introduced for higher order cases, but for any function we can't resolve we check to see if there's faster path for ClojureScript fns

14:06 cemerick: but that's expected, it should appear if you write (js/Math.seedrandom ...)

14:06 shouldn't

14:07 cemerick: ah-ha, will try

14:10 dnolen_: OK. I had no idea that cljs emitted different code for different optimization levels!

14:10 dnolen_: cemerick: it has for a long time now

14:10 cemerick: :static-fns is the compiler option - this is one by default under advanced

14:10 makes a huge difference

14:10 "this is on"

14:11 cemerick: dnolen_: noted, thanks :-)

14:11 dnolen_: static dispatching wherever possible to correct arities

14:11 including fancy calling into variadic fns by allocating array at call site

14:11 to avoid touch arguments objects in the all the cases

14:12 cemerick: riiight, that I remember

14:14 dnolen_: cemerick: you should look at emit :invoke in compiler.clj it's pretty funny

14:14 but all of these cases make CLJS much, much faster

14:17 cemerick: hah

14:17 man, that gnarly :-)

14:17 dnolen_: cemerick: hah oh yeah

14:18 jcromartie: I could spend forever editing Clojure Cookbook

14:18 :|

14:18 good thing or bad thing?

14:18 dnolen_: cemerick: a lot of it fell out of trying to make persistent data structures not suck perf-wise

14:18 jcromartie: it's a damn good learning experience

14:19 digging into lots of clojure.core and clojure.lang.* source code

14:23 cemerick: right

14:24 dnolen_: any interest in something like goog-dependencies, but generalized to any .js files on the classpath that define provides? Folding something like that in would eliminate most needs for specifying :libs.

14:25 dnolen_: cemerick: sounds interesting, but need more details - open a ticket

14:25 cemerick: sure

14:26 dnolen_: I'm surprised you haven't written a bot to sit on your handle and always respond to questions with "open a ticket" ;-D

14:26 dnolen_: cemerick: hehe

14:27 cemerick: should be a lazybot command. Bat-signal Raynes

14:32 futile: Does anyone ever really use ()?

14:32 ,()

14:32 clojurebot: ()

14:32 futile: So useless.

14:32 (1 2 3)

14:32 ,(1 2 3)

14:32 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

14:32 mefesto: ,'(1 2 3)

14:32 clojurebot: (1 2 3)

14:32 futile: And it's inconsistent. List with nothing is an empty list, list with things is a function/macro-call

14:33 Unless you quote it, of course.

14:33 But you could just as well do '()

14:33 ,'()

14:33 clojurebot: ()

14:33 futile: ,(= () '())

14:33 clojurebot: true

14:33 mefesto: ,(= nil ())

14:33 clojurebot: false

14:33 futile: Why even have ()?

14:33 ,(= nil '())

14:33 clojurebot: false

14:33 manutter: ,(nil)

14:33 clojurebot: #<CompilerException java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0:0)>

14:33 S11001001: futile: it's unambiguous, that's why

14:34 manutter: ,(seq '())

14:34 clojurebot: nil

14:34 justin_smith: also, I imagine common lisp related hysterical raisins

14:34 S11001001: futile: the eval thing is "look at the first thing in the list, and then...". There's no first thing in an empty list.

14:34 manutter: ,(first '())

14:34 clojurebot: nil

14:34 manutter: ,(rest '())

14:34 clojurebot: ()

14:35 futile: I mean, I see the point in having an empty list.

14:35 Yes, an empty list is very useful.

14:35 But why have () mean an empty list? That's so inconsistent.

14:35 '() is fine for an empty list.

14:35 S11001001: Because it's unambiguous, futile.

14:35 futile: So () should just be an error probably.

14:35 Or at least a function-call-ish-thing that returns nil.

14:36 mefesto: () looks like it's empty to me

14:37 what should we do with [] then :)

14:37 looks like an empty vector

14:37 futile: mefesto: but [1 2 3] is also a vector

14:37 mefesto: (1 2 3) is not a list

14:38 mefesto: '(1 2 3) is a list

14:38 mefesto: '() is an empty list

14:38 mefesto: [] is an empty vector

14:38 mefesto: () is an empty function call

14:38 Gnosis-: ,()

14:38 clojurebot: ()

14:38 futile: see the inconsistency?

14:38 mefesto: () is an empty function call?

14:38 futile: no

14:38 but it should be

14:38 hold on

14:38 S11001001: no

14:38 mefesto: why?

14:38 clojurebot: Why is the ram gone

14:38 hyPiRion: (1 2 3) is a list

14:39 ,(list 1 2 3)

14:39 clojurebot: (1 2 3)

14:39 mpenet: ,(type ())

14:39 clojurebot: clojure.lang.PersistentList$EmptyList

14:39 mpenet: ,(type '())

14:39 clojurebot: clojure.lang.PersistentList$EmptyList

14:39 hyPiRion: What you're asking is why () doesn't call the first argument with the rest of the arguments

14:39 mpenet: fine to me

14:39 hyPiRion: Which is because it has no first argument

14:40 TimMc: "Because Rich Hickey said so."

14:40 futile: https://gist.github.com/evanescence/5816707

14:40 Gnosis-: what does () do in Common Lisp or Scheme?

14:41 ToBeReplaced: i can understand his point; and I always use '() when needed (rare) instead of ()

14:41 hyPiRion: Gnosis-: it returns nil

14:41 futile: hyPiRion: () with things in it calls the first argument, when (first it) is nil, it should probably just be the same as (nil ...)

14:41 hyPiRion: NIL, rather.

14:41 mefesto: futile: well it's a list when it's read in but it gets evaluated as well

14:41 ,(read-string "(1)")

14:41 clojurebot: (1)

14:41 S11001001: Gnosis-: in CL, () is self-evaluating; in Scheme it's an error

14:41 TimMc: If it didn't evaluate to an empty list, then (#()) would be less interesting.

14:41 mefesto: ,(eval '())

14:41 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

14:41 mefesto: oh

14:41 futile: I'm so happy with gist as a blog engine.

14:42 amalloy: hyPiRion: are you sure? i think it's undefined in the standards for those languages

14:42 S11001001: amalloy: it is definitely self-evaluating in CL

14:42 hyPiRion: amalloy: Well, for CL at least?

14:42 mefesto: futile: i think "consistent" depends on your point of view: (), [], #{}, {} looks consistent :)

14:43 hyPiRion: Very sure ANSI CL at least defines (), NIL and '() to evaluate to the same thing

14:43 and that car and cdr on NIL returns NIL

14:43 amalloy: hyPiRion: you're probably right

14:43 mefesto: futile: if (1 2 3) generated a list instead of executing then how should we execute code instead?

14:43 Gnosis-: aha, okay, cool

14:44 futile: Cool. Turns out my gist-blog DOES have an atom feed: https://gist.github.com/evanescence.atom

14:44 Sweet. Sign up people.

14:44 mefesto: oh nice

14:45 futile: best blog engine ever

14:45 only thing it's missing are dated-named-permalinks

14:51 Is there a way to compare strings (for sorting) by the end rather than the beginning?

14:52 Oh wait, reverse it first. Duh.

14:52 hyPiRion: ,(sort-by (comp vec reverse) ["cba" "abc" "cab"])

14:52 clojurebot: ("cba" "cab" "abc")

14:53 hyPiRion: gurr, what

14:53 futile: ,(sort-by clojure.string/reverse ["quux" "foo" "bar"])

14:53 clojurebot: ("foo" "bar" "quux")

14:53 hyPiRion: yeah, that.

14:53 futile: :P

14:54 Oh wait, juxt to the rescue!

14:54 ,(sort-by (juxt clojure.string/reverse identity) ["quux" "foo" "bar"])

14:54 clojurebot: ("foo" "bar" "quux")

14:55 futile: That didn't help.

14:55 hyPiRion: I don't see how it matters there

14:55 futile: that is sorted by the last char, what more are you asking for?

14:56 Raynes: tpope: ping

14:56 hyPiRion: o < r < x

14:57 futile: basically i wanted to group filenames by extension and then sort them within those groups

14:57 but i figured out a hacky way thats faster so meh nm

14:58 borkdude: what is a common way to sort maps by value: (sort (fn [a b] (pred (second a) (second b))) some-map) or something shorter?

14:58 Zamarok: what's the best way to take n elements from the end of a list? Maybe something like (take n (reverse xs))? Or is there way to do it without reversing the whole list

14:58 gfredericks: &(doc nth-tail)

14:58 lazybot: java.lang.RuntimeException: Unable to resolve var: nth-tail in this context

14:59 gfredericks: $findfn [1 2 3 4 5 6] 2 [5 6]

14:59 lazybot: []

14:59 gfredericks: $findfn 2 [1 2 3 4 5 6] [5 6]

14:59 lazybot: [clojure.core/take-last]

14:59 gfredericks: found it

14:59 hyPiRion: Zamarok: list or vector?

14:59 You can do subvec, which is much faster

14:59 Zamarok: hyPiRion: list

14:59 hyPiRion: ah

15:00 Zamarok: hmm, ok.. noted. thanks

15:00 you too gfredericks ^^

15:00 hyPiRion: (obviously you can only do subvec for vectors.)

15:01 Zamarok: makes sense

15:01 hyPiRion: :o

15:01 ,(instance? clojure.lang.Counted (list 1 2 3))

15:01 clojurebot: true

15:02 ianeslick: Anyone run into the leiningen warning: ":gpg and <password> have a type mismatch merging profiles"? I can't see where I'm still specifgying :gpg anywhere

15:04 fsmunoz: I have a werid problem which I'm not sure is obvious or not, my lack of Java knowledge is likely at fault here. I have a getTableChangeDescription() function which returns "abstract TableChangeDescription[]"; this is "Interface TableChangeDescription" in the docs. However wheh I do a (println "Event type: " (.getTableChangeDescription evt) the class type (also checked with type and class) is "#<NTFDCNTableChanges[]

15:04 [Loracle.jdbc.driver.NTFDCNTableChanges;@301cb7b>". I wouldn't mind but this thing doesn't accept any of the methods in the documentation... any ideas?

15:04 s/werid/weird/

15:05 Raynes: tpope: Never mind. I should know by now that if I ever have a problem with Vim I should just look at your Github page.

15:05 amalloy: fsmunoz: it returns an array of things which do accept those methods

15:05 the array itself, doesn't, of course, just like you can't multiply '(5 6 7) by 4 without first taking things out of the list

15:06 futile: amalloy: hey did you get that merge i sent ya?

15:07 borkdude: no-one?

15:07 what is a common way to sort maps by value: (sort (fn [a b] (pred (second a) (second b))) some-map) or something shorter?

15:07 fsmunoz: amalloy: right, right, I see. I was expecting that to be clearer in the documentation, probably clear enough by the [] I suppose...

15:07 amalloy: that is specifically what [] means

15:07 fsmunoz: amalloy: so I should reference the first entry and see if it accepts the method

15:07 amalloy: yes, I'm seeing that now, thank you. Still not used to reading the obvious in the Java documentation.

15:08 justin_smith: borkdude: (sort-by pred some-map)

15:08 borkdude: sorry, make that (sort-by second pred some-map)

15:08 pred usually being comp and is an optional arg

15:08 borkdude: justin_smith thank you

15:09 justin_smith: also comparator is a better term than pred there, just reusing your term for clarity

15:10 fsmunoz: amalloy: perfect, it works as expected with an aget, many thanks!

15:12 TimMc: &(sort - [1 5 2])

15:12 lazybot: ⇒ (1 2 5)

15:12 TimMc: &(sort-by - [1 5 2])

15:12 lazybot: ⇒ (5 2 1)

15:16 justin_smith: TimMc: (comp - compare) seems like it would be useful

15:19 Raynes: yogthos: Man.

15:19 I get so many emails from your crazy pull request stuff.

15:19 yogthos: Raynes: haha I've been busy eh :P

15:20 gtrak: justin_smith: I call that function 'descending'

15:20 yogthos: Raynes: lol some of it didn't need to be on a branch I suppose, but kind of used to doing it now :)

15:20 akrikos: weavejester: I'm trying to build a webapp using ring that only uses wrap-reload in a dev environment. To do this, one tutorial suggests using wrap-if, but that seem to be available anymore. How should this be done now (I can't find wrap-if anywhere)? Apologies if this is readily available info somewhere… couldn't find it.

15:20 TimMc: &(.compare trampoline - 7)

15:20 lazybot: ⇒ -7

15:20 yogthos: Raynes: btw you see the access rule madness that came out of one of the issues? :)

15:20 weavejester: akrikos: I've never heard of wrap-if

15:21 yogthos: Raynes: check it out :) http://yogthos.github.io/lib-noir/noir.util.middleware.html#var-wrap-access-rules

15:21 gtrak: then I write stuff like: (->> entities (sort-by last-touched descending) (take n))

15:21 Raynes: yogthos: Yeah, that seems like the hardest tiny piece of code to get right ever given the number of issues about it recently.

15:21 akrikos: weavejester: ah. I got the idea from here: http://mmcgrana.github.io/2010/07/develop-deploy-clojure-web-applications.html but my co-worker is telling me I can add it easily… thanks for the response

15:22 Raynes: I was actually considering telling you to make it a separate library until I realized how small it was.

15:22 weavejester: akrikos: If you use lein-ring, it adds wrap-reload automatically for you when in development

15:22 yogthos: Raynes: yeah it's really tricky to get right and please everybody apparently :P

15:22 Raynes: hopefully now it's bulletproof :P

15:23 weavejester: akrikos: If you're manually creating your -main function, you can choose to apply dev middleware depending on some configuration setting.

15:23 Raynes: yogthos: Nothing to lose, fire away, fire away.

15:24 yogthos: weavejester: oh have a question about clout, I was using route-matches to check if the uri in the request matched the specified pattern, and I noticed that if you use context then it won't match, is that intentional?

15:24 gf3: sjl: Scala scares the shit out of me sometimes

15:24 sjl: "Heard u liek syntax, bro"

15:25 sjl: gf3: the syntax is horrifying coming from clojure

15:25 weavejester: yogthos: Clout prefers :path-info over :uri if that's what you mean.

15:25 yogthos: weavejester: eg: (context "/foo" [] (GET "/bar" [] ...) will still have uri "/foo/bar" but clout will not treat it same as (GET "/foo/bar" ...)

15:25 ah

15:25 `fogus: weavejester: Thanks again for the core.memoize bug report.

15:25 akrikos: thanks weavejester. I was off ze rails.

15:25 (inc weavejester)

15:25 lazybot: ⇒ 8

15:25 weavejester: `fogus: Thanks for fixing it :)

15:25 gf3: sjl: Evaluated using Scala + Akka for a project last fall, opted for Ruby + Celluloid :-/

15:26 sjl: I'm looking forward to poking at akka a bit... can you use it from Clojure/other JVM langs or is it really tied to scala hard?

15:27 yogthos: sjl: there are clojure wrappers for it

15:27 sjl: yogthos: ah cool

15:27 yogthos: eg https://github.com/jasongustafson/akka-clojure

15:27 sjl: neat

15:30 Zamarok: Is there a builtin function for finding elements in a list? Like `(search 5 (range 10)) => 5`

15:30 Seems like a very basic function, but hell if I can't find it

15:31 sjl: Zamarok: are you trying to get the actual element out, or the index?

15:31 I can't really tell from your example because I think they'd both be 5...

15:31 Zamarok: an element, if it exists, else nil I suppose

15:31 weavejester: Use a set

15:31 Zamarok: Oh, good point. The element itself

15:31 My data is already a very large list

15:32 sjl: &(some #(= :b) [:a :b :c])

15:32 lazybot: clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox5671$eval155578$fn

15:32 sjl: &(some #(= :b %) [:a :b :c])

15:32 lazybot: ⇒ true

15:32 sjl: er

15:32 Zamarok: went down the 'some' road already

15:32 weavejester: &(first (filter #{:b} [:a :b :c]))

15:32 lazybot: ⇒ :b

15:33 Zamarok: ah.. but doesn't that traverse the entire list? I want it to stop when it finds the element it was looking for

15:33 weavejester: No, filter is lazy

15:33 Zamarok: Oh o_o laziness continues to amaze me

15:33 sjl: &(let [find (comp first filter set)] (find :b [:a :b :c]))

15:33 lazybot: clojure.lang.ArityException: Wrong number of args (2) passed to: core$set

15:34 sjl: bleh

15:34 weavejester: No currying :)

15:34 sjl: &(let [find (comp first filter hash-set)] (find :b [:a :b :c]))

15:34 lazybot: clojure.lang.ArityException: Wrong number of args (1) passed to: core$filter

15:34 sjl: oh ffs

15:34 yeah

15:34 Zamarok: auto-currying is one thing I miss from Haskell

15:35 Raynes: gf3: HI

15:35 weavejester: It's a shame, but imo var-args are more useful

15:35 Raynes: gf3: WHERE'S MY REFHEAP CSS CHANGES. YOU TEASE.

15:36 gf3: Raynes: I'VE BEEN REAL BUSY

15:36 Raynes: I HAVE SKETCHES THOUGH

15:56 Raynes: gf3: WHAR SKETCHES

16:00 bpr: is anyone familiar with pedestal?

16:00 Raynes: Nope. Nobody in the whole world.

16:01 stuartsierra: bpr: I'm somewhat familiar with it, but mostly just the back-end parts.

16:03 bpr: ok. I'm having an issue with getting the front-end to recognize new/changed css files. I realize that's front-end, though.

16:03 stuartsierra: bpr: I'm afraid I won't be much help then. Try the mailing list.

16:03 bpr: thanks

16:12 dnolen_: stuartsierra: can we do another CLJS release?

16:12 stuartsierra: dnolen_: not this instant, but yes

16:12 dnolen_: stuartsierra: cool thx

16:13 gzmask: ,(doc ->>)

16:13 clojurebot: "([x form] [x form & more]); Threads the expr through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc."

16:14 gzmask: ,(-> 1 inc)

16:14 clojurebot: 2

16:14 gzmask: ,(->> 1 inc)

16:14 clojurebot: 2

16:14 gzmask: ,(-> 1 (+ 1))

16:14 clojurebot: 2

16:15 gzmask: ,(->> 1 (/ 1))

16:15 clojurebot: 1

16:15 gzmask: ,(->> 0 (/ 1))

16:15 clojurebot: #<ArithmeticException java.lang.ArithmeticException: Divide by zero>

16:15 gzmask: ,(-> 0 (/ 1))

16:15 clojurebot: 0

16:15 kmicu: gzmask: you can /query clojurebot in private buffer

16:15 gzmask: ops, sorry

16:19 jcromartie: rkneufeld: I don't see anything like a "basics" or "Getting Started" chapter that's centered around running a basic Clojure REPL or .clj files, creating a project, etc.

16:22 gzmask: jcromartie: what's your editor of choice

16:23 jcromartie: Emacs

16:23 gzmask: nrepl it is

16:23 jcromartie: gzmask? huh?

16:23 nREPL is great but it comes with a lot of gotchas

16:23 I'm talking about writing some recipes for the absolutely bare-bones basics

16:27 gzmask: i duno. I am new too and I feel Lisp is too flexible to have a big set of best-practices. me myself is learning by doing

16:28 dnolen_: yow

16:28 core.match on primitive arrays flies the wind

16:33 gzmask: I have doubts on the dynamic typed aspect of the language. is this making reading the source code of undocumented libraries a bit hard?

16:33 dnolen_: http://gist.github.com/swannodette/5817742

16:33 gzmask: fortunately most open source Clojure libraries are small

16:34 gzmask: larger teams have started adopting schema like systems from what I hear to document intent

16:34 bbloom: dnolen_: i'm quite enjoying your twitter ramblings about js parallelism sucking

16:35 dnolen_: bbloom: heh, I just get sad panda because zero thought has been put into *real* primitives for doing this stuff.

16:36 ~330ms for the final clause

16:36 bbloom: dnolen_: to me, there are parallels with the svn -> git transition for typical programmers

16:36 clojurebot: I don't understand.

16:36 dnolen_: that's pretty sweet

16:36 gzmask: well if open source means RTFSC then I am very scare of dynamic type languages

16:37 bbloom: dnolen_: you can't have parallelism unless you can fork a data structure & just as `svn cp /trunk /branches/foo` sucks, so does Object.clone

16:37 gtrak: gzmask: there's lots of ways to enforce or document contracts, typing is just one. I was scared of the freedom at first, but it grows on you

16:37 bbloom: so no matter what any runtime does, short of standardize some immutable data structures, parallelism is gonna suck

16:38 dnolen_: bbloom: that's what I mean - no talk about standardizing immutable data structures

16:38 bbloom: or at least providing something akin to final

16:38 gtrak: gzmask: there's a huge advantage in treating objects/things as data, and clojure emphasizes that

16:39 bbloom: dnolen_: i'm doing some Ruby work for a client right now & they had an algorithm that desperately needed some minor backtracking/speculation. so i swapped out their arrays and hahses with https://github.com/harukizaemon/hamster

16:39 dnolen_: bbloom: nice

16:39 bbloom: dnolen_: result? ~20 lines of code changed & suddenly we could do speculative evaluation

16:39 minds: blown.

16:40 dnolen_: bbloom: haha

16:40 immutability is a hell of drug

16:40 futile: new blog post again, something about documenting properly: https://gist.github.com/evanescence/5817408

16:40 man, writing blogs is fun!

16:42 bbloom: dnolen_: "i want to apply one of the operations from a list, then pick the result which maximizes some function"

16:42 dnolen_: the proposed solutions were entertaining

16:43 technomancy: futile: "Use codox, it's beautiful. This is where users will go every time they need to use your library." what

16:43 gtrak: futile: () is empty-list in other languages too

16:43 technomancy: futile: users will use docstrings

16:43 in the repl

16:48 gtrak: reading implementation code is always worthwhile in this community, I'm not sure how you can avoid it in other langs anyway unless your usages of libs are trivial.

16:48 I've had plenty of java deep-dives, too

16:49 bbloom: gtrak: diving, drowning, what's the difference really?

16:49 gtrak: bbloom: I guess the difference is whether you decide to stay in the water afterwards

16:49 futile: technomancy: if you know the name of the function you're looking for

16:50 gtrak: or possibly the decision might be made for you..

16:50 futile: technomancy: im sure its possible to use the repl to discover a library's namespace names, and functions within them

16:50 technomancy: but that sounds hard

16:50 gtrak: M-. is the most useful tool I have

16:51 futile: okay then let me change it to say 50% of users use codox, the other 50% use the repl

16:52 gtrak: I might cross-reference my code-reading with official docs, but the code's primary, I find that's a more effective use of time

16:53 jeremyheiler: futile: why do you say it's 50%?

16:53 futile: gtrak: i admit ive done both at differnt times

16:53 VFe: Personally I find codox quite useful since it's a very high level view of the code-base, but then I'm a little more graphically oriented. Can't speak for anyone else obviously.

16:53 futile: jeremyheiler: because it seems half of us havent yet become pros at repl-style development yet

16:53 jeremyheiler: The number seems entirely made up

16:53 futile: jeremyheiler: most of my numbers are based on intuition and experience, not hard stats

16:53 but ive found them pretty reliable, so meh

16:54 VFe: ditto

16:54 gtrak: I'd say I'm visual too, but I prefer my own visualizations and understanding to someone else's views

16:55 futile: gtrak: i dunno, this page is pretty awesome: http://ring-clojure.github.io/ring/index.html

16:55 gtrak: the code is the canonical source of the information, I try to build a bigger picture of intent from docs

16:55 futile: that just looks like noise to me :-)

16:56 futile: gtrak: no i mean click around on the left side.. then its wonderful

16:56 btw,

16:56 bbloom: futile: i agree with gtrak. that is completely useless to me

16:56 futile: this blog post was really aimed at motivating libs like https://github.com/8thlight/hyperion to shape up

16:56 bbloom: i hate javadoc & anything like it

16:57 gtrak: futile: I prefer grep to visual scanning

16:57 futile: because i love that lib and want more people to use it, but even i find the docs very lacking and hard to nav

16:57 gtrak: ring clicked when I read through the code and saw how people actually used it

16:58 sjl: http://jacobian.org/writing/great-documentation/

16:58 futile: ditto for ring.

16:58 gtrak: compojure clicked when I read every damn line

16:59 only took a couple hours

16:59 futile: pft, i got compojure right away, all i had to read was defroutes, routes, and route or something like that

16:59 not cuz im smart, but cuz its simple

17:00 gtrak: you think you get it, until it does something unexpected :-)

17:00 fsmunoz: Er, another obvious one that I'm having trouble with: how do I get the string value of an Enum? I have (str (.getTableOperations change) which seems tos enclose the result in [] (and likely is ont the right apporach anyway)

17:00 gtrak: like.. answer why is it uuencoding my query params..

17:00 or decoding them..

17:00 caused a bug, now I know where to look.

17:00 dnolen_: sjl: I respect Jacob Kaplan Moss he's a nice guy, but any framework that needs 700 pages of docs needs to be burned to the ground.

17:01 I hated going through Django docs

17:01 VFe: Compjure took me awhile, cause I was completely new to http as well at the time, learning compjure was like 95% figuring out wtfhttp, 5% compojure, hah

17:01 bbloom: dnolen_: oh yeah, rough. sooo verbose

17:01 gtrak: I gave up on Django, because I tried to understand it

17:01 sjl: dnolen_: there's something to be said for "tons of people use it because it actually works and gets things done"

17:01 gtrak: it made me feel like I was missing something :-)...

17:02 dnolen_: sjl: does not compute

17:02 sjl: lol

17:02 practicality beats purity

17:02 better?

17:02 clojurebot: better is swiss

17:02 gtrak: writing code without knowing what it's doing is much harder for me than taking the time, that's just me

17:03 bbloom: gtrak: yeah, my paranoid nervous twitches consume quite a lot of time

17:03 sjl: Django's admin interface alone saves like 50% of the time writing simple client CMS sites

17:03 dnolen_: sjl: it works, it solves problems - doesn't mean I like it

17:03 bbloom: sjl: i miss Microsoft Access.

17:03 VFe: gtrak, yeah. Me personally I'm more of a reverse engineer…I only learn by breaking things

17:03 sjl: sure

17:03 bbloom: see also: excel

17:03 bbloom: sjl: Django's admin (and ActiveAdmin for Rails) are nice

17:03 but maaaan i miss access

17:03 gtrak: VFe: breaking things lets me know I'm totally missing something. I try not to rely on it.

17:03 bbloom: so easy to make little GUIs tools for business folks to fuck with

17:03 sjl: excel ain't pretty but I bet it gets more done in a day than most languages have ever gotten done in their lifetimes

17:04 bbloom: the world runs on excel & visual basic for applications is the most popular programming language by number of "developers" by a huge margin :-P

17:04 gtrak: VFe: for instance, if you don't have immediate feedback, ie a stacktrace, you're out of luck.

17:04 VFe: gtrak yeah I totally feel like that sometimes too, but it's what drives me to kind of re-build the system in my head

17:06 sjl: but yeah, ignore the "700 pages" part of that series -- jacob is still pretty much spot on about docs

17:06 autogenerated api docs are like trying to teach someone spanish by giving them a dictionary

17:07 if you want to teach someone to use a language/library/guitar/car, *teach* them, don't just list information alphabetically

17:07 clojurebot: Raynes's list of enemies is '(brehaut)

17:07 sjl: clojurebot: you're drunk

17:07 clojurebot: excusez-moi

17:08 VFe: que?

17:08 clojurebot: A bug report (or other request for help) |has| three parts: What you did; what you expected to happen; what happened instead. If any of those three are missing, it is awfully hard to help you.

17:08 brehaut: i think im missing some context, clojurebot

17:09 hoangelos: I'm using procrun and clojure, and I can't seem to call the stop function. It gives me this error: "Method 'static void stop(String[])' not found in Class ../.."

17:09 hyPiRion: I love it when clojurebot is non sequitur.

17:11 dnolen_: sjl: congrats on the new gig, BTW

17:12 sjl: thanks

17:12 gtrak: VFe: trying to actually understand things also helps me stay away from complicated things :-)

17:12 sjl: I think it'll be mostly scala but I'll finally get to actually use Clojure in real life a bit too

17:12 dnolen_: sjl: nice

17:12 sjl: instead of just writing minecraft bots in it

17:12 lol

17:16 i_s: sjl: that sounds cool, do you have any on github or anything?

17:16 sjl: http://github.com/sjl/clojurecraft

17:17 i_s: hasn't been touched in a while tho

17:17 i_s: sweet, i'll check it out

17:17 jweiss: amalloy: i am making a patch to clojure.data.xml to properly handle cdata that contains the characters "]]>". the tests were actually wrong. but i can't figure out how to run them

17:17 (i am bugging you because your name is listed in the pom.xml)

17:18 hoangelos: anyone here use procrun with a clojure app?

17:19 tomjack: sjl: cool, do you have clients which can log in and behave reasonably?

17:19 I implemented the protocol once long ago but gave up when trying to figure out how to actually show up and not just bug out in crazy ways

17:29 gfredericks: I often use C-u C-x C-e to print some data to a buffer -- but when it's a moderate amount of data it all gets printed on one line. Is there any easy way with nrepl.el to get it pretty-printed instead?

17:30 bbloom: i swear i'll stop the shameless self promotion (some day), but everybody in NYC is coming to my awesome talk tonight, right? http://www.meetup.com/Clojure-NYC/events/120698402/

17:32 gfredericks: bbloom: I'm not in NYC nor am I coming, so that's one data point in favor of your theory

17:33 bbloom: where are you at? i'll flight right out tonight after the talk and present my talk to you offer your morning coffee

17:33 s/offer/over

17:34 futile: UX is fun

17:38 gtrak: bbloom: you NYC guys get all the fun.

17:39 mrb_bk: bbloom: can't make it this week - kill it!

17:41 gfredericks: bbloom: chicago

17:41 so at least there's a direct flight :)

17:43 dnolen_: bbloom: sadly I'll miss most of it probably, work party - but I'll try swing by catch the end

17:43 bbloom: sounds like Rich will be the audience ;)

17:43 bbloom: cool

17:43 akhudek: bbloom: videocast it!

17:43 bbloom: *scratches head* i think david greenberg does record them

17:44 akhudek: live

17:44 bbloom: akhudek: heh, unlikely. http://www.youtube.com/user/dsg123456789?feature=watch is where they go i think

17:45 akhudek: too bad, it wouldn't take much to do something like google's hangouts on air or maybe twitchtv or the like

17:46 mikerod: If you give a type hint, but it is incorrect, does any error happen? ex: (defn ^Integer i-return-int [] "hello") then (i-return-int)

17:47 arrdem: traditionally the vardic cases of a function must share one return type, right?

17:47 bbloom: mikerod: easy to try it ##((fn ^long [] "string"))

17:47 lazybot: ⇒ "string"

17:47 bbloom: ,((fn ^long [] "string"))

17:47 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number>

17:47 bbloom: mikerod: seems that it depends on the version of clojure!

17:47 patchwork: Is there a way to print a lein project.clj map out in the same format it is written?

17:48 pprint for instance puts keys and vals on different lines

17:48 but in a project.clj the val is on the same line as the key

17:48 mikerod: bbloom: I did try it and didn't seem to be getting errors. So then I was confused. That is interesting that results may vary though.

17:48 tomjack: ,((fn ^Long [] "string"))

17:48 clojurebot: "string"

17:49 tomjack: the error above happens only with ^long and ^double

17:49 mikerod: I guess what this means is, don't assume type hints will catch incorrect types; but don't accidentally give the wrong type hint, because it may throw exceptions

17:50 bbloom: tomjack: ah, primitives vs boxed types?

17:50 gtrak: is there a good write-up yet about clojure's relation to the 'right tool for the job' and sort of 'languaginess' of the language?

17:51 mikerod: tricky tricky primitives

17:52 gtrak: I feel propagandish..

17:56 dnolen_: mikerod: type hints have always been about optimization

17:57 ztellman: gtrak: I just discovered no-disassemble, it's very cool

17:57 are you aware of any representation of the bytecode which isn't just a pretty-printed string, though?

17:57 gtrak: ztellman: thank you :-) it's incredibly simple

17:58 ztellman: I dug through the jdt stuff a bit, to no avail

17:58 technomancy: gtrak: oh, does that make sense to expose as an auto-discovered nrepl command?

17:58 gtrak: ztellman: when I posted about it, hugod mentioned there's some bytecode stuff in ritz

17:59 technomancy: https://github.com/technomancy/nrepl-discover etc

17:59 ztellman: btw, if anyone here isn't familiar with this, it's great, you can just call 'disassemble' at the repl: https://gist.github.com/ztellman/5800916

17:59 gtrak: technomancy: possibly, but I'm wary of making it a generally useful thing when there's no cleanup of old classes

17:59 ztellman: potentially could also dig into the eclipse classes for something smaller

18:00 technomancy: I think to do it right, I have to transform clojure's classloader to handle cleanup.

18:00 technomancy: I can't tell if no one is interested in the nrepl-autodiscover stuff because none of the other editor devs have time to check it out, or if users just don't see the point

18:01 gtrak: ztellman: https://github.com/pallet/ritz/blob/develop/debugger/test/ritz/jpda/disassemble_test.clj#L90

18:02 ztellman: gtrak: thanks, I'll take a look

18:02 gtrak: ztellman: the eclipse disassembler implementation, it's a mess of visitors as you'd expect

18:02 ztellman: I don't really need anything more than the pretty-printed version right now

18:02 it was more out of curiosity

18:03 gtrak: yea, I'm willing to work on it, messing with the DynamicClassloader in the agent would be the next step, I think, but I'm not sure how hard it is.

18:04 technomancy: did you get anywhere with lein agent support?

18:04 technomancy: gtrak: yeah, it's in 2.2.0

18:04 gtrak: ah, I'll take a look

18:08 technomancy: it's not jumpting out at me, can you give me a pointer?

18:09 ah, I see it now :-) :java-agents

18:11 tomjack: glad to see the array perf mystery solved :)

18:12 I had just looked at the commits in master a minute ago to see what the heck got fixed since 1.5, and was baffled

18:12 dnolen_: tomjack: many perf mysteries solved at once

18:12 I've been scratching my head at why core.match / logic got slower for months

18:17 brehaut: cool

18:17 wrong window

18:18 gtrak: ztellman: if you've got any comments about my arrays of structs stuff, I would love to flesh that out, too, still just a toy, but I think I could implement it both on top of sun.misc.Unsafe and ByteBuffer.

18:19 ztellman: gtrak: where is this?

18:19 gtrak: on github.com/gtrak/knr

18:20 here's usage: https://github.com/gtrak/knr/blob/master/src/knr/core.clj#L136

18:21 ztellman: https://github.com/ztellman/vertigo has unsafe/bytebuffer stuff

18:21 I wasn't aware of your project, actually

18:21 gtrak: oh, ha

18:22 it was a post-conj sort of proof-of-concept, just to explore the possibility.

18:22 ztellman: yeah, took me a while to get around to it

18:23 mine tries to make the resulting data-structure indistinguishable from a normal clojure sequence

18:23 but with special high-performance accessors

18:24 gtrak: ah, that sounds pretty useful. I was starting to feel a mismatch and felt a need to carry around some type information in a macro, are you doing stuff like that?

18:25 I'll dig in sometime

18:26 ztellman: gtrak: clojure's compiler barfs when you add a tag that's not a class, so I compromise with a metadata keyword that can be resolved at compile-time as a valid struct

18:26 works surprisingly well, even if the code that figures it out is a bit ludicrous

18:26 gtrak: also, do you handle n-dimensions?

18:26 ztellman: yeah, array is variadic

18:26 I should make that clear in the docs

18:27 gtrak: sweet, I'll definitely check it out

18:27 ztellman: oddly, I'm not seeing a very big performance difference between direct bytebuffers and unsafe

18:28 maybe the jit's just that good, though

18:28 gtrak: yea, I read somewhere that hotspot can avoid bounds-checks in most cases

18:30 still, it's nice to have a good interface to it. I think it makes a good case for lisp. high-level better than java, low-level better than java.

18:31 ztellman: gtrak: yeah, I'm playing around with a core iteration/reduction abstraction right now

18:31 once that's there, you get some pretty nice compile-time guarantees in terms of correctness

18:31 certainly more than java could when using byte-buffers, let alone unsafe

18:39 futile: I like ##((juxt get dissoc) {:a 1 :b 2} :a) in theory, but haven't found a good use for it yet.

18:39 lazybot: ⇒ [1 {:b 2}]

18:40 gtrak: could use it in a reduce

18:41 futile: How?

18:41 clojurebot: with style and grace

18:41 futile: <3

18:41 (inc clojurebot)

18:41 lazybot: ⇒ 28

18:41 gtrak: say you want to pop off stuff every iteration and keep track of the last element in your accumulator :-)

18:42 don't know why you would want to do it, but that's a situation where I might come up with that solution

18:42 futile: I think I needed that once.. and asked about it on the mailing list...

18:42 hmmm

18:44 Oh! https://groups.google.com/d/msg/clojure/59anbc5Md9g/CcP0CJ98RecJ

18:45 I bet it could be used for that.. somehow

18:46 gtrak: first arg is the accumulator, which can do anything you want. difference between reduce and a loop is you don't get arbitrary control-flow.

19:43 Morgawr: s'up guys, I'll ask once again hoping for a helping hand. I have a ClojureScript library I am developing, this library uses a .js file for some native code (using :libs in project.clj). I package this library as a .jar with :jar true and built with "lein install". When I require the library in my other project that uses it, however, it can't find the .js native stuff. How do I package a javascript file with a clojurescript library?

19:45 tomjack: presumably :libs is something cljsbuild looks for?

19:46 Morgawr: tomjack: :libs is something used to include javascript files that are google closure compliant (aka with a goog.provide("namespace.name")) so you can require and refer them as if they were native code inside your clojurescript code

19:46 the problem is that I can't get to package the .js file with my library as a .jar (inside the .jar there's all the .cljs files)

19:46 tomjack: you think if the js file is on the classpath, it will work for the user?

19:46 Morgawr: if I copy over the .js file and then add it to the project as :libs manually, it works

19:47 tomjack: all you'd need to do is tell leiningen to include it in the jar

19:47 maybe :resource-paths ["foo/bar/baz.js"]

19:47 oh

19:47 right

19:47 nevermind

19:48 even if it's in the jar AND libs are looked for in the classpath, the user would still have to specify the lib manually, huh

19:48 Morgawr: yes

19:50 tomjack: seems like you'd need an enhancement to cljsbuild

19:50 Morgawr: mmm

19:50 I think the problem is

19:51 tomjack: looks like :libs does look in the classpath

19:51 Morgawr: when you package a .jar, I'm not entirely sure how it works but it seems to just take all the cljs source files and put them together (doesn't even respect directory structure) but the original project.clj is still there (with relative path references). It doesn't take the compiled .js of the library, it requires the user to re-compile everything together

19:51 this means that the end-user has to specify the .js file as well

19:52 I'm just confused as what's the point of compiling a library if you're just redistributing a .jar with the non-compiled files

19:53 tomjack: makes sense to me to distribute non-compiled files

19:53 this is what we usually do in clojure

19:54 Morgawr: yes, I know but then I don't really know how to deal with this corner case if packaging some native javascript as well

19:55 all I've seen online is how to use javascript in a clojurescript project or how to refer to clojurescript libraries from javascript, but never how to use hybrid javascript + clojurescript packaged together

19:55 tomjack: it looks like maybe clojurescript itself could use an enhancement like this

19:56 hmm, probably not though

19:56 not sure how it could work, but I don't think it does :)

19:57 futile: phew

19:57 Does your ClojureScript part of your web app usually live inside the Clojure web app itself, as a subdir? Or is it its own proj?

19:58 tomjack: Morgawr: you already tried just writing it in cljs with js interop, and found that to be too slow?

19:59 Morgawr: tomjack: I have tried working around with it and trying to write it with JS interop but it's just too big of a module itself to be elegant, it's better to just write it in Javascript. I mean, if nothing else works I can try re-write it like that but it would be pretty ugly and hackish

19:59 tomjack: otherwise it doesn't seem so bad to me that users will have to add :libs as long as you put that in your readme, until someday maybe something better works

19:59 Morgawr: in the end it's just a composite function that would look more elegant as a single javascript block (I know, Javascript and elegant don't go well together but this way it's just easier)

20:00 the problem is that it's not just :libs, they also have to download the .js file and add it themselves to their classpath

20:00 (not much of a deal but still)

20:00 tomjack: no, you should be able to get the js file on the classpath

20:00 Morgawr: mmm

20:00 let me try it out

20:00 tomjack: just stick it in the same places as your cljs files for example

20:01 then I _think_ :libs ["your/ns/blah.js"] should work for a user

20:01 at least there is code in closure.clj which appears to be searching for :libs on the classpath

20:03 or you could have src/js/your/ns/blah.js alongside src/cljs and have :resource-paths ["src/js"] :source-paths ["src/cljs"] in your library's project.clj, or something like that

20:04 Morgawr: giving it a go right now, will report back, thanks :)

20:09 CapnKernul: so happy to now have used cartesian-product in a real project. :)

20:12 Morgawr: tomjack: how do I make sure to package the .js file inside the .jar along with the rest of the .cljs files?

20:13 tomjack: easiest way would be to put it in the same place as your cljs files

20:13 otherwise :resource-paths ["src/js"] :source-paths ["src/cljs"] like I said above

20:14 er, hmm

20:14 Morgawr: oh yeah

20:14 I added it as :source-paths

20:14 tomjack: dunno if it makes sense to put cljs on your source-paths

20:14 cljs + leiningen + cljsbuild is all pretty confusing

20:14 Morgawr: putting it in the same places as the cljs files gave me troubles because lein didn't see it in the classpath, no idea why but I think it's cleaner this way, let's see if my other project sees it

20:15 tomjack: well if you put it in the same place as your cljs files, you need to include the path in :libs

20:16 like if it's src/your/ns/blah.js, you need :libs ["your/ns/blah.js"]

20:16 (which is good, you probably don't want a blah.js sitting at the root of your jar)

20:16 Morgawr: heh, I tried that but it printed an error saying it was missing a goog.provide

20:17 anyhow, I'll keep testing

20:18 tomjack: hmm, hope I didn't give you misinformation

20:18 Morgawr: tomjack: do I need to use :libs ["myns/myfile.js"] or ["src/cljs/myns/myfile.js"]?

20:18 tomjack: the former

20:19 but that will only work if src/cljs is in your classpath via :source-paths or whatever

20:19 Morgawr: yes yes, it works, at least the library compiles

20:19 cneira: .

20:19 Morgawr: now I need to figure a way to get it to work in my other project

20:20 tomjack: if you see the .js in the jar as myns/myfile.js, I'd expect it to just work with the exact same :libs in the depending project :)

20:20 cneira: anyone has used oop in clojure , i know is about fp ,but we have protocols & defrecord

20:20 technomancy: cneira: don't use protocols if you are just getting started

20:20 Morgawr: okay so, inside my .jar I have "myns/native/myfile.js". from the other project I have :libs ["myns/native/myfile.js"] but it still can't find it :(

20:21 TimMc: cneira: OOP and FP are overloaded terms. By various interpretations, Clojure is both.

20:21 Morgawr: oh.. wait

20:21 I'm an idiot, I was referring the wrong namespace

20:22 cneira: TimMc , great i have trouble doing some uml class diagram using clojure , is there any good read about oop in clojure ?

20:23 Morgawr: the O'reilly book about Clojure is pretty great

20:23 not sure about OOP specifics though

20:23 it does treat protocols and all of that

20:23 technomancy: cneira: you don't need it

20:29 ianeslick: Anyone have trouble getting nREPL to startup using lein run and an explicit command in the main function? It runs without error, but then doesn't create a socket...

20:33 pandeiro: is the only way to ensure that a lein project uses a particular version of clojure to use :exclusions [org.clojure/clojure] in any deps that include clojure?

20:33 technomancy: pandeiro: as long as no one uses version ranges, your version will win

20:33 you can use `lein deps :tree` to see if any version ranges are screwing with you

20:33 tomjack: O_o

20:34 is there a good reason version ranges can screw with you or some impl problem?

20:34 pandeiro: technomancy: version ranges have a particular syntax? i'm not noticing any

20:34 technomancy: tomjack: http://nelsonmorris.net/2012/07/31/do-not-use-version-ranges-in-project-clj.html

20:35 pandeiro: they can affect you transitively

20:35 tomjack: basically it's maven's fault?

20:35 technomancy: more or less

20:36 though actually-justifiable uses of version ranges are extremely rare

20:37 Morgawr: ,(inc tomjack) ; I hope I did it properly :S

20:37 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: tomjack in this context, compiling:(NO_SOURCE_PATH:0:0)>

20:37 Morgawr: (inc tomjack)

20:37 lazybot: ⇒ 1

20:37 Morgawr: okay lol

20:37 thanks tomjack, now my library works! :)

20:38 tomjack: nice, what is it?

20:38 Morgawr: basically, first I had to put the .js with all the .cljs files (I created a directory in the src/cljs subtree as "native" to separate .js code from .cljs)

20:38 then I used proper goog.provide and requires in my cljs files

20:38 and wrote a cljs file with wrapping for functions (just to keep it sane)

20:39 in the end I just added the :libs ["myns/native/myfile.js"] in the other project

20:39 it's not the best option (Something automatic would be great) but at least it works now

20:39 I'll leave a note in the readme for my library

20:40 I really need to write a blog post or something about this because I've been looking around the web for hours and nobody seemed to have the same problem I had. Either it was something very very easy and I didn't realize it or it's a specific corner case nobody really considered before (or didn't care about documenting it)

20:41 pandeiro: i'm not sure how to recognize version ranges; do i need to see the project.clj of each dep?

20:42 technomancy: pandeiro: `lein deps :tree` will tell you if any are present

20:42 it's hard to miss

20:42 pandeiro: huh.. i'm going blind...

20:42 my project.clj - http://sprunge.us/OBgX?clj

20:42 lein deps :tree - http://sprunge.us/OVXi?clj

20:43 technomancy: it didn't warn you, so there are none

20:43 pandeiro: for some reason when i create a repl with that project.clj, instead of 1.5.1 i get clojure 1.4.0

20:43 before i explicitly excluded clojure from enlive it was trying to use 1.2.0

20:46 tomjack: clutch?

20:46 pandeiro: so back to my original question

20:46 i gotta explicitly exclude clojure from any project that depends on it

20:46 tomjack: dunno why it would be winning..

20:46 pandeiro: if i want to use a specific version?

20:48 Zamarok: Can I use clojure.core/range to produce an infinite sequence like {0, 20, 40, 60, 80, ...}?

20:49 ianeslick: technomancy: Is there an obvious reason I might be missing why nrepl wouldn't launch in production?

20:49 justin_smith: Zamarok: ,(take 4 (map (partial * 20) (range)))

20:51 Zamarok: justin_smith: right, but range can't do it? It seems like a very basic thing that someone would want to do with a range function

20:52 justin_smith: oh, yeah, now that you mention it

20:52 (range 0 80 20)

20:52 amalloy: justin_smith: that's *almost* infinite

20:52 justin_smith: heh

20:52 amalloy: ,(range 0 Double/POSITIVE_INFINITY 20)

20:52 clojurebot: (0 20 40 60 80 ...)

20:52 Zamarok: there we go, thanks amalloy

20:53 hyPiRion: ,(let [range iterate] (range #(+ 20 %) 0))

20:53 clojurebot: (0 20 40 60 80 ...)

20:55 amalloy: clojurebot: show hyPiRion the door, please

20:55 clojurebot: that will show you what jars (including the clojure jar) leiningen is using

20:56 hyPiRion: amalloy: you're doing it wrong

20:57 ~guards

20:57 clojurebot: SEIZE HIM!

20:57 ianeslick: clojurebot is such a hoot

20:57 amalloy: hyPiRion: i'm just going to talk to clojurebot as if he were intelligent, and see how often his responses make sense

20:57 hyPiRion: clojurebot: the door is <reply>the door will show you what jars (including the clojure jar) leiningen is using

20:57 clojurebot: 'Sea, mhuise.

20:58 hyPiRion: He's on a completely different level of intelligent than what we are, though

20:59 metellus: ~gourds

20:59 clojurebot: SQUEEZE HIM!

20:59 hyPiRion: ,(->> 1 repeat (reductions +) (reductions +) (reductions +))

20:59 clojurebot: (1 4 10 20 35 ...)

21:00 pandeiro: is there somewhere i can read about how lein determines which version of clojure to use?

21:01 Raynes: Whatever is in your project.clj.

21:03 pandeiro: Raynes: did you see my links above by chance? i posted my project.clj and lein deps :tree but lein repl doesn't give me the version i'd expect

21:03 Raynes: I did not. One moment

21:04 amalloy: hyPiRion: i don't really understand what that's doing. there should be a simple formula for the nth element of that sequence, but what is it? i think it's computing...the sum of the first N triangle numbers, basically?

21:04 Raynes: pandeiro: Interesting.

21:04 pandeiro: It looks like clutch is causing it to ignore your Clojure version for some reason.

21:04 pandeiro: Try doing an :exclusions on clutch as well and see what happens?

21:05 pandeiro: Raynes: yeah ok, one sec

21:07 amalloy: hyPiRion: yeah, that's it. apparently that's called a tetrahedral number, and the nth element of that sequence is (* n (+ n 1) (+ n 2) 1/6)

21:07 pandeiro: weird. now i'm back to using 1.2.0 or 1.2.1 apparently

21:07 just get an error about mapv not existing

21:07 this is the same thing that was happening before i used :exclusions on enlive

21:07 the project name 'clj' wouldn't be interfering right?

21:10 ...but when i comment out overtone, for some reason, everything works

21:14 tomjack: sweet, I guess correctly http://oeis.org/wiki/Simplicial_polytopic_numbers

21:14 didn't guess "polytopic" though

21:14 (+ tomjack 1/2)

21:15 pandeiro: ok it's something very weird and non-deterministic or something... i am going to assume pebcak and return later

21:23 frem: is there a built in function that does the same thing as (fn [x] x) ?

21:24 I'm on this bit in clojure koans, and my solution seems slightly silly. https://github.com/functional-koans/clojure-koans/blob/master/src/koans/10_lazy_sequences.clj#L23

21:24 tomjack: $findfn :foo :foo

21:24 lazybot: [clojure.set/union clojure.set/intersection clojure.set/difference clojure.core/time clojure.core/dosync clojure.core/doto clojure.core/macroexpand-1 clojure.core/or clojure.core/comp clojure.core/-> clojure.core/macroexpand clojure.core/max clojure.core/identity clo... https://www.refheap.com/15937

21:25 tomjack: :)

21:25 frem: it's identity

21:25 &(max :foo)

21:25 lazybot: ⇒ :foo

21:25 tomjack: nice

21:26 frem: thanks!

21:26 tomjack: ,(doc find-keyword)

21:26 clojurebot: "([name] [ns name]); Returns a Keyword with the given namespace and name if one already exists. This function will not intern a new keyword. If the keyword has not already been interned, it will return nil. Do not use : in the keyword strings, it will be added automatically."

21:26 tomjack: I have never seen this before

21:26 how very odd

21:27 utterly baffling

21:28 what possible use could that have?

21:28 amalloy: tomjack: it was probably more useful back before keywords got GCed

21:29 so that you could find out whether keywordizing user input would cause you to use up more permanent space? i'm not sure tbh

21:29 tomjack: so you could, what, throw an error?

21:30 it looks like it could be used to set up an closed set of keywords in a particular ns

21:30 then avoid extra interns

21:30 vs keyword-izing and then checking a set of acceptable keywords

21:31 I guess that would have made sense back then

21:31 amalloy: fwiw, find-keyword isn't used anywhere in clojure.core

21:32 tomjack: &((comp comp comp) 42)

21:32 lazybot: ⇒ 42

21:40 brehaut: ,(comp 42)

21:40 clojurebot: 42

21:40 brehaut: i guess that makes sense?

21:43 tomjack: would be interesting if (comp) were comp

21:44 ..not really

21:46 amalloy: brehaut: i think that was added because some folks were made that (comp f) and (partial f) just blew up, rather than the "obvious" strategy of "just return f"

21:46 eg, in situations like (apply comp fs)

21:46 brehaut: amalloy: sure, just slightly surprising when its used on a non ifn

21:47 yay types i guess

21:47 amalloy: sure, but that's dynamic typing for you

21:47 brehaut: yeah

21:47 i for one welcome our core.typed overlords

21:47 amalloy: you would, you dirty type-sympathizer

21:48 brehaut: lol

21:49 tomjack: I never thought about the fact that there should be working clojure programs which won't typecheck

21:50 brehaut: tomjack: thats the fundamental argument of dynamic languages ;)

21:50 well, that those programs are simpler than the checking one and that that simplicity is a win

21:51 tomjack: I'd love to see real examples of that

21:51 ruling out comp-as-identity obviously is a win for core.typed

21:51

21:51 brehaut: ring is pretty damn hard to typecheck

21:51 even with a type system as flexible as core.typed

21:52 tomjack: well, that's a straw man

21:52 brehaut: how so?

21:52 because it was written for a dynamic language?

21:52 TimMc: &((((comp comp) ((comp ((comp comp) (comp comp))) (((comp) comp) comp))))()) ;; brehaut

21:52 lazybot: ⇒ ()

21:52 brehaut: oh, i thought you ment ring

21:52 tomjack: yeah, seems you need to compare to an 'equivalent' program in say haskell

21:53 amalloy: $mail dnolen is your "seqable" article findable anywhere now that posterous isn't serving it?

21:53 lazybot: Message saved.

21:53 brehaut: tomjack: the equivalent program would, IMO, be a writen using a unitype

21:53 tomjack: that doesn't seem like a useful comparison then

21:53 brehaut: which would jsut make it a long winded version of the same thing

21:53 well of course

21:53 that the crux of the debate

21:54 if you have to write a different program, its very hard to compare, but if you didnt have to, there wouldnt be an arguement

21:54 personally, as much as i appreciate category theory types and type checking, theres very little in the existing haskell web frameworks that i would prefer over ring, so thats good enough for me

21:55 tomjack: hmm, I guess I don't know what the claim is then

21:57 but that last thing you said makes sense

22:00 brehaut: i find it ironic that SPJ, someone so good at types, is so bad at type; trawling through all this comic sans hurts

22:00 http://cucats.soc.srcf.net/files/Escape%20from%20the%20ivory%20tower%20Feb12.pdf page 69 and 70

22:01 The Region of Abysmal Pain

22:04 tomjack: web programming is in there?

22:04 brehaut: it seems so

22:05 tomjack: I was talking with a friend earlier today about the possibility of an Agda successor which has "the Joyful Properties"

22:05 I hope someday..

22:16 hah "envy/ideas"

22:39 dnolen_: experimenting with logict using core.async https://www.refheap.com/6f7acfecd6c1ca0ce50974945

22:40 unfortunately at this point I've realized the whole point - failing faster on conjunction - doesn't make sense to me in a general logict context

22:40 I mean, conjunction doesn't seem to make sense

22:42 or maybe it does and I just don't see it yet, but I think you have to bake in the idea that the success chans receive substitutions, which I don't quite see how to square with some of the logict stuff

22:42 in this approach you pass a success chan into a goal, and it returns a fail chan which just closes when it fails

22:42 tjb1982: can someone help me understand how to install light table on linux (arch)?

22:45 tomjack: s/when it fails/when there are no more successes/

22:45 which I just realized is a nice fit w/ go

22:52 I guess I should have tried implementing msplit before deciding this approach was workable..

22:53 tjb1982: ibdknox: I'm having problems installing Light Table for linux. The package doesn't look like what I'm used to. Can you help me out?

22:54 tomjack: you don't have to install it

22:55 you can just extract the tar.gz and run it

22:58 tjb1982: It's complaining about "error while loading shared libraries: libudev.so.0: cannot open shared object file: no such file or directory"

22:58 tomjack: ^

22:59 I see libudev.so.1 in /usr/lib/ but not .0

23:00 tomjack: $google light table "error while loading shared libraries: libudev.so.0"

23:00 lazybot: [Light-Table-Playground - GitHub] https://github.com/Kodowa/Light-Table-Playground/issues/161

23:01 tomjack: seems maybe relevant?

23:02 tjb1982: that workaround looks like it should do the trick

23:04 it generally isn't a good idea to symlink different versions of libraries (as one commenter said)

23:06 tomjack: I think maybe another workaround was suggested that shouldn't affect the rest of your system

23:06 didn't look too closely

23:07 tjb1982: I see a script that should work here https://gist.github.com/rickeyvisinski-kanban/4559886

23:07 thanks for your help, btw

23:07 * Raynes pokes tomjack with an iPhone.

23:09 tomjack: I don't know whether to be mildly annoyed or screaming in pain

23:10 SegFaultAX: tomjack: Raynes doesn't know his own strength...

23:11 tjb1982: I' just glad you're not referring to me

23:11 hoping anyway

23:12 tomjack: tjb1982: no :)

23:17 I retract my last refheap :(

23:20 bluegator: hello all

23:20 a newbie to clojure

23:21 i am*

23:21 i installed la-clojure in intellij, want to know how i can execute lein commands from within intellij

23:22 for e.g., lein run

23:22 akhudek: bluegator: there is a leiningen plugin that does that, but I always just use the terminal anyway

23:23 bluegator: gotcha..

23:23 thanks man

23:23 also am new to emacs

23:24 does anyone recommend emacs over intellij for a newbie?

23:24 if so, is there a particular emacs (on mac-os) that is recommended?

23:25 akhudek: i think the general consensus here is that emacs is the best piece of software that exists, for any purpose. I still use la clojure myself though.

23:25 definitely worth learning if you interested in it!

23:25 tjb1982: emacs is great if you put in the effort

23:25 akhudek: emacs that is

23:26 brehaut: theres merit to not trying to learn two foreign things at once thoguh (emacs, fp/clojure)

23:27 CaptainLex: bluegator: I can't recommend from personal experience, but I do know my professor used aquamacs

23:27 bluegator: thx for the advice fellas

23:27 probably two new things at once might be hard to digest

23:27 akhudek: brehaut: I will use that as an excuse next time I am asked about it. I am always reading ml/papers and cannot learn two complicated things at once!

23:27 brehaut: if you do want emacs for os x, then http://emacsformacosx.com/ is the preferred place to get a build from

23:28 (the system one is exceedingly decrepit, and for emacs thats really saying something)

23:28 CaptainLex: bluegator: If you don't mind a bit of frustration, you can learn emacs at your own speed. It has most normal functionality as well as the kooky stuff

23:29 bluegator: thx for the link brehaut

23:29 lex, makes sense, will take it in bits and pieces

23:29 CaptainLex: That said, if and when you get hooked on keyboard shortcuts instead of the mouse, try to learn those all at once

23:30 it's very befuddling to be able to navigate part of the way on the keyboard, but have to use the mouse to finish it off

23:30 bluegator: true that

23:30 just saw this: http://overtone.github.io/emacs-live/

23:30 any opinions/comments on emacs live?

23:31 CaptainLex: Oooh, I've never heard of it, but I do love these kinds of things

23:31 akhudek: heard good things about it

23:31 amalloy: CaptainLex: last i checked rhickey uses aquamacs. i guess he can get away with it, but it's crazy

23:33 CaptainLex: amalloy: Is it now? I only saw it in action vaguely, and only for basic purposes. I've been using LT for my clojure work, so I don't know nothing from nothing in emacs these days :P

23:33 ddellacosta: I used emacs-live a little, but found that it had too much magic out-of-the-box which drove me nuts…to me it represents a specific person's .emacs setup

23:33 bluegator: LT?

23:33 clojurebot: filter is not map

23:33 brehaut: light table

23:33 bluegator: gotcha

23:33 brehaut: elucidating as always, clojurebot

23:34 ddellacosta: but, worth checking out if you are an emacs user

23:34 if you are a *beginner*, not sure I would recommend it

23:34 brehaut: the emacs-starter-kit is a relatively gentle introduction to emacs for dynamic languages

23:34 ddellacosta: I suspect that if I had spent some time configuring it a bit, I would have enjoyed it more

23:35 I recommend learning basic movement in both emacs and vim, and breaking oneself of any desire to assume one is better than the other. But that's a different discussion I suppose.

23:35 amalloy: CaptainLex: aquamacs apparently differs in so many interesting ways that the bots in #emacs have this canned response: "Because of how Aquamacs departs from conventional Emacs in terms of features, codebase, and stability, no one supports it here. Try #aquamacs"

23:36 brehaut: its like xemacs of the future

23:36 CaptainLex: amalloy: That is impressive! Thanks for the info!

23:36 Raynes: It's like the devil, brehaut.

23:36 The devil.

23:36 brehaut: Raynes: didnt i just say that?

23:37 * brehaut suffers a GTK1 flashback

23:39 ddellacosta: I'm getting clojure.tools.namespace.repl complaining about CLJS-related namespaces, but can't seem to tell it to ignore my cljs namespaces…any best practices for using c.t.n.r w/CLJS?

23:56 derek_c: hello guys, can someone tell me what does *variable-name* mean>

23:56 ?

Logging service provided by n01se.net