#clojure log - Jun 03 2012

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

0:03 mthvedt: parsley looks neat

0:15 antares_: KirinDave: FYI, I am migrating gantry to clojure 1.4

0:15 mthvedt: i'd rather use a clojure-ish parser than have to do something in antlr

0:16 gf3: I wonder if you could use TreeTop from JRuby

0:17 KirinDave: antares_: Oh cool. Is there really much to do for that?

0:17 antares_: KirinDave: it's a small codebase but they use stuff from like 1.1 days and libraries that are no longer maintained

0:17 we will see

0:17 I want a tool like that and don't use Clojure 1.2 for anything

0:25 KirinDave: antares_: Already forked it?

0:26 antares_: KirinDave: not yet, working in a local branch

0:26 KirinDave: I can stash and push if you want me to

0:26 KirinDave: antares_: That'd be cool. Pardon me, just got paged to deal with site issues.

0:27 antares_: looks like it may take a few hours to finish, there's a lot of weird stuff from clojure.contrib.condition being used

0:27 KirinDave: no problem

0:31 KirinDave: Man I have got to destroy this janky ruby system. :\

0:31 hah, wrong window.

0:31 but there we are. True story.

0:34 fil512: is there a way to turn (1 2 3) into 1 2 3?

0:34 or [1 2 3] into 1 2 3

0:34 Raynes: In what context?

0:35 That doesn't make sense except for in one context: passing them as individual arguments to some function.

0:35 fil512: yes

0:35 Raynes: &(apply println [1 2 3 4])

0:35 fil512: exactly

0:35 lazybot: ⇒ 1 2 3 4 nil

0:35 Raynes: apply! :D

0:35 fil512: hmmm

0:36 KirinDave: i was just trying to use palette.

0:36 fil512: I'm on 4clojure

0:36 KirinDave: Can't ein plugin install pallet/lein-template 0.2.1

0:36 Can anyone else.

0:36 fil512: trying to write the equivalent of flatten...

0:40 antares_: KirinDave: it works with lein2 for me

0:41 KirinDave: Should I be using lein2?

0:41 antares_: KirinDave: by the way, I pushed my fork of gantry. It will take a day or so of work to port it but if you are interested, here it is: https://github.com/michaelklishin/gantry

0:41 so far I have tests finally passing on OS X

0:42 digging in getting rid of clojure.contrib dependencies

0:42 Raynes: antares_: No it doesn't.

0:42 antares_: You can't 'plugin install' something in lein2. :p

0:42 antares_: Raynes: I did not plugin install it

0:42 I added it to my :user profile

0:42 and ran lein2 version, lein downloaded it just fine

0:42 Raynes: antares_: I know, but you implied you 'plugin install'ed it which might have confused KirinDave.

0:42 You should really be ashamed of yourself.

0:43 antares_: Raynes: fair enough

0:43 Raynes: KirinDave: If you're using the latest version of lein-newnew, you should just be able to do `lein new pallet ..`

0:43 It automagically downloads and installifies the template for you.

0:43 KirinDave: Raynes: Could not find template pallet on the classpath.

0:44 Raynes: What version of lein-nenwew?

0:44 newnew, even

0:44 KirinDave: 0.2.6 was listed on pallet

0:45 antares_: I think the most recent release is 0.2.8 or so

0:45 and I remember there were small features and bug fixes in 0.2.7 alone

0:46 KirinDave: Well this is bad.

0:46 Lein's plugins seem to be broken now.

0:57 rplevy: is interactive mode replaced by something else in lein 2?

1:00 Miko2: I have a trie represented as a map { \a { \b { \c { ... } } } }. What would be the easiest way to add "d" from "abcd" to the nested \c's map?

1:01 mthvedt: update-in?

1:02 antares_: Miko2: update-in, get-in?

1:03 tomoj: of course, but still surprising ##(assoc-in {} "foo" 3)

1:03 lazybot: ⇒ {\f {\o {\o 3}}}

1:03 Miko2: Woah, too easy to be true. Thanks. :)

1:06 rplevy: curious if lein interactive is not yet implemented, or if it has been removed in lein 2

1:09 xeqi: rplevy: I havne't heard of any plans to convert it

1:10 rplevy: is there some way to get a similar experience, or to run lein commands from the repl perhaps?

1:13 xeqi: I think the plan originally was to replace it with jark, but I haven't heard anything about it recently

1:14 rplevy: that sounds like a good idea

1:38 _KY_: what is the function [1 2 3 4] -> [[1] [1 2] [1 2 3] [1 2 3 4]]?

1:39 ivan: $fn [1 2 3 4] [[1] [1 2] [1 2 3] [1 2 3 4]]

1:39 _KY_: Nevermind... I can get around it...

1:39 ivan: $findfn [1 2 3 4] [[1] [1 2] [1 2 3] [1 2 3 4]]

1:39 lazybot: []

1:40 _KY_: It's just a simple (take n [...])

1:41 rplevy: I've never used jark before, but I just tried running the jark lein plugin and it output a null pointer exception. This is in a lein 2 project.

2:11 splunk: anybody know if there's an idiomatic parameter name for passing in a seq into a fn?

2:12 e.g.

2:12 (fn [seq] (first seq))

2:12 except not calling it seq?

2:20 duncanm: splunk: well, for that case, you can just pass 'first' directly

2:20 splunk: you can call it a-seq, or something like that

2:21 splunk: right, the first was just an example.

2:22 duncanm: cool, will use a-seq. Thanks!

2:31 craftybones: Hello

2:32 splunk: ahoy!

2:32 craftybones: I'm having a bit of trouble getting leiningen setup

2:33 https://gist.github.com/4a5169984336d1701bb3

2:38 splunk: are you installing on osx ?

2:38 have you seen this post?

2:38 http://comments.gmane.org/gmane.comp.java.clojure.leiningen/162

2:39 craftybones: Thanks splunk

2:40 borkdude: you could also try the fresh preview6 of leiningen 2 that got released two hours ago :)

2:41 craftybones: Lol. Will do. I am starting fresh on clojure

2:41 Man, Limechat absolutely rocks

2:42 Interesting. For some vague reason the lein script didn't download the jars properly. I moved my .ssh to a diff dir and tried again, and this worked.

2:42 borkdude: craftybones is it better than textual? I like that one also

2:47 eraad: hi

2:47 splunk: ahoy

2:52 craftybones: borkdude: Yeah, it has some cool stuff like, if you paste into the window, it puts it into a gist for you and pastes the link

2:53 borkdude: craftybones that sounds very convenient

2:53 craftybones: borkdude: Thanks for your help

2:53 splunk: you too

2:53 splunk: np

2:57 borkdude_: ok, I'm now in Limechat

2:58 ,(+ 1 2 3)

2:59 clojurebot: 6

2:59 borkdude_: craftybones: when does it paste smth btw?

3:02 craftybones: borkdude: If you ctrl-v or cmd-v that is

3:03 borkdude_: {:user {:plugins []}}

3:03 craftybones: beyond a certain length?

3:03 craftybones: borkdude: Yeah, or perhaps if there are \n in the paste

3:04 borkdude_: https://gist.github.com/da2c822bcf20a81cb103

3:04 ah great

3:05 craftybones: what is the use of that bottom window

3:05 craftybones: borkdude: Messages from other channels you've joined in

3:08 borkdude: craftybones If you're a fan of japanese software… I can recommend the Yorufukurou twitter client as well

3:09 craftybones: borkdude: thanks, I'll try that out. I am not a specific fan of Japanese software or anything, though I admit, I do love Ruby :)

3:09 borkdude: craftybones me neither, but I happen to like that twitter client ;)

3:11 craftybones I don't like that bottom window though, can I get rid of it? ;)

3:13 craftybones: Yes you can

3:16 borkdude: just resize it out and you'll be fine

3:18 borkdude: just testing what happens...

