#clojure log - Dec 20 2011

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

0:11 gf3: hello gents, I seem to be having an issue with lein not terminating read-line input

0:11 I have to build a jar and run that directly

3:24 _hiro_p: hi all, good evening

3:24 what's the simplest way to define a function that:

3:24 ta

3:25 takes a predicate and a collection/sequence, and returns the first item for which the predicate evaluates to true?

3:25 e.g.

3:25 I'd like to pass a vector like [1 2 3 4 5]

3:25 er

3:25 rather

3:25 let me gist it

3:25 clgv: _hiro_p: you can do that with 'some

3:25 brehaut: (comp first some)

3:26 ,((comp first some) odd? [2 4 6 7 8 9])

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

3:26 clgv: like: ##(some #(when (even? %) %) [1 2 3 4 5])

3:26 lazybot: ⇒ 2

3:26 clgv: brehaut: no need for first^^

3:26 ekoontz_: ##(some #(when (even? %) %) [1 2 3 4 5])

3:27 lazybot: ⇒ 2

3:27 _hiro_p: ah, let me try that

3:27 brehaut: ah indeed

3:27 i think i was thinking first filter too. fail.

3:27 clgv: yeah, first+filter is working as well

3:28 _hiro_p: clgv: sorry, I think I'm a bit confused…some returns true?

3:28 er

3:28 clgv: no it does not

3:29 _hiro_p: ah okay I had my syntax wrong

3:29 I see what you did now

3:29 clgv: some returns the result of the "predicate" function that is not nil

3:29 the first one that is not nil^^

3:30 _hiro_p: hrm.

3:30 what am I doing wrong here?

3:30 (some (fn [n] (= 1 n)) [0 2 3 4 5 6 1])

3:30 gives me true

3:30 I was expecting 1

3:30 clgv: _hiro_p: you have to return what you want. currently you return a boolean

3:31 _hiro_p: therefore I did the 'when construct

3:31 ekoontz_: ##(some (fn [n] (if (= 1 n) n false)) [0 2 3 4 5 6 1])

3:31 [0 2 3 4 5 6 1])

3:31 lazybot: ⇒ 1

3:32 _hiro_p: clgv: let me try...

3:32 clgv: _hiro_p: if thats too confusing or too much overhead for you just use: ##(first (filter #(= 1 %) [0 2 1 3 4]))

3:32 lazybot: ⇒ 1

3:32 clgv: though I have to say that it does not make any sense to do that for '= ;)

3:33 _hiro_p: clgv: aha

3:33 (some #(when (= 1 %) %) [0 2 3 4 5 6 1])

3:33 I'm still getting used to the pound syntax with anonymous functions…for some reason I like writing out the fn syntax more

3:33 but just have to practice I suppose

3:33 I like some and when

3:34 very succint

3:34 clgv: _hiro_p: I write the verbose syntax when the name of the parameter is important documentation or I have more than 2 parameters.

3:35 _hiro_p: clgv: that's a good rule of thumb

3:36 clgv: _hiro_p: and on 4clojrue I try to use almost only the anonymous short cut for a smaller golf score ;)

3:36 _hiro_p: I'm sort of mindblown by how much information I can pack into one liners and still have things stay readable. I've done most of my work in Ruby thus far, and Clojure is feeling really good.

3:36 ekoontz_: me too, still preferring (fn) over #

3:37 good night guys

3:37 _hiro_p: clgv: haha, some of the 4clojure solutions are maybe just a wee bit too terse, but I'm also a begginer

3:37 clgv: _hiro_p: I only shortened the medium and easy ones heavily. for the hard ones I'll stay with "it works" ;)

3:39 brehaut: hmm. i think i have a non-1.3 compatible dependency based on the amount of ^:dynamic warnings ive got

3:39 AWizzArd: Moin.

3:40 clgv: brehaut: very likely ^^

3:41 brehaut: anybody know if one of [ring/ring-core "1.0.0"], [ring/ring-jetty-adapter "1.0.0"], [net.cgrand/moustache "1.0.0"], [enlive "1.0.0"], [com.ashafa/clutch "0.3.0"], [clj-time "0.3.3"] is not 1.3 compatible?

3:42 clgv: brehaut: you should get a file or a namespace with that warning, shouldnt you?

3:43 brehaut: clgv: i thought so, but apparently im not :/

3:44 eg "Warning: *byte-array-type* not declared dynamic and thus is not dynamically rebindable, but its name suggests otherwise. Please either indicate ^:dynamic *byte-array-type* or change the name."

3:44 clgv: clgv: I know there was a ring clojure 1.3 compatibility release but I dont know the exact version

3:44 lol haha. I wrote myself :P

3:44 brehaut: 1.0.0 is very recent, i hope its not that ;)

3:44 lol

3:45 hmm. clutch claims to be compatible, so i can cross that off

3:46 clgv: hmm yes, I have ring 0.3.11 and its clojure 1.3 ready ;)

3:46 pyr: cemerick: around ?

3:46 cemerick: hi

3:47 brehaut: hmm. i think clj-time might be a culprit

3:47 clgv: ah, cemerick: there is some weird formatting in CCW when you type "(use '" it does an automatic line break. can I create an issue without a google account login anywhere?

3:48 cemerick: brehaut: those are just warnings

3:48 i.e. try to not be discouraged by them ;-)

3:48 brehaut: cemerick: haha :) aight then

3:49 clgv: well those warning have effects, since most of the time the library author wants to rebind them

3:49 AWizzArd: How comes that those americans are still awake? Isn't it like 4am over there? ;)

3:49 _hiro_p: AWizzArd: depends on the time zone

3:49 brehaut: AWizzArd: who needs their hearing? redbull forever

3:50 _hiro_p: where I am, it's only 1am, in Hawaii it's still yesterday :)

3:50 on the East Coast, yes….it's pretty darn late.

3:50 brehaut: AWizzArd: or perhaps atomospheric thaums are slowing the passing of time

3:51 cemerick: brehaut: once I can find and swap in a new http client, then I can ditch the contrib dependency entirely.

3:51 brehaut: cemerick: ah right, so its clutch thats causing all the noise

3:52 ?

3:52 cemerick: well, contrib, but yes, depended upon by clutch :-(

3:52 brehaut: sure

3:52 cemerick: shouldn't be a new thing though…

3:53 brehaut: weel

3:53 im foolishly upgrading a bunch of deps in my site at once

3:53 including clojure

3:53 (and ring and clutch)

3:54 i was on some paleolithic version of a lot of libs, but especially clutch

3:54 cemerick: should go swimmingly, I've been on 1.3 running the latest of compojure and ring for months

3:54 brehaut: excellent :)

3:55 im looking forward to getting new clutch

3:55 in

3:55 and finally writing an admin interface

3:56 (so i can stop relying on futon)

3:56 cemerick: just for your app, or a general-purpose UI?

3:56 brehaut: just for my app

3:56 cemerick: ah, right

3:57 brehaut: i do really like futon though

3:57 (+ ssh tunnel)

3:57 cemerick: One of the (many) reasons I like cloudant: futon w/o the tunnel or admin hassle.

3:58 brehaut: ah true

3:58 im too cheap to pay for anything beyond my VPS for my site

3:59 so i havent looked around at other services

3:59 i guess these days i could host my site on heroku for cheap and then pay for a cloud couch

3:59 clgv: cemerick: any chance to submit a CCW issue without a google account?

4:00 cemerick: clgv: sorry, missed your last /msg; what's the issue?

4:00 brehaut: cloudant has a free tier

4:00 brehaut: oh interesting

4:01 cemerick: and they're available as an opt-in service through heroku too, although I don't quite know how/why that would work.

4:02 zakwilson: Is it just me, or is ClojureQL buggy as hell and probably dying?

4:02 clgv: cemerick: a disturbing line break after typing \' - I noticed when typing (use 'debuglib....)

4:03 (use \n(defn blubb ...) becomes (use \n'(defn blubb ...) when typing the \' on the use-line

4:03 cemerick: clgv: oh, yup

4:03 clgv: turn on paredit, you'll be happier in general

4:03 clgv: cemerick: I switch between both

4:03 cemerick: crazy man ;-)

4:04 I'll file a bug for you.

4:04 clgv: thx :)

4:04 cemerick: clgv: one time deal though — get thyself a google account :-)

4:04 brehaut: cemerick: how much of the gist you linked to in the clutch ann is relevant to the new api?

4:05 clgv: yeah sometimes the default mode is handy for editing "diagonal" through the parens ;)

4:05 brehaut: cemerick: is that stuff 'just' the future direction?

4:06 cemerick: brehaut: Anything involving the protocol or type is coming attractions.

4:07 I needed the new API in order to implement the type though.

4:07 clgv: http://code.google.com/p/counterclockwise/issues/detail?id=313

4:07 clgv: :)

4:08 kral: namaste

4:09 clgv: cemerick: I am interested in how modular CCW is - is it possible to use the repl view of CCW standalone in a project?

4:10 cemerick: Not at present, no.

4:10 clgv: thats a pity.

4:10 cemerick: Laurent inherited the codebase…it's gotten much better over the couple of years or so, but it's still quite bound up.

4:11 Much of it is being rewritten in Clojure now, which will help quite a lot.

4:12 brehaut: cemerick: so my biggest hurdle with 0.3.0 of couch has been that the db is no longer a map :P

4:12 cemerick: brehaut: thank goodness :-P

4:13 There's a record factory @ com.ashafa.clutch.utils/url

4:13 clgv: cemerick: yeah thats true. is there some developer documentation of CCW anywhere? I checked out the codebase a year ago and was quite confused where to start. ;)

4:13 cemerick: clgv: check the wiki; the dev process hasn't changed much, unfortunately

4:14 clgv: cemerick: what wiki page do you have in mind?

4:15 ClojureDevInternals?

4:16 cemerick: huh, github has its own rev of jenkins for CI http://news.ycombinator.com/item?id=3372824

4:18 clgv: there's that and the how to build page

4:18 clgv: ah ok.

4:20 kotarak: The series of useless forks continuous...

4:22 cemerick: kotarak: ?

4:22 brehaut: cemerick: if im reading the docs for utils/url right, i can just pass in the string that was the name i was previously using right?

4:22 cemerick: brehaut: yup, that presupposes localhost, standard port, database name as provided

4:22 brehaut: yup

4:22 kotarak: cemerick: ah nothing. When ever I read such headlines, I always think: they'd rather improved the original product.

4:23 cemerick: there was hudson, then jenkins (admittedly for different reasons), today we add janky, tomorrow panky, and then hanky.

4:24 cemerick: heh

4:24 kotarak: cemerick: ah, nothing.

4:24 cemerick: from a brief look, it seems that they're not forking it but reusing it

4:53 Blkt: good morning everyonbe

4:54 cmdrdats: good morning

4:55 clgv: hmm what would you suggest for better performance: (dissoc m k) or (if (contains? m k) (dissoc m k) m) ?

4:57 cmdrdats: i would guess just the dissoc, since it would need to try find it to remove it? but I don't really know for sure :)

4:58 clgv: cmdrdats: I just meassured it for a million times. if the key is present the first is fast but the first seems slower if the key is not present

5:00 hmm I guess I have to decide quick for the more likely case and not waste too much time on it ;)

5:00 raek: clgv: I think bith 'contains?' and 'dissoc' are O(log_32 n)

5:00 *both

5:01 clgv: raek: dissoc does a contains? anyway as first action then it should be superior

5:01 +if

5:03 alandipert: clgv no need for the contains? there, as dissoc doesn't do anything if k isn't in m

5:03 raek: clgv: I assume dissoc walks down the hash trie to find the place where the entry should be. if the entry is not there, dissoc is done. if the entry is there it creates new nodes for the path back up to the root

5:03 amalloy: dissoc should be very close to contains performance if the key is not present

5:03 but certainly it will have to do some more work

5:04 and if this decision makes a noticeable difference in your program, you can revisit the decision later

5:04 cmdrdats: I usually just use dissoc alone because it's simpler

5:05 raek: clgv: I wouldn't bother with micro-optimizations like this where the alternatives have the same complexity class

5:05 cmdrdats: with the assumption that if i measure it as a bottleneck, i'll figure out how to optimize

