#clojure logs

2011-12-20

00:11gf3hello gents, I seem to be having an issue with lein not terminating read-line input
00:11gf3I have to build a jar and run that directly
03:24_hiro_phi all, good evening
03:24_hiro_pwhat's the simplest way to define a function that:
03:24_hiro_pta
03:25_hiro_ptakes a predicate and a collection/sequence, and returns the first item for which the predicate evaluates to true?
03:25_hiro_pe.g.
03:25_hiro_pI'd like to pass a vector like [1 2 3 4 5]
03:25_hiro_per
03:25_hiro_prather
03:25_hiro_plet me gist it
03:25clgv_hiro_p: you can do that with 'some
03:25brehaut(comp first some)
03:26brehaut,((comp first some) odd? [2 4 6 7 8 9])
03:26clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Boolean>
03:26clgvlike: ##(some #(when (even? %) %) [1 2 3 4 5])
03:26lazybot⇒ 2
03:26clgvbrehaut: no need for first^^
03:26ekoontz_##(some #(when (even? %) %) [1 2 3 4 5])
03:27lazybot⇒ 2
03:27_hiro_pah, let me try that
03:27brehautah indeed
03:27brehauti think i was thinking first filter too. fail.
03:27clgvyeah, first+filter is working as well
03:28_hiro_pclgv: sorry, I think I'm a bit confused…some returns true?
03:28_hiro_per
03:28clgvno it does not
03:29_hiro_pah okay I had my syntax wrong
03:29_hiro_pI see what you did now
03:29clgvsome returns the result of the "predicate" function that is not nil
03:29clgvthe first one that is not nil^^
03:30_hiro_phrm.
03:30_hiro_pwhat am I doing wrong here?
03:30_hiro_p(some (fn [n] (= 1 n)) [0 2 3 4 5 6 1])
03:30_hiro_pgives me true
03:30_hiro_pI was expecting 1
03:30clgv_hiro_p: you have to return what you want. currently you return a boolean
03:31clgv_hiro_p: therefore I did the 'when construct
03:31ekoontz_##(some (fn [n] (if (= 1 n) n false)) [0 2 3 4 5 6 1])
03:31ekoontz_ [0 2 3 4 5 6 1])
03:31lazybot⇒ 1
03:32_hiro_pclgv: let me try...
03:32clgv_hiro_p: if thats too confusing or too much overhead for you just use: ##(first (filter #(= 1 %) [0 2 1 3 4]))
03:32lazybot⇒ 1
03:32clgvthough I have to say that it does not make any sense to do that for '= ;)
03:33_hiro_pclgv: aha
03:33_hiro_p(some #(when (= 1 %) %) [0 2 3 4 5 6 1])
03:33_hiro_pI'm still getting used to the pound syntax with anonymous functions…for some reason I like writing out the fn syntax more
03:33_hiro_pbut just have to practice I suppose
03:33_hiro_pI like some and when
03:34_hiro_pvery succint
03:34clgv_hiro_p: I write the verbose syntax when the name of the parameter is important documentation or I have more than 2 parameters.
03:35_hiro_pclgv: that's a good rule of thumb
03:36clgv_hiro_p: and on 4clojrue I try to use almost only the anonymous short cut for a smaller golf score ;)
03:36_hiro_pI'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.
03:36ekoontz_me too, still preferring (fn) over #
03:37ekoontz_good night guys
03:37_hiro_pclgv: haha, some of the 4clojure solutions are maybe just a wee bit too terse, but I'm also a begginer
03:37clgv_hiro_p: I only shortened the medium and easy ones heavily. for the hard ones I'll stay with "it works" ;)
03:39brehauthmm. i think i have a non-1.3 compatible dependency based on the amount of ^:dynamic warnings ive got
03:39AWizzArdMoin.
03:40clgvbrehaut: very likely ^^
03:41brehautanybody 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?
03:42clgvbrehaut: you should get a file or a namespace with that warning, shouldnt you?
03:43brehautclgv: i thought so, but apparently im not :/
03:44brehauteg "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."
03:44clgvclgv: I know there was a ring clojure 1.3 compatibility release but I dont know the exact version
03:44clgvlol haha. I wrote myself :P
03:44brehaut1.0.0 is very recent, i hope its not that ;)
03:44brehautlol
03:45brehauthmm. clutch claims to be compatible, so i can cross that off
03:46clgvhmm yes, I have ring 0.3.11 and its clojure 1.3 ready ;)
03:46pyrcemerick: around ?
03:46cemerickhi
03:47brehauthmm. i think clj-time might be a culprit
03:47clgvah, 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?
03:48cemerickbrehaut: those are just warnings
03:48cemericki.e. try to not be discouraged by them ;-)
03:48brehautcemerick: haha :) aight then
03:49clgvwell those warning have effects, since most of the time the library author wants to rebind them
03:49AWizzArdHow comes that those americans are still awake? Isn't it like 4am over there? ;)
03:49_hiro_pAWizzArd: depends on the time zone
03:49brehautAWizzArd: who needs their hearing? redbull forever
03:50_hiro_pwhere I am, it's only 1am, in Hawaii it's still yesterday :)
03:50_hiro_pon the East Coast, yes….it's pretty darn late.
03:50brehautAWizzArd: or perhaps atomospheric thaums are slowing the passing of time
03:51cemerickbrehaut: once I can find and swap in a new http client, then I can ditch the contrib dependency entirely.
03:51brehautcemerick: ah right, so its clutch thats causing all the noise
03:52brehaut?
03:52cemerickwell, contrib, but yes, depended upon by clutch :-(
03:52brehautsure
03:52cemerickshouldn't be a new thing though…
03:53brehautweel
03:53brehautim foolishly upgrading a bunch of deps in my site at once
03:53brehautincluding clojure
03:53brehaut(and ring and clutch)
03:54brehauti was on some paleolithic version of a lot of libs, but especially clutch
03:54cemerickshould go swimmingly, I've been on 1.3 running the latest of compojure and ring for months
03:54brehautexcellent :)
03:55brehautim looking forward to getting new clutch
03:55brehautin
03:55brehautand finally writing an admin interface
03:56brehaut(so i can stop relying on futon)
03:56cemerickjust for your app, or a general-purpose UI?
03:56brehautjust for my app
03:56cemerickah, right
03:57brehauti do really like futon though
03:57brehaut(+ ssh tunnel)
03:57cemerickOne of the (many) reasons I like cloudant: futon w/o the tunnel or admin hassle.
03:58brehautah true
03:58brehautim too cheap to pay for anything beyond my VPS for my site
03:59brehautso i havent looked around at other services
03:59brehauti guess these days i could host my site on heroku for cheap and then pay for a cloud couch
03:59clgvcemerick: any chance to submit a CCW issue without a google account?
04:00cemerickclgv: sorry, missed your last /msg; what's the issue?
04:00cemerickbrehaut: cloudant has a free tier
04:00brehautoh interesting
04:01cemerickand they're available as an opt-in service through heroku too, although I don't quite know how/why that would work.
04:02zakwilsonIs it just me, or is ClojureQL buggy as hell and probably dying?
04:02clgvcemerick: a disturbing line break after typing \' - I noticed when typing (use 'debuglib....)
04:03clgv(use \n(defn blubb ...) becomes (use \n'(defn blubb ...) when typing the \' on the use-line
04:03cemerickclgv: oh, yup
04:03cemerickclgv: turn on paredit, you'll be happier in general
04:03clgvcemerick: I switch between both
04:03cemerickcrazy man ;-)
04:04cemerickI'll file a bug for you.
04:04clgvthx :)
04:04cemerickclgv: one time deal though — get thyself a google account :-)
04:04brehautcemerick: how much of the gist you linked to in the clutch ann is relevant to the new api?
04:05clgvyeah sometimes the default mode is handy for editing "diagonal" through the parens ;)
04:05brehautcemerick: is that stuff 'just' the future direction?
04:06cemerickbrehaut: Anything involving the protocol or type is coming attractions.
04:07cemerickI needed the new API in order to implement the type though.
04:07cemerickclgv: http://code.google.com/p/counterclockwise/issues/detail?id=313
04:07clgv:)
04:08kralnamaste
04:09clgvcemerick: I am interested in how modular CCW is - is it possible to use the repl view of CCW standalone in a project?
04:10cemerickNot at present, no.
04:10clgvthats a pity.
04:10cemerickLaurent inherited the codebase…it's gotten much better over the couple of years or so, but it's still quite bound up.
04:11cemerickMuch of it is being rewritten in Clojure now, which will help quite a lot.
04:12brehautcemerick: so my biggest hurdle with 0.3.0 of couch has been that the db is no longer a map :P
04:12cemerickbrehaut: thank goodness :-P
04:13cemerickThere's a record factory @ com.ashafa.clutch.utils/url
04:13clgvcemerick: 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. ;)
04:13cemerickclgv: check the wiki; the dev process hasn't changed much, unfortunately
04:14clgvcemerick: what wiki page do you have in mind?
04:15clgvClojureDevInternals?
04:16cemerickhuh, github has its own rev of jenkins for CI http://news.ycombinator.com/item?id=3372824
04:18cemerickclgv: there's that and the how to build page
04:18clgvah ok.
04:20kotarakThe series of useless forks continuous...
04:22cemerickkotarak: ?
04:22brehautcemerick: 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?
04:22cemerickbrehaut: yup, that presupposes localhost, standard port, database name as provided
04:22brehautyup
04:22kotarakcemerick: ah nothing. When ever I read such headlines, I always think: they'd rather improved the original product.
04:23kotarakcemerick: there was hudson, then jenkins (admittedly for different reasons), today we add janky, tomorrow panky, and then hanky.
04:24cemerickheh
04:24kotarakcemerick: ah, nothing.
04:24cemerickfrom a brief look, it seems that they're not forking it but reusing it
04:53Blktgood morning everyonbe
04:54cmdrdatsgood morning
04:55clgvhmm what would you suggest for better performance: (dissoc m k) or (if (contains? m k) (dissoc m k) m) ?
04:57cmdrdatsi would guess just the dissoc, since it would need to try find it to remove it? but I don't really know for sure :)
04:58clgvcmdrdats: 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
05:00clgvhmm I guess I have to decide quick for the more likely case and not waste too much time on it ;)
05:00raekclgv: I think bith 'contains?' and 'dissoc' are O(log_32 n)
05:00raek*both
05:01clgvraek: dissoc does a contains? anyway as first action then it should be superior
05:01clgv+if
05:03alandipert clgv no need for the contains? there, as dissoc doesn't do anything if k isn't in m
05:03raekclgv: 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
05:03amalloydissoc should be very close to contains performance if the key is not present
05:03amalloybut certainly it will have to do some more work
05:04amalloyand if this decision makes a noticeable difference in your program, you can revisit the decision later
05:04cmdrdatsI usually just use dissoc alone because it's simpler
05:05raekclgv: I wouldn't bother with micro-optimizations like this where the alternatives have the same complexity class
05:05cmdrdatswith the assumption that if i measure it as a bottleneck, i'll figure out how to optimize
05:06clgvraek: 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
05:07raekclgv: ok, but my guesstimate is that 'contains?' + 'dissoc' does more work tha just 'dissoc' and does not add any benefit
05:08clgvraek: yeah that was my first guess as well
05:08raekclgv: you should profile the code know where the bottleneck really is and also read about how the data structures work before you make decisions
05:09amalloy(defmacro awesome-dissoc [m k] (if *awesome-mode* `(let [m# ~m k# ~k] (if (contains? m# k#) (dissoc m# k#) m#)) `(dissoc ~m ~k)))
05:09amalloynow you have both, with no runtime cost. but seriously just use dissoc :P
05:09raek
05:09clgvlol
05:12amalloy(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)
05:12clgvamalloy: yes that idea is good. I did that for another problem some time ago
05:13raekwhen debugging or profiling, just gather information about what actually happens in your app until the solution becomes obvious
05:13amalloylisp: the easiest language to reinvent #ifdef in
05:14clgvamalloy: muhahaha. #ifdef I suffered from #ifdef in my second job for years...
05:38AWizzArdTo the german users: there is also a #Clojure.de channel. Die Deutschen Nutzer können gerne in den entsprechenden Kanal kommen (:
05:43Scriptorthe latest vimclojure seems to have some lag whenever I try to use the 'o' or 'O' commands
05:56kotarakScriptor: this is fixed in the next version. It was around for years, but finally @darevay was able to track the issue down.
05:58Scriptorkotarak: ah, nice. How soon until the next version is out?
05:59kotarakkotarak: maybe over christmas. Depends on time allocation. But there have some fixes accumulated. So a quick bugfix release is actually due.
06:00kotarakScriptor: Unfortunately the changes for this fix were rather extensive. So I can't recommend a simple two-line change as workaround...
06:02Scriptorkotarak: got it, I was just starting to look through the commits list too!
06:02Scriptorstrange though, I don't remember having this problem before
06:22kotarakScriptor: It was a long lasting thing.
06:24kotarakScriptor: Tried to be too functional with vim...
06:37Rayneskotarak: Yeah. Too bad there isn't an editor configured in a Lis... oh wait.
06:38clgvRaynes: yeah slightly OT ;)
06:38RaynesOff topic?
06:39RaynesNot sure about that. I didn't realize I was over 2 hours late though.
06:40clgvhmm well they like vim so they use a vimplugin for clojure. your comment does not more than teasing...
06:53AWizzArdRaynes: but Emacs is very difficult to learn and unintuitive.
06:53RaynesTough crowd this morning.
06:54AWizzArdRaynes: I am using Emacs, and nothing else, since 2002 ;)
06:54Raynesclgv: It was a joke -- kotarak is the author of VimClojure. :)
06:54RaynesAWizzArd: Represent! :>
06:54AWizzArdBut it was difficult to get into.
06:54RaynesI recently did a little experience where I used Vim exclusively for a couple of weeks.
06:54AWizzArdurks :)
06:55clgvRaynes: np. I wont mind much more since I dont even use VimClojure - I just ahted the sound of that ;)
06:56RaynesI 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.
06:57G0SUB"I don't hate ViM users, I pity them"
06:57G0SUB"Using ViM is not a sin, it's a penance"
06:57G0SUB;-P
06:57RaynesThat's close to my conclusion, but mine isn't quite as mean. :p
06:57clgvlein uberjar
06:58AWizzArdclgv: when you have a german keyboard layout then “lein überjar” is cooler.
06:58clgvAWizzArd: that will work?
06:58AWizzArdyes
06:58AWizzArdThis is an actual alias.
06:59G0SUBRaynes: lol
07:00G0SUBSo 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?
07:00G0SUBWithout creating a wrapper function for seq in foo.bar
07:01gensym,(clojure-version)
07:01clojurebot"1.3.0"
07:01gensym,(clojure-version )
07:01clojurebot"1.3.0"
07:02cmdrdats,( clojure-version)
07:02clojurebot"1.3.0"
07:02cmdrdatsportal 2 right there.
07:04accelare multimethods per namespace or per program?
07:05G0SUBaccel: program, unless you provide your own hierarchy
07:06G0SUBaccel: if you don't provide any hierarchy to defmulti, it will use the global hierarchy
07:14accelG0SUB: how do I provide a hierarchy to defmulti?
07:15accelso if multimethods are per program
07:15accelso 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
07:17raekaccel: multimethods still have namespaces
07:17raek(defmulti foo ...) in namespace a and (defmulti foo ...) in namespace b are separate multimethods
07:19raekand if third parties are allowed to add implementations to your multimethod they should ideally only implement methods for their own dispatch values
07:19accelraek: so multimethods are _per namesapce_ and not _per program_ ?
07:19raeka multimethod lives in a namespace
07:20Chousukemultimethods work like regular functions in that regard
07:20raekthe set of implementations of a multimehtod lives in the multimethods, but can be defined anywhere in the progran
07:20accelso 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
07:20accelraek: but to define it in another namespace, I need to refer to it as some.other.module.foo right?
07:21raekaccel: you just use the usual way to access a var of another namespace, e.g. (:use :only [...]) or (:require ...)
07:21jweissanyone 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?
07:22accelraek: great; I think we are now loudly agreeing
07:22raekprotocols works similarly
07:33elriclHello.How do i get input from stdin,and store them in a list,so I can use it to call a function later?
07:37elriclI want to do something like this http://pastebin.com/si5xvT6y but in clojure.
07:42svankiEelricl: http://stackoverflow.com/questions/2034059/how-to-read-lines-from-stdin-in-in-clojure
07:44elriclsvankiE, instead of printing it,I want to store it and use it as a argument for someother function. How do I do that?
07:48svankiEelricl: you could look at this Rayne's answer at SO. http://stackoverflow.com/a/1114722/542702
07:54elriclsvankiE, The main thing I am confused about is,where to store the data. Can you just gimme a snippet for the pastebin link
07:57osa1where 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
07:57kotarakRaynes: which cannot use Clojure and CL together. Pfff..
07:57kotarakTo each his poison. :)
08:25svankiEelricl: 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
09:04Raynescmeier: Morning.
09:07cmeierGood morning Raynes!
09:07cmeierLike the name for the library
09:08RaynesSome guy mentioned 'PowerRangers', but that's too long.
09:08bhenryif 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.
09:09Raynesbhenry: You want to load a bunch of clj files that you don't know the names of?
09:09RaynesWhen in doubt, simplify the *shit* out of your problem.
09:09bhenryi 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
09:10RaynesYeah, gist an example.
09:10RaynesI'm not quite following.
09:10RaynesI *think* I get it.
09:10RaynesYou probably want clojure.tools.namespace
09:10bhenryright 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.
09:10RaynesYeah, you definitely want clojure.tools.namespace.
09:11bhenryso we want to have a reports dir with abandon-report.clj kpi-report.clj etc
09:11RaynesIt'll allow you to grab the nses/paths of all Clojure files in a directory and then you can load them all.
09:11RaynesLoad ALL the things!
09:11bhenryexcellent i will look into that. thanks Raynes
10:11TimMc$inc svankiE
10:11lazybot⇒ 1
10:13svankiETimMc: :>
10:17yaziriananyone 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:28mprenticeyazirian: At 2:14AM Eastern Time, Emacs finally became self-aware.
10:29yazirianhaha
10:29yaziriani may have killed a sentient being :(
10:31fielcabral@yazirian I remember Star Frontiers too!
10:39yazirianholy ... it's been years since somebody got that reference
10:39yazirianfielcabral: you officially win at esoteric references today
10:41fielcabral:)
11:05tomkin_cd
11:08juhu_chapaHi 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:09kraljuhu_chapa: there must be a java process somewhere to kill...
11:11juhu_chapakral: let me try.
11:12juhu_chapai am running it inside enclojure.
11:32devnyazirian: I don't have that problem but I still use slime-connect
11:42Raynesdevn: Dude. The future. Join us.
11:49devnRaynes: What are the benefits in this future of yours?
11:49Raynesdevn: One less command to manually type.
11:49RaynesLess pointless clutter in your Emacs initialization files.
11:50devnBut...but...
11:50yazirianActually opens a repl whether or not the SLIME devs think you need one.
11:50yazirianOh how I didn't like having to add MORE pointless clutter to get that back.
11:50devnHonestly 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:56lzskissyo
11:57Rayneshoho
11:58dmansenoh man. my boss just saw some clojure we forced into the codebase and said it looked good :)
11:59kral:)
12:06hansengelhi, I am getting the error "No matching ctor found for class
12:06hansengeljpen.demo.PenCanvas" when trying to instantiate a class from a Java lib
12:07hansengelthis error occurs when I run `(PenCanvas.)` or `(new PenCanvas)`
12:07hansengelthere clearly is a matching constructor: http://jpen.svn.sourceforge.net/viewvc/jpen/trunk/src/main/java/jpen/demo/PenCanvas.java?revision=290&amp;view=markup
12:08dmanseni notice that that constructor has no visibility. would that make it default to package private?
12:10hansengelah, missed that - you're right
12:10hansengelthanks :)
12:11dmansennp!
12:17replacaQ: is the ->Type function that I get when I "(deftype Type..." a constructor? Am I always guaranteed to have it?
12:18Raynesreplaca: It is a factory function. It isn't going to not be there.
12:18RaynesDouble negatives are fun.
12:19replacaThat's awesome! Thanks Raynes
12:20replacafactory means it's just a wrapper for the Java constructor? Or does it do something else?
12:20RaynesJust a wrapper.
12:21replacacool, thanks
12:21cgrayRaynes: 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:21Raynescgray: What version of marginalia are you using?
12:22cgraylein-marginalia 0.6.1
12:22RaynesUse 0.7.0-SNAPSHOT.
12:23cgraythanks, that worked
12:24Raynesreplaca: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_deftype.clj#L238
12:24RaynesIf you're interested in precisely what is going on there.
12:25Raynesreplaca: Be careful if you read that stuff though. Sure path to the closest mental institution.
12:25RaynesParticularly the implementation of emit-defrecord. I have nightmares.
12:31replacaRaynes: Yeah, so far I've avoided diving in that deep
12:31replacabut thanks for the pointer - I may have to
12:32replacaI'm trying to get autodoc to do what it can in terms of discovering and documenting types and records
12:34duck1123sweet, 0.7.0-SNAPSHOT worked for me as well
12:34RaynesI keep the snapshots generally up-to-date with fixes in marginalia.
12:35RaynesBecause I know how annoying it is to need a fix that isn't released.
12:37cgrayRaynes: are you a maintainer of it?
12:37Raynescgray: Kindasorta.
12:38cgraycool, well it's really nice :)
12:38RaynesI can release and I have commit access. The amount of work I actually do is another thing though.
12:38duck1123The worst thing about Marginalia is it reminds me of just how many of my functions aren't documented
12:38cgraya kindasorta bug is that "bar" (def foo "bar") gets interpreted as a docstring
12:39cgray:)
12:39Raynescgray: That was fixed two days ago.
12:39RaynesI have released a new snapshot.
12:39Rayneshaven't*
12:39cgrayno problem, it just made me document my var
12:41Raynescgray: 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:25simardhow 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:27technomancysimard: 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:27simardtechnomancy: thank you
13:27jcromartie_deskEmacs IRC plus Solarized theme: most subtle IRC evarrrrr
13:27technomancysimard: but don't use clojure-contrib
13:28simardI see, well I need that math round function.
13:28jcromartie_deskThere'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:28jcromartie_deskI can't do that in Visual Studio
13:29technomancy,(Math/round 1.7)
13:29clojurebot2
13:29simardoh that's java's Math
13:29technomancyjcromartie_desk: yeah, how many IRC clients have integrated paredit capability?
13:30jcromartie_desk:P I haven't switched on paredit in irc though
13:30simardtechnomancy: as for not using clojure-contrib, may I ask why ?
13:31amalloyclojurebot: what happened to contrib?
13:31clojurebotIt's greek to me.
13:31simardbecause they wouldn't be compatible for the next release of clojure ?
13:31amalloyclojurebot: where did contrib go?
13:31clojurebotwell... it's a long story: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
13:31technomancysimard: the current release, actually
13:31cmdrdatshmm, wish i could run a function to find out just how many people in #clojure is connected here within emacs
13:31simard1.3, yes.
13:31technomancyplus it was never really a good idea to begin with
13:32amalloyand 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:32jcromartie_deskI'm kind of sad that clojure-contrib was broken up, but I know it makes sense for the future.
13:32jcromartie_deskIt was a nice "batteries included" feel.
13:33jcromartie_deskbut those batteries were getting heavy
13:33jkkramerthere has been mention of doing a batteries-included version of new contrib
13:33simardso when is 1.4 due ?
13:33jkkrameri think it would be handy for experimental repl stuff
13:33RaynesYeah, but people would abuse it and we'd have to deal with it.
13:34RaynesSo I don't think I'm a fan.
13:34amalloyamusingly, according to jira 1.4 is due last month
13:34amalloyi assume someone just made up a date on a whim and it never got updated
13:34cmdrdatswe just need a lein plugin that can automatically check your dependencies and include the correct ones :P
13:34cmdrdats(based on namespace)
13:45TimMcclojurebot: what happened to contrib |is| <reply>Well... it's a long story: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
13:45clojurebotIn Ordnung
13:45TimMcclojurebot: What happened to contrib?
13:45clojurebotWell... it's a long story: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
13:48amalloyTimMc: good save. i always ask the wrong question
13:51TimMcIs it because of your childhood that you always ask the wrong question?
13:52TimMc(An ELIZA module would be one of the most annoying things you could put on an IRC bot.)
13:52dmansenis there a way to interrupt the current evaluation in lein repl without killing the jvm?
13:52technomancydmansen: no, you'd need swank or some other editor integration for that
13:53TimMctechnomancy: Is that a limitation of Lein or Clojure's built-in REPL?
13:53TimMcBeen wondering.
13:53dmansentechnomancy: 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:53choffsteintechnomancy: any new thoughts on s3-wagon?
13:53technomancyTimMc: not sure. I don't use lein's repl at all.
13:53TimMchaha
13:54technomancychoffstein: 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:54technomancychoffstein: in the mean time I think a tweak in the buildpack could handle your use case
13:55choffsteintechnomancy: amazing
13:56dnolentechnomancy: dmansen: doesn't clojure.repl/set-break-handler! work?
13:58dmansenooh, i'll try that
13:58technomancyhuh; /me had no idea
13:58technomancyoh, it's new in 1.3
13:58TimMcNot sure how I would use that, but maybe Leiningen could register a thunk with it.
13:59technomancyTimMc: trickier since it's not guaranteed to be supported though
13:59amalloydnolen: to be able to stop the running expression you need to have it on its own thread though, right
13:59technomancybut lein could inject a form that used resolve and no-oped if it wasn't found
13:59dnolenamalloy: it works for me is all I know.
14:00TimMcdnolen: What do you pass it?
14:00dnolenTimMc: you don't need to pass it anything
14:00TimMcOh, just use the default?
14:00dnolenTimMc: yes
14:01technomancyhuh; could sneak a (when-let [sbh (resolve 'clojure.repl/set-break-handler)] (sbh)) into lein repl easily enough
14:01technomancydnolen: thanks for the heads-up
14:01dnolentechnomancy: np
14:01TimMcdnolen: That doesn't work for me -- C-c still dumps me back to Bash.
14:01dmansensame here. but i'm in lein repl
14:04TimMcIf I were in SLIME, I'd use C-c C-c or whatever it is.
14:14technomancyit looks like you'd need a custom break-handler that would restart the socket-repl thread
14:15amalloytechnomancy: 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:16technomancyoh, I missed that
14:16technomancyyeah
14:16gfredericksI 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:16amalloythat will have a number of other problems, of course
14:16technomancywant to just delegate to nrepl
14:18gfredericksor is it something you're supposed to not want to do?
14:19technomancygfredericks: leaning towards the latter
14:19gfredericks:/
14:19technomancyrationale: http://blog.ianbicking.org/2011/03/30/js-on-server-and-client-is-not-a-big-deal/
14:19technomancyit's about node, but it applies to clojurescript as well
14:20cemerickgfredericks: the same challenges apply if you were to want to use the same clojure codebase on the JVM and CLR, but even moreso
14:20technomancyclojurebot: 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:20clojurebotRoger.
14:21jkkramergfredericks: I think it's an idea worth pursuing
14:21gfredericksI 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:22jkkramerespecially 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:22gfredericksthe 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:23gfredericks(it's a client-heavy JS app)
14:24jkkramerright. how you use the information gathered ("this input is invalid") may differ, but the logic to gather that info could be shared
14:24jkkramermaybe it would get messy in practice. but i think it's worth experimenting with, at least
14:25technomancyyeah, 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:26gfrederickstechnomancy: yeah, just some pure-logic nothing-host-related namespaces
14:27gfredericksso it's at least technologically feasible? I haven't used clojurescript nearly at all, so I can't answer that myself
14:28TimMcThere'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:28jkkramergfredericks: symlinks? :)
14:29gfredericksjkkramer: maybe the cljs-compile script copies over the relevant files...
14:29jkkramerthere was a post on the mailing list about this. someone came up with a working prototype, I believe
14:37cemerickdnolen: you're inspiring some _very_ strange tweets these days :-P
14:38dnolencemerick: heh, I think that was because I helped him fix a bug he'd lost a lot of time over.
14:38cemerickoh, sure! But…
14:40sridpython/ruby programmers here: could you critique my blog post? http://blog.srid.name/2011/12/clojure-line-seq-python-ruby/
14:41amalloysrid: it doesn't take a lazy sequence of streams at all
14:41amalloyer, of strings
14:41amalloyit 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:42sridpoint noted. thanks. editing...
14:47ccarpenterghello 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:52mabessrid: you can use Ruby's Enumerator for lazy lists
14:52jkkramerccarpenterg: the books Programming Clojure and The Joy of Clojure are great resources. Also, read everything on clojure.org
14:53cmdrdatsThe videos are also a fantastic source of info :)
14:53mabessrid: here is an example http://benmabey.com/2011/08/14/word-break-in-clojure-and-ruby-and-laziness-in-ruby.html
14:53sridmabes: half the answer :-) how would I use enumerator with eventmachine loop?
14:53srid(like using python generator with gevent greenlet)
14:54sridreading....
14:54ccarpentergoh thanks, that sounds great, where do you find the videos?
14:54jkkramerccarpenterg: http://blip.tv/clojure (older videos may be more accessible)
14:54mabessrid: ah, I see. fair enough.
14:56sridi guess i should make it clear in the blog post that the context is concurrency
14:56Vinzentccarpenterg, also check the http://learn-clojure.com
15:02ccarpentergthanks
15:03amalloysrid: huhhh, how is that post relevant to concurrency?
15:04djKianooshmabes, http://www.4clojure.com is good too
15:04djKianooshi meant.. ccarpenterg
15:08mcrittendencan someone help me understand line 8 here: https://gist.github.com/1503055
15:08mcrittendenthe (File. "string") syntax is tripping me up, not sure what's going on there
15:09Vinzentit's the same as (new File "string")
15:09samaaronmcrittenden: you're calling the constructor on File passing it one arg - the path as a string
15:09mcrittendenso Something. is a shortcut for new Something
15:10mcrittendencool, thanks
15:10Vinzentmcrittenden, yes, and it's preffered over a (new ...)
15:10mcrittendenmakes sense
15:17sridamalloy: 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:17sridin clojure, each of those tailing was done as a future (thread). in python and ruby, the code is async
15:18juhu_chapaclojurians, 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:19juhu_chapathe resulting array must contain {1, 2, 3}
15:19juhu_chapa...
15:20Vinzent(doc read-lines)
15:20clojurebotTitim gan éirí ort.
15:21ccarpentergthanks very much
15:22simardis 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:22juhu_chapahx
15:22Vinzentjuhu_chapa, hm, maybe it was in contrib... But there is read-line anyway
15:23amalloyVinzent, juhu_chapa: line-seq
15:23Vinzentsimard, are you sure there is no typo or something?
15:24Vinzentright, that's what I was trying to remember
15:26simardVinzent: http://pastebin.com/imSp2h70
15:26juhu_chapaok, i got a line, then how do i insert into the array?
15:26simardnot quite sure if that import line is useful or not anyway.
15:28TimMcsimard: Math should always be available by default.
15:28TimMcbeing in java.lang
15:28simardyeah.. well it was working.
15:28Vinzentsimard, Math/round expects a double, and your (* 10) returns an int
15:28Vinzentso it throws IllegalArgumentException
15:28Vinzent,(Math/round 10)
15:28clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: round>
15:29simarderrrr
15:29simardthere should be an n there :D
15:30TimMcYou should still call (double ...) on n or the multiplication just be sure you don't tickle that again.
15:30VinzentMaybe it also makes sense to call double on the result, jsut in case
15:30TimMcTry (mils 5)
15:37amalloyMath/round takes either a float or a double. if you give it an integer it can't tell which version you want
16:04tscheiblhmm.. can't get (binding [...] ...) to work across namespace (file) boundaries in Clojurescript
16:05TimMctscheibl: You can't bind something from another namespace, or no binding holds across a call to a function in another namespace?
16:05dnolentscheibl: a paste of both files would help.
16:06tscheiblI'm no native speaker, maybe I didn't explain it correctly
16:06tscheiblI'm doing the same thing that works in CLlojure...
16:06tscheibl..like the with-connection function/macro in contrib jdbc
16:07tscheiblcalling a function from another namespace within the binding call
16:07dnolentscheibl: again, let's see a minimal example. then someone can confirm and open a ticket if it's a bug.
16:07hiredmanbinding doesn't exist in clojurescript, does it?
16:07dnolenhiredman: it does
16:07hiredmanbut there are no vars
16:08gfrederickspoor man's vars
16:08hiredmandnolen: so it is the same thing as with-redefs then?
16:08tscheiblhiredman: what does that mean?
16:08dnolenhiredman: basically.
16:08hiredmantscheibl: what does what mean?
16:08tscheiblwhat implication does that bring with it?
16:08tscheibl"there are no vars"
16:09tscheiblthere are Javascript vars...
16:09TimMcI suppose binding fails across setTimeout calls just as it would with lazy seqs.
16:09dnolentscheibl: which aren't the same as Clojure vars.
16:09gfrederickstscheibl: if javascript is single-threaded I don't think you notice a difference
16:09hiredmanit is a sadder more dismal place, a world without magic
16:09tscheiblI don't use setTimeout
16:09tscheiblI do it just like in java.jdbc
16:09dnolentscheibl: in anycase we can't help you if we don't see the code :)
16:10gfrederickstscheibl: I think the same stuff applies to callbacks in general
16:10tscheibl... like with-connection .. as I did many times in Clojure projects
16:10hiredmantscheibl: "var" in clojure refers to specific reference type used for linking
16:10tscheibl..ok i 'll try to put some example on gist
16:11dnolentscheibl: thx
16:11TimMc&(class (var +))
16:11lazybot⇒ clojure.lang.Var
16:11hiredmanfor whatever reason (interop?) clojurescript was written without vars
16:17dnolenhiredman: not much advantage to having Clojure style vars in ClojureScript that I can see.
16:19hiredmandnolen: clojure hangs a lot of compilation and linking information on vars
16:19tscheibldnolen: https://gist.github.com/1503322 (print-something) does output undefined
16:20tscheibldnolen: where it should say 42
16:20dnolenhiredman: true, ClojureScript moves that info into the compilation environment.
16:21dnolentscheibl: one thing - you didn't define *something* anywhere.
16:22tscheibldnolen .. ok I left out the (declare ^:dynamic *something*) in the example
16:22tscheiblbut I do this in my original code
16:22technomancyhiredman: clojurescript doesn't really seem to be optimized for "pleasant-at-runtime"
16:23technomancywell, pleasant for the user rather than pleasant for the developer, I should say
16:23amalloytechnomancy: developer is already happy because he can use same language on server and client. no need to appease him
16:23dnolentscheibl: ^:dynamic is not necessary in ClojureScript.
16:24technomancyamalloy: "not having to use Javascript" covers a multitude of sins, in other words?
16:24technomancyI'll buy that.
16:24tscheibldnolen: ok
16:24amalloywell, 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:24hiredmantechnomancy: I think amalloy may have been making a sarcastic allusion
16:24technomancywhoosh
16:25tscheibldnolen: ... ohh.. my god... this might be embarassing... just let me have a second look...
16:25dnolentscheibl: (def *something* nil), declare does not exist in ClojureScript, and (def *something*) doesn't work (probably should)
16:27dnolentechnomancy: 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:27hiredmanbleh, so static
16:28Vinzent(haven't followed the conversation) slime? is there slime support for clojurescript?
16:28tscheibldnolen: phew... still doesn'twork
16:28Vinzentor, cljs support for slime
16:28technomancyhopefully the fact that you now have to manage two runtimes can be abstracted away, but that seems to be a long way off.
16:28tscheiblI used the same "dynamic" var twice.. fixed that.. but it still does'nt work
16:28dnolenhiredman: no, it's just stratified, compilation / runtime environment. but CLJS is clearly designed for these to work together.
16:28technomancyVinzent: I think dnolen just meant that there's no technical reason it couldn't be done.
16:29dnolentscheibl: update the gist please. I'll take a look
16:30tscheibldnolen: the problem was just in my original code... but I updated the gist with the declare
16:30Vinzenttechnomancy, ok, then I'll continue wait for it
16:30dnolenVinzent: technomancy: I actually added file and line support for all CLJS defs recently, lots of other things can be added as well.
16:31technomancyas 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:31clojurebothey man is for horses
16:33dnolentscheibl: so it does or doesn't work?
16:34tscheibldnolen: it doesn't
16:34tscheibldnolen: it wokrs in CLojure ... in Clojurescript only if I do this in the same file
16:37mcrittendenis there a best practice for converting a string into a seq of 1-char strings, so e.g. "something" becomes ("s", "o", "m", .....)
16:38Vinzent,(map str "something")
16:38clojurebot("s" "o" "m" "e" "t" ...)
16:39amalloymcrittenden: are you sure you want that? why not just ##(seq "something")
16:39lazybot⇒ (\s \o \m \e \t \h \i \n \g)
16:39TimMc&(drop 1 (.split "something" ""))
16:39lazybot⇒ ("s" "o" "m" "e" "t" "h" "i" "n" "g")
16:40TimMc:-P
16:40cgrayTimMc: there must be a more convoluted way...
16:41TimMcI'm sure, but this is pretty good.
16:42TimMcmcrittenden: Vinzent's solution is the one you want, just to be clear. (Assuming amalloy's assessment is not correct.)
16:42mcrittendenthanks. list of chars might work as well, so i'll try amalloy's route.
16:43mcrittendenany guidance on the ##() syntax? what's the double hash there for?
16:43lazybot⇒ ()
16:43TimMcnow you know!
16:44mcrittendensorry 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:46cemerickmcrittenden: ## is syntax for the bot, not Clojure itself :-)
16:46mcrittendenoh, good, that one had me worried
16:47dnolentscheibl: binding works for me just fine across two files.
16:47dnolentscheibl: your ns form for the second file is wrong as well as your use of declare.
16:52technomancychoffstein: ping
16:52tscheibldnolen: it works for me if the func argument is a function defined in the same namespace where with-something call is executed
16:52choffsteintechnomancy: yessir?
16:53technomancychoffstein: I think I have a fix for your issue, mind if I msg?
16:53choffsteinplease do!
16:54tscheibldnolen: ok.. i forgot to type the colon in gist... but it's there in my project code
16:54tscheibl..before use
16:55amalloytscheibl: 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:56tscheiblamalloy: because I tried to extract only the necessary information
16:57TimMctscheibl: 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:57TimMc.
16:57tscheiblamalloy: .. and it should be executable without all my dependencies
16:58tscheiblTimMc: possible... yes... I'll try
16:58TimMcI prefer to do that with a new git branch + deleting a bunch of code. :-)
16:58tscheiblTimMc: arghh.. I would have to delete quite a bunch of code then :(
16:59TimMcThere's different ways of doing it, but the basic idea is to make sure you have a reproducible, minimal test case.
16:59TimMcUsually the process of producing that minimal test case tells you your error.
16:59amalloyheh
17:00tscheiblTimMc: that's ging to be a long night again ...
17:00RaynesHrm. I thought that cljs could compile entire directories when targeting node.js.
17:00tscheibl..as every night...
17:01RaynesIf 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:01Raynesdnolen: Does that sound like a bug, making the wild assumption that have any idea?
17:02amalloyi 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:02TimMcacronym?
17:03TimMcwait wait
17:03TimMc$google SSCCEE
17:03lazybot[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:03TimMc$google SSCCE
17:03lazybot[Short, Self Contained, Correct Example] http://sscce.org/
17:03TimMcheh
17:03brehauthaha correctness is apparently defined by 'compilable'
17:04TimMcUsually the question is "why isn't this correct?"
17:04amalloyTimMc: i usually took "correct" in context to mean: "the code i am giving you actually exhibits the behavior i'm having trouble with"
17:05TimMchmm
17:05amalloybut that's not what the SSCCE page says, so perhaps i'm a jerk
17:06TimMcI think they just wanted a succinct acronym at all costs.
17:07amalloySmall, Snarky, Curt, Compressed Elocution?
17:08dnolenRaynes: I haven't played much w/ the node.js support. You should make a ticket w/ instructions on how to repro.
17:08dnolenRaynes: also if you could weigh in on your earlier CLJS tickets that would be helpful too.
17:08RaynesEH?
17:08RaynesMinus the shouting.
17:08dnolenRaynes: I responded to your CJLS tickets a long time ago.
17:09RaynesI never got any emails.
17:09dnolenRaynes: yeah amalloy has the same problem.
17:09dnolenhad
17:09RaynesThat Jira is a worthless hunk of garbage? We all have that problem.
17:11technomancyfree as in puppies
17:11TimMc,(println "&(println \"Amen.\")")
17:11tscheibldnolen: 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:11clojurebot&(println "Amen.")
17:11lazybot⇒ Amen. nil
17:11dnolentscheibl: heh, that was what somebody suggest earlier :)
17:11dnolensuggested
17:12tscheibldnolen: shame on me...
17:12Raynesdnolen: 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:12TimMctscheibl: That's because the current stack unwinds, exiting the binding, and the event handler is called later.
17:12dnolenRaynes: it's fine if it involves node, testability is the key thing.
17:13tscheibldnolen: 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:13tscheibli'll dig into that now ....
17:14tscheiblthanks to all for your help
17:14Raynesdnolen: Is there anything in particular wrong with the example that I posted?
17:16tscheiblnice... you can select the programming language in gist... didn't know that... was my first gist anyway
17:16tscheiblTimMc: I can work around that by creating a local binding before assigning the event handler
17:18Raynesdnolen: Looks like it isn't happening anymore.
17:18RaynesYou can close 42.
17:18RaynesUnless I can?
17:19RaynesEvery time I log into Jira a kitten commits suicide.
17:19RaynesYeah, I can't close that.
17:20amalloyRaynes: yeah, i had to ask cemerick to close my old issues for me, because jira doesn't think i'm grown up enough
17:20Raynesdnolen: https://gist.github.com/1503548 this should have been a reproducing example.
17:21RaynesI don't see any other issues of mine that you've responded to.
17:21Rayneshttp://dev.clojure.org/jira/browse/CLJS-69 This is the only other issue I see that remains open.
17:22RaynesWow, that one is still open? :o
17:27dnolenRaynes: thx, cljs-42 resolved
17:27dnolenRaynes: I'll look into CLJS-69
17:27RaynesThat one was fun to debug.
17:28RaynesAnd by fun I mean utterly painful.
17:28RaynesI 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:29technomancywe have an internal prototype project at work using server-side node cljs
17:30RaynesAnd it works?
17:30technomancywell
17:30technomancyit deploys
17:30technomancyI wasn't able to get it working on my own machine though.
17:30RaynesI'm not astonished.
17:30RaynesI've written a total of one thing that actually worked in node cljs.
17:30RaynesAnd that took forever because of cljs-69.
17:31amalloyRaynes: better than your track record for jvm-clj
17:31technomancyI 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:31Raynes~rimshot
17:31clojurebotBadum, *ching*
17:31technomancythat blew my mind
17:31Raynes...
17:33RaynesI've been considering writing actual node.js js. But then the hallucinogenics wear off.
17:34technomancydon't you function enjoy seeing the function word function everywhere?
17:35RaynesIt isn't nearly as much fn as it could be..
17:35brehauts/$/});});});/
17:35dnolentechnomancy: I should brush up my cljs-on-node REPL
17:36samaarondnolen: what? You hack using a REPL????
17:36technomancywe've talked about writing a clojurescript buildpack, but there's no sense in doing it until there's a stable release.
17:37technomancydnolen: yeah, that would make it a lot more bearable
17:37samaaronwho needs REPLs when we have IDEs?
17:38Raynessamaaron: You're dead to me, music man.
17:38samaaronRaynes: you're clearly not a *real* programmer
17:38samaaronReal enterprise programmers develop real systems with real IDEs
17:39technomancydeveloping without a repl is cybernetically unsound
17:39samaaronno need for extinct tech like REPLs
17:39zakwilsonIt'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:39samaarontechnomancy: so you too have been assimilated?
17:39brehauti dont understand this repl. how do you type your classs in correct in one pass?
17:40samaaronbrehaut: precisely!
17:40technomancysamaaron: Norbert Weiner is my homeboy.
17:41samaaronzakwilson: there's a huge differene between real programming and scripting. Scripting is for kiddies, and real programming is for grown ups
17:41technomancyreal programming supports GOTO
17:41technomancyamirite?
17:41brehautreal programmers alternate their hard and soft layers
17:42zakwilsonHeh. I will actually agree there's a difference between scripting and real programming, but it isn't the language.
17:42zakwilsonHard candy shell with a chewy center?
17:42technomancyclojurebot: ed is the standard editor!
17:42clojurebotIn Ordnung
17:42brehautmmmm nougat
17:44samaaronreal programming has semi-colons
17:45brehautim glad im not a real programmer
17:45samaaronbrehaut: we all have a real programmer inside us
17:46tscheiblis my assumption correct that I cannot use ore require cljs namespaces (files) in cljs macro files?
17:47samaaronRaynes: so if i'm dead, are you going to hack on Overtone in my place?
17:47brehauttscheibl: im not a reliable source but i think cljs macros are writen in clojure, not clojurescript
17:47tscheiblbrehaut: that's exactly the reason why I'm assuming that...
17:48devnreal programming involves magnets, pins, and a steady hand.
17:48brehauthttp://xkcd.com/378/
17:49samaarondevn: are you coding with fridge magnets again?
17:49dnolentscheibl: that's correct
17:49tscheiblso I will have to fully qualify symbols from other namespaces that I use in macros
17:50Raynesnowaiman
17:51samaaronRaynes: it's easy, writing a music system/langauge has no technical challenges whatsoever - not like real enterprise programming
17:54ekoontzcan people recommend a good combination of clojure and clojure-contrib version tags?
17:54brehaut1.3.0 and no monolithic contrib
17:55ekoontzbrehaut, thanks..no monolithic contrib..i am looking at github.com/clojure/clojure-contrib.git
17:55ekoontzis that monolithic?
17:55TimMcekoontz: contrib is dead, basically
17:55brehauthttp://dev.clojure.org/display/doc/Clojure+Contrib
17:55ekoontzi see, thanks guys, reading
17:56brehautekoontz: see also http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
17:56brehautekoontz: the only trick with some of those libs is you may need the snapshots repo in your projects repos
17:57amalloydo we have something like prefix-of? eg (prefix-of? [1 2 3] [1]) => true, (prefix-of? [1 2 3] [a 2]) => false
17:58brehaut$findfn [1 2 3] [1] true
17:58lazybot[clojure.set/superset? clojure.core/not= clojure.core/distinct? clojure.core/every?]
17:58brehaut$findfn [1 2 3] [:a 1] false
17:58lazybot[clojure.set/superset? clojure.set/subset? clojure.core/identical? clojure.core/isa? clojure.core/= clojure.core/contains?]
17:59samaaronbrehaut: what awesome magic are you casting there?
18:00brehautsamaaron: 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:00brehauteg
18:00brehaut$findfn 1 2
18:00lazybot[clojure.core/unchecked-inc-int clojure.core/unchecked-inc clojure.core/inc clojure.core/inc']
18:00brehautall the functions that take 1 as an argument and return 2
18:00samaaronthat sounds like something I need in my IDE
18:00samaarons/IDE/REPL/
18:01amalloysamaaron: it's available standalone on Raynes's github
18:01amalloyand he wrote a lein plugin as well, i think
18:01samaaronvery cool
18:01samaaronis it just called findfn?
18:02amalloyyeah
18:02samaarongot it - awesome
18:03samaaronamalloy: although not quite as awesome as a pint of bacon
18:04amalloyyeah, my whole life has been empty since that dinner. nothing compares to the wonder of discovering a pint of bacon on a menu
18:04brehautit comes in pints‽
18:06samaaronbrehaut: only in america
18:07samaaronamalloy: 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:08samaaronI must have dropped a couple the previous night
18:08brehautis it… fermented?
18:08amalloyhaha that's awesome
18:08Raynesbrehaut: Just fried bacon in a glass, bro.
18:09amalloybrehaut: no, it was a pint glass with strips of bacon in it like...pencils in a tin can? something like that
18:10TimMcThere are fermented meats, but bacon is not one.
18:14TimMcsamaaron: You're sure she wasn't a Conjurer?
18:14brehautRaynes: 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:14TimMcI guess she would have recognized you in that case.
18:14RaynesThat's true.
18:14samaaronTimMc: you mean an Incanterer?
18:15RaynesShe was a sorcerjure.
18:15samaaronTimMc: but yeah it was freaky, she had no idea that it was a logo for a music project :-)
18:16cgraythere 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:16TimMcYou asked her?
18:16samaaronTimMc: yeah, we did
18:16TimMcHaha, nice.
18:16samaaronbut we didn't try to explain what it was when she didn't know
18:16TimMc"Do you have any idea what that sticker means?"
18:17amalloyTimMc: englishers don't have the crippling social awkwardness we americans do
18:17samaaronTimMc: that's exactly what we asked
18:17amalloyoh man, and then you didn't tell her?
18:17samaaronshe actually wasn't that interested
18:17samaaroni don't think she would have believed us
18:17amalloysamaaron: i just can't help imagining her, like..."does this say that i hate jesus? is it a gang sign?"
18:18samaaronhahaha
18:18samaaronit's actually a pro-SOPA logo
18:19TimMcThis must be some cool logo if she didn't care.
18:20samaaronTimMc: hmm, i didn't think of it that way, but you're right
18:20samaaroneither that or she was pretty crazy
18:20samaaronor perhaps both :-)
18:20TimMcIs it the image at the top of the home page? or just the two-circles part?
18:21TimMcit is a pretty sweet logo
18:22samaaronjust two circles
18:22samaaronthanks
18:23samaaronTimMc: have you played with Overtone yet?
18:23TimMcnope!
18:24tscheibldeftype/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:24TimMcI like how you say "yet". :-P
18:24samaaronof course
18:24samaaronall Clojure hackers will have at least made a bleep with it before next year is out
18:25samaaronyou'll be amazed at how fun it is :-)
18:25samaaronone of our users wrote a sequencer during the first night of Overtone hacking
18:26TimMcAny idea when the video will be up?
18:26technomancycould overtone be hooked up to tryclj for server-side composition?
18:26samaaronthis stuff isn't that hard if you've got some Clojure chops
18:26samaarontechnomancy: yeah, i've been thinking of exactly that
18:26technomancysamaaron: outputting to html5 audio tags or something?
18:26samaaronwe just need to ice-cast the audio session
18:27samaaronyeah, or html5 audio tags if that works
18:27TimMcI wonder if <audio> tags take the data: URI...
18:27technomancysamaaron: any chance it could run on Heroku? =)
18:27samaarontechnomancy: now that's a tempting question...
18:28samaaronso Overtone works on linux
18:28technomancybut you need system-level packages installed, right?
18:29samaaronbut 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:29samaaronso the way it works right now (on linux) is that we either require a separate install of SuperCollider
18:29samaaronor we use our own pre-compiled version which requires jack
18:29technomancyif you were outputting to an HTTP stream would you still need jack?
18:30samaaronthe pre-compiled version ships in a jar and is dynamically launched by copying it to a tmp dir
18:30samaaroni don't think the current binary will boot without jack
18:30samaaronbut it might be possible to re-compile a new binary without those requirements
18:30technomancybut it's not technically required for non-hardware output?
18:30technomancyinteresting
18:31samaaronit just depends on whether you can compile SC
18:31samaaronbut one of my plans is to have an online instance where people can collaboratively jam
18:31technomancyyou can compile pretty much anything on heroku if you're willing to hunt down dev headers yourself.
18:31samaaronit's the only way I can perceive of making any money in order to allow me to continue hacking Overtone full time
18:32technomancyI'm chatting through a ZNC instance on heroku, which is a C++ program that gets compiled when I do git push.
18:32technomancyah; now that's an interesting angle
18:32Raynestechnomancy: Whoa.
18:32Raynestechnomancy: You've got teach me that.
18:33spike`is there a recommended way of getting swank/emacs setup?
18:33hiredman~swank
18:33technomancyRaynes: unfortunately it requires access to the TCP router, which is a private alpha feature right now. =(
18:33clojurebotswank is try the readme. seriously.
18:33technomancybut I'm bugging them to open it up for wider beta testing because it's awesome
18:33samaarontechnomancy: but getting this working on heroku would be insanely cool
18:33TimMcspike`: technomancy's starter kit
18:33TimMcspike`: Depends on whether you already have a highly-customized Emacs.
18:34spike`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:35samaaronspike`: you might also take a look at the overtone emacs config: https://github.com/overtone/live-coding-emacs/
18:35samaaronfor ideas on how to pimp up emacs
18:35technomancyspike`: tl;dr: install clojure-mode and leiningen, then do M-x clojure-jack-in inside a project.
18:35spike`here's what I've got: https://gist.github.com/1503817
18:35technomancythe swank-clojure readme should provide details
18:36spike`okay, thank you
18:36samaarontechnomancy: if we were able to get the overtone stack running on heroku, how would it handle crashes?
18:37samaaronit's pretty easy to crash SC
18:37technomancysamaaron: it would attempt a restart, but if it repeatedly crashed on boot it would fall back to "crashed" status.
18:37samaaronah, it wouldnt' crash on boot - only when the user futzes with it
18:38technomancyyou might have issues routing across multiple dynos if you're relying on in-process statefulness though
18:38samaarontechnomancy: what do you mean?
18:38samaaroncan we not persist state to a shared disk?
18:39technomancythere's really no scalable way to implement shared disks on EC2
18:39technomancyso you need to offload shared state into a database; usually postgres or redis or something
18:39amalloytechnomancy, samaaron: shared db?
18:40samaaronoh, that's no issue
18:40technomancybut presumably overtone also depends upon in-memory function definitions, right?
18:40technomancyso if each request got load balanced to a different instance, you'd lose stuff
18:40samaaronoh yeah, that couldn't happen
18:41samaaronone instance would have to represent one session
18:41amalloytechnomancy: it's hard to tell from heroku's website: is the "one free dyno" per app, or per account, or what?
18:41technomancyamalloy: that'd be per account
18:41samaaronOvertone users essentially hack at the REPL to create their compositions
18:42brehautsamaaron: i think you mean at the IDE
18:42samaaronbrehaut: we haven't built the IDE yet
18:42technomancyyeah, that complicates things a bit since the routing layer is designed for shared-nothing webapps
18:42samaaronwe're still stuck in the dark ages
18:43amalloyreally? 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:43samaarontechnomancy: tell blake to fix it!
18:44technomancysamaaron: hah; you know blake mizerany?
18:44amalloyand it's not as if email addresses are expensive - it's easy to work around this setup
18:44samaarontechnomancy: yup, i took him on a cycle ride to the countryside outside of Amsterdam one time
18:44technomancyamalloy: if your app has no traffic it should idle after a while; I think then it stops counting hours?
18:44technomancysamaaron: oh cool
18:44amalloymeh. if i have three apps that each get one request per hour...
18:45amalloy(or whatever, divide into appropriate timeslices)
18:45samaaronso you can tell him sam requests heroku become a music making platform ;-)
18:45samaaronhehe
18:45technomancysamaaron: 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:45simardI 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:46samaarontechnomancy: well, so there's two issues really
18:46amalloyyes. records are java classes; you import them
18:46simardoh.
18:46samaaronfirstly, there's the clojure part - we want to have the state of the JVM persist between requests
18:46samaaronand secondly there's the SC instance which stores the *real* state
18:46hiredmansc as a service
18:47samaaronOvertone mirrors a lot of that state
18:47samaaronhiredman: so that should be possible - sc just talks OSC via UDP
18:47samaaronbut the sc state would *need* to be persisted between requests
18:48samaaronin fact, sc would need to be continuously running in the background pumping out data to an icecast server or equivalent
18:48amalloyi 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:51hiredmanamalloy: write a clojure app server, deploy it to heroku, and deploy you little apps to your clojure app server
18:51samaarontechnomancy: so if SC could be made a service similar to a db or redis, then that might work
18:52technomancysamaaron: yeah, that's quite a bit more involved than deploying an app though
18:53samaaronyeah, it's starting to look that way
18:53samaaronand we're still a way off the kind of stability you'd want with that kind of service
18:53samaaronbut it's definitely an end-game
18:54samaaronspeaking of end-games, it's bedtime for me
18:54samaaroncheerio
18:56technomancylater
18:58TimMctechnomancy: I really wish heroku had a small-fee level of like $3 a month.
18:58TimMc$35/mo is quite a jump.
18:58TimMcI guess if it gets to that point I should really be monetizing my site. :-P
19:06TimMcI guess I'm spoiled by pay-for-what-you-use mostly-static hosting.
19:07mrb_bkdoes anyone here use vim with clojure?
19:07mrb_bki'm having a hard time getting syntax highlighting to work
19:08mrb_bkit recognizes that clojure is one of the options for setf
19:08mrb_bkbut when i choose it, the colors don't change
19:09mrb_bkand my other file types all work
19:27TimMcWhen I try to compile CLJS "(def x 1)" using cljs.compiler/analyze and cljs.compiler/emits I get back ".x = 1" -- wtf?
19:34jodarohmm
19:35jodaroif i have a multimethod that dispatches on the class of an argument
19:35jodaroand it needs to handle PersistentList and PersistentVector
19:35jodarois there something upstream of those to avoid handling each separately?
19:35jodaroif they are handled the same way, of course
19:36TimMcI *think* you actually declare the multi to handle ICollection or whatever.
19:36jodarook
19:37jodaroi'll try that out
19:37TimMcAnd if there's not a common interface, you use derive and a ::keyword.
19:38jodaroheh
19:38jodaroits cool, i do that all the time
19:38jodaroi feel like i saw the right way to do this somewhere
19:38jodaroon the interwebs or in a book
19:38jodaroand of course
19:38jodaronow i can't find it
19:39jodarocould be that i need something smarter than just class as the dispatch
19:39jodarobut i do need to handle String and a java class
19:40technomancyyou could use clojure.data/equality-partition
19:40jodaroImplementation detail. Subject to change.
19:40jodaro
19:40jodaroheh
19:40technomancyyeah =\
19:41jodarowell worst case is i repeat some code i guess
19:42jodaroits only a few lines at this point
19:42jodaroactually
19:42jodaroeach 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:46TimMcjodaro: Yeah, you can use derive to establish a hierarchy.
19:47TimMchttps://gist.github.com/1503998
19:49jodaroahh right
19:49jodarocool, thanks
19:50TimMcNow, the exact semantics of when Clojure uses the hierarchy... I don't know.
19:50TimMcMaybe just when the dispatch values are keywords or classes.
19:51jodaroi just figured out how to handle a byte array as well
19:52jodarohave to use (Class/forName "[B")
19:52TimMcin the derive statement?
19:52jodarowell
19:52jodaroin the defmethod statement
19:53jodarofor now
19:53TimMcjodaro: "The first test of isa? is ="
19:53TimMcWell, there we go.
19:54TimMc,(isa? String Object)
19:54clojurebottrue
19:54TimMc,(isa? "hi" "hi")
19:54clojurebottrue
19:55ttaxusAnybody 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:58jodaroi'm pretty close to just registering clojuredogs.org and having it redirect to clojuredocs.org
19:58tscheiblawesome.. I really managed to get around all Clojurescript problems I had today :)
19:58jodarofor some reason i almost always type the former first
20:03technomancythe keys are right next to each other
20:03technomancy(in dvorak)
20:03technomancysame with http://guthub.com
20:41accelhow do I cast a Graphics to a Graphics2D in clojure?
20:41hiredmanwhat makes you think you need to cast?
20:42jlihum. does contains? with a list always return false? seems like it.
20:42hiredmanand why do you think the object you have, that you say is of type Graphics, is also of type Graphics2D?
20:42accelhiredman: I'm converting a piece of Java code to Clojure
20:42hiredmanjli: please read the doc string for contains?
20:43accelthere is a line ther that says: Graphics 2D g2 = (Graphics2D) g;
20:43accelthis is a fairly good indication taht (1) it contains a Graphics2D object and (2) needs to be cast.
20:43hiredmannot in a dynamic language
20:43ttaxus@jli had the same problem with contains? as well. It doesn't do what you think
20:44ttaxus@jli Basically, you need to use filter to find things
20:44duck1123clojurebot: contains?
20:44clojurebotcontains? 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:44ttaxusor you can use the java, but that's cheating, isn't it?
20:45hiredmanttaxus: this is not twitter, please don't prefix nicks with @
20:45ttaxusWhat is the convention for replying?
20:45TimMcttaxus: Look around you.
20:45TimMc:-)
20:45duck1123ttaxus: don't be afraid to use java interop if it's the best solution to your problem. It's not cheating at all
20:45hiredmanttaxus: like I just did
20:48gfredericksis there an official version of clojurescript in clojars or somewhere?
20:48TimMcgfredericks: Nope, and probably not for a while.
20:49TimMcWell, no, there's a recent "release" branch, but I'm not sure what the timeline is.
20:49dnolengfredericks: if there is an official version it'll be accessible via maven.
20:50TimMcdnolen: You're one of the major devs on that, right?
20:50dnolenTimMc: I don't think it's that far off.
20:50TimMcCool.
20:50dnolenTimMc: major devs meaning I peruse tickets and fix bugs, sure.
20:50gfredericksI'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:51TimMcdnolen: Do you know if using the cljs.compiler functions (instead of calling from script) is going to be "supported"?
20:51dnolenTimMc: what do you mean?
20:51gfrederickspublic API versus private/unstable
20:52TimMcdnolen: 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:53TimMcI 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:53jliI 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:53TimMcdnolen: Basically, I want to know whether to keep banging at it or wait for a release. :-P
20:54dnolenTimMc: I don't expect the compiler to change that much, but it is alpha software...
20:55dnolenTimMc: 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:56dnolenjli: I could be wrong but I don't think JS switch is like Clojure case.
20:56TimMcI haven't dug into that REPL enough to figure out if it can be adapted without server sessions.
20:56dnolenTimMc: what do you mean by server sessions?
20:57jlidnolen: hmm? in what sense? do you think it's linear, and no faster than cond?
20:57dnolenjli: yes I don't think JS makes any guarantees about constant time dispatch
20:57TimMcdnolen: 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:58TimMcI'll continue poking around in the REPL stuff, of course -- I just don't have a full picture yet.
20:58jlidnolen: oh, huh. cond it is, then
21:00dnolenjli: if case can't be done, I don't really see a reason for it to exist - but that's just my opinion.
21:03spike2251hey 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:04dnolenTimMc: that approach seems like more work - the client browser itself will need a REPL
21:04TimMcdnolen: Oh, I already have that.
21:04TimMcThat was the easy part -- I just forked tryclj.com
21:04TimMcwell, rplevy did :-)
21:04brehauttimmc: are you enliving it?
21:05TimMcbrehaut: Haha, no -- I'm going to make work.
21:05brehautlol
21:05brehautthats helpful
21:05gtrak```dnolen, what env would you recommend for playing around while studying 'Reasoned Schemer'?
21:05dnolenTimMc: but tryclj.com isn't really a proper REPL right? printing of Clojure objects actually happens on the server.
21:05TimMcdnolen: Right, there's a time-limited sandbox on the server.
21:06TimMcdnolen: 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:07dnolenTimMc: 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:08TimMcDoesn't CLJS have pr-str?
21:08dnolengtrak```: core.logic is good, but any competent Scheme + minikanren.scm is great as well.
21:08gtrak```ah ok, I want to learn core.logic anyway, it's not too much at once?
21:08dnolenTimMc: it does, so like I said, probably not that big of a deal.
21:09TimMcI'll just wrap the expression in a (pr-str (do ...)) or something.
21:10dnolengtrak```: the differences are minor, tho if you want to the book, Scheme is nice.
21:10dnolenwant to stick to the book I mean.
21:12TimMcOK, thanks for the chat. G'night.
21:14gfredericksis there any documentation/discussion anywhere about numerics in cljs?
21:15dnolengfredericks: not really. but I don't really see how much cljs can offer over JS numerics.
21:16gfredericksdnolen: so integers/bigints/ratios/etc would always be foreign types?
21:17dnolengfredericks: bigints/ratios/complex etc would be cool. Not so sure about integers - anything there will just slow things down.
21:19gfredericksdnolen: I'm curious about your comment on http://dev.clojure.org/jira/browse/CLJS-13 -- why can't integers be detected?
21:22brehautgfredericks: the browser is free to change the physical type backing any Number (or primative number) at runtime.
21:22dnolengfredericks: look at the implementation of integer? in CLJS, suffers from floating point underflow
21:23gfredericksI guess there'd be ambiguity at the upper range of integer precision as well :/
21:23gfredericksat some point (= x (inc x))
21:25gfredericksnot even clear if you want (integer? x) to be true at that point
21:25duck1123has 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:25dnolengfredericks: it needs some thought, but not something I'm thinking about too much.
21:26dnolengfredericks: I implemented inlining arithmetic, but of course that means string concatenation given the wrong input.
21:26gfredericksdnolen: I tend to care about numerics more than is typical. It's probably a weakness.
21:26dnolenmight be interesting to support some notion of unchecked ops, and checked ops … but again not something I've thought about much.
21:27gfredericksI was interested in implementing ratios, assuming the design was all figured out, but sounds like it's not
21:28dnolengfredericks: what's missing for you to implement ratios?
21:28gfredericksdnolen: oh just what we've been discussing. should they be implemented with primitives or goog ints?
21:28dnolengfredericks: it'd be cool for someone to lead the CLJS numerics discussion … hint hint
21:29dnolengfredericks: so much bad JS crap has been purged from CLJS, would be nice to have a similarly good story for numerics.
21:30gfredericksI'm definitely interested in it; apparently I'm a bit lacking in browser under-the-hood numerics
21:31gfredericksI think there's some new stuff with integers and such? My traditional assumption is all doubles all the time
21:31dnolengfredericks: I don't you can make many assumptions about the presence of integer any time soon.
21:31brehautgfredericks: 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:32gfredericksdnolen: can you pretend there are no ints? brehaut's comment just there sounds like you could
21:32dnolenhttp://stackoverflow.com/questions/307179/what-is-javascripts-max-int-whats-the-highest-integer-value-a-number-can-go-t
21:32dnolenlots of weird stuff to watch for
21:32dnolenlike bit operations - 32bit ints
21:33brehautgfredericks: relatedly https://developer.mozilla.org/en/JavaScript_typed_arrays
21:36gfrederickshmm
21:37brehautgfredericks: aside from division, i think the most common routes to floats/doubles are probably any op with Infinity or NaN as arguments
21:38accelthis 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:38brehaut(use :reload 'namespace.foo)
21:38brehautdont know if it applies to jars though
21:38acceli need to reload the jars
21:39acceli.e. I modify some java code; I don't want to restart my repl.
21:39dnolengfredericks: 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:39gfredericksdnolen: okay, so the opinion is that the core arith ops should definitely _not_ be polymorphic?
21:39gfredericksfor performance?
21:40dnolengfredericks: not unless you want CLJS to be slow for common tasks.
21:40gfredericksdnolen: I do :) but I assume most don't
21:42dnolengfredericks: I think CLJS is useful for graphics / audio in the browser, I wouldn't introduce anything which impedes that.
21:42brehautgfredericks: open up an inspector and evaluate 1 + {valueOf: function () { return 2; }}
21:43gfredericksbrehaut: wow.
21:43brehauthave some cake and eat some too ;)
21:44dnolengfredericks: if multiarity fns get special cased, I think CLJS can be just as fast as JS when you want/need it.
21:44dnolenbrehaut: whoa, I did not know that
21:44dnolenbrehaut: I guess it's been that way for a long while?
21:44gfredericksbrehaut: until I can do {__PLUS__: function(a) { ...} } + {__PLUS__: ...}, I don't see how that could help _too_ much
21:45brehautdnolen: yeah. i think i first encountered it in 1.2? but i think its very old
21:46brehautgfredericks: it means your numerics can drop down to fast path code relatively painlessly
21:46dnolenbrehaut: that's slick!
21:46gfredericksbrehaut: yeah, but you couldn't use the core arith functions without making them polymorphic
21:46gfredericksso (+ 3/4 5/6) would still come out as a double
21:47brehautgfredericks: indeed. but it does make something like + and +' viable
21:47gfredericks+' would be a nice parallel to clojure's...
21:47gfrederickswell sorta
21:48gfredericksI guess it's a different purpose
21:49qbgDoes CLJS have persistent collections yet?
21:49dnolenqbg: no.
21:50qbgAnybody currently working on them?
21:51qbg(publicly, that you know of)
21:51brehautim curious, does clojurescript define its own equality operator seperate to === ?
21:51dnolenqbg: not that I'm aware of. would be interesting to pursue.
21:51qbgI may have a project to work on then :)
21:52qbgbrehaut: I would think so since === doesn't do value comparisons
21:52brehauthuh it does. thats really interesting
21:52dnolenbrehaut: CLJS uses =, which is really -equiv
21:53dnolenbrehaut: identical? uses ===
21:53brehautqbg: indeed; the lack of a value based comparison has impeded javascript collections being developed for years
21:53brehautdnolen: thanks
21:54dnolenbrehaut: having proper collections in CLJS is oh so nice.
21:54brehautdnolen: totally. its the killer feature i think ;) i havent had a chance to use cljs yet unfortunately
21:55brehauti miss real maps and sets whenever i write JS
21:55qbgPutting objects in maps too
21:55qbg(as keys)
21:55brehautqbg: _exactly_
21:55gfredericksand not having to clone things all the time
21:56qbgWho doesn't like [Object] though?
21:56brehaut[Object] is my favorite member
21:56qbgIt's my favorite key :p
21:57dnolenbrehaut: one JS insanity I fixed - (instance? js/String "foo") => true
21:57brehautto be fair, you could use toString as a hashcode replacement ;)
21:58brehautdnolen: oh nice :)
21:59qbg4 is a good hashcode replacement. It was chosen by a fair die
21:59gfredericksit's not lisp until your hashmaps are implemented with linked lists
22:00qbgDoes a balanced tree of cons cells count?
22:00gfredericksif you can pull that off with a constant hash function, sure
22:03brehautdnolen: https://gist.github.com/1504352
22:04dnolenbrehaut: yup I know about that. I think iframes are equivalent to classloaders
22:04brehautpretty much yeah
22:04gfredericksis that in the spec?
22:04brehautcan cause merry hell with type test though :S
22:04dnolengfredericks: js spec says nothing about iframes as far as I know.
22:05brehautgfredericks: implicitly i think
22:05dnolenbrehaut: when iframes were more common as communication channels I would have agreed.
22:05brehautdnolen: yeah. its much less painful now
22:06brehautalthough it can be nice if you want to make a finagled Array type without breaking everyone else's
22:06dnolenbrehaut: that's not a problem in CLJS tho.
22:06brehautindeed
22:06brehautprototypes are much better solution to that problem :)
22:07dnolenthe CLJS code I've seen is gorgeous. namespaced modification of prototypes is just too beautiful.
22:08brehautim tempted to rewrite my holiday project in cljs now :P
22:08dnolenbrehaut: 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:09brehautdnolen: the only caveats i have are a) using it from javascript and b) performance
22:09brehaut(im writing an animation library for fun)
22:09brehautif i can expose a javascript programmer friendly interface then i think i'm ok
22:10gfredericksbrehaut: I'm interested in the API capability as well
22:10dnolenbrehaut: a) might be possible. haven't thought about that enough b) I think is mostly a non-issue.
22:11dnolenbrehaut: so you're animation lib isn't based on CSS transitions / transforms ?
22:11brehautdnolen: thats phase two: compile down to those.
22:12brehautdnolen: i want to be able to write composable timelines in javascript is the first requirement
22:15dnolenbrehaut: well if you have a smaller weekend project in mind, I recommend you give CLJS a spin, we could use your input :)
22:15brehautdnolen: i'll definately keep that in mind :)
22:18jlidnolen: hum, do you think constant-ness is an essential part of case?
22:19dnolenjli: http://clojuredocs.org/clojure_core/1.2.0/clojure.core/case
22:20jliI 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:21dnolenjli: 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:21jlihm, okay then
22:23dnolenjli: but I'm also not that familiar with the Clojure implementation, perhaps it's possible to do well in JS.
22:24brehautwhy couldnt you implement it in cljs?
22:25dnolenbrehaut: jli: I wasn't saying that you couldn't. perhaps you can write so it works well, especially in the new JS engines.
22:25jliit calls "case*", and I can't find where that's defined
22:25jlioh, the java parts, maybe
22:26jlidoes defmacro not work in cljs?
22:26dnolenjli: Compiler.java 7947
22:26brehautdnolen: i would imagine so. i had great success rewriting the regexps in my clojure brush as a big monster case
22:27dnolenjli: 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:27brehautgot a huge speed up inspite of javascript regexp engines jitting the FAs to native code
22:31wolfjbin 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:31gfrederickswith-redefs
22:31wolfjbthanks
22:32dnolenjli: http://oreilly.com/server-administration/excerpts/even-faster-websites/writing-efficient-javascript.html
22:32dnolenjli: case seems worthy of pursuing in CLJS, it would be interesting to see some benchmarks.
22:35akhudekIs there a replacement for http://richhickey.github.com/clojure-contrib/ for the new contrib modules?
22:35lazybotNooooo, 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:36brehautirony
22:36akhudekor rather a replacement for that link?
22:36brehautakhudek: http://dev.clojure.org/display/doc/Clojure+Contrib
22:36akhudekyeah, that's what I've been using
22:36mbac_hahah
22:37akhudekit would be handy to have autogenerated API docs though
22:37brehautakhudek: http://clojure.github.com/
22:37brehauthas some of them
22:37akhudekah, so it does, thanks!
22:38ekoontzwow, these bots are smart..triggering off URLs like the old clojure-contrib link.
22:38ekoontz(i wasted some time trying to get the old contrib repo to work)
22:38brehauti wonder when algo.monads will get a non-snapshot release
22:41akhudekIt would probably be good to link http://clojure.github.com from somewhere prominent.
22:41akhudekmain site takes you here http://clojure.github.com/clojure/
22:42brehautdnolen: i am curious if the advice about scope chains on that oreilly link is still valid since the advent of "use strict"
22:45brehauteg (function () { eval("var x = 1"); return x; } ()) #=> 1 vs (function () { "use strict"; eval("var x = 1"); return x; } ()) #=> error
22:45wolfjbokay, 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:45dnolenjli: brehaut: https://gist.github.com/1504464
22:45dnolenvery interesting
22:46dnolentested w/ node.js 0.6.5
22:46brehautwolfjb: (with-redefs [temp …] …) ?
22:47brehautdnolen: that is very interesting
22:47jliwell. that's unfortunate.
22:47brehautdnolen: i wonder if constant if's are being compiled to the same code under the hood?
22:48gfrederickswolfjb: I would expect calling (doc with-redefs) from the repl would be more accurate
22:49wolfjbbrehaut: 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:49wolfjbgfredericks: thanks, I'll try that
22:49gfrederickswolfjb: the syntax is quite similar to let
22:49wolfjbah
22:50gfredericksand binding, and various other core clojure macros that are like that
22:50wolfjbwell, that escaped me
22:50wolfjbthanks, I'll try again :-)
22:51dnolenjli: compiling to switch is probably best, w/ arrays you would need to store expressions as functions I think.
22:52dnolenjli: a quick test shows that array w/ expressions as functions is around ~300ms so slowest by far.
22:53jlibut switch is linear, no? or, I guess it's dependent on the engine
22:53brehautdnolen: 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:53deechHaskell 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:53dnolenjli: no the oreilly made it seems like few switch implementations are linear - though there's no guarantee of course.
22:53dnolenoreilly link.
22:54wolfjbok, 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:54gfrederickswolfjb: use (constantly true) instead of true
22:54jlidnolen: but for your node test, it was linear, right?
22:54gfredericksyou have to redef it with a function
22:55dnolenjli: no if slowest at 200ms, switch was ~130-40ms, and arrays w/ fns in them ~300ms
22:55wolfjbah
22:56wolfjbthanks gfredericks
22:56dnolenjli: oops sorry, looking at the wrong thing!
22:56dnolenjli: ifs and switches are the same.
22:57akhudekdeech: wouldn't primitive lists still not be garanteed to be mutable?
22:58deechakhudek: Yes, any data structures not provided by FSET are mutable.
22:59jlidnolen: okay, whew, I was confused :)
22:59deechakhudek: Just wondering what benefits of FP in Clojure I miss if I stick to that library.
23:01akhudekdeech: 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:01akhudekdeech: also, jvm integration if that matters at all to you, or maybe it's a negative to you
23:01akhudekdeech: it would be an interesting exercise to see how close you could get with basic lisp libraries
23:02deechakhudek: 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:04dnolenjli: 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:07jlihm, okay
23:07qbgdeech: I guess it comes down to if you want to use a language that is built around immutable values or not.
23:08qbgI wouldn't be surprised if Clojure was more performant though.
23:08akhudekdeech: 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:08qbgI think error-kit provided the restart style system to Clojure
23:09deechqbg: Yes, my primary (non-day-job) language is Haskell. I am very aware of the benefits of immutability.
23:10qbgCL isn't a bad language, so if it makes more sense for what want, use it
23:11qbgI very rarely wish I was using CL when I'm doing Clojure though
23:11deechqbg: Not even the debugging environment? conditions, restarts and what not?
23:12qbgMight be because I never really did use them that much in CL
23:14deechThanks for your input!
23:14dnolendeech: 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:14qbgThe repl is a good enough debugging environment for how I debug
23:14qbg(which isn't to say how I debug is the best)
23:15ibdknoxdnolen: I'm working on faster versions of map and do-seq for cljs collections
23:15dnolenibdknox: sweet!
23:16deechdnolen: Yup, immutability is a huge plus and having one way of dealing with collections is great.
23:16ibdknoxdnolen: it's kinda meh, because it reaches down into the internals.. buuuut they'll be fast.
23:18dnolendeech: also the immutable data structures go hand in hand w/ the concurrency primitives - so it's all of a piece / design.
23:22wolfjbwhen 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:24qbgwolfjb: Sounds like the input stream is not being directed to the right process
23:24qbgI don't know enough about the internals of lein run to know for sure though
23:25wolfjbinteresting
23:26wolfjbunfortunately, about all I know about lein is how to spell it... sorta :-)
23:26wolfjbstill learning though
23:26qbgOr 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:29wolfjbso, 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:30wolfjbs,.myjar.jar,./myjar.jar/
23:30ibdknoxwolfjb: try lein trampoline
23:31wolfjbok
23:31wolfjbsorry, what is that?
23:31qbgeval-in-project's docstring says "Executes form in an isolated classloader with the classpath and compile path
23:31qbgset correctly for the project. [...]". That makes me suspect it may be a redirected input stream issue.
23:32ibdknoxI believe trampoline was actually added just for this type of issue actually
23:32ibdknoxwow
23:32qbglein help trampoline
23:32ibdknoxfail
23:32ibdknoxtoo many actually's
23:33wolfjbah, and there in the doc it specifically targets stdin issue
23:33wolfjbcool
23:36wolfjbsaweet!
23:36wolfjblein trampoline run ... goodness!
23:51akhudekhuh, is this expected to work? (case '(:a :a) '(:b :a) 1 '(:a :a) 2)
23:51akhudekit works in 1.2
23:51akhudekbut in 1.3 IllegalArgumentException Duplicate case test constant: quote clojure.core/case/assoc-test--4734 (core.clj:5939)
23:54ibdknox,(case [:a :a] [:b :a] 1 [:a :a] 2)
23:54akhudekthe vector version works
23:54clojurebot2
23:55akhudekah, I see that the vector version also matches if you give it a seq as input