3:18 (def defaults {:source-paths ["src"]

3:18 :resource-paths ["resources"]

3:18 :test-paths ["test"]

3:18 :native-path "target/native"

3:18 ok… maybe I can find a textual plugin that does the same as limechat

3:47 amalloy: splunk: i don't really like a-seq. popular names include coll and xs

4:18 borkdude: craftybones haha I see your msg on twitter… the rest of the day barely interesting… these people don't read twitter?

4:19 craftybones: borkdude: Oh, they're very good friends. They obviously read.

4:20 borkdude: craftybones you didn't mean the wedding itself then? I guess it's a bit ambiguous ;)

4:20 craftybones: borkdude: Yes. The wedding itself wasn't. They had a large history leading up to the wedding, so it was finally amazing that it did happen

4:26 So I run a lein plugin install swank-clojure-1.3.4 and it doesn't really seem to have done anything

4:29 Ah never mind.

4:29 Space for the version

4:29 borkdude: craftybones 1.4.2 seems to be the newest

4:31 craftybones: borkdude: Yeah I got 1.4.2, but now a clojure jack in isn't working from emacs

4:31 borkdude: tells me project.clj is missing

4:32 borkdude: craftybones you must visit a file within tyour project in emacs

4:32 craftybones only then it knows which project to start the swank server for

4:33 craftybones: borkdude: Ah, so I can't essentially use it without using a lein-ed project

4:33 borkdude: craftybones right

4:35 sdevijver: what's the difference between :dependencies and :dev-dependencies in lein?

4:35 borkdude: craftybones what I do if I just want a repl to play with, I make a project for that situation

4:36 craftybones so just somewhere: lein new foo, and then visit a file in that project

4:36 craftybones: borkdude: Ok. Thanks. So inferior-lisp is slightly easier to do this then?

4:36 borkdude: craftybones I think so

4:37 aperiodic: sdevijver: :dev-dependencies are non-transitive (projects that use yours won't use its dev-dependencies)

4:37 sdevijver: they're also on the classpath for plugins

4:39 sdevijver: typically, dev-dependencies are development tools, hence the name

4:40 borkdude: aperiodic I guess they aren't included when uberjarring as well?

4:41 aperiodic: borkdude: correct

4:42 sdevijver: they're going away in lein2, though

4:42 sdevijver: instead, use profiles to accomplish the same thing

4:43 sdevijver: also profiles have other benefits besides, but i haven't really used lein2 much

4:44 sdevijver: aperiodic, I'm trying to get lazytest working with midje on lein 2, I already had a suspicion :dev-dependencies were ignored :)

4:45 craftybones: Dummy question. So a clojure-jack-in complains about a missing lein. Where is this complaint coming from and where do I tell it that it needs to look for lein somewhere specific?

4:46 borkdude: craftybones missing lein?

4:46 craftybones: lein not found

4:46 borkdude: craftybones did you put it on PATH?

4:46 craftybones: borkdude: Yeah

4:46 I think I know why

4:47 I think I might have to add lein to my project.clj

4:48 aperiodic: that sounds fishy to me; PATH issues seem like the more likely culprit

4:50 borkdude: I never had to set the path for leiningen in emacs

4:50 craftybones: Got it working. It was in path, but I hadn't sourced it in that window :D

4:50 aperiodic: i don't know anything about emacs, though, it's just that specifying lein in the project.clj seems... redundant

4:50 heh

4:51 craftybones: Sweet. Yeah it works without that

4:52 borkdude: 404 users…

4:52 not found...

4:53 co-incidental combination ;)

4:55 craftybones I think you're better of switching to lein2 anyway

4:55 craftybones: borkdude: Alright :)

4:55 aperiodic: check out lein-precate

4:57 borkdude: or just make a file called profiles.clj in ~/.lein with {:user {:plugins [[lein-swank "1.4.4"]]}}

4:57 lein swank / clojure-jack-in will work

4:57 without installing anything

4:57 (manually that is)

6:12 almostobsolete: Hello, I'm very new to Clojure and having some issues with lein

6:13 When running "lein deps" on a project based on the compojure quickstart I get the following:


6:13 [INFO] Unable to find resource 'org.clojure:clojure:jar:1.2.0-RC1' in repository clojars (http://clojars.org/repo/)

6:14 Full error trace: https://gist.github.com/2862895

6:14 Any ideas what I might be doing wrong?

6:18 ejackson: almostobsolete: using a WAY to old clojure :)

6:18 stable is currently 1.4

6:18 use this one: [org.clojure/clojure "1.4.0"]

6:19 in your project.clj

6:19 almostobsolete: Thanks! Trying it now...

6:19 ejackson: Raynes: past midnight and you turn into a cat ?

6:20 almostobsolete: I'm still getting a similar error:

6:20 [INFO] Unable to find resource 'org.clojure:clojure-contrib:pom:1.4.0' in repository central (http://repo1.maven.org/maven2)

6:20 ejackson: almostobsolete: OK, its not going to find it in maven central

6:21 hiredman: almostobsolete: there is no contrib 1.4.0

6:21 almostobsolete: contrib after 1.2 doesn't exist as a single package

6:21 ejackson: oh yeah, that too :)

6:21 almostobsolete: Oh, ok, so I don't need to have that dep at all?

6:22 ejackson: it gets annoying, if the template called for it, then compojure might be wanting it, but the whole thing is woefully out of date

6:22 almostobsolete: Seems to have worked!

6:22 ejackson: will the repl will start, but will compojure route ?

6:22 or compoje, or whatever

6:24 almostobsolete: Success! Is displaying in browser :)

6:24 ejackson: well, we have a winner :)

6:25 almostobsolete: Hmmm, and looking at the quick start it doesn't match the project.clj, I must have got that from another example. Cut and paste coding strikes again! ;)

6:27 Where's a good place to search for clojure libraries?

6:32 ejackson: try: http://clojuresphere.herokuapp.com/

6:32 or: http://clojure-libraries.appspot.com/

6:32 which I just nicked from: http://dev.clojure.org/display/doc/Getting+Started

6:33 almostobsolete: Thansk!

6:35 ejackson: I also like http://www.clojure-toolbox.com/

6:38 antares_: almostobsolete: http://clojurewerkz.org

6:39 speaking of libraries, I have announced Neocons RC1 earlier today on the mailing list but not here :) http://clojureneo4j.info/

6:40 zomg: I guess clojure oriented libs would be more suited into the style of the language vs. libs developed with standard Java in mind?

6:40 ejackson: neocons ! lol

6:40 antares_: zomg: what a "libs developed with standard Java in mind"?

6:40 *are

6:40 zomg: well I mean any Java libs I guess :)

6:40 antares_: Clojure was created to be hosted and interoperate and reuse existing infrastructure

6:41 zomg: I know but the style of code is quite different in Clojure than in Java

6:41 antares_: there is nothing wrong with having DSLish layers on top of Java libs and using Java libs

6:41 certainly, I don't think anyone has tried to develop clojure libraries that look like Java libraries

6:42 sometimes you need to implement a few interfaces to extend a Java library, people do it in clojure, too

6:42 zomg: Yeah was just wondering about the point for clojure-oriented libs, since afterall java libs work in clojure

6:42 antares_: zomg: ease of use, better geared towards functional programming techniques

6:42 zomg: Yeah pretty much as I thought then :)

6:42 antares_: zomg: take a look at clojurewerkz.org projects, many of them have Java libraries underneath but expose much more concise API

6:43 also, you use Clojure data structures instead of instantiating lots of lib-specific objects

6:43 but I guess that falls into the "ease of use" category

6:44 opened: I am reading "clojure programming" and on the definition of show-info on page 395, a static method is used on the when-let macro which expectedly results to the method not being found.

6:44 Is that an errata or am I doing something wrong?

6:45 antares_: opened: do you have a print book?

6:45 in my PDF on page 394 it looks fine

6:46 opened: antares_: nope

6:46 antares_: show-info is a no-op (or some code is missing?) and it is invoked from a Java listener callback

6:47 opened: antares_: In page 395 rather

6:47 antares_: ah

6:48 opened: here: http://pastebin.com/TGpQ3fEF

6:48 antares_: (when-let [selected-fn (.getSelectedValue fn-names)]

6:48 this is what I have in when-let

6:49 opened: try macroexpand on the when-let, it truncates the "JOptionPane" and just leaves "showMessageDialog"

6:50 antares_: opened: I see

6:50 opened: http://shop.oreilly.com/product/0636920013754.do

6:51 opened: one of the pages suggest going to this URL for errata

6:51 opened: Wait... So it is an errata then?

6:51 antares_: opened: feel free to post on the clojure ML, all authors are there and will be happy to answer your questions

6:51 I am not sure, looking

6:51 http://oreilly.com/catalog/errata.csp?isbn=0636920013754

6:54 twhume: I'm using map to apply a function to a sequence; in this function I'd like to know what position I'm at in the sequence (so that I can allocate a unique incrementing ID to members of the resulting sequence). What's the most idiomatic way to do this?

6:55 ejackson: twhume: you could reduce over the seq, passing the counter along

6:57 twhume: ejackson: thanks (I'm a clojure noob btw, if you hadn't noticed). Is that the standard way to do this kinda thing in Clojure, or one of many possible paths?

6:57 I'm trying to learn idiom as well as getting the thing working...

6:57 raek: twhume: do you need the results from the function calls?

6:57 twhume: raek: yes.

6:57 raek: twhume: then you can't use map nor reduce

6:57 twhume: The function calls are producing maps I will later need. I would like each map to be numbered sequentially.

6:58 raek: one way is to roll your own loop

6:58 PeregrinePDX: map-indexed?

6:58 woollyams: Another noob question: is there a Clojure equivalent of Haskell's "tails"? http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-List.html#v:tails

6:58 ejackson: or just bind the numbers in before you start

6:58 raek: (since your usage does not fit the pattern map and reduce factors out)

6:59 another way is to use state, which is slightly more unideomatic

6:59 twhume: raek: yep, coming from a Java background my instinct was to set an atom, but I need that to be beaten out of me. map-indexed looks interesting tho.

6:59 PeregrinePDX: What's wrong with using map indexed.. It seems to be exactly what he is asking for. KNowing what position he is in the sequence while he's using map.

6:59 err map-indexed even

7:00 opened: raek: using state is a bit of an overkill

7:00 how about mapping the function to the sequence first, then zipmap the resulting sequence with (iter inc 0)

7:02 twhume: I have map-indexed working for me now - thank you :)

7:03 ejackson: PeregrinePDX: I didn't know about mapindexed, thanks