5:06 clgv: raek: well it will be used in bottleneck area - therefore the consideration. I'll measure the whole map idea in comparison to the current implementation anyway

5:07 raek: clgv: ok, but my guesstimate is that 'contains?' + 'dissoc' does more work tha just 'dissoc' and does not add any benefit

5:08 clgv: raek: yeah that was my first guess as well

5:08 raek: clgv: you should profile the code know where the bottleneck really is and also read about how the data structures work before you make decisions

5:09 amalloy: (defmacro awesome-dissoc [m k] (if *awesome-mode* `(let [m# ~m k# ~k] (if (contains? m# k#) (dissoc m# k#) m#)) `(dissoc ~m ~k)))

5:09 now you have both, with no runtime cost. but seriously just use dissoc :P

5:09 raek:

5:09 clgv: lol

5:12 amalloy: (i do think this is a valuable technique in general, though. if you're not sure which approach to take but the decision might matter, and they're both simple, you can implement both with a little compile-time switch)

5:12 clgv: amalloy: yes that idea is good. I did that for another problem some time ago

5:13 raek: when debugging or profiling, just gather information about what actually happens in your app until the solution becomes obvious

5:13 amalloy: lisp: the easiest language to reinvent #ifdef in

5:14 clgv: amalloy: muhahaha. #ifdef I suffered from #ifdef in my second job for years...

5:38 AWizzArd: To the german users: there is also a #Clojure.de channel. Die Deutschen Nutzer können gerne in den entsprechenden Kanal kommen (:

5:43 Scriptor: the latest vimclojure seems to have some lag whenever I try to use the 'o' or 'O' commands

5:56 kotarak: Scriptor: this is fixed in the next version. It was around for years, but finally @darevay was able to track the issue down.

5:58 Scriptor: kotarak: ah, nice. How soon until the next version is out?

5:59 kotarak: kotarak: maybe over christmas. Depends on time allocation. But there have some fixes accumulated. So a quick bugfix release is actually due.

6:00 Scriptor: Unfortunately the changes for this fix were rather extensive. So I can't recommend a simple two-line change as workaround...

6:02 Scriptor: kotarak: got it, I was just starting to look through the commits list too!

6:02 strange though, I don't remember having this problem before

6:22 kotarak: Scriptor: It was a long lasting thing.

6:24 Scriptor: Tried to be too functional with vim...

6:37 Raynes: kotarak: Yeah. Too bad there isn't an editor configured in a Lis... oh wait.

6:38 clgv: Raynes: yeah slightly OT ;)

6:38 Raynes: Off topic?

6:39 Not sure about that. I didn't realize I was over 2 hours late though.

6:40 clgv: hmm well they like vim so they use a vimplugin for clojure. your comment does not more than teasing...

6:53 AWizzArd: Raynes: but Emacs is very difficult to learn and unintuitive.

6:53 Raynes: Tough crowd this morning.

6:54 AWizzArd: Raynes: I am using Emacs, and nothing else, since 2002 ;)

6:54 Raynes: clgv: It was a joke -- kotarak is the author of VimClojure. :)

6:54 AWizzArd: Represent! :>

6:54 AWizzArd: But it was difficult to get into.

6:54 Raynes: I recently did a little experience where I used Vim exclusively for a couple of weeks.

6:54 AWizzArd: urks :)

6:55 clgv: Raynes: np. I wont mind much more since I dont even use VimClojure - I just ahted the sound of that ;)

6:56 Raynes: I didn't hate it. I certainly find Emacs to be the much better environment for Clojure development, but I can see how Vim people get by with Vim. I mostly did it just to see what Vim people were missing out on during Clojure development. I don't mind recommending VimClojure to Vim people anymore, now that I know that it is manageable.

6:57 G0SUB: "I don't hate ViM users, I pity them"

6:57 "Using ViM is not a sin, it's a penance"

6:57 ;-P

6:57 Raynes: That's close to my conclusion, but mine isn't quite as mean. :p

6:57 clgv: lein uberjar

6:58 AWizzArd: clgv: when you have a german keyboard layout then “lein überjar” is cooler.

6:58 clgv: AWizzArd: that will work?

6:58 AWizzArd: yes

6:58 This is an actual alias.

6:59 G0SUB: Raynes: lol

7:00 So I have extended a type to the ISeqable interface in the foo.bar ns, how do I use that extension from the foo.quux ns?

7:00 Without creating a wrapper function for seq in foo.bar

7:01 gensym: ,(clojure-version)

7:01 clojurebot: "1.3.0"

7:01 gensym: ,(clojure-version )

7:01 clojurebot: "1.3.0"

7:02 cmdrdats: ,( clojure-version)

7:02 clojurebot: "1.3.0"

7:02 cmdrdats: portal 2 right there.

7:04 accel: are multimethods per namespace or per program?

7:05 G0SUB: accel: program, unless you provide your own hierarchy

7:06 accel: if you don't provide any hierarchy to defmulti, it will use the global hierarchy

7:14 accel: G0SUB: how do I provide a hierarchy to defmulti?

7:15 so if multimethods are per program

7:15 so if multimethods are per program, is there the possibility that multimethods I define might conflict with some library I use? this seems to break encapsulation

7:17 raek: accel: multimethods still have namespaces

7:17 (defmulti foo ...) in namespace a and (defmulti foo ...) in namespace b are separate multimethods

7:19 and if third parties are allowed to add implementations to your multimethod they should ideally only implement methods for their own dispatch values

7:19 accel: raek: so multimethods are _per namesapce_ and not _per program_ ?

7:19 raek: a multimethod lives in a namespace

7:20 Chousuke: multimethods work like regular functions in that regard

7:20 raek: the set of implementations of a multimehtod lives in the multimethods, but can be defined anywhere in the progran

7:20 accel: so the "short name multimethod" refers to the one in the namespace; however, I can add to multimethods in other namespaces by using the long name

7:20 raek: but to define it in another namespace, I need to refer to it as some.other.module.foo right?

7:21 raek: accel: you just use the usual way to access a var of another namespace, e.g. (:use :only [...]) or (:require ...)

7:21 jweiss: anyone use emacs' auto-complete and/or ac-slime? i notice auto-complete is apparently not packaged, thought about uploading to marmalade but figured there might be a good reason it's not there?

7:22 accel: raek: great; I think we are now loudly agreeing

7:22 raek: protocols works similarly

7:33 elricl: Hello.How do i get input from stdin,and store them in a list,so I can use it to call a function later?

7:37 I want to do something like this http://pastebin.com/si5xvT6y but in clojure.

7:42 svankiE: elricl: http://stackoverflow.com/questions/2034059/how-to-read-lines-from-stdin-in-in-clojure

7:44 elricl: svankiE, instead of printing it,I want to store it and use it as a argument for someother function. How do I do that?

7:48 svankiE: elricl: you could look at this Rayne's answer at SO. http://stackoverflow.com/a/1114722/542702

7:54 elricl: svankiE, The main thing I am confused about is,where to store the data. Can you just gimme a snippet for the pastebin link

7:57 osa1: where can I find more about implementation details of clojure's persistent data structures? I read this http://blog.higher-order.net/2009/02/01/understanding-clojures-persistentvector-implementation/ but there are some points which I didn't understand

7:57 kotarak: Raynes: which cannot use Clojure and CL together. Pfff..

7:57 To each his poison. :)

8:25 svankiE: elricl: oh. i can't do that, amigo. but you could read this http://java.ociweb.com/mark/clojure/article.html especially the 'getting started' section. and, if you have some minutes: http://catb.org/~esr/faqs/smart-questions.html

9:04 Raynes: cmeier: Morning.

9:07 cmeier: Good morning Raynes!

9:07 Like the name for the library

9:08 Raynes: Some guy mentioned 'PowerRangers', but that's too long.

9:08 bhenry: if i have a bunch of files in a reports directory, what is an idiomatic way to grab the report spec from each xxx-report.clj file. if this doesn't make sense i'll be gisting an example, so bear with me.

9:09 Raynes: bhenry: You want to load a bunch of clj files that you don't know the names of?

9:09 When in doubt, simplify the *shit* out of your problem.

9:09 bhenry: i want my list of reports to automatically include all of the reports in the reports directory, so as i add reports i need not change anything else

9:10 Raynes: Yeah, gist an example.

9:10 I'm not quite following.

9:10 I *think* I get it.

9:10 You probably want clojure.tools.namespace

9:10 bhenry: right now we are using ns publics to get all the report specs out of a reports.clj file. but as we added reports, that file is getting enormous.

9:10 Raynes: Yeah, you definitely want clojure.tools.namespace.

9:11 bhenry: so we want to have a reports dir with abandon-report.clj kpi-report.clj etc

9:11 Raynes: It'll allow you to grab the nses/paths of all Clojure files in a directory and then you can load them all.

9:11 Load ALL the things!

9:11 bhenry: excellent i will look into that. thanks Raynes

10:11 TimMc: $inc svankiE

10:11 lazybot: ⇒ 1

10:13 svankiE: TimMc: :>

10:17 yazirian: anyone seeing crazy memory leaks in emacs24? yesterday afternoon I did a clojure-jack-in on a project just to try the zookeeper bindings out, then left the repl with the zk connection open overnight... this morning the emacs process is 2.75gb!

10:28 mprentice: yazirian: At 2:14AM Eastern Time, Emacs finally became self-aware.

10:29 yazirian: haha

10:29 i may have killed a sentient being :(

10:31 fielcabral: @yazirian I remember Star Frontiers too!

10:39 yazirian: holy ... it's been years since somebody got that reference

10:39 fielcabral: you officially win at esoteric references today

10:41 fielcabral: :)

11:05 tomkin_: cd

11:08 juhu_chapa: Hi guys! I just executed the following code: http://clojuredocs.org/clojure_contrib/clojure.contrib.server-socket/create-server and indeed the program is working, now How do I stop it?

11:09 kral: juhu_chapa: there must be a java process somewhere to kill...

11:11 juhu_chapa: kral: let me try.

11:12 i am running it inside enclojure.

11:32 devn: yazirian: I don't have that problem but I still use slime-connect

11:42 Raynes: devn: Dude. The future. Join us.

11:49 devn: Raynes: What are the benefits in this future of yours?

11:49 Raynes: devn: One less command to manually type.

11:49 Less pointless clutter in your Emacs initialization files.

11:50 devn: But...but...

11:50 yazirian: Actually opens a repl whether or not the SLIME devs think you need one.

11:50 Oh how I didn't like having to add MORE pointless clutter to get that back.

11:50 devn: Honestly I could probably use some help fixing up my old emacs config. I have a giant clojure config file to fix paredit, setup slime, etc.

11:53 * Wild_Cat really needs to seriously learn Emacs.

11:56 lzskiss: yo

11:57 Raynes: hoho

11:58 dmansen: oh man. my boss just saw some clojure we forced into the codebase and said it looked good :)

11:59 kral: :)

12:06 hansengel: hi, I am getting the error "No matching ctor found for class

12:06 jpen.demo.PenCanvas" when trying to instantiate a class from a Java lib

12:07 this error occurs when I run `(PenCanvas.)` or `(new PenCanvas)`

12:07 there clearly is a matching constructor: http://jpen.svn.sourceforge.net/viewvc/jpen/trunk/src/main/java/jpen/demo/PenCanvas.java?revision=290&view=markup

12:08 dmansen: i notice that that constructor has no visibility. would that make it default to package private?

12:10 hansengel: ah, missed that - you're right

12:10 thanks :)

12:11 dmansen: np!

12:17 replaca: Q: is the ->Type function that I get when I "(deftype Type..." a constructor? Am I always guaranteed to have it?

12:18 Raynes: replaca: It is a factory function. It isn't going to not be there.

12:18 Double negatives are fun.

12:19 replaca: That's awesome! Thanks Raynes

12:20 factory means it's just a wrapper for the Java constructor? Or does it do something else?

12:20 Raynes: Just a wrapper.

12:21 replaca: cool, thanks

12:21 cgray: Raynes: you use marginalia right? i've been having a problem where the docstrings aren't taken out from the function definitions, and wondered if you saw that too

12:21 Raynes: cgray: What version of marginalia are you using?

12:22 cgray: lein-marginalia 0.6.1

12:22 Raynes: Use 0.7.0-SNAPSHOT.