7:04 PeregrinePDX: The first thing I do when I have a library function that almost works for me but doesn't quite is in the repl I do (apropos 'function that almost works)

7:04 So (apropos 'map) and voila all the functions that have map in them.

7:06 ejackson: i'd have ended up doing: https://www.refheap.com/paste/2979

7:10 opened: woollyams: I don't think there is one, but here something similar: (take-while (comp not nil?) (iterate next [1 2 3 4]))

7:12 woollyams: opened: Close enough. Thanks!

7:12 opened: woollyams:okay

7:13 twhume: thanks everyone :)

7:13 opened: ... and about the book "clojure programming". I am going to submit an errata now, unless someone disagrees.

7:13 jsnikeris: Hi all. How do you get information about a Java class from Slime? Public members, Javadocs, etc

7:19 michaelr525: jsnikeris: you open an eclipse in parallel :)

7:19 though i usually search google

7:20 antares_: jsnikeris: REPLy has a function that opens Java docs (for JDK classes) in the browser, you just pass it an instance and it does the rest

7:21 jsnikeris: as for public members, REPL should have tab-completion over them (definitely for class and package names, static methods and other stuff that has important info to the left of the point)

7:21 I mean, any REPL, not just REPLy lein2 comes with

7:22 michaelr525: antares_: only starting from lein2?

7:22 antares_: michaelr525: REPLy can be used as a standalone tool but then you will have to figure out SLIME integration on your own

7:22 clojure-jack-in uses the same stuff lein repl does

7:24 jsnikeris: antares_: I see see what you mean about tab-completion, but what about seeing what the parameters of a method are? For example, I'm trying to instantiate a class (Blah. _) and my cursor is at '_' is there a way to easily see what the available constructors that class has?

7:25 antares_: jsnikeris: SLIME does it for clojure functions but not class constructors

7:25 probably because SLIME wasn't designed for languages that interoperate with Java :)

7:25 jsnikeris: antares_: ah OK

7:25 :)

7:26 is there better support for this kind of stuff in other editors?

7:26 antares_: IDEA should have what you expect from IDEA

7:27 the plugin is called La Clojure

7:27 I am not familiar with Counterclockwise (the Eclipse plugin) but I guess it is comparable

7:28 jsnikeris: antares_: I already use IDEA for Java development, so I'll give La Clojure a try. Thanks

7:29 antares_: jsnikeris: it is from JetBrains folks themselves

7:50 opened: oh GOD... I am such a retard D: The code in the book is just fine. I only forgot to include the title for the message dialog.

7:51 I even sent a errata for it! Someone shoot me.

7:52 Oh well. I probably need some break from reading.

7:53 gfredericks: ,(println "/me shoots opened")

7:53 clojurebot: /me shoots opened

7:53 gfredericks: aw man

7:54 opened: *dies*

7:55 ejackson: opened: don't sweat it bro,

7:55 nobody will mind :)

7:56 opened: yeah, who would mind a garbage ;)

7:59 I've been reading a lot these days, and I noticed my attention to detail has worsened, unlike before. Anyone else experienced this?

7:59 ejackson: oh, you have finite bandwidth ?

8:01 its the implacable foe: how can you learn all topics you need in sufficient depth to use them properly ? Near to impossible.

8:04 opened: I guess I am overfed with information. I'll take a break tomorrow.

10:10 tomoj: at this point if I'm writing a cljs library intended to be used from javascript (in particular node) with mori, is there something better I can do besides copying mori's source into my cljs project?

10:14 dnolen: tomoj: planning on continuing to support mori, but would like to deal with some CLJS stuff perf stuff first.

10:14 tomoj: you can create a jar and put it on clojars and include it as dep until I get around to doing that myself.

10:15 tomoj: oh, of course

10:57 duck1123: Is there a better function than instance? for testing the type of a record? (instance? Foo (Foo.)) is true, but (instance? Foo (map->Foo {})) is false

10:59 ejackson: how about isa? ?

11:01 duck1123: still false

11:02 dnolen: duck1123: you're env is stale, instance? should work

11:02 your

11:03 duck1123: deftype and defrecord don't play well with redefinition on the JVM

11:03 duck1123: you usually need to recompile the whole file when working with deftype / defrecord

11:06 duck1123: actually, I think you might be right. I just defined a new record type, and that one works

11:06 dnolen: duck1123: yep

11:07 duck1123: I'll take "you need to clean" over "what you'd logically expect doesn't work" anyday, thanks

11:09 skoodge: Is it possible to turn the content of a variable (a function) into a symbol? Let's say I have the variable foo, which contains the clojure function +, how do I get '+ out of foo?

11:10 duck1123: skoodge: you should probably be assigning #'+ to foo, that way you have the full var, and you can do a bit more with it

11:13 dnolen: so is the issue that I changed my record and didn't clean, or is it that I re-evaled that ns in the session?

11:14 dnolen: duck1123: if you change your record you need to recompile all code that refers to it.

11:15 duck1123: ok, I can deal with that. I probably won't be changing those record defs anymore

11:16 dnolen: duck1123: well host-y code like instance?

11:16 duck1123: just wanted to make sure I'm safe to C-c C-k my model s

11:17 skoodge: duck1123: well, I would like to directly pass functions instead of quoted functions into some function. So I need some way to turn the passed function into a (unqualified) symbol. Is there any way do to that?

11:18 duck1123: a function doesn't know it's symbol, so if you want to get back symbols, you need to pass around vars

11:18 dnolen: skoodge: you can't do what you want. but #'+ is not a quoted function. it's the var.

11:18 duck1123: I have to do a similar thin in my code

11:20 ok, after a clean compile, that test passes. on to the next

11:23 skoodge: duck1123, dnolen: ok, thanks. I guess I'll keep passing quoted functions then and use resolve on that

11:27 duck1123: passing around symbols will be dependant on the ns declarations of when you resolve them. passing around vars will have the ns info included

11:28 ,(map class [+ '+ #'+])

11:28 clojurebot: (clojure.core$_PLUS_ clojure.lang.Symbol clojure.lang.Var)

11:30 gfredericks: dnolen: I've been working on the numerics the last day or two and am filling in my thoughts on confluence

11:32 okay updated confluence

11:48 dnolen: gfredericks: might be better to outline how we could get Clojure numerics w/o much regard for how things are now - and then start thinking about how we could make it fast again per rhickey's suggestion.

11:49 gfredericks: dnolen: you mean mimicking jvm clojure semantics? like using longs?

11:57 dnolen: gfredericks: longs & double, generic operators. Look at Numbers.java

11:58 gfredericks: has many, many tricks

12:02 jsnikeris: How would one pass an import-list stored in a var to the 'import' macro?