12:23 cgray: thanks, that worked

12:24 Raynes: replaca: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_deftype.clj#L238

12:24 If you're interested in precisely what is going on there.

12:25 replaca: Be careful if you read that stuff though. Sure path to the closest mental institution.

12:25 Particularly the implementation of emit-defrecord. I have nightmares.

12:31 replaca: Raynes: Yeah, so far I've avoided diving in that deep

12:31 but thanks for the pointer - I may have to

12:32 I'm trying to get autodoc to do what it can in terms of discovering and documenting types and records

12:34 duck1123: sweet, 0.7.0-SNAPSHOT worked for me as well

12:34 Raynes: I keep the snapshots generally up-to-date with fixes in marginalia.

12:35 Because I know how annoying it is to need a fix that isn't released.

12:37 cgray: Raynes: are you a maintainer of it?

12:37 Raynes: cgray: Kindasorta.

12:38 cgray: cool, well it's really nice :)

12:38 Raynes: I can release and I have commit access. The amount of work I actually do is another thing though.

12:38 duck1123: The worst thing about Marginalia is it reminds me of just how many of my functions aren't documented

12:38 cgray: a kindasorta bug is that "bar" (def foo "bar") gets interpreted as a docstring

12:39 :)

12:39 Raynes: cgray: That was fixed two days ago.

12:39 I have released a new snapshot.

12:39 haven't*

12:39 cgray: no problem, it just made me document my var

12:41 Raynes: cgray: Released. You'd need to nuke the marginalia snapshot from your ~/.m2 and reinstall lein-marginalia for it to pick up the new snapshot.

13:25 simard: how can I find official packages on clojars, say clojure-contrib ? the search engine on clojars doesn't list the packages in an order that seems suitable for it to find that kind of release, instead I hit everyone's fork of the package

13:27 technomancy: simard: official packages don't get published to clojars. but you can use "lein search" to simultaneously search clojars and maven central, which includes them

13:27 simard: technomancy: thank you

13:27 jcromartie_desk: Emacs IRC plus Solarized theme: most subtle IRC evarrrrr

13:27 technomancy: simard: but don't use clojure-contrib

13:28 simard: I see, well I need that math round function.

13:28 jcromartie_desk: There's also something to be said about having code in one window and a conversation with the language/frameworks's author in the other

13:28 I can't do that in Visual Studio

13:29 technomancy: ,(Math/round 1.7)

13:29 clojurebot: 2

13:29 simard: oh that's java's Math

13:29 technomancy: jcromartie_desk: yeah, how many IRC clients have integrated paredit capability?

13:30 jcromartie_desk: :P I haven't switched on paredit in irc though

13:30 simard: technomancy: as for not using clojure-contrib, may I ask why ?

13:31 amalloy: clojurebot: what happened to contrib?

13:31 clojurebot: It's greek to me.

13:31 simard: because they wouldn't be compatible for the next release of clojure ?

13:31 amalloy: clojurebot: where did contrib go?

13:31 clojurebot: well... it's a long story: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

13:31 technomancy: simard: the current release, actually

13:31 cmdrdats: hmm, wish i could run a function to find out just how many people in #clojure is connected here within emacs

13:31 simard: 1.3, yes.

13:31 technomancy: plus it was never really a good idea to begin with

13:32 amalloy: and bringing in a hundred-million-zillion megabyte library just so you don't have to type (int (+ x 1/2)) seems a bit wasteful

13:32 jcromartie_desk: I'm kind of sad that clojure-contrib was broken up, but I know it makes sense for the future.

13:32 It was a nice "batteries included" feel.

13:33 but those batteries were getting heavy

13:33 jkkramer: there has been mention of doing a batteries-included version of new contrib

13:33 simard: so when is 1.4 due ?

13:33 jkkramer: i think it would be handy for experimental repl stuff

13:33 Raynes: Yeah, but people would abuse it and we'd have to deal with it.

13:34 So I don't think I'm a fan.

13:34 amalloy: amusingly, according to jira 1.4 is due last month

13:34 i assume someone just made up a date on a whim and it never got updated

13:34 cmdrdats: we just need a lein plugin that can automatically check your dependencies and include the correct ones :P

13:34 (based on namespace)

13:45 TimMc: clojurebot: what happened to contrib |is| <reply>Well... it's a long story: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

13:45 clojurebot: In Ordnung

13:45 TimMc: clojurebot: What happened to contrib?

13:45 clojurebot: Well... it's a long story: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

13:48 amalloy: TimMc: good save. i always ask the wrong question

13:51 TimMc: Is it because of your childhood that you always ask the wrong question?

13:52 (An ELIZA module would be one of the most annoying things you could put on an IRC bot.)

13:52 dmansen: is there a way to interrupt the current evaluation in lein repl without killing the jvm?

13:52 technomancy: dmansen: no, you'd need swank or some other editor integration for that

13:53 TimMc: technomancy: Is that a limitation of Lein or Clojure's built-in REPL?

13:53 Been wondering.

13:53 dmansen: technomancy: ah, yeah. my coworker is using lein repl and hasn't gotten his editor stuff set up. i'll just tell him to stop being lazy

13:53 choffstein: technomancy: any new thoughts on s3-wagon?

13:53 technomancy: TimMc: not sure. I don't use lein's repl at all.

13:53 TimMc: haha

13:54 technomancy: choffstein: I'm thinking I may take the explicit :plugins declaration I was planning for lein 2 and see if I can implement it in 1.6.3.

13:54 choffstein: in the mean time I think a tweak in the buildpack could handle your use case

13:55 choffstein: technomancy: amazing

13:56 dnolen: technomancy: dmansen: doesn't clojure.repl/set-break-handler! work?

13:58 dmansen: ooh, i'll try that

13:58 technomancy: huh; /me had no idea

13:58 oh, it's new in 1.3

13:58 TimMc: Not sure how I would use that, but maybe Leiningen could register a thunk with it.

13:59 technomancy: TimMc: trickier since it's not guaranteed to be supported though

13:59 amalloy: dnolen: to be able to stop the running expression you need to have it on its own thread though, right

13:59 technomancy: but lein could inject a form that used resolve and no-oped if it wasn't found

13:59 dnolen: amalloy: it works for me is all I know.

14:00 TimMc: dnolen: What do you pass it?

14:00 dnolen: TimMc: you don't need to pass it anything

14:00 TimMc: Oh, just use the default?

14:00 dnolen: TimMc: yes

14:01 technomancy: huh; could sneak a (when-let [sbh (resolve 'clojure.repl/set-break-handler)] (sbh)) into lein repl easily enough

14:01 dnolen: thanks for the heads-up

14:01 dnolen: technomancy: np

14:01 TimMc: dnolen: That doesn't work for me -- C-c still dumps me back to Bash.

14:01 dmansen: same here. but i'm in lein repl

14:04 TimMc: If I were in SLIME, I'd use C-c C-c or whatever it is.

14:14 technomancy: it looks like you'd need a custom break-handler that would restart the socket-repl thread

14:15 amalloy: technomancy: or do what i suggested, which is start each expression on a new thread. then when that thread stops, the guy who was waiting for it wakes up

14:16 technomancy: oh, I missed that

14:16 yeah

14:16 gfredericks: I apologize if this question gets asked a lot, but what's the feasibility of writing pure business-logic-code in generic clojure[script], so it's valid in both languages?

14:16 amalloy: that will have a number of other problems, of course

14:16 technomancy: want to just delegate to nrepl

14:18 gfredericks: or is it something you're supposed to not want to do?

14:19 technomancy: gfredericks: leaning towards the latter

14:19 gfredericks: :/

14:19 technomancy: rationale: http://blog.ianbicking.org/2011/03/30/js-on-server-and-client-is-not-a-big-deal/

14:19 it's about node, but it applies to clojurescript as well

14:20 cemerick: gfredericks: the same challenges apply if you were to want to use the same clojure codebase on the JVM and CLR, but even moreso

14:20 technomancy: clojurebot: sharing code between client and server is not as simple or great as it sounds: http://blog.ianbicking.org/2011/03/30/js-on-server-and-client-is-not-a-big-deal/

14:20 clojurebot: Roger.

14:21 jkkramer: gfredericks: I think it's an idea worth pursuing

14:21 gfredericks: I guess the crux for me is the idea: "If you can do it on the client then you probably don’t have to do it on the server, and vice versa."

14:22 jkkramer: especially with respect to validation code and hiccup templates. I don't necessarily agree with the article that "there’s not much in common between these two kinds of validation"

14:22 gfredericks: the reason I think the business logic should be in both places is: we need it on the server, e.g. to share the code with a rails app, or generating excel spreadsheets, etc. But we'd like it on the client so the web app can be peppy, rather than pinging the server for every computation it needs

14:23 (it's a client-heavy JS app)

14:24 jkkramer: right. how you use the information gathered ("this input is invalid") may differ, but the logic to gather that info could be shared

14:24 maybe it would get messy in practice. but i think it's worth experimenting with, at least

14:25 technomancy: yeah, I guess if you're talking about a namespace or two it could make sense. the official "explicitly a non-goal" statements have been about taking entire libraries or applications between runtimes.

14:26 gfredericks: technomancy: yeah, just some pure-logic nothing-host-related namespaces

14:27 so it's at least technologically feasible? I haven't used clojurescript nearly at all, so I can't answer that myself

14:28 TimMc: There's some pretty basic stuff you can share that makes it easier on the user: Max character limits, date restrictions, credit card number formats...

14:28 jkkramer: gfredericks: symlinks? :)

14:29 gfredericks: jkkramer: maybe the cljs-compile script copies over the relevant files...

14:29 jkkramer: there was a post on the mailing list about this. someone came up with a working prototype, I believe

14:37 cemerick: dnolen: you're inspiring some _very_ strange tweets these days :-P

14:38 dnolen: cemerick: heh, I think that was because I helped him fix a bug he'd lost a lot of time over.

14:38 cemerick: oh, sure! But…

14:40 srid: python/ruby programmers here: could you critique my blog post? http://blog.srid.name/2011/12/clojure-line-seq-python-ruby/

14:41 amalloy: srid: it doesn't take a lazy sequence of streams at all

14:41 er, of strings

14:41 it takes a BufferedReader, which can produce strings when you call readLine. philosophically similar, but i don't think you should just gloss over the difference

14:42 srid: point noted. thanks. editing...

14:47 ccarpenterg: hello I'm coming from Python and I don't know Java, where should I start to learn Clojure? I already understand the basic syntax and I've been playing with the REPL on Linux

14:52 mabes: srid: you can use Ruby's Enumerator for lazy lists

14:52 jkkramer: ccarpenterg: the books Programming Clojure and The Joy of Clojure are great resources. Also, read everything on clojure.org

14:53 cmdrdats: The videos are also a fantastic source of info :)

14:53 mabes: srid: here is an example http://benmabey.com/2011/08/14/word-break-in-clojure-and-ruby-and-laziness-in-ruby.html

14:53 srid: mabes: half the answer :-) how would I use enumerator with eventmachine loop?

14:53 (like using python generator with gevent greenlet)

14:54 reading....

14:54 ccarpenterg: oh thanks, that sounds great, where do you find the videos?

14:54 jkkramer: ccarpenterg: http://blip.tv/clojure (older videos may be more accessible)

14:54 mabes: srid: ah, I see. fair enough.

14:56 srid: i guess i should make it clear in the blog post that the context is concurrency

14:56 Vinzent: ccarpenterg, also check the http://learn-clojure.com

15:02 ccarpenterg: thanks

15:03 amalloy: srid: huhhh, how is that post relevant to concurrency?

15:04 djKianoosh: mabes, http://www.4clojure.com is good too

15:04 i meant.. ccarpenterg

15:08 mcrittenden: can someone help me understand line 8 here: https://gist.github.com/1503055

15:08 the (File. "string") syntax is tripping me up, not sure what's going on there

15:09 Vinzent: it's the same as (new File "string")

15:09 samaaron: mcrittenden: you're calling the constructor on File passing it one arg - the path as a string

15:09 mcrittenden: so Something. is a shortcut for new Something

15:10 cool, thanks

15:10 Vinzent: mcrittenden, yes, and it's preffered over a (new ...)

15:10 mcrittenden: makes sense

15:17 srid: amalloy: the code in that post was taken from a project similar to heroku's pulse, where log files from multiple hosts were streamed and processed to a single channel/pipe (and then sent to websocket, etc..)

15:17 in clojure, each of those tailing was done as a future (thread). in python and ruby, the code is async

15:18 juhu_chapa: clojurians, how do I load a file inside an array? I mean, the file has lines like these: 1 in 1st line, 2 in 2nd line... etc

15:19 the resulting array must contain {1, 2, 3}

15:19 ...

15:20 Vinzent: (doc read-lines)

15:20 clojurebot: Titim gan éirí ort.

15:21 ccarpenterg: thanks very much

15:22 simard: is there something special I must do to get access to (Math/stuff ...) ? it used to work in my core namespace, but within a new file (and a new namespace) it doesn't find the method

15:22 juhu_chapa: hx

15:22 Vinzent: juhu_chapa, hm, maybe it was in contrib... But there is read-line anyway

15:23 amalloy: Vinzent, juhu_chapa: line-seq

15:23 Vinzent: simard, are you sure there is no typo or something?

15:24 right, that's what I was trying to remember

15:26 simard: Vinzent: http://pastebin.com/imSp2h70

15:26 juhu_chapa: ok, i got a line, then how do i insert into the array?

15:26 simard: not quite sure if that import line is useful or not anyway.

15:28 TimMc: simard: Math should always be available by default.

15:28 being in java.lang

15:28 simard: yeah.. well it was working.

15:28 Vinzent: simard, Math/round expects a double, and your (* 10) returns an int

15:28 so it throws IllegalArgumentException

15:28 ,(Math/round 10)

15:28 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: round>

15:29 simard: errrr

15:29 there should be an n there :D

15:30 TimMc: You should still call (double ...) on n or the multiplication just be sure you don't tickle that again.

15:30 Vinzent: Maybe it also makes sense to call double on the result, jsut in case

15:30 TimMc: Try (mils 5)

15:37 amalloy: Math/round takes either a float or a double. if you give it an integer it can't tell which version you want

16:04 tscheibl: hmm.. can't get (binding [...] ...) to work across namespace (file) boundaries in Clojurescript

16:05 TimMc: tscheibl: You can't bind something from another namespace, or no binding holds across a call to a function in another namespace?

16:05 dnolen: tscheibl: a paste of both files would help.

16:06 tscheibl: I'm no native speaker, maybe I didn't explain it correctly

16:06 I'm doing the same thing that works in CLlojure...

16:06 ..like the with-connection function/macro in contrib jdbc

16:07 calling a function from another namespace within the binding call

16:07 dnolen: tscheibl: again, let's see a minimal example. then someone can confirm and open a ticket if it's a bug.

16:07 hiredman: binding doesn't exist in clojurescript, does it?

16:07 dnolen: hiredman: it does

16:07 hiredman: but there are no vars

16:08 gfredericks: poor man's vars

16:08 hiredman: dnolen: so it is the same thing as with-redefs then?

16:08 tscheibl: hiredman: what does that mean?

16:08 dnolen: hiredman: basically.

16:08 hiredman: tscheibl: what does what mean?

16:08 tscheibl: what implication does that bring with it?

16:08 "there are no vars"

16:09 there are Javascript vars...

16:09 TimMc: I suppose binding fails across setTimeout calls just as it would with lazy seqs.

16:09 dnolen: tscheibl: which aren't the same as Clojure vars.

16:09 gfredericks: tscheibl: if javascript is single-threaded I don't think you notice a difference

16:09 hiredman: it is a sadder more dismal place, a world without magic

16:09 tscheibl: I don't use setTimeout

16:09 I do it just like in java.jdbc

16:09 dnolen: tscheibl: in anycase we can't help you if we don't see the code :)

16:10 gfredericks: tscheibl: I think the same stuff applies to callbacks in general

16:10 tscheibl: ... like with-connection .. as I did many times in Clojure projects

16:10 hiredman: tscheibl: "var" in clojure refers to specific reference type used for linking

16:10 tscheibl: ..ok i 'll try to put some example on gist

16:11 dnolen: tscheibl: thx

16:11 TimMc: &(class (var +))

16:11 lazybot: ⇒ clojure.lang.Var

16:11 hiredman: for whatever reason (interop?) clojurescript was written without vars

16:17 dnolen: hiredman: not much advantage to having Clojure style vars in ClojureScript that I can see.

16:19 hiredman: dnolen: clojure hangs a lot of compilation and linking information on vars

16:19 tscheibl: dnolen: https://gist.github.com/1503322 (print-something) does output undefined

16:20 dnolen: where it should say 42

16:20 dnolen: hiredman: true, ClojureScript moves that info into the compilation environment.

16:21 tscheibl: one thing - you didn't define *something* anywhere.

16:22 tscheibl: dnolen .. ok I left out the (declare ^:dynamic *something*) in the example

16:22 but I do this in my original code

16:22 technomancy: hiredman: clojurescript doesn't really seem to be optimized for "pleasant-at-runtime"

16:23 well, pleasant for the user rather than pleasant for the developer, I should say

16:23 amalloy: technomancy: developer is already happy because he can use same language on server and client. no need to appease him

16:23 dnolen: tscheibl: ^:dynamic is not necessary in ClojureScript.

16:24 technomancy: amalloy: "not having to use Javascript" covers a multitude of sins, in other words?

16:24 I'll buy that.

16:24 tscheibl: dnolen: ok

16:24 amalloy: well, i was alluding to your earlier link to http://blog.ianbicking.org/2011/03/30/js-on-server-and-client-is-not-a-big-deal/

16:24 hiredman: technomancy: I think amalloy may have been making a sarcastic allusion

16:24 technomancy: whoosh

16:25 tscheibl: dnolen: ... ohh.. my god... this might be embarassing... just let me have a second look...

16:25 dnolen: tscheibl: (def *something* nil), declare does not exist in ClojureScript, and (def *something*) doesn't work (probably should)

16:27 technomancy: ClojureScript can also optimized for pleasant at runtime, most of the fancy SLIME things can be done, just hook into all the analyzer data.

16:27 hiredman: bleh, so static

16:28 Vinzent: (haven't followed the conversation) slime? is there slime support for clojurescript?

16:28 tscheibl: dnolen: phew... still doesn'twork

16:28 Vinzent: or, cljs support for slime

16:28 technomancy: hopefully the fact that you now have to manage two runtimes can be abstracted away, but that seems to be a long way off.

16:28 tscheibl: I used the same "dynamic" var twice.. fixed that.. but it still does'nt work

16:28 dnolen: hiredman: no, it's just stratified, compilation / runtime environment. but CLJS is clearly designed for these to work together.

16:28 technomancy: Vinzent: I think dnolen just meant that there's no technical reason it couldn't be done.

16:29 dnolen: tscheibl: update the gist please. I'll take a look

16:30 tscheibl: dnolen: the problem was just in my original code... but I updated the gist with the declare

16:30 Vinzent: technomancy, ok, then I'll continue wait for it

16:30 dnolen: Vinzent: technomancy: I actually added file and line support for all CLJS defs recently, lots of other things can be added as well.

16:31 technomancy: as George Bernard Shaw said, "The reasonable man adapts himself to Clojure, the unreasonable man adapts Clojure to himself. Therefore all progress depends upon the unreasonable man."

16:31 clojurebot: hey man is for horses

16:33 dnolen: tscheibl: so it does or doesn't work?

16:34 tscheibl: dnolen: it doesn't

16:34 dnolen: it wokrs in CLojure ... in Clojurescript only if I do this in the same file

16:37 mcrittenden: is there a best practice for converting a string into a seq of 1-char strings, so e.g. "something" becomes ("s", "o", "m", .....)

16:38 Vinzent: ,(map str "something")

16:38 clojurebot: ("s" "o" "m" "e" "t" ...)

16:39 amalloy: mcrittenden: are you sure you want that? why not just ##(seq "something")

16:39 lazybot: ⇒ (\s \o \m \e \t \h \i \n \g)

16:39 TimMc: &(drop 1 (.split "something" ""))

16:39 lazybot: ⇒ ("s" "o" "m" "e" "t" "h" "i" "n" "g")

16:40 TimMc: :-P

16:40 cgray: TimMc: there must be a more convoluted way...

16:41 TimMc: I'm sure, but this is pretty good.

16:42 mcrittenden: Vinzent's solution is the one you want, just to be clear. (Assuming amalloy's assessment is not correct.)

16:42 mcrittenden: thanks. list of chars might work as well, so i'll try amalloy's route.

16:43 any guidance on the ##() syntax? what's the double hash there for?

16:43 lazybot: ⇒ ()

16:43 TimMc: now you know!

16:44 mcrittenden: sorry about all the newb questions. seems like everytime i ask something in here, i'm introduced to a new syntax so i'm trying to keep them all straight in my head

16:46 cemerick: mcrittenden: ## is syntax for the bot, not Clojure itself :-)

16:46 mcrittenden: oh, good, that one had me worried

16:47 dnolen: tscheibl: binding works for me just fine across two files.

16:47 tscheibl: your ns form for the second file is wrong as well as your use of declare.

16:52 technomancy: choffstein: ping

16:52 tscheibl: dnolen: it works for me if the func argument is a function defined in the same namespace where with-something call is executed

16:52 choffstein: technomancy: yessir?

16:53 technomancy: choffstein: I think I have a fix for your issue, mind if I msg?

16:53 choffstein: please do!

16:54 tscheibl: dnolen: ok.. i forgot to type the colon in gist... but it's there in my project code

16:54 ..before use

16:55 amalloy: tscheibl: why are you gisting stuff that isn't your actual code? why not just copy/paste the whole thing so that nobody has to second-guess you?

16:56 tscheibl: amalloy: because I tried to extract only the necessary information

16:57 TimMc: tscheibl: You should extract the "necessary information" to a separate set of files, test that, and *then* paste -- otherwise, you may be changing things without knowing,

16:57 .

16:57 tscheibl: amalloy: .. and it should be executable without all my dependencies

16:58 TimMc: possible... yes... I'll try

16:58 TimMc: I prefer to do that with a new git branch + deleting a bunch of code. :-)

16:58 tscheibl: TimMc: arghh.. I would have to delete quite a bunch of code then :(

16:59 TimMc: There's different ways of doing it, but the basic idea is to make sure you have a reproducible, minimal test case.

16:59 Usually the process of producing that minimal test case tells you your error.

16:59 amalloy: heh

17:00 tscheibl: TimMc: that's ging to be a long night again ...

17:00 Raynes: Hrm. I thought that cljs could compile entire directories when targeting node.js.

17:00 tscheibl: ..as every night...

17:01 Raynes: If I try to do that (with just one file in the directory that works if compiled alone), it fails with a weird TypeError: Cannot read property 'cljs$lang$maxFixedArity' of null exception.

17:01 dnolen: Does that sound like a bug, making the wild assumption that have any idea?

17:02 amalloy: i remember when i hung out on comp.lang.java briefly, the guys there were always asking for an SSCCE. not a super-friendly place, but a good philosophy to have when looking for help

17:02 TimMc: acronym?

17:03 wait wait

17:03 $google SSCCEE

17:03 lazybot: [SSCCEE Sociedad Colombiana de Cosmetología y Estética ...] http://www.facebook.com/pages/SSCCEE-Sociedad-Colombiana-de-Cosmetolog%C3%ADa-y-Est%C3%A9tica/109864375701369

17:03 TimMc: $google SSCCE

17:03 lazybot: [Short, Self Contained, Correct Example] http://sscce.org/

17:03 TimMc: heh

17:03 brehaut: haha correctness is apparently defined by 'compilable'

17:04 TimMc: Usually the question is "why isn't this correct?"

17:04 amalloy: TimMc: i usually took "correct" in context to mean: "the code i am giving you actually exhibits the behavior i'm having trouble with"

17:05 TimMc: hmm

17:05 amalloy: but that's not what the SSCCE page says, so perhaps i'm a jerk

17:06 TimMc: I think they just wanted a succinct acronym at all costs.

17:07 amalloy: Small, Snarky, Curt, Compressed Elocution?

17:08 dnolen: Raynes: I haven't played much w/ the node.js support. You should make a ticket w/ instructions on how to repro.

17:08 Raynes: also if you could weigh in on your earlier CLJS tickets that would be helpful too.

17:08 Raynes: EH?

17:08 Minus the shouting.

17:08 dnolen: Raynes: I responded to your CJLS tickets a long time ago.

17:09 Raynes: I never got any emails.

17:09 dnolen: Raynes: yeah amalloy has the same problem.

17:09 had

17:09 Raynes: That Jira is a worthless hunk of garbage? We all have that problem.

17:11 technomancy: free as in puppies

17:11 TimMc: ,(println "&(println \"Amen.\")")

17:11 tscheibl: dnolen: found the problem.. it "looses" the binding when in an event handler established by using jquery... that should be acceptable and could be worked around

17:11 clojurebot: &(println "Amen.")

17:11 lazybot: ⇒ Amen. nil

17:11 dnolen: tscheibl: heh, that was what somebody suggest earlier :)