12:03 e.g. (def an-import-list '(blah.blah.blah blee blow blum))

12:03 gfredericks: ,(doc import)

12:03 clojurebot: "([& import-symbols-or-lists]); import-list => (package-symbol class-name-symbols*) For each name in class-name-symbols, adds a mapping from name to the class named by package.name to the current namespace. Use :import in the ns macro in preference to calling this directly."

12:03 jsnikeris: (import an-import-list)

12:03 gfredericks: it's not a macro

12:03 (apply import an-import-list)

12:04 dreish: (source import) shows a defmacro for me.

12:04 ,import

12:04 clojurebot: #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/import, compiling:(NO_SOURCE_PATH:0)>

12:04 dreish: Yep. That's a macro.

12:04 I would think you could use eval.

12:05 gfredericks: ,import

12:05 clojurebot: #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/import, compiling:(NO_SOURCE_PATH:0)>

12:05 dreish: Or, going the other way, (import #=(eval an-import-list))

12:05 gfredericks: boo; doc is supposed to say it's a mocr

12:05 jsnikeris: what's that #= syntac?

12:05 syntax

12:06 dreish: Read-time "eval" -- though it's not really the full eval unless you call eval.

12:06 More like just apply.

12:08 gfredericks: dnolen: do you expect closure longs perform significantly better than clojure bigints?

12:09 dnolen: gfredericks: no idea w/o benchmarking

12:10 gfredericks: okay; just curious if that's why we would use them instead of just bigints directly

12:10 dnolen: gfredericks: from glancing at the source, seems like it would perform well.

12:10 gfredericks: closure long is not about bigints

12:12 gfredericks: if you mean that closure long is 64bit integer and closure integer is bigint, then yes I understand that

12:12 I assume we'd want to support closure-integers for bigints; i.e., that's what 42N would compile to

12:13 so if we already have bigints it's not obvious to me that it wouldn't be simpler to just compile 42 to a bigint as well, rather than a long

12:13 unless it's expected to perform better or there is a high value on mirroring jvm-clojure

12:15 dnolen: gfredericks: I'd expect it to perform better.

12:15 gfredericks: making things generic isn't the challenge here.

12:16 the challenge is getting modern JS engine perf that means somehow moving sensisbly from JS numbers to Closure (or Closure-like) long to BigInts.

12:17 gfredericks: so outline the changes for Clojure JVM numeric semantics - and figure out the hard work of not slowing everything down.

12:17 frozenlock: Hello gentlemen. Any advice on how I could read byte from a buffered-input-stream? I've tried (read buff...) but apparently it doesn't work if my steam isn't of type java.io.PushbackReader.

12:21 gfredericks: frozenlock: isn't there an instance method for that? (.read buff)?

12:21 the read function is for reading s-expressions

12:22 frozenlock: There is, but I was getting an error. So I dismissed it..

12:22 dnolen: gfredericks: actually might be as simple as *unchecked-math* which means we emit JS numbers and overflow on integer values that can't be represented with 53 bits.

12:23 gfredericks: dnolen: I was thinking another option would be a js/+

12:23 would give you the current behavior

12:23 dnolen: gfredericks: nope

12:24 gfredericks: anything that make core.cljs hard to repurpose it a non-starter, I've working to eliminate such things as much as possible.

12:24 gfredericks: so *unchecked-math* is a compile-time change?

12:24 dnolen: gfredericks: same as Clojure

12:26 gfredericks: that would only apply to longs though I would think

12:26 dnolen: gfredericks: same as Clojure

12:27 gfredericks: maybe I've been assuming too little about the perf needed. I thought it was all about retaining the ability to do fast double arithmetic

12:28 dnolen: gfredericks: JS has 64 bits floats, what's there to do?

12:29 gfredericks: dnolen: ensure that (+ 3.0 4.0) is just as fast as it currently is

12:29 since presumably + couldn't just be an inlined "+" anymore

12:29 dnolen: gfredericks: sure, but that's easy, we statically can determine those are double and emit JS numbers.

12:30 gfredericks: why not?

12:30 gfredericks: simple if we have type information, otherwise generic ops as usual.

12:30 gfredericks: but currently it's fast even if we don't have type information, because it still inlines the native +

12:31 that's where I assumed the hit would be

12:32 we'd have to emit "if(typeof x == 'number' && typeof y == 'number'){x+y}else{add(x,y)}", no?

12:34 * gfredericks replaces that with a proper ternary

12:35 Miko2: Can I put utility functions inside defrecord, or do I need to put them outside?

12:36 ...as "regular" functions.

12:40 eckroth: Miko2: it is my understanding that you have to either make them regular funcs or create a protocol

12:40 Miko2: but that funcs do not go "inside" defrecord like you would in java

12:41 ejackson: does clojurescript do anything to strings passed in as arguments. In a console $("div:contains('foo')") returns the elements, but called from compiled clojurescript (js/jQuery "div:contains('foo')") does not :(

12:41 Miko2: Yeah. So I just put the "methods" that implement the protocol inside defrecord and do everything else with regular functions? :)

12:41 ejackson: Miko2: yup.

12:56 devn: brain fart: is there a not-empty?

12:57 like...

12:57 ,((complement empty?) "")

12:57 clojurebot: false

12:57 Chousuke: use "seq"?

12:58 iirc empty? is defined as (not (seq ...)) :p

12:58 devn: Chousuke: thanks

12:58 ejackson: there is not-empty

13:00 devn: ejackson: that isn't a predicate though

13:00 TimMc: It can be.

13:00 drguildo: i have a scala program with a listbuffer that stores swing progress bars that get drawn to a table. what's the "best" way to achieve the same kind of thing the clojure/functional way?

13:01 ejackson: right

13:01 TimMc: &(map not-empty [[] [1 2 3]])

13:01 lazybot: ⇒ (nil [1 2 3])

13:01 drguildo: i should have mentioned the listbuffer gets added to and removed from

13:02 TimMc: It preserves type, so it is used in things like (when-let [v (not-empty ...)] ...)

13:02 Chousuke: drguildo: a vector/list inside an atom or something

13:04 ejackson: in answer to my earlier clojurescipt question: no, clojurescript behaves like you'd expect. I got nailed by async, per usual.

13:06 tomoj: suppose I can provide blocking ISeq semantics in clojure, but not in clojurescript. I can provide nonblocking ISeq semantics in both, where each element is an eventual value, say through ISeqable. but providing both semantics in clojure would mean (seq? x) but (not= x (seq x)) and (not= (first x) (first (seq x)))

13:06 is that reasonable?

13:08 TimMc: tomoj: first calls seq

13:09 tomoj: not if it's already a seq

13:09 TimMc: hmmm

13:09 That sounds rather naughty.

13:09 tomoj: actually

13:10 if I just don't use ISeqable, and instead provide a function that returns a seq of eventual values, it looks a lot less weird

13:10 drguildo: Chousuke: thanks

13:12 mheld: is there a devise-like authentication framework for clojure?

13:13 lynaghk: mheld: https://github.com/cemerick/friend

13:15 mheld: gracias

13:21 freiksenet: hi! I am having trouble connecting to lein swank server, it says 'can't find suitable coding-system'. Is there any standard solution to that? It used to be working ~6 months ago with same config

13:21 slime is latest quicklisp version, works with SBCL fine

13:27 Miko2: Umm, the records defined with defrecord are not available through lein repl when I (use 'xyz) them. The other functions from xyz are in the scope. :/

13:28 Getting CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: Foobar, compiling:(NO_SOURCE_PATH:16)

13:32 Oh, I need to import it?

13:44 meiji11: I've written a macro that swaps the values of two locals created in a let if those bindings satisfy some predicate. the macro is incredibly slow.. it takes about 9 seconds whereas the original code executes in about 100 ms. why might that be?

13:50 ah, never mind. I see now.

15:02 technomancy: freiksenet: if you're still having trouble with slime, the problem is the version you're using is too new: http://p.hagelb.org/slime-cvs-rant.txt

15:03 freiksenet: technomancy: I tried clojure-jack-in and now it complains about unbalanced parens. clojure-jack-in should be using it's own slime, shouldn't it?

15:08 technomancy: it should, but there's no way to unload an existing slime if you've already got one loaded in a given instance

15:08 the results of loading two different versions sequentially are undefined

15:10 freiksenet: okay, I removedthe file that loaded slime. result is the same

15:10 so it still complains about unbalanced parenthesis

15:17 technomancy: so what's the last supported slime version? I will try to downgrade and use my previous setup

15:28 scottj: freiksenet: I have good luck with 2009-10-15

15:29 bbloom: dnolen: Help me help you & Raph with the pluggable backend stuff :-)

15:30 I've got some extra time to work on CLJS now

15:30 Decoupling parse&analyze from js&emit seems like the right first step

15:31 freiksenet: scottj: that's quite old )

15:31 scottj: freiksenet: ritz supports a more recent version, but it's from 2010 I think :)

15:32 The only major new feature I've heard mentioned since then is presentations, would be curious to hear of others

15:41 dnolen: bbloom: heya, cool!

15:41 bbloom: dnolen: hey

15:42 dnolen: bbloom: finally getting around to doing something about your emit patches, source map work is under way.

15:42 bbloom: :-) who's doing more stuff on source maps?

15:42 dnolen: bbloom: I am! :)

15:42 bbloom: http://github.com/clojure/clojurescript/tree/source-map

15:43 bbloom: dnolen: nice.

15:43 dnolen: bbloom: more than happy to get some help of course :)

15:43 bbloom: dnolen: heh, i have some vlq encoding code here too

15:43 dnolen: bbloom: http://github.com/clojure/clojurescript/compare/master...source-map

15:43 bbloom: vlq stuff is done, works

15:44 bbloom: dnolen: great. gotta instrument emission

15:44 dnolen: bbloom: yes emission I think will be straightforward.

15:45 bbloom: dnolen: i haven't given it much thought yet, so i dunno

15:45 dnolen: but we need to parse the Closure source map, merge with original line/col info and generate a real source map.

15:46 bbloom: dnolen: so i have several irons in the fire: 1) source maps 1B) column metadata 2) decouple parse/emit 3) vars 4) ast children

15:46 maybe something else too....

15:46 where should i start? :-P

15:48 i think there's a bunch of stuff in the parse/analyze phase that can move to the emit phase and there's a bunch of stuff in the emit phase that can move into macros… for example :vector, :set, :map, etc can become macros. they simply generate function calls

15:48 I'd love to trim down the compiler.clj file into analyzer.clj and compiler/js.clj + whatever core compiler stuff

15:48 dnolen: bbloom: source maps are big, if you want to get up to speed w/ what I've done that would be helpful.

15:49 bbloom: raph_amiard is already working on that.

15:49 bbloom: col metadata is really just waiting on Clojure/core approval - that may take a while.

15:50 bbloom: dnolen: OK. I have no idea if that patch will stay up to date with other changes. i'm still pretty new to contributing to other people's open source communities!

15:50 dnolen: I read the master..sourcemaps diff — anything else to look at?

15:52 dnolen: bbloom: not yet, just trying to figure the best format to emit CLJS -> JS mapping info.

15:52 bbloom: dnolen: OK, i can help think about that… what have you got so far?

15:52 dnolen: bbloom: I'm thinking a map for the segment, vector of segments for the line, vector of lines

15:53 bbloom: that's for the CLJS -> JS side, we need that info.

15:53 bbloom: then we need to read the Closure map source-map and probably convert to the same format

15:53 bbloom: merge

15:53 bbloom: hold on, finding the source map spec

15:53 dnolen: open to other reps, just whatever is the simplest for merging.

15:54 bbloom: you mean merging multiple compilation units? or merging multi-level source mappings?