17:11 suggested

17:12 tscheibl: dnolen: shame on me...

17:12 Raynes: dnolen: No, I don't have a testable example that doesn't involve node because I don't use or know how to use ClojureScript for anything but node.

17:12 TimMc: tscheibl: That's because the current stack unwinds, exiting the binding, and the event handler is called later.

17:12 dnolen: Raynes: it's fine if it involves node, testability is the key thing.

17:13 tscheibl: dnolen: but now I've got another problem with a defrecord only recognized as Javascript Object and thus not beeing accepted by it's protocol functions ...

17:13 i'll dig into that now ....

17:14 thanks to all for your help

17:14 Raynes: dnolen: Is there anything in particular wrong with the example that I posted?

17:16 tscheibl: nice... you can select the programming language in gist... didn't know that... was my first gist anyway

17:16 TimMc: I can work around that by creating a local binding before assigning the event handler

17:18 Raynes: dnolen: Looks like it isn't happening anymore.

17:18 You can close 42.

17:18 Unless I can?

17:19 Every time I log into Jira a kitten commits suicide.

17:19 Yeah, I can't close that.

17:20 amalloy: Raynes: yeah, i had to ask cemerick to close my old issues for me, because jira doesn't think i'm grown up enough

17:20 Raynes: dnolen: https://gist.github.com/1503548 this should have been a reproducing example.

17:21 I don't see any other issues of mine that you've responded to.

17:21 http://dev.clojure.org/jira/browse/CLJS-69 This is the only other issue I see that remains open.

17:22 Wow, that one is still open? :o

17:27 dnolen: Raynes: thx, cljs-42 resolved

17:27 Raynes: I'll look into CLJS-69

17:27 Raynes: That one was fun to debug.

17:28 And by fun I mean utterly painful.

17:28 I tend to find a new problem in cljs every time I use it. At least witht he nodejs target anyway, since I think I might be the only person on the planet who does that.

17:29 technomancy: we have an internal prototype project at work using server-side node cljs

17:30 Raynes: And it works?

17:30 technomancy: well

17:30 it deploys

17:30 I wasn't able to get it working on my own machine though.

17:30 Raynes: I'm not astonished.

17:30 I've written a total of one thing that actually worked in node cljs.

17:30 And that took forever because of cljs-69.

17:31 amalloy: Raynes: better than your track record for jvm-clj

17:31 technomancy: I mentioned there was no repl for cljs-on-node, and the guy that wrote it said that he doesn't even use the repl for regular clojure, so it didn't bother him.

17:31 Raynes: ~rimshot

17:31 clojurebot: Badum, *ching*

17:31 technomancy: that blew my mind

17:31 * brehaut boggles

17:31 Raynes: ...

17:32 * Raynes deletes cljs node projects off of his system to rid himself of contamination.

17:33 Raynes: I've been considering writing actual node.js js. But then the hallucinogenics wear off.

17:34 technomancy: don't you function enjoy seeing the function word function everywhere?

17:35 Raynes: It isn't nearly as much fn as it could be..

17:35 brehaut: s/$/});});});/

17:35 dnolen: technomancy: I should brush up my cljs-on-node REPL

17:36 samaaron: dnolen: what? You hack using a REPL????

17:36 technomancy: we've talked about writing a clojurescript buildpack, but there's no sense in doing it until there's a stable release.

17:37 dnolen: yeah, that would make it a lot more bearable

17:37 samaaron: who needs REPLs when we have IDEs?

17:38 Raynes: samaaron: You're dead to me, music man.

17:38 samaaron: Raynes: you're clearly not a *real* programmer

17:38 Real enterprise programmers develop real systems with real IDEs

17:39 technomancy: developing without a repl is cybernetically unsound

17:39 samaaron: no need for extinct tech like REPLs

17:39 zakwilson: It's funny, I was just telling other people who wanted to transition from "scripting" to "real programming" that there's no useful distinction anymore between a "scripting language" and a "real programming language".

17:39 samaaron: technomancy: so you too have been assimilated?

17:39 brehaut: i dont understand this repl. how do you type your classs in correct in one pass?

17:40 samaaron: brehaut: precisely!

17:40 technomancy: samaaron: Norbert Weiner is my homeboy.

17:41 samaaron: zakwilson: there's a huge differene between real programming and scripting. Scripting is for kiddies, and real programming is for grown ups

17:41 technomancy: real programming supports GOTO

17:41 amirite?

17:41 brehaut: real programmers alternate their hard and soft layers

17:42 zakwilson: Heh. I will actually agree there's a difference between scripting and real programming, but it isn't the language.

17:42 Hard candy shell with a chewy center?

17:42 technomancy: clojurebot: ed is the standard editor!

17:42 clojurebot: In Ordnung

17:42 brehaut: mmmm nougat

17:44 samaaron: real programming has semi-colons

17:45 brehaut: im glad im not a real programmer

17:45 samaaron: brehaut: we all have a real programmer inside us

17:46 tscheibl: is my assumption correct that I cannot use ore require cljs namespaces (files) in cljs macro files?

17:47 samaaron: Raynes: so if i'm dead, are you going to hack on Overtone in my place?

17:47 brehaut: tscheibl: im not a reliable source but i think cljs macros are writen in clojure, not clojurescript

17:47 tscheibl: brehaut: that's exactly the reason why I'm assuming that...

17:48 devn: real programming involves magnets, pins, and a steady hand.

17:48 brehaut: http://xkcd.com/378/

17:49 samaaron: devn: are you coding with fridge magnets again?

17:49 dnolen: tscheibl: that's correct

17:49 tscheibl: so I will have to fully qualify symbols from other namespaces that I use in macros

17:50 Raynes: nowaiman

17:51 samaaron: Raynes: it's easy, writing a music system/langauge has no technical challenges whatsoever - not like real enterprise programming

17:54 ekoontz: can people recommend a good combination of clojure and clojure-contrib version tags?

17:54 brehaut: 1.3.0 and no monolithic contrib

17:55 ekoontz: brehaut, thanks..no monolithic contrib..i am looking at github.com/clojure/clojure-contrib.git

17:55 is that monolithic?

17:55 TimMc: ekoontz: contrib is dead, basically

17:55 brehaut: http://dev.clojure.org/display/doc/Clojure+Contrib

17:55 ekoontz: i see, thanks guys, reading

17:56 brehaut: ekoontz: see also http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

17:56 ekoontz: the only trick with some of those libs is you may need the snapshots repo in your projects repos

17:57 amalloy: do we have something like prefix-of? eg (prefix-of? [1 2 3] [1]) => true, (prefix-of? [1 2 3] [a 2]) => false

17:58 brehaut: $findfn [1 2 3] [1] true

17:58 lazybot: [clojure.set/superset? clojure.core/not= clojure.core/distinct? clojure.core/every?]

17:58 brehaut: $findfn [1 2 3] [:a 1] false

17:58 lazybot: [clojure.set/superset? clojure.set/subset? clojure.core/identical? clojure.core/isa? clojure.core/= clojure.core/contains?]

17:59 samaaron: brehaut: what awesome magic are you casting there?

18:00 brehaut: samaaron: amalloy's magic :P lazybot tries every function it knows with the arguments you provide and compares them to the return value you provide

18:00 eg

18:00 $findfn 1 2

18:00 lazybot: [clojure.core/unchecked-inc-int clojure.core/unchecked-inc clojure.core/inc clojure.core/inc']

18:00 brehaut: all the functions that take 1 as an argument and return 2

18:00 samaaron: that sounds like something I need in my IDE

18:00 s/IDE/REPL/

18:01 amalloy: samaaron: it's available standalone on Raynes's github

18:01 and he wrote a lein plugin as well, i think

18:01 samaaron: very cool

18:01 is it just called findfn?

18:02 amalloy: yeah

18:02 samaaron: got it - awesome

18:03 amalloy: although not quite as awesome as a pint of bacon

18:04 amalloy: yeah, my whole life has been empty since that dinner. nothing compares to the wonder of discovering a pint of bacon on a menu

18:04 brehaut: it comes in pints‽

18:06 samaaron: brehaut: only in america

18:07 amalloy: what amused me was going back to that place the next day for lunch to find the lady serving us wearing an Overtone sticker on her t-shirt

18:08 I must have dropped a couple the previous night

18:08 brehaut: is it… fermented?

18:08 amalloy: haha that's awesome

18:08 Raynes: brehaut: Just fried bacon in a glass, bro.

18:09 amalloy: brehaut: no, it was a pint glass with strips of bacon in it like...pencils in a tin can? something like that

18:10 TimMc: There are fermented meats, but bacon is not one.

18:14 samaaron: You're sure she wasn't a Conjurer?

18:14 brehaut: Raynes: and yet, googling reveals an article on the guardian that suggests that americans do make bacon beer http://www.guardian.co.uk/lifeandstyle/wordofmouth/2010/dec/10/fancy-a-pint-bacon-beer

18:14 TimMc: I guess she would have recognized you in that case.

18:14 Raynes: That's true.

18:14 samaaron: TimMc: you mean an Incanterer?

18:15 Raynes: She was a sorcerjure.

18:15 samaaron: TimMc: but yeah it was freaky, she had no idea that it was a logo for a music project :-)

18:16 cgray: there should be a function called max-by that works on a seq so that it wasn't always necessary to do (apply max-key ...)

18:16 TimMc: You asked her?

18:16 samaaron: TimMc: yeah, we did

18:16 TimMc: Haha, nice.

18:16 samaaron: but we didn't try to explain what it was when she didn't know

18:16 TimMc: "Do you have any idea what that sticker means?"

18:17 amalloy: TimMc: englishers don't have the crippling social awkwardness we americans do

18:17 samaaron: TimMc: that's exactly what we asked

18:17 amalloy: oh man, and then you didn't tell her?

18:17 samaaron: she actually wasn't that interested

18:17 i don't think she would have believed us

18:17 amalloy: samaaron: i just can't help imagining her, like..."does this say that i hate jesus? is it a gang sign?"

18:18 samaaron: hahaha

18:18 it's actually a pro-SOPA logo

18:19 TimMc: This must be some cool logo if she didn't care.

18:20 samaaron: TimMc: hmm, i didn't think of it that way, but you're right

18:20 either that or she was pretty crazy

18:20 or perhaps both :-)

18:20 TimMc: Is it the image at the top of the home page? or just the two-circles part?

18:21 it is a pretty sweet logo

18:22 samaaron: just two circles

18:22 thanks

18:23 TimMc: have you played with Overtone yet?

18:23 TimMc: nope!

18:24 tscheibl: deftype/defrecord protocol function dispatch doesn't work here in Closurescript. I get the error: No protocol method PMsgQ.subscribe defined for type object: [object Object]

18:24 TimMc: I like how you say "yet". :-P

18:24 samaaron: of course

18:24 all Clojure hackers will have at least made a bleep with it before next year is out

18:25 you'll be amazed at how fun it is :-)

18:25 one of our users wrote a sequencer during the first night of Overtone hacking

18:26 TimMc: Any idea when the video will be up?

18:26 technomancy: could overtone be hooked up to tryclj for server-side composition?

18:26 samaaron: this stuff isn't that hard if you've got some Clojure chops

18:26 technomancy: yeah, i've been thinking of exactly that

18:26 * technomancy realized "composition" could be have two meanings there

18:26 technomancy: samaaron: outputting to html5 audio tags or something?