15:55 also worth noting: last i tried, webkit provided practically zero in-app logging of sourcemap loading. if you run chrome from a terminal w/ the debug flag on the command line, you get slightly more info

15:56 dnolen: bbloom: anything less than multi-level source mapping is useless for CLJS.

15:57 bbloom: dnolen: but does that mean we need to do the merging? my assumption was that we just needed to produce a single source map and provide it as input to gclosure

15:57 dnolen: bbloom: news to me, do you have a link?

15:57 bbloom: dnolen: isn't that what GWT does? java->js as input to closure compiler which produces java->minjs

15:58 dnolen: looking

15:58 dnolen: bbloom: far as I know noone has multi-level source mapping.

16:01 bbloom: dnolen: hold on, slow connection & need to checkout the closure compiler source

16:05 dnolen: bbloom: Closure does provide a SourceMapConsumer but it doesn't produce Clojure types so it will be a pain to work w/.

16:07 bbloom: dnolen: still checking out — but i thought you could just produce a source map as json & then pass that file path to the closure compiler

16:09 dnolen: bbloom: and what would that do?

16:10 bbloom: dnolen: well, you're saying we need multi-level because of clj->js->minified, right?

16:11 dnolen: step one is clj->js and disable advanced optimizations — i *thought* closure could handle merging for us, but even if it can't you still need a source map to merge! :-)

16:11 dnolen: bbloom: there's not to disable adv opts, emission has nothing to do with that.

16:11 no need to disable.

16:12 bbloom: dnolen: no, what im saying is that the two source maps you want to merge are cljs->js and js->optimized, right?

16:12 dnolen: bbloom: source-map branch is already generating the Closure source-map for any :optimization level from the original emitted JS

16:12 Anniepoo: lein.bat's not working for me on winders 7. It installs with self-install but doesn't find the clojure jars after

16:12 =8c/

16:12 dnolen: bbloom: no

16:12 * Anniepoo waves at dnolen

16:13 bbloom: dnolen: then which are they?

16:13 dnolen: bbloom: Closure optimization compilation produces a source map, before that CLJS-JS emissions produces in-memory mappings

16:13 bbloom: dnolen: yeah, that's js->minjs, right?

16:14 dnolen: bbloom: we load closure source map converting it into another set of in-memory mappings that's mergeable with the one we created during emission

16:14 bbloom: a bit convoluted but I've seen nothing in Closure that would make this simpler (could be missing something)

16:15 bbloom: dnolen: have you pushed the latest work you have to github? :-P b/c all i see is the vlq code

16:15 dnolen: no changes to compiler.clj

16:16 dnolen: bbloom: not yet, I'm toying with some stuff but the approach is in mostly in my head at the moment.

16:16 bbloom: dnolen: heh, ok. what i'm saying is that there are three source maps that exist. one is cljs->js, the next is js->minjs, and the last is cljs->minjs

16:17 dnolen: bbloom: there are only two source-map that will actually get produce, not three

16:17 bbloom: dnolen: closure produces js->minjs and *might* provide map composition we need (might also not)

16:17 dnolen: 1) closure js->minjs, 2) cljs->minjs

16:18 we never actually produce cljs->js

16:18 bbloom: dnolen: why not?

16:18 it seems like that's the only one *we* need to make, if closure provides a way to compose maps for us

16:19 dnolen: bbloom: *if* closure does, I've seen nothing of the sort. source v3 doc specifically mentions the challenges around merging source map. and

16:20 bbloom: dnolen: actually, that seems like the only one we *can* make on our own :-P we don't know what transformations closure's compiler makes for us

16:20 but anyway, my thought was to just ignore advanced compilation for a moment. implement cljs->js, and then worry about merging next

16:21 dnolen: bbloom: it's just too low of a goal at this point.

16:21 Anniepoo: is leiningen dead?

16:22 dnolen: bbloom: we do a lot of optimizations ourself under advanced compilation.

16:22 Vinzent: Anniepoo, what do you mean?

16:23 Anniepoo: I'm trying to install leiningen/clojure/etc on a windows 7 machine,

16:23 lein self-install installs, but then can't find clojure. d/l and install binaries and adding to my classpath doesn't help

16:23 8c/

16:23 bbloom: dnolen: we might be talking past each other. "advanced compilation" == google closure's advanced compilation. i'm saying we should get source maps working inside the cljs compiler on a single compilation unit without touching google closure at all — we need to get source maps working on a single expression before we can worry about project-wide

16:24 Vinzent: Anniepoo, what do you mean by "can't find clojure"?

16:26 dnolen: bbloom: to be clear, it doesn't matter what level of :optimization you use

16:27 Anniepoo: ah- ok, my beliefs about how this all works are out of date

16:27 dnolen: bbloom: and yes, what you're saying does need to be solved regardless.

16:29 Vinzent: Anniepoo, btw, you can run "lein repl" to get basic code evaluation tool. It can be done outside of project too

16:29 bbloom: dnolen: right. i'm saying that compiler.clj needs to be able to produce a mapping — long before closure.clj touches it

16:29 Anniepoo: they moved the clojure jares, I tried adding them to project.clk

16:30 dnolen: bbloom: currently the compiler always defaults to :simple - but :whitespace, :pretty-print all of these things change the original emitted source.

16:31 bbloom: writing the code that produces the simplest source map will need to be done. but I don't think anyone will ever use it once we get to merging - which I don't think will be much work.

16:34 bbloom: dnolen: except that we probably *shouldn't* do merging ourselves b/c it's something that the browsers should be able to handle. you actually want *both* source maps in the browser so you can debug at varying levels

16:34 dnolen: also, it's something that *every* compiler needs

16:34 dnolen: consider again GWT: java->js->minjs

16:35 the merging doesn't belong in GWT, it belongs in the js->minjs phase

16:35 or, better yet, it belongs in the web inspector

16:35 dnolen: bbloom: I've heard of no such browser plans - source maps in fact launched mentioning that this might be supported one day but who knows when?

16:35 bbloom: unless you have evidence to the contrary.

16:37 bbloom: dnolen: i *thought* had evidence to the contrary. still looking. either way, merging should happen elsewhere. we should contribute to chromium or gecko, if they don't support merging. that's the right level for this merging to happen.

16:37 dnolen: bbloom: btw I've never seen any demos of GWT java->js->minjs

16:37 bbloom: only java->js

16:37 only js->minjs

16:38 bbloom: CoffeeScript has the same problem thus things are still moving slowly on this, plus they emit semi-debuggable JS.

16:38 bbloom: dnolen: GWT probably isn't the best example. I'm pretty sure I saw a coffeescript -> minjs demo

16:38 dnolen: bbloom: does not exist

16:39 bbloom: if it did I most definitely with have heard about it from Jeremy Ashkenas himself.

16:39 bbloom: dnolen: heh, ok

16:40 dnolen: either way, the cljs->js mapping needs to exist before merging can do anything useful

16:41 dnolen: bbloom: yes

16:43 iwo: hey, does anyone know how i set jvm arguments that should be used when running swank in emacs?

16:43 i use :jvm-opts in my project.clj for lein, but this isn't used by swank when run via clojure-jack-in

16:56 bbloom: dnolen: reviewed the source map specs & gave some thought to the in memory representation. i think you're right. to clarify:

16:57 top-level map with :file and :lines keys. each lines key is just a vector of segments. each segment is just a map with :original and :generated keys with [line column] values and :name, :source-file keys

16:59 so: {:file "abc.js" :mappings [[{:source [1 2] :generated [3 4] :name 'abc :file "abc.cljs"}]]}

16:59 dnolen: bbloom: branch updated, with some thinking http://github.com/clojure/clojurescript/compare/master...source-map

17:00 bbloom: now all we need is code to produce a v3 source map from *cljs-mappings*

17:02 bbloom: side question: why are all of these vars prefixed with cljs- ?

17:03 dnolen: i thought namespaces meant we didn't need prefixes :-)

17:04 dnolen: bbloom: well eventually these will get moved into the js emission namespace, good way to mark things that will move for now :) but yeah, should be more consistent

17:05 bbloom: dnolen: looks like a good start. clever use of metadata on the symbols

17:06 is :var the only place we need to emit mappings?

17:07 dnolen: also, use :col (when m (:col m 0))

17:07 dnolen: that way it will gracefully upgrade to support columns when available :-)

17:08 dnolen: and actually, are columns and lines one or zero based? maybe you want 1, not 0

17:08 dnolen: bbloom: I'm not totally sure - sidenote, I'm not totally sure why source map v3 segments are 1,4,5

17:08 bbloom: columns are 0 based

17:08 bbloom: lines are 1, but that's implicit in the mapping vector anyhow.

17:08 bbloom: 4 I guess for things minifiers might do? 1 is a mystery.

17:08 bbloom: good catch re: col

17:10 bbloom: dnolen: yeah, the 1,4,5 is a bit of a mystery for me… the docs are complecting logical representation and encoding based on prior values

17:11 dnolen: http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/ is a little clearer than the spec

17:11 dnolen: bbloom: k then 1 is probably to account for whitespace

17:12 bbloom: yeah I looked over that a few times.

17:14 bbloom: dnolen: is *cljs-gen-col*necessary? seems like one more thing to keep track of. couldn't you do: (let [last-segment (-> *cljs-mappings* last)] (+ (:gcol last-segment) (count (:name last-segment)))

17:14 dnolen: (it is very hard to code in irc :-P you get the idea)

17:15 dnolen: bbloom: *cljs-mappings* doesn't contains segments, it contains lines, *cljs-gen-col* just seems faster/simpler in this case.

17:16 bbloom: sorry, i mean (-> *cljs-mappings* last last)

17:16 dnolen: not super important anyway

17:16 dnolen: I'm glad the *position* thing was already done :-) that makes all this much easier!

17:17 dnolen: bbloom: oh definitely, when I started digging in I realized your work makes this trivial :)

17:17 bbloom: dnolen: that's why i did it :-)

17:18 dnolen: I'd be twice as clever if I wasn't trying to run a startup at the same time!

17:18 dnolen: bbloom: it's very clean, lets us keep the source mapping code very self contained.

17:19 bbloom: dnolen: yeah, mostly. i'm still not sure if :var is the only place we want to omit stuff

17:19 dnolen: because there are other places we generate javascript names… basically anywhere we emits (:name foo)

17:19 dnolen: that's one of those things where we'll have to feel it out once it's working in the browser

17:20 dnolen: bbloom: it most definitely is not, we also probably want to generate position information for anon functions etc.

17:21 bbloom: right. some of this source map stuff is going to leak into the repl implementation if we want to support source mapping of eval-ed code

17:21 at minimum, compile-file needs to emit a // source map comment

17:21 and there was some talk of adding an X-SourceMap header, but that probably belongs in Ring or something as a middleware

17:22 dnolen: bbloom: source mapping of eval-ed code is for later :) yes on the // source map comment

17:25 bbloom: dnolen: i see you added a json lib. do we really need that extra dependency… i mean… we're a compiler that emits javascript… we've already got all the escaping code we need :-)

17:27 dnolen: bbloom: we don't have anything for emitting JSON from maps.

17:27 maps/vectors etc I mean.

17:29 bbloom: dnolen: this is what i have in my local source-maps branch: https://www.refheap.com/paste/2982

17:31 dnolen: no dependency & the encoded mappings are guarenteed to be valid JSON strings. i don't think the "names" key is necessary, but even then, it would just be (string/join ",") and emit-constant for file names

17:31 dnolen: bbloom: ah right, yeah that's better

17:31 bbloom: good point, no need for data.json here.

17:32 bbloom: dnolen: just need to make sure you rebind the various dynamic vars used during compilation. don't want to override *cljs-mappings* while emitting source maps. which brings me back to the question "do we need *cljs-gcol*?"

17:33 dnolen: IMO, we should merge all of those with *cljs-file* into a single dynamic var for the current compilation state

17:34 dnolen: bbloom: I'd be wary of performance

17:34 bbloom: should be measured before going down that route.

17:35 bbloom: dnolen: *shrug* you'd know the perf stuff better than me.

17:35 dnolen: I'd be surprised (and saddened) if a top level record wasn't fast enough

17:36 dnolen: bbloom: updateing top level record will never compete w/ updating top level atom, ever.

17:37 bbloom: dnolen: fair enough. did those are-we-fast-yet graphs include benchmarks for the compiler itself? or just the output code?

17:38 dnolen: bbloom: yes they benchmark compile times, things have a gotten a little slower as we do more analysis, more optimizations.

17:39 bbloom: dnolen: ok. shouldn't be an issue at all for interactive development, but luckily, it should parallelize well by file for larger projects

17:41 dnolen: anyway, i want to make a lot more refactoring to compiler.clj — the limiting factor however may be your time to understand and review them :-)

17:44 dnolen: bbloom: sure, always good to write up your notes somewhere on what you'd like to see improved.

17:45 bbloom: dnolen: i did that a bit with Vars, but no one seemed to notice

17:45 dnolen: i don't want to feel like i'm always pestering you to get my patches accepted

17:46 dnolen: bbloom: I've looked a bit at your vars stuff, that patch/enhancement is just not high priority.

17:48 bbloom: things that'll move faster is anything related to compiler modularity, debugging, and performance.

17:48 bbloom: dnolen: fair enough. i'm just interested in helping improve the cljs environment & working towards CinC.

17:48 dnolen: fair enough. re: modularity, take another look at my munging patch :-)

17:49 dnolen: untangling the layers in compiler.clj are a big step towards the lua backend, but i'm more interested in digging down to the module layer, so that we can enable the various optimizations you have on core to apply to other namespaces. stuff like direct dispatch

17:50 dnolen: both goals follow many of the same steps, however

17:50 dnolen: bbloom: ah thanks for updating that ticket, sounds good will look into.

17:50 bbloom: direct dispatch already works on all namespaces.

17:51 bbloom: I mean I'll review CLJS-294 patch more closely, and probably apply.

17:51 bbloom: dnolen: k, thanks.

17:51 dnolen: bbloom: analysis follows namespaces now

17:51 bbloom: dnolen: ah, ok — missed that

17:52 dnolen: bbloom: the only patch you've submitted that I'm dragging my feet on is the vars enhancement, excited about the others :)

17:53 bbloom: your contributions are most welcome.

17:53 bbloom: dnolen: thanks :-)

17:54 dnolen: RE: the vars stuff. i greatly scaled back that patch. no changes to dynamic vars, etc. no iwatchable, etc. just implemented the #' reader and (var ) form. it simply emits a wrapper object which enables stuff like (comp f #'g)

17:54 dnolen: should be much less objectionable :-)

17:54 dnolen: bbloom: k, thx for the update I'll take another look. Also thanks for getting in touch with raph_amiard! sorry I didn't follow up about the mentoring stuff - just got back from a trip today.

17:55 bbloom: dnolen: no worries. i don't mean to pester. i'm just excited :-) haven't had this much fun coding in years

18:04 johnmn3: https://www.refheap.com/paste/2984

18:05 So, I'm getting noticable speedup with r/map with inc (after I cleaned up my chunkifier)

18:06 but when I try it with other workloads, I can't repeat this

18:16 trying to put together a simple example, but I'm working with a cellular automaton that has grown a little complex

18:17 dnolen: bbloom: nice patch, CLJS-294 patch merged into master. that removed quite a bit of ugliness thx.

18:18 bbloom: dnolen: cool, thanks

18:38 johnmn3: so, reduce applies a fun to the first element, and then applies the fn to the result and the next element

18:40 so for a 1d cellular automaton, I could reduce across by conjing the result.. but no, that wouldn't work

18:40 tomoj: (doseq [x cljs.core.PersistentQueue] (.log js/console x)) prints "null" for me

18:40 er, cljs.core.PersistentQueue/EMPTY ofc

18:42 TimMc: Anniepoo!

19:14 Anniepoo: hey Tim!

19:14 mheld: is compojure worth following?

19:14 Anniepoo: 8cD I'm getting back into Clojure!

19:15 mheld: compojure over noir?

19:16 weavejester: mheld: Noir is a higher-level framework, but in some ways less flexible than Compojure.

19:16 mheld: I'm kinda biased, but Compojure tends to be "simpler" while Noir tends to be "easier"

19:22 mheld: weavejester: I come from the rails world (but I'm a schemer) -- which would I be happier with?

19:22 weavejester: mheld: Noir is closest to the Rails/Ruby world, I think :)

19:23 Anniepoo: on the other hand, that's a strong argument for compojure

19:23 8cD

19:23 weavejester: Anniepoo: I think so :)

19:23 mheld: weavejester: isn't it a little less resource-focused and more page-focused, though?

19:24 dnolen: weavejester: Noir is not close the the Rails world at all from what I've seen.

19:24 mheld: Noir seems Sinatra-like, minimal with standard patterns for the usual stuff.

19:25 mheld: Compojure is lower level - a tiny bit of sugar over Ring - which is like Rack

19:26 weavejester: dnolen: It's closer than Compojure, I think. Though I agree it's pretty distant from Rails; it's more like Sinatra.

19:26 dnolen: mheld: Rail-ish stuff is not the kind of thing Clojure folks get excited about.

19:27 Anniepoo: ok, aaaargh, stupid question, started repl in foo, my sources are in ns tacos.core in tacos/src/tacos/core.clj, what's the arg to use?