18:26 samaaron: we just need to ice-cast the audio session

18:27 yeah, or html5 audio tags if that works

18:27 TimMc: I wonder if <audio> tags take the data: URI...

18:27 * TimMc is kind of terrible

18:27 technomancy: samaaron: any chance it could run on Heroku? =)

18:27 samaaron: technomancy: now that's a tempting question...

18:28 so Overtone works on linux

18:28 technomancy: but you need system-level packages installed, right?

18:29 samaaron: but it's all a bit hacky right now - we're actually looking for someone who has some C++ and JNA fu to help get this stuff smoother

18:29 so the way it works right now (on linux) is that we either require a separate install of SuperCollider

18:29 or we use our own pre-compiled version which requires jack

18:29 technomancy: if you were outputting to an HTTP stream would you still need jack?

18:30 samaaron: the pre-compiled version ships in a jar and is dynamically launched by copying it to a tmp dir

18:30 i don't think the current binary will boot without jack

18:30 but it might be possible to re-compile a new binary without those requirements

18:30 technomancy: but it's not technically required for non-hardware output?

18:30 interesting

18:31 samaaron: it just depends on whether you can compile SC

18:31 but one of my plans is to have an online instance where people can collaboratively jam

18:31 technomancy: you can compile pretty much anything on heroku if you're willing to hunt down dev headers yourself.

18:31 samaaron: it's the only way I can perceive of making any money in order to allow me to continue hacking Overtone full time

18:32 technomancy: I'm chatting through a ZNC instance on heroku, which is a C++ program that gets compiled when I do git push.

18:32 ah; now that's an interesting angle

18:32 Raynes: technomancy: Whoa.

18:32 technomancy: You've got teach me that.

18:33 spike`: is there a recommended way of getting swank/emacs setup?

18:33 hiredman: ~swank

18:33 technomancy: Raynes: unfortunately it requires access to the TCP router, which is a private alpha feature right now. =(

18:33 clojurebot: swank is try the readme. seriously.

18:33 technomancy: but I'm bugging them to open it up for wider beta testing because it's awesome

18:33 samaaron: technomancy: but getting this working on heroku would be insanely cool

18:33 TimMc: spike`: technomancy's starter kit

18:33 spike`: Depends on whether you already have a highly-customized Emacs.

18:34 spike`: I installed emacs starter kit, I'm a newb so I don't think I have a very customized emacs, but I have added a few things

18:35 samaaron: spike`: you might also take a look at the overtone emacs config: https://github.com/overtone/live-coding-emacs/

18:35 for ideas on how to pimp up emacs

18:35 technomancy: spike`: tl;dr: install clojure-mode and leiningen, then do M-x clojure-jack-in inside a project.

18:35 spike`: here's what I've got: https://gist.github.com/1503817

18:35 technomancy: the swank-clojure readme should provide details

18:36 spike`: okay, thank you

18:36 samaaron: technomancy: if we were able to get the overtone stack running on heroku, how would it handle crashes?

18:37 it's pretty easy to crash SC

18:37 technomancy: samaaron: it would attempt a restart, but if it repeatedly crashed on boot it would fall back to "crashed" status.

18:37 samaaron: ah, it wouldnt' crash on boot - only when the user futzes with it

18:38 technomancy: you might have issues routing across multiple dynos if you're relying on in-process statefulness though

18:38 samaaron: technomancy: what do you mean?

18:38 can we not persist state to a shared disk?

18:39 technomancy: there's really no scalable way to implement shared disks on EC2

18:39 so you need to offload shared state into a database; usually postgres or redis or something

18:39 amalloy: technomancy, samaaron: shared db?

18:40 samaaron: oh, that's no issue

18:40 technomancy: but presumably overtone also depends upon in-memory function definitions, right?

18:40 so if each request got load balanced to a different instance, you'd lose stuff

18:40 samaaron: oh yeah, that couldn't happen

18:41 one instance would have to represent one session

18:41 amalloy: technomancy: it's hard to tell from heroku's website: is the "one free dyno" per app, or per account, or what?

18:41 technomancy: amalloy: that'd be per account

18:41 samaaron: Overtone users essentially hack at the REPL to create their compositions

18:42 brehaut: samaaron: i think you mean at the IDE

18:42 samaaron: brehaut: we haven't built the IDE yet

18:42 technomancy: yeah, that complicates things a bit since the routing layer is designed for shared-nothing webapps

18:42 samaaron: we're still stuck in the dark ages

18:43 amalloy: really? it seems like all that does is force users to sign up for lots of accounts if they want to try out multiple apps. i got the impression the idea was "throw together some cheapo apps on heroku, and if any of them get much traffic you'll be happy to start paying us for them"

18:43 samaaron: technomancy: tell blake to fix it!

18:44 technomancy: samaaron: hah; you know blake mizerany?

18:44 amalloy: and it's not as if email addresses are expensive - it's easy to work around this setup

18:44 samaaron: technomancy: yup, i took him on a cycle ride to the countryside outside of Amsterdam one time

18:44 technomancy: amalloy: if your app has no traffic it should idle after a while; I think then it stops counting hours?

18:44 samaaron: oh cool

18:44 amalloy: meh. if i have three apps that each get one request per hour...

18:45 (or whatever, divide into appropriate timeslices)

18:45 samaaron: so you can tell him sam requests heroku become a music making platform ;-)

18:45 hehe

18:45 technomancy: samaaron: would it be feasible to just store a history of repl inputs in the shared DB and recompile them on each request, or is the compilation too expensive?

18:45 simard: I have two files, one of which contains defrecords, and the other one that :use them. I get a "Unable to resolve classname" from the file that tries to construct a record, is that normal ?

18:46 samaaron: technomancy: well, so there's two issues really

18:46 amalloy: yes. records are java classes; you import them

18:46 simard: oh.

18:46 samaaron: firstly, there's the clojure part - we want to have the state of the JVM persist between requests

18:46 and secondly there's the SC instance which stores the *real* state

18:46 hiredman: sc as a service

18:47 samaaron: Overtone mirrors a lot of that state

18:47 hiredman: so that should be possible - sc just talks OSC via UDP

18:47 but the sc state would *need* to be persisted between requests

18:48 in fact, sc would need to be continuously running in the background pumping out data to an icecast server or equivalent

18:48 amalloy: i had an idea for a neat little app i could toy with, but if every new idea i have requires another heroku account (and presumably this is against the TOS as well as being a hassle), it's not very compelling as a service and i might as well just use my VPS and deal with the administrative overhead that heroku is supposed to abstract for me

18:51 hiredman: amalloy: write a clojure app server, deploy it to heroku, and deploy you little apps to your clojure app server

18:51 samaaron: technomancy: so if SC could be made a service similar to a db or redis, then that might work

18:52 technomancy: samaaron: yeah, that's quite a bit more involved than deploying an app though

18:53 samaaron: yeah, it's starting to look that way

18:53 and we're still a way off the kind of stability you'd want with that kind of service

18:53 but it's definitely an end-game

18:54 speaking of end-games, it's bedtime for me

18:54 cheerio

18:56 technomancy: later

18:58 TimMc: technomancy: I really wish heroku had a small-fee level of like $3 a month.

18:58 $35/mo is quite a jump.

18:58 I guess if it gets to that point I should really be monetizing my site. :-P

19:06 I guess I'm spoiled by pay-for-what-you-use mostly-static hosting.

19:07 mrb_bk: does anyone here use vim with clojure?

19:07 i'm having a hard time getting syntax highlighting to work

19:08 it recognizes that clojure is one of the options for setf

19:08 but when i choose it, the colors don't change

19:09 and my other file types all work

19:27 TimMc: When I try to compile CLJS "(def x 1)" using cljs.compiler/analyze and cljs.compiler/emits I get back ".x = 1" -- wtf?

19:34 jodaro: hmm

19:35 if i have a multimethod that dispatches on the class of an argument

19:35 and it needs to handle PersistentList and PersistentVector

19:35 is there something upstream of those to avoid handling each separately?

19:35 if they are handled the same way, of course

19:36 TimMc: I *think* you actually declare the multi to handle ICollection or whatever.

19:36 jodaro: ok

19:37 i'll try that out

19:37 TimMc: And if there's not a common interface, you use derive and a ::keyword.

19:37 * TimMc might be talking out of his ass

19:38 jodaro: heh

19:38 its cool, i do that all the time

19:38 i feel like i saw the right way to do this somewhere

19:38 on the interwebs or in a book

19:38 and of course

19:38 now i can't find it

19:39 could be that i need something smarter than just class as the dispatch

19:39 but i do need to handle String and a java class

19:40 technomancy: you could use clojure.data/equality-partition

19:40 jodaro: Implementation detail. Subject to change.


19:40 heh

19:40 technomancy: yeah =\

19:41 jodaro: well worst case is i repeat some code i guess

19:42 its only a few lines at this point

19:42 actually

19:42 each mm ends up having to package things up in a similar way so i guess if i abstract that action out it will be a little cleaner

19:46 TimMc: jodaro: Yeah, you can use derive to establish a hierarchy.

19:47 https://gist.github.com/1503998

19:49 jodaro: ahh right

19:49 cool, thanks

19:50 TimMc: Now, the exact semantics of when Clojure uses the hierarchy... I don't know.

19:50 Maybe just when the dispatch values are keywords or classes.

19:51 jodaro: i just figured out how to handle a byte array as well

19:52 have to use (Class/forName "[B")

19:52 TimMc: in the derive statement?

19:52 jodaro: well

19:52 in the defmethod statement

19:53 for now

19:53 TimMc: jodaro: "The first test of isa? is ="

19:53 Well, there we go.

19:54 ,(isa? String Object)

19:54 clojurebot: true

19:54 TimMc: ,(isa? "hi" "hi")

19:54 clojurebot: true

19:55 ttaxus: Anybody made a Textmate 2 (yes it exists now!) bundle for Clojure? Odd that the in-app installable bundles include other "obscure" languages like io and erlang, but not our favorite... Googling just comes up with the Textmate 1 ones...

19:58 jodaro: i'm pretty close to just registering clojuredogs.org and having it redirect to clojuredocs.org

19:58 tscheibl: awesome.. I really managed to get around all Clojurescript problems I had today :)

19:58 jodaro: for some reason i almost always type the former first

20:03 technomancy: the keys are right next to each other

20:03 (in dvorak)

20:03 same with http://guthub.com

20:41 accel: how do I cast a Graphics to a Graphics2D in clojure?

20:41 hiredman: what makes you think you need to cast?

20:42 jli: hum. does contains? with a list always return false? seems like it.

20:42 hiredman: and why do you think the object you have, that you say is of type Graphics, is also of type Graphics2D?

20:42 accel: hiredman: I'm converting a piece of Java code to Clojure

20:42 hiredman: jli: please read the doc string for contains?

20:43 accel: there is a line ther that says: Graphics 2D g2 = (Graphics2D) g;

20:43 this is a fairly good indication taht (1) it contains a Graphics2D object and (2) needs to be cast.

20:43 hiredman: not in a dynamic language

20:43 ttaxus: @jli had the same problem with contains? as well. It doesn't do what you think

20:44 @jli Basically, you need to use filter to find things

20:44 duck1123: clojurebot: contains?

20:44 clojurebot: contains? is for checking whether a collection has a value for a given key. If you want to find out whether a value exists in a Collection (in linear time!), use the java method .contains

20:44 ttaxus: or you can use the java, but that's cheating, isn't it?

20:45 hiredman: ttaxus: this is not twitter, please don't prefix nicks with @

20:45 ttaxus: What is the convention for replying?

20:45 TimMc: ttaxus: Look around you.

20:45 :-)

20:45 duck1123: ttaxus: don't be afraid to use java interop if it's the best solution to your problem. It's not cheating at all

20:45 hiredman: ttaxus: like I just did

20:48 gfredericks: is there an official version of clojurescript in clojars or somewhere?

20:48 TimMc: gfredericks: Nope, and probably not for a while.

20:49 Well, no, there's a recent "release" branch, but I'm not sure what the timeline is.

20:49 dnolen: gfredericks: if there is an official version it'll be accessible via maven.

20:50 TimMc: dnolen: You're one of the major devs on that, right?