19:27 (brain's been twisted by prolog)

19:27 weavejester: mheld: Compojure tends to take the view that complex web applications should be compositions of smaller sets of routes.

19:27 Anniepoo: Arg to use for what?

19:27 Anniepoo: to (use)

19:28 mheld: dnolen: I can appreciate that, I just like the idea of being able to structure my app based around resources that talk together

19:28 but I guess that's not impossible

19:28 Anniepoo: as in, I'd like to import into the repl's space.

19:28 weavejester: Anniepoo: load ?

19:29 Anniepoo: 8c( I've forgotten lots of details

19:29 pepijndevos: dnolen, I herad you're going to do something with cljs saturday at hackerschool :) Looking forward to meet you.

19:29 dnolen: pepijndevos: ah you got in!

19:29 Anniepoo: I'd do (load 'tacos.core)

19:29 or somesuch

19:29 pepijndevos: dnolen, yea! They're amazing folks, had a picnic yesterday.

19:30 dnolen: pepijndevos: rad! congrats!

19:30 pepijndevos: look forward to meeting in person as well!

19:30 * Anniepoo is an old school type, hackers hung out all night at the computer center

19:34 pepijndevos: dnolen, there seem to be some ckanren related fns on github already. what's up with that?

19:34 dnolen: pepijndevos: half baked motions

19:34 pepijndevos: got caught up in CLJS stuff so I haven't revisited.

19:35 pepijndevos: challenge is coming up with good fast representations for the domains.

19:35 pepijndevos: dnolen, FYI, the only dead tree I brought is the reasoned schemer :D

19:35 dnolen: pepijndevos: haha nice

19:35 pepijndevos: I can walk you through the cKanren stuff on Sat if you like.

19:36 pepijndevos: dnolen, That'd be amazing. I don't feel like I really understand minikanren itself though.

19:38 dnolen: pepijndevos: I can give you a run through on that as well

19:39 pepijndevos: my talk won't be that long

19:39 pepijndevos: taking off for a bit, talk soon.

19:39 pepijndevos: ok, splendid.

19:40 see you Saturday

19:55 johnmn3: how do I get the full stack trace from lein2 run?

19:59 sc_: OO people have UML and several methodologies for large S/W design. What techniques do lisp people normally use for large S/W design?

20:01 bbloom: sc_: avoidance of writing large software by careful use of abstractions and layering :-)

20:01 Anniepoo: the question's less often an issue because programs tend to be about 10% of the length.

20:04 johnmn3: is this inefficient? (drop 1 (drop-last (range (count coll))))

20:06 bbloom: ,(doc drop-last)

20:06 &(doc drop-last)

20:06 lazybot: ⇒ "([s] [n s]); Return a lazy sequence of all but the last n (default 1) items in coll"

20:06 bbloom: says it's lazy :-)

20:07 &(first (drop-last (range)))

20:07 lazybot: ⇒ 0

20:07 bbloom: johnmn3: looks efficient to me

20:08 johnmn3: does it matter if coll is a vector or a list?

20:08 or no

20:08 I mean (drop 1 (drop-last (vec (range (count coll)))))

20:09 bbloom: well the "vec" will be eager

20:10 laziness happens on seqs (that is: 'seq?) but anything that is 'sequential? supports the first/rest/lazy-cat/lazy-seq pattern

20:10 via coercion to a seq: (seq [1 2 3])

20:48 frozenlo`: I'm stuck again... The worse part is that I'm sure the solution is really simple. I have a function taking as argument an input (data) and an output (stream). I can easily send the output to a file, but how can I simply get the result directly?

20:49 Here is the function I'm playing with: https://gist.github.com/1858654 . More precisely `gunzip'

20:49 bbloom: &(doc *out*)

20:49 lazybot: ⇒ "; A java.io.Writer object representing standard output for print operations. Defaults to System/out, wrapped in an OutputStreamWriter"

20:50 bbloom: &(doc binding)

20:50 lazybot: ⇒ "Macro ([bindings & body]); binding => var-symbol init-expr Creates new bindings for the (already-existing) vars, with the supplied initial values, executes the exprs in an implicit do, then re-establishes the bindings that existed before. The new bindings are m... https://www.refheap.com/paste/2985

20:50 bbloom: &(doc with-out-str)

20:50 lazybot: ⇒ "Macro ([& body]); Evaluates exprs in a context in which *out* is bound to a fresh StringWriter. Returns the string created by any nested printing calls."

20:50 bbloom: frozenlo`: does that help?

20:51 frozenlo`: The last one is gold, thank you very much!

20:51 bbloom: :-)

20:52 frozenlo`: Works flawlessly. I can't believe I was stuck on this for more than a hour.

20:52 bbloom: &(source with-out-str)

20:52 lazybot: java.lang.RuntimeException: Unable to resolve symbol: source in this context

20:52 frozenlo`: Thank you very much indeed

20:52 bbloom: aw, no source…. run that one in your repl

20:52 take a look at the source of it — it's not magic! :-)

20:52 amalloy: ~def with-out-str

20:53 bbloom: amalloy: no luck...

20:53 amalloy: he'll notice eventually

20:53 i bet

20:53 bbloom: heh

20:54 frozenlo`: Interesting. Should I try to use StringWriter manually? Or is rebinding *out* common practice?

20:55 bbloom: Frozenlock: rebinding *out* is as designed — just wanted to show you how you could dig into the various things to understand how they work

20:55 Frozenlock: for example, check out the source of prn, prn-str, pr-str, print-str, etc

20:56 Frozenlock: bbloom: That's what got me in this rabbit hole in the first place.. I was looking at slurp, then reader... Started in the wrong direction :P

20:58 bbloom: Frozenlock: heh, yeah. printing is quite the rabbit hole for sure. there are a bunch of printing vars worth understanding. see: http://clojure.org/other_functions#Other%20Useful%20Functions%20and%20Macros-Printing

21:03 Frozenlock: Now I see `str' (which I use quite often) with new eyes!

21:04 _ato: I wouldn't use *out* rebinding for gzip, because you're dealing with binary data (streams) not string data (readers)

21:06 bbloom: _ato: ah, good point. I didn't even look at his gist, had no idea it was binary

21:07 Frozenlock: still, the pattern is worth mirroring for your use case

21:07 Frozenlock: _ato: So it only worked because I was encoding strings?

21:09 _ato: probably, not sure what you did, but if you're passing things through readers/writers/strings it'll likely break on byte sequences that aren't valid UTF-8 characters

21:10 personally I'd just keep it how it is in your gist and add an extra helper like gunzip-text-lines that passes a ByteArrayOutputStream

21:11 gunzip-to-array or something

21:12 beware that I'm not sure I'm fully understanding the question though

21:12 lynaghk: jimduey: ping

21:14 Frozenlock: In my case it isn't really a problem, as I intend to encode only strings. Still, could you point me towards a solution to convert a stream to an array?

21:14 tomoj: Frozenlock: a demonstration https://gist.github.com/6fe33dc93b1b15634245

21:15 er, except leave out the io/input-stream of course :)

21:21 Frozenlock: tomoj: thanks :)

21:21 I should really come here more often

21:22 TimMc: Anniepoo: Did your question about loading namespaces get answered? Form the REPL you'd do something like (use 'tacos.core)

21:22 Anniepoo: no, never got answered

21:22 and actually, I got distracted, now I'm back at it

21:22 so I'm still trying to figure out the filename/require mapping

21:23 TimMc: Anniepoo: tacos/core.clj is the file in which the namespace tacos.core lives.

21:23 Anniepoo: yes- hang on, lets talk absolute paths a moment

21:23 TimMc: Anniepoo: Hyphens in namespaces map to underscores in file and folder names (because the JVM is limited.)

21:24 bbloom: dnolen: http://dev.clojure.org/jira/browse/CLJS-297 I've got a big ol bag of refactors in me :-)

21:24 Anniepoo: C:\development\lein\tacos\src\tacos\core.clj contains this short file

21:24 (ns tacos.core)

21:24 TimMc: Anniepoo: OK. src/ is a classpath root, one of many. That's something Leiningen knows about, so it adds that to the classpath.

21:24 Anniepoo: ah, ok

21:25 so my namespace is tacos.core

21:25 TimMc: Anniepoo: When Clojure's loader looks for the *namespace* tacos.core-with-hyphen, it asks the JVM for the *resource* tacos/core_with_hyphen.clj, and the JVM finds it in one of the classpath roots.

21:25 Got to go, but that's the basics of namespaces and classpaths.

21:26 Anniepoo: hmm

21:26 ok, but I can only start lein repl in dev\lein

21:29 jimduey: lynaghk: pong

21:29 TimMc: Anniepoo: Call it from the project root.

21:29 Anniepoo: ok

21:30 lynaghk: jimduey: hey, I'm just reading your blog. I was going to ask about the ring testing DSL you talked about at Clojure/West but I found the source on the githubs.

21:30 TimMc: Then it will see the project.clj and read it, loading the right classpath.

21:30 jimduey: For anyone interested in monads, I just put up a new post:

21:30 http://www.clojure.net/2012/06/03/Monad-Protocols/

21:30 Anniepoo: gripes about

21:30 jimduey: lynaghk: cool. Hope it's understandable.

21:31 lynaghk: jimduey: I have some time to clean up an old project (API that spits out charts), so I'm looking around for a good way to put together a test suite.

21:31 Anniepoo: gripes it can't find the lein self install jar

21:31 lynaghk: jimduey: do you have any suggestions for doing http tests in Clojure? At this point I'm thinking about just using clj-http with Midje

21:32 jimduey: lynaghk: Not really other than what's in that library.

21:33 Anniepoo: ah, clue - the complaint is it can't find leiningen-1.6.2-standalone.jar

21:33 lynaghk: jimduey: okay, cool. I didn't know if you wrote that up for funsies or if there was a big work project behind it or somethin

21:33 Anniepoo: and running lein self-install asserts that leining-1.7.7-standalone.jar already exists

21:34 jimduey: lynaghk: I needed it for a personal project. What's there was enough for me. It should be easy to extend

21:35 If you want to add anything, I'd be glad to help.