20:50 dnolen: TimMc: I don't think it's that far off.

20:50 TimMc: Cool.

20:50 dnolen: TimMc: major devs meaning I peruse tickets and fix bugs, sure.

20:50 gfredericks: I'm not as much interested in a stable release as I am in being able to get it via maven rather that "installing" it

20:51 TimMc: dnolen: Do you know if using the cljs.compiler functions (instead of calling from script) is going to be "supported"?

20:51 dnolen: TimMc: what do you mean?

20:51 gfredericks: public API versus private/unstable

20:52 TimMc: dnolen: Well, I'm trying to write a CLJS REPL (like tryclj.com) and I'm getting some pretty bogus results out of cljs.compiler/emits, and I don't know if that's just because that namespace isn't supposed to be used from Clojure.

20:53 I think I'm not setting up some environment stuff that it expects, and I suspect that setup is not accessible without going through compile-file.

20:53 jli: I want to add "case" to clojurescript. it seems like "switch" in javascript is a statement, not an expression. is it okay to just write a macro to change it to a cond? I expect "switch" would be faster, but I guess it'd need to be wrapped in a function or something to work as cljs's case?

20:53 TimMc: dnolen: Basically, I want to know whether to keep banging at it or wait for a release. :-P

20:54 dnolen: TimMc: I don't expect the compiler to change that much, but it is alpha software...

20:55 TimMc: remember with emit you need to provide some information via the initial environment. I also don't see why you can't just repurpose the existing REPL.

20:56 jli: I could be wrong but I don't think JS switch is like Clojure case.

20:56 TimMc: I haven't dug into that REPL enough to figure out if it can be adapted without server sessions.

20:56 dnolen: TimMc: what do you mean by server sessions?

20:57 jli: dnolen: hmm? in what sense? do you think it's linear, and no faster than cond?

20:57 dnolen: jli: yes I don't think JS makes any guarantees about constant time dispatch

20:57 TimMc: dnolen: Well, in the case of TryCljs, all the server does is compile stuff -- the browser has *all* the state. I'm not sure if that's feasible.

20:58 I'll continue poking around in the REPL stuff, of course -- I just don't have a full picture yet.

20:58 jli: dnolen: oh, huh. cond it is, then

21:00 dnolen: jli: if case can't be done, I don't really see a reason for it to exist - but that's just my opinion.

21:03 spike2251: hey I was just trying to follow this tutorial: http://webnoir.org/. I added all of the code to one file, and it's not working. Here is my code: https://gist.github.com/1504221 and "lein run" is complaining about line 22, the reference to all-todos

21:04 dnolen: TimMc: that approach seems like more work - the client browser itself will need a REPL

21:04 TimMc: dnolen: Oh, I already have that.

21:04 That was the easy part -- I just forked tryclj.com

21:04 well, rplevy did :-)

21:04 brehaut: timmc: are you enliving it?

21:05 TimMc: brehaut: Haha, no -- I'm going to make work.

21:05 brehaut: lol

21:05 thats helpful

21:05 gtrak```: dnolen, what env would you recommend for playing around while studying 'Reasoned Schemer'?

21:05 dnolen: TimMc: but tryclj.com isn't really a proper REPL right? printing of Clojure objects actually happens on the server.

21:05 TimMc: dnolen: Right, there's a time-limited sandbox on the server.

21:06 dnolen: http://k.timmc.org:7013/ is the current host of trycljs -- if you give it (js* "alert(5)") you'll see that the browser is being used as the eval environment.

21:07 dnolen: TimMc: so if you're using the server only as a compilation service (no evaluation), you're going to need to handling printing at client. not insurmountable, but seems like duplication of work. Though perhaps not that much of a challenge.

21:08 TimMc: Doesn't CLJS have pr-str?

21:08 dnolen: gtrak```: core.logic is good, but any competent Scheme + minikanren.scm is great as well.

21:08 gtrak```: ah ok, I want to learn core.logic anyway, it's not too much at once?

21:08 dnolen: TimMc: it does, so like I said, probably not that big of a deal.

21:09 TimMc: I'll just wrap the expression in a (pr-str (do ...)) or something.

21:10 dnolen: gtrak```: the differences are minor, tho if you want to the book, Scheme is nice.

21:10 want to stick to the book I mean.

21:11 * gfredericks is not as smart as grep

21:12 TimMc: OK, thanks for the chat. G'night.

21:14 gfredericks: is there any documentation/discussion anywhere about numerics in cljs?

21:15 dnolen: gfredericks: not really. but I don't really see how much cljs can offer over JS numerics.

21:16 gfredericks: dnolen: so integers/bigints/ratios/etc would always be foreign types?

21:17 dnolen: gfredericks: bigints/ratios/complex etc would be cool. Not so sure about integers - anything there will just slow things down.

21:19 gfredericks: dnolen: I'm curious about your comment on http://dev.clojure.org/jira/browse/CLJS-13 -- why can't integers be detected?

21:22 brehaut: gfredericks: the browser is free to change the physical type backing any Number (or primative number) at runtime.

21:22 dnolen: gfredericks: look at the implementation of integer? in CLJS, suffers from floating point underflow

21:22 * gfredericks looks

21:23 gfredericks: I guess there'd be ambiguity at the upper range of integer precision as well :/

21:23 at some point (= x (inc x))

21:25 not even clear if you want (integer? x) to be true at that point

21:25 duck1123: has anyone ever seen the issue where lein midje will only run the tests every other run? It only happens with one project, so it's something I'm doing, but I can't figure it out

21:25 dnolen: gfredericks: it needs some thought, but not something I'm thinking about too much.

21:26 gfredericks: I implemented inlining arithmetic, but of course that means string concatenation given the wrong input.

21:26 gfredericks: dnolen: I tend to care about numerics more than is typical. It's probably a weakness.

21:26 dnolen: might be interesting to support some notion of unchecked ops, and checked ops … but again not something I've thought about much.

21:27 gfredericks: I was interested in implementing ratios, assuming the design was all figured out, but sounds like it's not

21:28 dnolen: gfredericks: what's missing for you to implement ratios?

21:28 gfredericks: dnolen: oh just what we've been discussing. should they be implemented with primitives or goog ints?

21:28 dnolen: gfredericks: it'd be cool for someone to lead the CLJS numerics discussion … hint hint

21:29 gfredericks: so much bad JS crap has been purged from CLJS, would be nice to have a similarly good story for numerics.

21:30 gfredericks: I'm definitely interested in it; apparently I'm a bit lacking in browser under-the-hood numerics

21:31 I think there's some new stuff with integers and such? My traditional assumption is all doubles all the time

21:31 dnolen: gfredericks: I don't you can make many assumptions about the presence of integer any time soon.

21:31 brehaut: gfredericks: the spec is all doubles all the time, but the modern runtimes will use ints when their analysis reveals that you are only doing int math (with gaurds to return to floats as needed)

21:32 gfredericks: dnolen: can you pretend there are no ints? brehaut's comment just there sounds like you could

21:32 dnolen: http://stackoverflow.com/questions/307179/what-is-javascripts-max-int-whats-the-highest-integer-value-a-number-can-go-t

21:32 lots of weird stuff to watch for

21:32 like bit operations - 32bit ints

21:33 brehaut: gfredericks: relatedly https://developer.mozilla.org/en/JavaScript_typed_arrays

21:36 gfredericks: hmm

21:37 brehaut: gfredericks: aside from division, i think the most common routes to floats/doubles are probably any op with Infinity or NaN as arguments

21:38 accel: this is kind of embrassing. Is there a way to tell clojure "err, I just modified some *.jar files that you have already loaded. Please reload them."

21:38 brehaut: (use :reload 'namespace.foo)

21:38 dont know if it applies to jars though

21:38 accel: i need to reload the jars

21:39 i.e. I modify some java code; I don't want to restart my repl.

21:39 dnolen: gfredericks: an issue with introducing ratio/bigint/etc is that + etc in JS not polymorphic. you would need runtime checks, probably makes sense to have a generic namespace.

21:39 gfredericks: dnolen: okay, so the opinion is that the core arith ops should definitely _not_ be polymorphic?

21:39 for performance?

21:40 dnolen: gfredericks: not unless you want CLJS to be slow for common tasks.

21:40 gfredericks: dnolen: I do :) but I assume most don't

21:42 dnolen: gfredericks: I think CLJS is useful for graphics / audio in the browser, I wouldn't introduce anything which impedes that.

21:42 brehaut: gfredericks: open up an inspector and evaluate 1 + {valueOf: function () { return 2; }}

21:43 gfredericks: brehaut: wow.

21:43 brehaut: have some cake and eat some too ;)

21:44 dnolen: gfredericks: if multiarity fns get special cased, I think CLJS can be just as fast as JS when you want/need it.

21:44 brehaut: whoa, I did not know that

21:44 brehaut: I guess it's been that way for a long while?

21:44 gfredericks: brehaut: until I can do {__PLUS__: function(a) { ...} } + {__PLUS__: ...}, I don't see how that could help _too_ much

21:45 brehaut: dnolen: yeah. i think i first encountered it in 1.2? but i think its very old

21:46 gfredericks: it means your numerics can drop down to fast path code relatively painlessly

21:46 dnolen: brehaut: that's slick!

21:46 gfredericks: brehaut: yeah, but you couldn't use the core arith functions without making them polymorphic

21:46 so (+ 3/4 5/6) would still come out as a double

21:47 brehaut: gfredericks: indeed. but it does make something like + and +' viable

21:47 gfredericks: +' would be a nice parallel to clojure's...

21:47 well sorta

21:48 I guess it's a different purpose

21:49 qbg: Does CLJS have persistent collections yet?

21:49 dnolen: qbg: no.

21:50 qbg: Anybody currently working on them?

21:51 (publicly, that you know of)

21:51 brehaut: im curious, does clojurescript define its own equality operator seperate to === ?

21:51 dnolen: qbg: not that I'm aware of. would be interesting to pursue.

21:51 qbg: I may have a project to work on then :)

21:52 brehaut: I would think so since === doesn't do value comparisons

21:52 brehaut: huh it does. thats really interesting

21:52 dnolen: brehaut: CLJS uses =, which is really -equiv

21:53 brehaut: identical? uses ===

21:53 brehaut: qbg: indeed; the lack of a value based comparison has impeded javascript collections being developed for years

21:53 dnolen: thanks

21:54 dnolen: brehaut: having proper collections in CLJS is oh so nice.

21:54 brehaut: dnolen: totally. its the killer feature i think ;) i havent had a chance to use cljs yet unfortunately

21:55 i miss real maps and sets whenever i write JS

21:55 qbg: Putting objects in maps too

21:55 (as keys)

21:55 brehaut: qbg: _exactly_

21:55 gfredericks: and not having to clone things all the time

21:56 qbg: Who doesn't like [Object] though?

21:56 brehaut: [Object] is my favorite member

21:56 qbg: It's my favorite key :p

21:57 dnolen: brehaut: one JS insanity I fixed - (instance? js/String "foo") => true

21:57 brehaut: to be fair, you could use toString as a hashcode replacement ;)

21:58 dnolen: oh nice :)

21:59 qbg: 4 is a good hashcode replacement. It was chosen by a fair die

21:59 gfredericks: it's not lisp until your hashmaps are implemented with linked lists

22:00 qbg: Does a balanced tree of cons cells count?

22:00 gfredericks: if you can pull that off with a constant hash function, sure

22:03 brehaut: dnolen: https://gist.github.com/1504352

22:04 dnolen: brehaut: yup I know about that. I think iframes are equivalent to classloaders

22:04 brehaut: pretty much yeah

22:04 gfredericks: is that in the spec?

22:04 brehaut: can cause merry hell with type test though :S

22:04 dnolen: gfredericks: js spec says nothing about iframes as far as I know.

22:05 brehaut: gfredericks: implicitly i think

22:05 dnolen: brehaut: when iframes were more common as communication channels I would have agreed.

22:05 brehaut: dnolen: yeah. its much less painful now

22:06 although it can be nice if you want to make a finagled Array type without breaking everyone else's

22:06 dnolen: brehaut: that's not a problem in CLJS tho.

22:06 brehaut: indeed

22:06 prototypes are much better solution to that problem :)