21:37 lynaghk: jimduey: okay, thanks! Yeah, my needs aren't really huge. Half of what I'm wondering about is whether there are clever things out there for doing parallel requests or structuring/generating tests for a RESTful API.

21:41 TimMc: Anniepoo: Deleting ~/.lein (and if necessary, the ~/.m2/repository cache) has helped some folks in the past...

21:42 then lein self-install again

21:42 Anniepoo: ok, will do that next

21:42 I decided to try grepping my whole drive for lein

21:43 TimMc: Nah, it's all in those two places.

21:43 Anniepoo: I actrually have an old one in c:\Program Files (x86)\Clojure Box\swank-clojure

21:44 (an old leiningen directory)

21:46 oooh! I now have 25 hits

21:46 I think I should clean up some of this

21:46 =8co

21:50 johnmn3: confused by this:

21:50 Caused by: java.lang.NoSuchMethodError: clojure.lang.Numbers.lt(II)Z

21:50 what is .lt(II)Z

21:51 TimMc: I = Integer, I think. Z = Long?

21:52 &(class (boolean-array []))

21:52 lazybot: ⇒ [Z

21:52 TimMc: &(class (int-array []))

21:52 lazybot: ⇒ [I

21:52 TimMc: Oh, that makes sense. Wonder what's up.

22:15 mheld: noir vs conjure?

22:20 technomancy: compojure!

22:21 weavejester: I haven't heard a lot from conjure in a while.

22:21 Conjure also seemed not very Clojure-like...

22:22 I agree with technomancy's choice, too ;)

22:29 johnmn3: weird errors

22:29 Exception in thread "main" java.lang.NoSuchMethodError: clojure.lang.Numbers.min

22:29 us(I)I

22:29 Exception in thread "main" java.lang.NoSuchMethodError: clojure.lang.Numbers.minus(I)I

22:30 is this because I'm using clojure 1.5alpha1?

22:30 do Numbers not implement minus?

22:31 in the repl (- 1) works fine

22:32 but the top of the stack trace points to this line: (let [left-index (- (int (/ the-width 2))) ...

22:32 mheld: yeah, I don't see much going on with conjure

22:32 tomoj: johnmn3: it sounds like the clojure version at runtime probably doesn't match the clojure version used to AOT compile some code you're using

22:33 mheld: I'm going to secede from trying to use anything *other* than compojure

22:33 johnmn3: tomoj: I did a lein2 dep again

22:33 mheld: what do y'all use for url routing?

22:33 tomoj: but did you AOT compile, or do any of your deps contain AOT compiled clojure code?

22:34 johnmn3: I have a main class, but none of the namespace declarations ask to be :aot compiled

22:34 tomoj: you have a (:gen-class)?

22:35 johnmn3: no

22:35 tomoj: where does the stacktrace on the error lead?

22:35 johnmn3: should I just empty out the libs and bin folder and re-dep?

22:35 it leads back to the main class

22:36 tomoj: clojure.main? or how do you have a main class without (:gen-class) ?

22:37 johnmn3: -main

22:39 tomoj: can you gist the stack trace?

22:42 johnmn3: https://www.refheap.com/paste/2986

22:43 tomoj: huh

22:44 johnmn3: ewe, my pasting lost the line numbers

22:44 I can re try that

22:44 tomoj: error is on line 68 in your paste I assume

22:44 so looks like aot is not the problem?

22:45 johnmn3: well, for some reason it is saying: All namespaces already :aot compiled.

22:45 tomoj: I guess just try `lein2 clean` `lein2 compile` to be sure

22:45 johnmn3: k

22:45 tomoj: also check lib and lib/dev for multiple copies of clojure

22:46 dnolen: bbloom: heya looks like CLJ-294 broke ^:export

22:46 CLJS-294 I mean.

22:46 johnmn3: hah, that worked

22:47 strange. Now pmap is beating reducers

22:48 tomoj: with fold?

22:59 johnmn3: tomoj: yea, the new reducers/fold thing

23:02 bbloom: dnolen: can you elaborate on "broke" ? will it be obvious if i try it?

23:06 dnolen: bbloom: it will be obvious

23:06 bbloom: goog.exportSymbol("cljs.foo_bar", cljs - foo - bar)

23:06 bbloom: :export is now broken.

23:07 bbloom: dnolen: ok, ill look at it in a few minutes. should be a quick fix

23:07 dnolen: i'll also try to get a test case in there

23:07 dnolen: bbloom: great thx

23:14 bbloom: dnolen: yeah, trivial fix -- just add a call to munge on line 463

23:15 dnolen: can you just make that change for me?

23:16 dnolen: or ill just make a patch :-P

23:17 dnolen: bbloom: I see it thx

23:18 bbloom: dnolen: it's actually two calls

23:18 i'm uploading the patch now

23:18 dnolen: bbloom: k thx

23:19 bbloom: dnolen: updated http://dev.clojure.org/jira/browse/CLJS-298

23:22 dnolen: sorry i missed that!

23:28 rhdoenges: is there a way of mapping over a seq without worrying about the return value? ie (map println a-bunch-of-strings) but without returning a big list of nils?

23:28 I mean, map works fine

23:28 bbloom: &(doc doseq)

23:28 lazybot: ⇒ "Macro ([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."

23:29 bbloom: &(doc do all)

23:29 lazybot: clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox7502$doc

23:29 bbloom: &(doc doall)

23:29 lazybot: ⇒ "([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through t... https://www.refheap.com/paste/2987

23:29 bbloom: rhdoenges: does that help?

23:31 rhdoenges: ah

23:31 ok

23:31 thanks!

23:31 bbloom: rhdoenges: although, for println, you may want apply

23:31 &(apply println [1 2 3])

23:31 lazybot: ⇒ 1 2 3 nil

23:32 bbloom: println takes a variable number of arguments & apply can operate on lazy collections

23:33 rhdoenges: oh no I'm using a more complicated function

23:33 I was just using that as an example.

23:34 bbloom: rhdoenges: ah, ok. well you want to use dorun, doseq, doall, etc with side effects

23:34 rhdoenges: oooh while I'm in here: is there something like apply that applies to the rest of its args instead of a list of args?

23:34 tomoj: johnmn3: what's the size of the collection?

23:34 rhdoenges: ie (magic-function println 1 2 3)

23:35 bbloom: isn't that just (println 1 2 3) ?

23:35 tomoj: johnmn3: did you already try passing a different n to fold?

23:35 johnmn3: tomoj: was 100,000... just bumped it to 1,000,000

23:35 playing with the dials

23:36 bbloom: rhdoenges: i'm not sure what you're asking

23:36 tomoj: I wonder if there are performance differences between jdk7 and jsr166y

23:36 or is it pretty much the same thing?

23:38 rhdoenges: bbloom: well currently I am doing (map #(apply % []) list-of-functions)

23:38 johnmn3: not sure.

23:38 rhdoenges: bbloom: and I wanted a better way of doing it

23:38 bbloom: &(doc juxt)

23:38 lazybot: ⇒ "([f] [f g] [f g h] [f g h & fs]); Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"

23:38 rhdoenges: s/better/shorter/

23:39 ooooh

23:39 I forgot about juxt

23:39 bbloom: rhdoenges: juxt is awesome. took me a while to get used to it, but now i find excuses to use it surprisingly frequently

23:41 rhdoenges: it would simply be ((apply juxt list-of-functions) xyz)

23:41 rhdoenges: neato

23:41 thanks! :D

23:41 bbloom: rhdoenges: you're welcome!

23:41 rhdoenges: as an aside, quil is making my brain hurt and it is wonderful.

23:43 bbloom: rhdoenges: damn. i hadn't even seen quil. too many cool projects to play with!

23:43 rhdoenges: so much to do so little time, right?

23:44 bbloom: rhdoenges: way too little time.

23:44 rhdoenges: it beat out opengl for my attention because opengl involves more...

23:44 typing?

23:45 bbloom: opengl is a pretty old API. it's this weird hybrid between a nice API & what was fast back in the day on older gfx cards & vendor specific extensions for actual perf of modern games/etc

23:46 especially from java -- it's just not much… um… fun. yeah. fun is the word.

23:46 rhdoenges: I was writing c but yeah

23:46 not much fun :(

23:46 bbloom: it's main problem is that it tries to be both high level & expose the hardware at the same time

23:47 directx actually much better represents the underlying hardware architecture & layers the higher level stuff on top in terms of batching

23:47 rhdoenges: hmm

23:47 bbloom: it's the logical equivilent of building a file system on top of a block storage device. opengl tries to do the former without the later

23:47 rhdoenges: hahaha, good analogy

23:47 bbloom: as a result, all modern opengl apps just use nvidia and ati extensions that emulate the direct3d api

23:47 lol

23:48 i worked on xna/xbox/directx/etc at msft for a bit -- say what you will about msft's dev tools, but damn direct3d is a solid piece of software

23:50 rhdoenges: I've never done serious win dev

23:51 muhoo: what's the trick for adding a non-clojars, non-maven repo to a clojure heroku project?

23:52 technomancy: muhoo: s3-private-repo is currently the best bet

23:53 muhoo: thanks

23:54 technomancy: this? https://github.com/technomancy/s3-wagon-private

23:55 technomancy: yeah

Logging service provided by n01se.net