22:07 dnolen: the CLJS code I've seen is gorgeous. namespaced modification of prototypes is just too beautiful.

22:08 brehaut: im tempted to rewrite my holiday project in cljs now :P

22:08 dnolen: brehaut: that would cool, I'm sure you'd have a lot of good feedback given your JS experience, there still some rough edges to iron out.

22:09 brehaut: dnolen: the only caveats i have are a) using it from javascript and b) performance

22:09 (im writing an animation library for fun)

22:09 if i can expose a javascript programmer friendly interface then i think i'm ok

22:10 gfredericks: brehaut: I'm interested in the API capability as well

22:10 dnolen: brehaut: a) might be possible. haven't thought about that enough b) I think is mostly a non-issue.

22:11 brehaut: so you're animation lib isn't based on CSS transitions / transforms ?

22:11 brehaut: dnolen: thats phase two: compile down to those.

22:12 dnolen: i want to be able to write composable timelines in javascript is the first requirement

22:15 dnolen: brehaut: well if you have a smaller weekend project in mind, I recommend you give CLJS a spin, we could use your input :)

22:15 brehaut: dnolen: i'll definately keep that in mind :)

22:18 jli: dnolen: hum, do you think constant-ness is an essential part of case?

22:19 dnolen: jli: http://clojuredocs.org/clojure_core/1.2.0/clojure.core/case

22:20 jli: I guess I'm actually asking, if it's not possible to make it constant in cljs, is it better to just not have it?

22:21 dnolen: jli: I think so, case is a slick optimization, but if you can't implement it I don't see why it needs to exist.

22:21 jli: hm, okay then

22:23 dnolen: jli: but I'm also not that familiar with the Clojure implementation, perhaps it's possible to do well in JS.

22:24 brehaut: why couldnt you implement it in cljs?

22:25 dnolen: brehaut: jli: I wasn't saying that you couldn't. perhaps you can write so it works well, especially in the new JS engines.

22:25 jli: it calls "case*", and I can't find where that's defined

22:25 oh, the java parts, maybe

22:26 does defmacro not work in cljs?

22:26 dnolen: jli: Compiler.java 7947

22:26 brehaut: dnolen: i would imagine so. i had great success rewriting the regexps in my clojure brush as a big monster case

22:27 dnolen: jli: CLJS only supports compiler macros. you can't define macros in CLJS source. You can define them in CLJ files and require them in your CLJS.

22:27 brehaut: got a huge speed up inspite of javascript regexp engines jitting the FAs to native code

22:31 wolfjb: in unit testing, sometimes I need to mock a method so that I can control the return result, for example to not actually call to the database or write a file or something. how do I do that in clojure?

22:31 gfredericks: with-redefs

22:31 wolfjb: thanks

22:32 dnolen: jli: http://oreilly.com/server-administration/excerpts/even-faster-websites/writing-efficient-javascript.html

22:32 jli: case seems worthy of pursuing in CLJS, it would be interesting to see some benchmarks.

22:35 akhudek: Is there a replacement for http://richhickey.github.com/clojure-contrib/ for the new contrib modules?

22:35 lazybot: Nooooo, that's so out of date! Please see instead http://clojure.github.com/clojure-contrib/ and try to stop linking to rich's repo.

22:36 brehaut: irony

22:36 akhudek: or rather a replacement for that link?

22:36 brehaut: akhudek: http://dev.clojure.org/display/doc/Clojure+Contrib

22:36 akhudek: yeah, that's what I've been using

22:36 mbac_: hahah

22:37 akhudek: it would be handy to have autogenerated API docs though

22:37 brehaut: akhudek: http://clojure.github.com/

22:37 has some of them

22:37 akhudek: ah, so it does, thanks!

22:38 ekoontz: wow, these bots are smart..triggering off URLs like the old clojure-contrib link.

22:38 (i wasted some time trying to get the old contrib repo to work)

22:38 brehaut: i wonder when algo.monads will get a non-snapshot release

22:41 akhudek: It would probably be good to link http://clojure.github.com from somewhere prominent.

22:41 main site takes you here http://clojure.github.com/clojure/

22:42 brehaut: dnolen: i am curious if the advice about scope chains on that oreilly link is still valid since the advent of "use strict"

22:45 eg (function () { eval("var x = 1"); return x; } ()) #=> 1 vs (function () { "use strict"; eval("var x = 1"); return x; } ()) #=> error

22:45 wolfjb: okay, I'm failing on using with-redefs, http://dev.clojure.org/display/doc/1.3# shows (with-redefs temp (println nil?)) but trying that for me gives an IllegalArgumentException Don't know how to create ISeq from: clojure.lang.Symbol... and so on, what am I missing? is there better doc to read on how to use this?

22:45 dnolen: jli: brehaut: https://gist.github.com/1504464

22:45 very interesting

22:46 tested w/ node.js 0.6.5

22:46 brehaut: wolfjb: (with-redefs [temp …] …) ?

22:47 dnolen: that is very interesting

22:47 jli: well. that's unfortunate.

22:47 brehaut: dnolen: i wonder if constant if's are being compiled to the same code under the hood?

22:48 gfredericks: wolfjb: I would expect calling (doc with-redefs) from the repl would be more accurate

22:49 wolfjb: brehaut: that gave back nil, which, I think, is expected. it aleast didn't error, though I'm still confused on the syntax. doc says with-redefs bindings & body and binding => var-symbol temp-value-expr, so it seems like temp got replaced with the println ?

22:49 gfredericks: thanks, I'll try that

22:49 gfredericks: wolfjb: the syntax is quite similar to let

22:49 wolfjb: ah

22:50 gfredericks: and binding, and various other core clojure macros that are like that

22:50 wolfjb: well, that escaped me

22:50 thanks, I'll try again :-)

22:51 dnolen: jli: compiling to switch is probably best, w/ arrays you would need to store expressions as functions I think.

22:52 jli: a quick test shows that array w/ expressions as functions is around ~300ms so slowest by far.

22:53 jli: but switch is linear, no? or, I guess it's dependent on the engine

22:53 brehaut: dnolen: it'll be interesting to try that again in 6 months; i think the first round of reliable inliners are making their appearances in browsers now / soon

22:53 deech: Haskell developer and Lisp newb here, interested in clojure and ABCL. Can I get the immutability guarantees of Clojure by just using an immutable data structures package like FSET (http://common-lisp.net/project/fset/)?

22:53 dnolen: jli: no the oreilly made it seems like few switch implementations are linear - though there's no guarantee of course.

22:53 oreilly link.

22:54 wolfjb: ok, so the thing I'm bumping into is I have a function I created y-or-n-p like from lisp but it reads from the console. I want to mock that out so it always returns true in a particular test and false in a different test. with-redefs seems to be concerned with vars so (with-redefs [y-or-n-p true] (println (y-or-n-p "answer"))) is throwing me a ClassCastException because (true "answer") isn't valid. am I going about this wrong?

22:54 gfredericks: wolfjb: use (constantly true) instead of true

22:54 jli: dnolen: but for your node test, it was linear, right?

22:54 gfredericks: you have to redef it with a function

22:55 dnolen: jli: no if slowest at 200ms, switch was ~130-40ms, and arrays w/ fns in them ~300ms

22:55 wolfjb: ah

22:56 thanks gfredericks

22:56 dnolen: jli: oops sorry, looking at the wrong thing!

22:56 jli: ifs and switches are the same.

22:57 akhudek: deech: wouldn't primitive lists still not be garanteed to be mutable?

22:58 deech: akhudek: Yes, any data structures not provided by FSET are mutable.

22:59 jli: dnolen: okay, whew, I was confused :)

22:59 deech: akhudek: Just wondering what benefits of FP in Clojure I miss if I stick to that library.

23:01 akhudek: deech: I suppose the concurrency, it is also the case that all clojure lists are immutable, which it doesn't look like you could achieve with fset, unless I'm mistaken.

23:01 deech: also, jvm integration if that matters at all to you, or maybe it's a negative to you

23:01 deech: it would be an interesting exercise to see how close you could get with basic lisp libraries

23:02 deech: akhudek: Yes Clojure JVM integration is cleaner than ABCL's. But I do like a lot of the CL features, eg. debuggability, handler-bind/case, restart etc.

23:04 dnolen: jli: I just tried with SpiderMonkey 1.8.5, on that engine switch is the fastest by far (though overall SM is an order of magnitude slower than node.js/v8)

23:07 jli: hm, okay

23:07 qbg: deech: I guess it comes down to if you want to use a language that is built around immutable values or not.

23:08 I wouldn't be surprised if Clojure was more performant though.

23:08 akhudek: deech: I'm not very familiar with CL. I jumped from C++ to Clojure, so it's my first lisp. Someone with more experience in CL might be able to suggest similar solutions in clojure, I'm not sure.

23:08 qbg: I think error-kit provided the restart style system to Clojure

23:09 deech: qbg: Yes, my primary (non-day-job) language is Haskell. I am very aware of the benefits of immutability.

23:10 qbg: CL isn't a bad language, so if it makes more sense for what want, use it

23:11 I very rarely wish I was using CL when I'm doing Clojure though

23:11 deech: qbg: Not even the debugging environment? conditions, restarts and what not?

23:12 qbg: Might be because I never really did use them that much in CL

23:14 deech: Thanks for your input!

23:14 dnolen: deech: I think have immutability baked into the language a much bigger leverage than using a immutable data structure lib. most clojure libs are built on the same datastructure presenting the same interface.

23:14 qbg: The repl is a good enough debugging environment for how I debug

23:14 (which isn't to say how I debug is the best)

23:15 ibdknox: dnolen: I'm working on faster versions of map and do-seq for cljs collections

23:15 dnolen: ibdknox: sweet!

23:16 deech: dnolen: Yup, immutability is a huge plus and having one way of dealing with collections is great.

23:16 ibdknox: dnolen: it's kinda meh, because it reaches down into the internals.. buuuut they'll be fast.

23:18 dnolen: deech: also the immutable data structures go hand in hand w/ the concurrency primitives - so it's all of a piece / design.

23:22 wolfjb: when I run lein repl, then use (read-line) it works as expected. Typed input, press the enter key and the input is echoed as the return value. however, running lein run with my main class which will call (read-line), it seems to never return as if it doesn't detect the enter key is the end of the line or something. I'm on Linux, clojure version is 1.3.0 and lein is 1.6.2 on java 1.6.0_22 64bit, any pointers or information?

23:24 qbg: wolfjb: Sounds like the input stream is not being directed to the right process

23:24 I don't know enough about the internals of lein run to know for sure though

23:25 wolfjb: interesting

23:26 unfortunately, about all I know about lein is how to spell it... sorta :-)

23:26 still learning though

23:26 qbg: Or it is proxying the input incorrectly. I know back in the day Cake had an issue with that until I submitted a bug report

23:29 wolfjb: so, if I wanted to run it without lein, would I run it basically like a java app? (ie clojure -cp .myjar.jar com.mydomain.mainclass args)

23:30 s,.myjar.jar,./myjar.jar/

23:30 ibdknox: wolfjb: try lein trampoline

23:30 * wolfjb blinks

23:31 wolfjb: ok

23:31 sorry, what is that?

23:31 qbg: eval-in-project's docstring says "Executes form in an isolated classloader with the classpath and compile path

23:31 set correctly for the project. [...]". That makes me suspect it may be a redirected input stream issue.

23:32 ibdknox: I believe trampoline was actually added just for this type of issue actually

23:32 wow

23:32 qbg: lein help trampoline

23:32 ibdknox: fail

23:32 too many actually's

23:33 wolfjb: ah, and there in the doc it specifically targets stdin issue

23:33 cool

23:36 saweet!

23:36 lein trampoline run ... goodness!

23:51 akhudek: huh, is this expected to work? (case '(:a :a) '(:b :a) 1 '(:a :a) 2)

23:51 it works in 1.2

23:51 but in 1.3 IllegalArgumentException Duplicate case test constant: quote clojure.core/case/assoc-test--4734 (core.clj:5939)

23:54 ibdknox: ,(case [:a :a] [:b :a] 1 [:a :a] 2)

23:54 akhudek: the vector version works

23:54 clojurebot: 2

23:55 akhudek: ah, I see that the vector version also matches if you give it a seq as input

Logging service provided by n01se.net