#clojure logs

2012-06-03

00:03mthvedtparsley looks neat
00:15antares_KirinDave: FYI, I am migrating gantry to clojure 1.4
00:15mthvedti'd rather use a clojure-ish parser than have to do something in antlr
00:16gf3I wonder if you could use TreeTop from JRuby
00:17KirinDaveantares_: Oh cool. Is there really much to do for that?
00:17antares_KirinDave: it's a small codebase but they use stuff from like 1.1 days and libraries that are no longer maintained
00:17antares_we will see
00:17antares_I want a tool like that and don't use Clojure 1.2 for anything
00:25KirinDaveantares_: Already forked it?
00:26antares_KirinDave: not yet, working in a local branch
00:26antares_KirinDave: I can stash and push if you want me to
00:26KirinDaveantares_: That'd be cool. Pardon me, just got paged to deal with site issues.
00:27antares_looks like it may take a few hours to finish, there's a lot of weird stuff from clojure.contrib.condition being used
00:27antares_KirinDave: no problem
00:31KirinDaveMan I have got to destroy this janky ruby system. :\
00:31KirinDavehah, wrong window.
00:31KirinDavebut there we are. True story.
00:34fil512is there a way to turn (1 2 3) into 1 2 3?
00:34fil512or [1 2 3] into 1 2 3
00:34RaynesIn what context?
00:35RaynesThat doesn't make sense except for in one context: passing them as individual arguments to some function.
00:35fil512yes
00:35Raynes&(apply println [1 2 3 4])
00:35fil512exactly
00:35lazybot⇒ 1 2 3 4 nil
00:35Raynesapply! :D
00:35fil512hmmm
00:36KirinDavei was just trying to use palette.
00:36fil512I'm on 4clojure
00:36KirinDaveCan't ein plugin install pallet/lein-template 0.2.1
00:36KirinDaveCan anyone else.
00:36fil512trying to write the equivalent of flatten...
00:40antares_KirinDave: it works with lein2 for me
00:41KirinDaveShould I be using lein2?
00:41antares_KirinDave: by the way, I pushed my fork of gantry. It will take a day or so of work to port it but if you are interested, here it is: https://github.com/michaelklishin/gantry
00:41antares_so far I have tests finally passing on OS X
00:42antares_digging in getting rid of clojure.contrib dependencies
00:42Raynesantares_: No it doesn't.
00:42Raynesantares_: You can't 'plugin install' something in lein2. :p
00:42antares_Raynes: I did not plugin install it
00:42antares_I added it to my :user profile
00:42antares_and ran lein2 version, lein downloaded it just fine
00:42Raynesantares_: I know, but you implied you 'plugin install'ed it which might have confused KirinDave.
00:42RaynesYou should really be ashamed of yourself.
00:43antares_Raynes: fair enough
00:43RaynesKirinDave: If you're using the latest version of lein-newnew, you should just be able to do `lein new pallet ..`
00:43RaynesIt automagically downloads and installifies the template for you.
00:43KirinDaveRaynes: Could not find template pallet on the classpath.
00:44RaynesWhat version of lein-nenwew?
00:44Raynesnewnew, even
00:44KirinDave0.2.6 was listed on pallet
00:45antares_I think the most recent release is 0.2.8 or so
00:45antares_and I remember there were small features and bug fixes in 0.2.7 alone
00:46KirinDaveWell this is bad.
00:46KirinDaveLein's plugins seem to be broken now.
00:57rplevyis interactive mode replaced by something else in lein 2?
01:00Miko2I have a trie represented as a map { \a { \b { \c { ... } } } }. What would be the easiest way to add "d" from "abcd" to the nested \c's map?
01:01mthvedtupdate-in?
01:02antares_Miko2: update-in, get-in?
01:03tomojof course, but still surprising ##(assoc-in {} "foo" 3)
01:03lazybot⇒ {\f {\o {\o 3}}}
01:03Miko2Woah, too easy to be true. Thanks. :)
01:06rplevycurious if lein interactive is not yet implemented, or if it has been removed in lein 2
01:09xeqirplevy: I havne't heard of any plans to convert it
01:10rplevyis there some way to get a similar experience, or to run lein commands from the repl perhaps?
01:13xeqiI think the plan originally was to replace it with jark, but I haven't heard anything about it recently
01:14rplevythat sounds like a good idea
01:38_KY_what is the function [1 2 3 4] -> [[1] [1 2] [1 2 3] [1 2 3 4]]?
01:39ivan$fn [1 2 3 4] [[1] [1 2] [1 2 3] [1 2 3 4]]
01:39_KY_Nevermind... I can get around it...
01:39ivan$findfn [1 2 3 4] [[1] [1 2] [1 2 3] [1 2 3 4]]
01:39lazybot[]
01:40_KY_It's just a simple (take n [...])
01:41rplevyI've never used jark before, but I just tried running the jark lein plugin and it output a null pointer exception. This is in a lein 2 project.
02:11splunkanybody know if there's an idiomatic parameter name for passing in a seq into a fn?
02:12splunke.g.
02:12splunk(fn [seq] (first seq))
02:12splunkexcept not calling it seq?
02:20duncanmsplunk: well, for that case, you can just pass 'first' directly
02:20duncanmsplunk: you can call it a-seq, or something like that
02:21splunkright, the first was just an example.
02:22splunkduncanm: cool, will use a-seq. Thanks!
02:31craftybonesHello
02:32splunkahoy!
02:32craftybonesI'm having a bit of trouble getting leiningen setup
02:33craftyboneshttps://gist.github.com/4a5169984336d1701bb3
02:38splunkare you installing on osx ?
02:38splunkhave you seen this post?
02:38splunkhttp://comments.gmane.org/gmane.comp.java.clojure.leiningen/162
02:39craftybonesThanks splunk
02:40borkdudeyou could also try the fresh preview6 of leiningen 2 that got released two hours ago :)
02:41craftybonesLol. Will do. I am starting fresh on clojure
02:41craftybonesMan, Limechat absolutely rocks
02:42craftybonesInteresting. For some vague reason the lein script didn't download the jars properly. I moved my .ssh to a diff dir and tried again, and this worked.
02:42borkdudecraftybones is it better than textual? I like that one also
02:47eraadhi
02:47splunkahoy
02:52craftybonesborkdude: Yeah, it has some cool stuff like, if you paste into the window, it puts it into a gist for you and pastes the link
02:53borkdudecraftybones that sounds very convenient
02:53craftybonesborkdude: Thanks for your help
02:53craftybonessplunk: you too
02:53splunknp
02:57borkdude_ok, I'm now in Limechat
02:58borkdude_,(+ 1 2 3)
02:59clojurebot6
02:59borkdude_craftybones: when does it paste smth btw?
03:02craftybonesborkdude: If you ctrl-v or cmd-v that is
03:03borkdude_{:user {:plugins []}}
03:03borkdude_craftybones: beyond a certain length?
03:03craftybonesborkdude: Yeah, or perhaps if there are \n in the paste
03:04borkdude_https://gist.github.com/da2c822bcf20a81cb103
03:04borkdude_ah great
03:05borkdude_craftybones: what is the use of that bottom window
03:05craftybonesborkdude: Messages from other channels you've joined in
03:08borkdudecraftybones If you're a fan of japanese software… I can recommend the Yorufukurou twitter client as well
03:09craftybonesborkdude: thanks, I'll try that out. I am not a specific fan of Japanese software or anything, though I admit, I do love Ruby :)
03:09borkdudecraftybones me neither, but I happen to like that twitter client ;)
03:11borkdudecraftybones I don't like that bottom window though, can I get rid of it? ;)
03:13craftybonesYes you can
03:16craftybonesborkdude: just resize it out and you'll be fine
03:18borkdudejust testing what happens...
03:18borkdude(def defaults {:source-paths ["src"]
03:18borkdude :resource-paths ["resources"]
03:18borkdude :test-paths ["test"]
03:18borkdude :native-path "target/native"
03:18borkdudeok… maybe I can find a textual plugin that does the same as limechat
03:47amalloysplunk: i don't really like a-seq. popular names include coll and xs
04:18borkdudecraftybones haha I see your msg on twitter… the rest of the day barely interesting… these people don't read twitter?
04:19craftybonesborkdude: Oh, they're very good friends. They obviously read.
04:20borkdudecraftybones you didn't mean the wedding itself then? I guess it's a bit ambiguous ;)
04:20craftybonesborkdude: Yes. The wedding itself wasn't. They had a large history leading up to the wedding, so it was finally amazing that it did happen
04:26craftybonesSo I run a lein plugin install swank-clojure-1.3.4 and it doesn't really seem to have done anything
04:29craftybonesAh never mind.
04:29craftybonesSpace for the version
04:29borkdudecraftybones 1.4.2 seems to be the newest
04:31craftybonesborkdude: Yeah I got 1.4.2, but now a clojure jack in isn't working from emacs
04:31craftybonesborkdude: tells me project.clj is missing
04:32borkdudecraftybones you must visit a file within tyour project in emacs
04:32borkdudecraftybones only then it knows which project to start the swank server for
04:33craftybonesborkdude: Ah, so I can't essentially use it without using a lein-ed project
04:33borkdudecraftybones right
04:35sdevijverwhat's the difference between :dependencies and :dev-dependencies in lein?
04:35borkdudecraftybones what I do if I just want a repl to play with, I make a project for that situation
04:36borkdudecraftybones so just somewhere: lein new foo, and then visit a file in that project
04:36craftybonesborkdude: Ok. Thanks. So inferior-lisp is slightly easier to do this then?
04:36borkdudecraftybones I think so
04:37aperiodicsdevijver: :dev-dependencies are non-transitive (projects that use yours won't use its dev-dependencies)
04:37aperiodicsdevijver: they're also on the classpath for plugins
04:39aperiodicsdevijver: typically, dev-dependencies are development tools, hence the name
04:40borkdudeaperiodic I guess they aren't included when uberjarring as well?
04:41aperiodicborkdude: correct
04:42aperiodicsdevijver: they're going away in lein2, though
04:42aperiodicsdevijver: instead, use profiles to accomplish the same thing
04:43aperiodicsdevijver: also profiles have other benefits besides, but i haven't really used lein2 much
04:44sdevijveraperiodic, I'm trying to get lazytest working with midje on lein 2, I already had a suspicion :dev-dependencies were ignored :)
04:45craftybonesDummy question. So a clojure-jack-in complains about a missing lein. Where is this complaint coming from and where do I tell it that it needs to look for lein somewhere specific?
04:46borkdudecraftybones missing lein?
04:46craftyboneslein not found
04:46borkdudecraftybones did you put it on PATH?
04:46craftybonesborkdude: Yeah
04:46craftybonesI think I know why
04:47craftybonesI think I might have to add lein to my project.clj
04:48aperiodicthat sounds fishy to me; PATH issues seem like the more likely culprit
04:50borkdudeI never had to set the path for leiningen in emacs
04:50craftybonesGot it working. It was in path, but I hadn't sourced it in that window :D
04:50aperiodici don't know anything about emacs, though, it's just that specifying lein in the project.clj seems... redundant
04:50aperiodicheh
04:51craftybonesSweet. Yeah it works without that
04:52borkdude404 users…
04:52borkdudenot found...
04:53borkdudeco-incidental combination ;)
04:55borkdudecraftybones I think you're better of switching to lein2 anyway
04:55craftybonesborkdude: Alright :)
04:55aperiodiccheck out lein-precate
04:57borkdudeor just make a file called profiles.clj in ~/.lein with {:user {:plugins [[lein-swank "1.4.4"]]}}
04:57borkdudelein swank / clojure-jack-in will work
04:57borkdudewithout installing anything
04:57borkdude(manually that is)
06:12almostobsoleteHello, I'm very new to Clojure and having some issues with lein
06:13almostobsoleteWhen running "lein deps" on a project based on the compojure quickstart I get the following:
06:13almostobsolete
06:13almostobsolete[INFO] Unable to find resource 'org.clojure:clojure:jar:1.2.0-RC1' in repository clojars (http://clojars.org/repo/)
06:14almostobsoleteFull error trace: https://gist.github.com/2862895
06:14almostobsoleteAny ideas what I might be doing wrong?
06:18ejacksonalmostobsolete: using a WAY to old clojure :)
06:18ejacksonstable is currently 1.4
06:18ejacksonuse this one: [org.clojure/clojure "1.4.0"]
06:19ejacksonin your project.clj
06:19almostobsoleteThanks! Trying it now...
06:19ejacksonRaynes: past midnight and you turn into a cat ?
06:20almostobsoleteI'm still getting a similar error:
06:20almostobsolete[INFO] Unable to find resource 'org.clojure:clojure-contrib:pom:1.4.0' in repository central (http://repo1.maven.org/maven2)
06:20ejacksonalmostobsolete: OK, its not going to find it in maven central
06:21hiredmanalmostobsolete: there is no contrib 1.4.0
06:21hiredmanalmostobsolete: contrib after 1.2 doesn't exist as a single package
06:21ejacksonoh yeah, that too :)
06:21almostobsoleteOh, ok, so I don't need to have that dep at all?
06:22ejacksonit gets annoying, if the template called for it, then compojure might be wanting it, but the whole thing is woefully out of date
06:22almostobsoleteSeems to have worked!
06:22ejacksonwill the repl will start, but will compojure route ?
06:22ejacksonor compoje, or whatever
06:24almostobsoleteSuccess! Is displaying in browser :)
06:24ejacksonwell, we have a winner :)
06:25almostobsoleteHmmm, and looking at the quick start it doesn't match the project.clj, I must have got that from another example. Cut and paste coding strikes again! ;)
06:27almostobsoleteWhere's a good place to search for clojure libraries?
06:32ejacksontry: http://clojuresphere.herokuapp.com/
06:32ejacksonor: http://clojure-libraries.appspot.com/
06:32ejacksonwhich I just nicked from: http://dev.clojure.org/display/doc/Getting+Started
06:33almostobsoleteThansk!
06:35ejacksonI also like http://www.clojure-toolbox.com/
06:38antares_almostobsolete: http://clojurewerkz.org
06:39antares_speaking of libraries, I have announced Neocons RC1 earlier today on the mailing list but not here :) http://clojureneo4j.info/
06:40zomgI guess clojure oriented libs would be more suited into the style of the language vs. libs developed with standard Java in mind?
06:40ejacksonneocons ! lol
06:40antares_zomg: what a "libs developed with standard Java in mind"?
06:40antares_*are
06:40zomgwell I mean any Java libs I guess :)
06:40antares_Clojure was created to be hosted and interoperate and reuse existing infrastructure
06:41zomgI know but the style of code is quite different in Clojure than in Java
06:41antares_there is nothing wrong with having DSLish layers on top of Java libs and using Java libs
06:41antares_certainly, I don't think anyone has tried to develop clojure libraries that look like Java libraries
06:42antares_sometimes you need to implement a few interfaces to extend a Java library, people do it in clojure, too
06:42zomgYeah was just wondering about the point for clojure-oriented libs, since afterall java libs work in clojure
06:42antares_zomg: ease of use, better geared towards functional programming techniques
06:42zomgYeah pretty much as I thought then :)
06:42antares_zomg: take a look at clojurewerkz.org projects, many of them have Java libraries underneath but expose much more concise API
06:43antares_also, you use Clojure data structures instead of instantiating lots of lib-specific objects
06:43antares_but I guess that falls into the "ease of use" category
06:44openedI am reading "clojure programming" and on the definition of show-info on page 395, a static method is used on the when-let macro which expectedly results to the method not being found.
06:44openedIs that an errata or am I doing something wrong?
06:45antares_opened: do you have a print book?
06:45antares_in my PDF on page 394 it looks fine
06:46openedantares_: nope
06:46antares_show-info is a no-op (or some code is missing?) and it is invoked from a Java listener callback
06:47openedantares_: In page 395 rather
06:47antares_ah
06:48openedhere: http://pastebin.com/TGpQ3fEF
06:48antares_(when-let [selected-fn (.getSelectedValue fn-names)]
06:48antares_this is what I have in when-let
06:49openedtry macroexpand on the when-let, it truncates the "JOptionPane" and just leaves "showMessageDialog"
06:50antares_opened: I see
06:50antares_opened: http://shop.oreilly.com/product/0636920013754.do
06:51antares_opened: one of the pages suggest going to this URL for errata
06:51openedWait... So it is an errata then?
06:51antares_opened: feel free to post on the clojure ML, all authors are there and will be happy to answer your questions
06:51antares_I am not sure, looking
06:51antares_http://oreilly.com/catalog/errata.csp?isbn=0636920013754
06:54twhumeI'm using map to apply a function to a sequence; in this function I'd like to know what position I'm at in the sequence (so that I can allocate a unique incrementing ID to members of the resulting sequence). What's the most idiomatic way to do this?
06:55ejacksontwhume: you could reduce over the seq, passing the counter along
06:57twhumeejackson: thanks (I'm a clojure noob btw, if you hadn't noticed). Is that the standard way to do this kinda thing in Clojure, or one of many possible paths?
06:57twhumeI'm trying to learn idiom as well as getting the thing working...
06:57raektwhume: do you need the results from the function calls?
06:57twhumeraek: yes.
06:57raektwhume: then you can't use map nor reduce
06:57twhumeThe function calls are producing maps I will later need. I would like each map to be numbered sequentially.
06:58raekone way is to roll your own loop
06:58PeregrinePDXmap-indexed?
06:58woollyamsAnother noob question: is there a Clojure equivalent of Haskell's "tails"? http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-List.html#v:tails
06:58ejacksonor just bind the numbers in before you start
06:58raek(since your usage does not fit the pattern map and reduce factors out)
06:59raekanother way is to use state, which is slightly more unideomatic
06:59twhumeraek: yep, coming from a Java background my instinct was to set an atom, but I need that to be beaten out of me. map-indexed looks interesting tho.
06:59PeregrinePDXWhat's wrong with using map indexed.. It seems to be exactly what he is asking for. KNowing what position he is in the sequence while he's using map.
06:59PeregrinePDXerr map-indexed even
07:00openedraek: using state is a bit of an overkill
07:00openedhow about mapping the function to the sequence first, then zipmap the resulting sequence with (iter inc 0)
07:02twhumeI have map-indexed working for me now - thank you :)
07:03ejacksonPeregrinePDX: I didn't know about mapindexed, thanks
07:04PeregrinePDXThe first thing I do when I have a library function that almost works for me but doesn't quite is in the repl I do (apropos 'function that almost works)
07:04PeregrinePDXSo (apropos 'map) and voila all the functions that have map in them.
07:06ejacksoni'd have ended up doing: https://www.refheap.com/paste/2979
07:10openedwoollyams: I don't think there is one, but here something similar: (take-while (comp not nil?) (iterate next [1 2 3 4]))
07:12woollyamsopened: Close enough. Thanks!
07:12openedwoollyams:okay
07:13twhumethanks everyone :)
07:13opened... and about the book "clojure programming". I am going to submit an errata now, unless someone disagrees.
07:13jsnikerisHi all. How do you get information about a Java class from Slime? Public members, Javadocs, etc
07:19michaelr525jsnikeris: you open an eclipse in parallel :)
07:19michaelr525though i usually search google
07:20antares_jsnikeris: REPLy has a function that opens Java docs (for JDK classes) in the browser, you just pass it an instance and it does the rest
07:21antares_jsnikeris: as for public members, REPL should have tab-completion over them (definitely for class and package names, static methods and other stuff that has important info to the left of the point)
07:21antares_I mean, any REPL, not just REPLy lein2 comes with
07:22michaelr525antares_: only starting from lein2?
07:22antares_michaelr525: REPLy can be used as a standalone tool but then you will have to figure out SLIME integration on your own
07:22antares_clojure-jack-in uses the same stuff lein repl does
07:24jsnikerisantares_: I see see what you mean about tab-completion, but what about seeing what the parameters of a method are? For example, I'm trying to instantiate a class (Blah. _) and my cursor is at '_' is there a way to easily see what the available constructors that class has?
07:25antares_jsnikeris: SLIME does it for clojure functions but not class constructors
07:25antares_probably because SLIME wasn't designed for languages that interoperate with Java :)
07:25jsnikerisantares_: ah OK
07:25jsnikeris:)
07:26jsnikerisis there better support for this kind of stuff in other editors?
07:26antares_IDEA should have what you expect from IDEA
07:27antares_the plugin is called La Clojure
07:27antares_I am not familiar with Counterclockwise (the Eclipse plugin) but I guess it is comparable
07:28jsnikerisantares_: I already use IDEA for Java development, so I'll give La Clojure a try. Thanks
07:29antares_jsnikeris: it is from JetBrains folks themselves
07:50openedoh GOD... I am such a retard D: The code in the book is just fine. I only forgot to include the title for the message dialog.
07:51openedI even sent a errata for it! Someone shoot me.
07:52openedOh well. I probably need some break from reading.
07:53gfredericks,(println "/me shoots opened")
07:53clojurebot/me shoots opened
07:53gfredericksaw man
07:54opened*dies*
07:55ejacksonopened: don't sweat it bro,
07:55ejacksonnobody will mind :)
07:56openedyeah, who would mind a garbage ;)
07:59openedI've been reading a lot these days, and I noticed my attention to detail has worsened, unlike before. Anyone else experienced this?
07:59ejacksonoh, you have finite bandwidth ?
08:01ejacksonits the implacable foe: how can you learn all topics you need in sufficient depth to use them properly ? Near to impossible.
08:04openedI guess I am overfed with information. I'll take a break tomorrow.
10:10tomojat this point if I'm writing a cljs library intended to be used from javascript (in particular node) with mori, is there something better I can do besides copying mori's source into my cljs project?
10:14dnolentomoj: planning on continuing to support mori, but would like to deal with some CLJS stuff perf stuff first.
10:14dnolentomoj: you can create a jar and put it on clojars and include it as dep until I get around to doing that myself.
10:15tomojoh, of course
10:57duck1123Is there a better function than instance? for testing the type of a record? (instance? Foo (Foo.)) is true, but (instance? Foo (map->Foo {})) is false
10:59ejacksonhow about isa? ?
11:01duck1123still false
11:02dnolenduck1123: you're env is stale, instance? should work
11:02dnolenyour
11:03dnolenduck1123: deftype and defrecord don't play well with redefinition on the JVM
11:03dnolenduck1123: you usually need to recompile the whole file when working with deftype / defrecord
11:06duck1123actually, I think you might be right. I just defined a new record type, and that one works
11:06dnolenduck1123: yep
11:07duck1123I'll take "you need to clean" over "what you'd logically expect doesn't work" anyday, thanks
11:09skoodgeIs it possible to turn the content of a variable (a function) into a symbol? Let's say I have the variable foo, which contains the clojure function +, how do I get '+ out of foo?
11:10duck1123skoodge: you should probably be assigning #'+ to foo, that way you have the full var, and you can do a bit more with it
11:13duck1123dnolen: so is the issue that I changed my record and didn't clean, or is it that I re-evaled that ns in the session?
11:14dnolenduck1123: if you change your record you need to recompile all code that refers to it.
11:15duck1123ok, I can deal with that. I probably won't be changing those record defs anymore
11:16dnolenduck1123: well host-y code like instance?
11:16duck1123just wanted to make sure I'm safe to C-c C-k my model s
11:17skoodgeduck1123: well, I would like to directly pass functions instead of quoted functions into some function. So I need some way to turn the passed function into a (unqualified) symbol. Is there any way do to that?
11:18duck1123a function doesn't know it's symbol, so if you want to get back symbols, you need to pass around vars
11:18dnolenskoodge: you can't do what you want. but #'+ is not a quoted function. it's the var.
11:18duck1123I have to do a similar thin in my code
11:20duck1123ok, after a clean compile, that test passes. on to the next
11:23skoodgeduck1123, dnolen: ok, thanks. I guess I'll keep passing quoted functions then and use resolve on that
11:27duck1123passing around symbols will be dependant on the ns declarations of when you resolve them. passing around vars will have the ns info included
11:28duck1123,(map class [+ '+ #'+])
11:28clojurebot(clojure.core$_PLUS_ clojure.lang.Symbol clojure.lang.Var)
11:30gfredericksdnolen: I've been working on the numerics the last day or two and am filling in my thoughts on confluence
11:32gfredericksokay updated confluence
11:48dnolengfredericks: might be better to outline how we could get Clojure numerics w/o much regard for how things are now - and then start thinking about how we could make it fast again per rhickey's suggestion.
11:49gfredericksdnolen: you mean mimicking jvm clojure semantics? like using longs?
11:57dnolengfredericks: longs & double, generic operators. Look at Numbers.java
11:58dnolengfredericks: has many, many tricks
12:02jsnikerisHow would one pass an import-list stored in a var to the 'import' macro?
12:03jsnikerise.g. (def an-import-list '(blah.blah.blah blee blow blum))
12:03gfredericks,(doc import)
12:03clojurebot"([& import-symbols-or-lists]); import-list => (package-symbol class-name-symbols*) For each name in class-name-symbols, adds a mapping from name to the class named by package.name to the current namespace. Use :import in the ns macro in preference to calling this directly."
12:03jsnikeris(import an-import-list)
12:03gfredericksit's not a macro
12:03gfredericks(apply import an-import-list)
12:04dreish(source import) shows a defmacro for me.
12:04dreish,import
12:04clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/import, compiling:(NO_SOURCE_PATH:0)>
12:04dreishYep. That's a macro.
12:04dreishI would think you could use eval.
12:05gfredericks,import
12:05clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/import, compiling:(NO_SOURCE_PATH:0)>
12:05dreishOr, going the other way, (import #=(eval an-import-list))
12:05gfredericksboo; doc is supposed to say it's a mocr
12:05jsnikeriswhat's that #= syntac?
12:05jsnikerissyntax
12:06dreishRead-time "eval" -- though it's not really the full eval unless you call eval.
12:06dreishMore like just apply.
12:08gfredericksdnolen: do you expect closure longs perform significantly better than clojure bigints?
12:09dnolengfredericks: no idea w/o benchmarking
12:10gfredericksokay; just curious if that's why we would use them instead of just bigints directly
12:10dnolengfredericks: from glancing at the source, seems like it would perform well.
12:10dnolengfredericks: closure long is not about bigints
12:12gfredericksif you mean that closure long is 64bit integer and closure integer is bigint, then yes I understand that
12:12gfredericksI assume we'd want to support closure-integers for bigints; i.e., that's what 42N would compile to
12:13gfredericksso if we already have bigints it's not obvious to me that it wouldn't be simpler to just compile 42 to a bigint as well, rather than a long
12:13gfredericksunless it's expected to perform better or there is a high value on mirroring jvm-clojure
12:15dnolengfredericks: I'd expect it to perform better.
12:15dnolengfredericks: making things generic isn't the challenge here.
12:16dnolenthe challenge is getting modern JS engine perf that means somehow moving sensisbly from JS numbers to Closure (or Closure-like) long to BigInts.
12:17dnolengfredericks: so outline the changes for Clojure JVM numeric semantics - and figure out the hard work of not slowing everything down.
12:17frozenlockHello gentlemen. Any advice on how I could read byte from a buffered-input-stream? I've tried (read buff...) but apparently it doesn't work if my steam isn't of type java.io.PushbackReader.
12:21gfredericksfrozenlock: isn't there an instance method for that? (.read buff)?
12:21gfredericksthe read function is for reading s-expressions
12:22frozenlockThere is, but I was getting an error. So I dismissed it..
12:22dnolengfredericks: actually might be as simple as *unchecked-math* which means we emit JS numbers and overflow on integer values that can't be represented with 53 bits.
12:23gfredericksdnolen: I was thinking another option would be a js/+
12:23gfrederickswould give you the current behavior
12:23dnolengfredericks: nope
12:24dnolengfredericks: anything that make core.cljs hard to repurpose it a non-starter, I've working to eliminate such things as much as possible.
12:24gfredericksso *unchecked-math* is a compile-time change?
12:24dnolengfredericks: same as Clojure
12:26gfredericksthat would only apply to longs though I would think
12:26dnolengfredericks: same as Clojure
12:27gfredericksmaybe I've been assuming too little about the perf needed. I thought it was all about retaining the ability to do fast double arithmetic
12:28dnolengfredericks: JS has 64 bits floats, what's there to do?
12:29gfredericksdnolen: ensure that (+ 3.0 4.0) is just as fast as it currently is
12:29gfrederickssince presumably + couldn't just be an inlined "+" anymore
12:29dnolengfredericks: sure, but that's easy, we statically can determine those are double and emit JS numbers.
12:30dnolengfredericks: why not?
12:30dnolengfredericks: simple if we have type information, otherwise generic ops as usual.
12:30gfredericksbut currently it's fast even if we don't have type information, because it still inlines the native +
12:31gfredericksthat's where I assumed the hit would be
12:32gfrederickswe'd have to emit "if(typeof x == 'number' && typeof y == 'number'){x+y}else{add(x,y)}", no?
12:35Miko2Can I put utility functions inside defrecord, or do I need to put them outside?
12:36Miko2...as "regular" functions.
12:40eckrothMiko2: it is my understanding that you have to either make them regular funcs or create a protocol
12:40eckrothMiko2: but that funcs do not go "inside" defrecord like you would in java
12:41ejacksondoes clojurescript do anything to strings passed in as arguments. In a console $("div:contains('foo')") returns the elements, but called from compiled clojurescript (js/jQuery "div:contains('foo')") does not :(
12:41Miko2Yeah. So I just put the "methods" that implement the protocol inside defrecord and do everything else with regular functions? :)
12:41ejacksonMiko2: yup.
12:56devnbrain fart: is there a not-empty?
12:57devnlike...
12:57devn,((complement empty?) "")
12:57clojurebotfalse
12:57Chousukeuse "seq"?
12:58Chousukeiirc empty? is defined as (not (seq ...)) :p
12:58devnChousuke: thanks
12:58ejacksonthere is not-empty
13:00devnejackson: that isn't a predicate though
13:00TimMcIt can be.
13:00drguildoi have a scala program with a listbuffer that stores swing progress bars that get drawn to a table. what's the "best" way to achieve the same kind of thing the clojure/functional way?
13:01ejacksonright
13:01TimMc&(map not-empty [[] [1 2 3]])
13:01lazybot⇒ (nil [1 2 3])
13:01drguildoi should have mentioned the listbuffer gets added to and removed from
13:02TimMcIt preserves type, so it is used in things like (when-let [v (not-empty ...)] ...)
13:02Chousukedrguildo: a vector/list inside an atom or something
13:04ejacksonin answer to my earlier clojurescipt question: no, clojurescript behaves like you'd expect. I got nailed by async, per usual.
13:06tomojsuppose I can provide blocking ISeq semantics in clojure, but not in clojurescript. I can provide nonblocking ISeq semantics in both, where each element is an eventual value, say through ISeqable. but providing both semantics in clojure would mean (seq? x) but (not= x (seq x)) and (not= (first x) (first (seq x)))
13:06tomojis that reasonable?
13:08TimMctomoj: first calls seq
13:09tomojnot if it's already a seq
13:09TimMchmmm
13:09TimMcThat sounds rather naughty.
13:09tomojactually
13:10tomojif I just don't use ISeqable, and instead provide a function that returns a seq of eventual values, it looks a lot less weird
13:10drguildoChousuke: thanks
13:12mheldis there a devise-like authentication framework for clojure?
13:13lynaghkmheld: https://github.com/cemerick/friend
13:15mheldgracias
13:21freiksenethi! I am having trouble connecting to lein swank server, it says 'can't find suitable coding-system'. Is there any standard solution to that? It used to be working ~6 months ago with same config
13:21freiksenetslime is latest quicklisp version, works with SBCL fine
13:27Miko2Umm, the records defined with defrecord are not available through lein repl when I (use 'xyz) them. The other functions from xyz are in the scope. :/
13:28Miko2Getting CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: Foobar, compiling:(NO_SOURCE_PATH:16)
13:32Miko2Oh, I need to import it?
13:44meiji11I've written a macro that swaps the values of two locals created in a let if those bindings satisfy some predicate. the macro is incredibly slow.. it takes about 9 seconds whereas the original code executes in about 100 ms. why might that be?
13:50meiji11ah, never mind. I see now.
15:02technomancyfreiksenet: if you're still having trouble with slime, the problem is the version you're using is too new: http://p.hagelb.org/slime-cvs-rant.txt
15:03freiksenettechnomancy: I tried clojure-jack-in and now it complains about unbalanced parens. clojure-jack-in should be using it's own slime, shouldn't it?
15:08technomancyit should, but there's no way to unload an existing slime if you've already got one loaded in a given instance
15:08technomancythe results of loading two different versions sequentially are undefined
15:10freiksenetokay, I removedthe file that loaded slime. result is the same
15:10freiksenetso it still complains about unbalanced parenthesis
15:17freiksenettechnomancy: so what's the last supported slime version? I will try to downgrade and use my previous setup
15:28scottjfreiksenet: I have good luck with 2009-10-15
15:29bbloomdnolen: Help me help you & Raph with the pluggable backend stuff :-)
15:30bbloomI've got some extra time to work on CLJS now
15:30bbloomDecoupling parse&analyze from js&emit seems like the right first step
15:31freiksenetscottj: that's quite old )
15:31scottjfreiksenet: ritz supports a more recent version, but it's from 2010 I think :)
15:32scottjThe only major new feature I've heard mentioned since then is presentations, would be curious to hear of others
15:41dnolenbbloom: heya, cool!
15:41bbloomdnolen: hey
15:42dnolenbbloom: finally getting around to doing something about your emit patches, source map work is under way.
15:42bbloom:-) who's doing more stuff on source maps?
15:42dnolenbbloom: I am! :)
15:42dnolenbbloom: http://github.com/clojure/clojurescript/tree/source-map
15:43bbloomdnolen: nice.
15:43dnolenbbloom: more than happy to get some help of course :)
15:43bbloomdnolen: heh, i have some vlq encoding code here too
15:43dnolenbbloom: http://github.com/clojure/clojurescript/compare/master...source-map
15:43dnolenbbloom: vlq stuff is done, works
15:44bbloomdnolen: great. gotta instrument emission
15:44dnolenbbloom: yes emission I think will be straightforward.
15:45bbloomdnolen: i haven't given it much thought yet, so i dunno
15:45dnolenbut we need to parse the Closure source map, merge with original line/col info and generate a real source map.
15:46bbloomdnolen: so i have several irons in the fire: 1) source maps 1B) column metadata 2) decouple parse/emit 3) vars 4) ast children
15:46bbloommaybe something else too....
15:46bbloomwhere should i start? :-P
15:48bbloomi think there's a bunch of stuff in the parse/analyze phase that can move to the emit phase and there's a bunch of stuff in the emit phase that can move into macros… for example :vector, :set, :map, etc can become macros. they simply generate function calls
15:48bbloomI'd love to trim down the compiler.clj file into analyzer.clj and compiler/js.clj + whatever core compiler stuff
15:48dnolenbbloom: source maps are big, if you want to get up to speed w/ what I've done that would be helpful.
15:49dnolenbbloom: raph_amiard is already working on that.
15:49dnolenbbloom: col metadata is really just waiting on Clojure/core approval - that may take a while.
15:50bbloomdnolen: OK. I have no idea if that patch will stay up to date with other changes. i'm still pretty new to contributing to other people's open source communities!
15:50bbloomdnolen: I read the master..sourcemaps diff — anything else to look at?
15:52dnolenbbloom: not yet, just trying to figure the best format to emit CLJS -> JS mapping info.
15:52bbloomdnolen: OK, i can help think about that… what have you got so far?
15:52dnolenbbloom: I'm thinking a map for the segment, vector of segments for the line, vector of lines
15:53dnolenbbloom: that's for the CLJS -> JS side, we need that info.
15:53dnolenbbloom: then we need to read the Closure map source-map and probably convert to the same format
15:53dnolenbbloom: merge
15:53bbloomhold on, finding the source map spec
15:53dnolenopen to other reps, just whatever is the simplest for merging.
15:54bbloomyou mean merging multiple compilation units? or merging multi-level source mappings?
15:55bbloomalso worth noting: last i tried, webkit provided practically zero in-app logging of sourcemap loading. if you run chrome from a terminal w/ the debug flag on the command line, you get slightly more info
15:56dnolenbbloom: anything less than multi-level source mapping is useless for CLJS.
15:57bbloomdnolen: but does that mean we need to do the merging? my assumption was that we just needed to produce a single source map and provide it as input to gclosure
15:57dnolenbbloom: news to me, do you have a link?
15:57bbloomdnolen: isn't that what GWT does? java->js as input to closure compiler which produces java->minjs
15:58bbloomdnolen: looking
15:58dnolenbbloom: far as I know noone has multi-level source mapping.
16:01bbloomdnolen: hold on, slow connection & need to checkout the closure compiler source
16:05dnolenbbloom: Closure does provide a SourceMapConsumer but it doesn't produce Clojure types so it will be a pain to work w/.
16:07bbloomdnolen: still checking out — but i thought you could just produce a source map as json & then pass that file path to the closure compiler
16:09dnolenbbloom: and what would that do?
16:10bbloomdnolen: well, you're saying we need multi-level because of clj->js->minified, right?
16:11bbloomdnolen: step one is clj->js and disable advanced optimizations — i *thought* closure could handle merging for us, but even if it can't you still need a source map to merge! :-)
16:11dnolenbbloom: there's not to disable adv opts, emission has nothing to do with that.
16:11dnolenno need to disable.
16:12bbloomdnolen: no, what im saying is that the two source maps you want to merge are cljs->js and js->optimized, right?
16:12dnolenbbloom: source-map branch is already generating the Closure source-map for any :optimization level from the original emitted JS
16:12Anniepoolein.bat's not working for me on winders 7. It installs with self-install but doesn't find the clojure jars after
16:12Anniepoo=8c/
16:12dnolenbbloom: no
16:13bbloomdnolen: then which are they?
16:13dnolenbbloom: Closure optimization compilation produces a source map, before that CLJS-JS emissions produces in-memory mappings
16:13bbloomdnolen: yeah, that's js->minjs, right?
16:14dnolenbbloom: we load closure source map converting it into another set of in-memory mappings that's mergeable with the one we created during emission
16:14dnolenbbloom: a bit convoluted but I've seen nothing in Closure that would make this simpler (could be missing something)
16:15bbloomdnolen: have you pushed the latest work you have to github? :-P b/c all i see is the vlq code
16:15bbloomdnolen: no changes to compiler.clj
16:16dnolenbbloom: not yet, I'm toying with some stuff but the approach is in mostly in my head at the moment.
16:16bbloomdnolen: heh, ok. what i'm saying is that there are three source maps that exist. one is cljs->js, the next is js->minjs, and the last is cljs->minjs
16:17dnolenbbloom: there are only two source-map that will actually get produce, not three
16:17bbloomdnolen: closure produces js->minjs and *might* provide map composition we need (might also not)
16:17dnolen1) closure js->minjs, 2) cljs->minjs
16:18dnolenwe never actually produce cljs->js
16:18bbloomdnolen: why not?
16:18bbloomit seems like that's the only one *we* need to make, if closure provides a way to compose maps for us
16:19dnolenbbloom: *if* closure does, I've seen nothing of the sort. source v3 doc specifically mentions the challenges around merging source map. and
16:20bbloomdnolen: actually, that seems like the only one we *can* make on our own :-P we don't know what transformations closure's compiler makes for us
16:20bbloombut anyway, my thought was to just ignore advanced compilation for a moment. implement cljs->js, and then worry about merging next
16:21dnolenbbloom: it's just too low of a goal at this point.
16:21Anniepoois leiningen dead?
16:22dnolenbbloom: we do a lot of optimizations ourself under advanced compilation.
16:22VinzentAnniepoo, what do you mean?
16:23AnniepooI'm trying to install leiningen/clojure/etc on a windows 7 machine,
16:23Anniepoolein self-install installs, but then can't find clojure. d/l and install binaries and adding to my classpath doesn't help
16:23Anniepoo8c/
16:23bbloomdnolen: we might be talking past each other. "advanced compilation" == google closure's advanced compilation. i'm saying we should get source maps working inside the cljs compiler on a single compilation unit without touching google closure at all — we need to get source maps working on a single expression before we can worry about project-wide
16:24VinzentAnniepoo, what do you mean by "can't find clojure"?
16:26dnolenbbloom: to be clear, it doesn't matter what level of :optimization you use
16:27Anniepooah- ok, my beliefs about how this all works are out of date
16:27dnolenbbloom: and yes, what you're saying does need to be solved regardless.
16:29VinzentAnniepoo, btw, you can run "lein repl" to get basic code evaluation tool. It can be done outside of project too
16:29bbloomdnolen: right. i'm saying that compiler.clj needs to be able to produce a mapping — long before closure.clj touches it
16:29Anniepoothey moved the clojure jares, I tried adding them to project.clk
16:30dnolenbbloom: currently the compiler always defaults to :simple - but :whitespace, :pretty-print all of these things change the original emitted source.
16:31dnolenbbloom: writing the code that produces the simplest source map will need to be done. but I don't think anyone will ever use it once we get to merging - which I don't think will be much work.
16:34bbloomdnolen: except that we probably *shouldn't* do merging ourselves b/c it's something that the browsers should be able to handle. you actually want *both* source maps in the browser so you can debug at varying levels
16:34bbloomdnolen: also, it's something that *every* compiler needs
16:34bbloomdnolen: consider again GWT: java->js->minjs
16:35bbloomthe merging doesn't belong in GWT, it belongs in the js->minjs phase
16:35bbloomor, better yet, it belongs in the web inspector
16:35dnolenbbloom: I've heard of no such browser plans - source maps in fact launched mentioning that this might be supported one day but who knows when?
16:35dnolenbbloom: unless you have evidence to the contrary.
16:37bbloomdnolen: i *thought* had evidence to the contrary. still looking. either way, merging should happen elsewhere. we should contribute to chromium or gecko, if they don't support merging. that's the right level for this merging to happen.
16:37dnolenbbloom: btw I've never seen any demos of GWT java->js->minjs
16:37dnolenbbloom: only java->js
16:37dnolenonly js->minjs
16:38dnolenbbloom: CoffeeScript has the same problem thus things are still moving slowly on this, plus they emit semi-debuggable JS.
16:38bbloomdnolen: GWT probably isn't the best example. I'm pretty sure I saw a coffeescript -> minjs demo
16:38dnolenbbloom: does not exist
16:39dnolenbbloom: if it did I most definitely with have heard about it from Jeremy Ashkenas himself.
16:39bbloomdnolen: heh, ok
16:40bbloomdnolen: either way, the cljs->js mapping needs to exist before merging can do anything useful
16:41dnolenbbloom: yes
16:43iwohey, does anyone know how i set jvm arguments that should be used when running swank in emacs?
16:43iwoi use :jvm-opts in my project.clj for lein, but this isn't used by swank when run via clojure-jack-in
16:56bbloomdnolen: reviewed the source map specs & gave some thought to the in memory representation. i think you're right. to clarify:
16:57bbloomtop-level map with :file and :lines keys. each lines key is just a vector of segments. each segment is just a map with :original and :generated keys with [line column] values and :name, :source-file keys
16:59bbloomso: {:file "abc.js" :mappings [[{:source [1 2] :generated [3 4] :name 'abc :file "abc.cljs"}]]}
16:59dnolenbbloom: branch updated, with some thinking http://github.com/clojure/clojurescript/compare/master...source-map
17:00dnolenbbloom: now all we need is code to produce a v3 source map from *cljs-mappings*
17:02bbloomside question: why are all of these vars prefixed with cljs- ?
17:03bbloomdnolen: i thought namespaces meant we didn't need prefixes :-)
17:04dnolenbbloom: well eventually these will get moved into the js emission namespace, good way to mark things that will move for now :) but yeah, should be more consistent
17:05bbloomdnolen: looks like a good start. clever use of metadata on the symbols
17:06bbloomis :var the only place we need to emit mappings?
17:07bbloomdnolen: also, use :col (when m (:col m 0))
17:07bbloomdnolen: that way it will gracefully upgrade to support columns when available :-)
17:08bbloomdnolen: and actually, are columns and lines one or zero based? maybe you want 1, not 0
17:08dnolenbbloom: I'm not totally sure - sidenote, I'm not totally sure why source map v3 segments are 1,4,5
17:08dnolenbbloom: columns are 0 based
17:08dnolenbbloom: lines are 1, but that's implicit in the mapping vector anyhow.
17:08dnolenbbloom: 4 I guess for things minifiers might do? 1 is a mystery.
17:08dnolenbbloom: good catch re: col
17:10bbloomdnolen: yeah, the 1,4,5 is a bit of a mystery for me… the docs are complecting logical representation and encoding based on prior values
17:11bbloomdnolen: http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/ is a little clearer than the spec
17:11dnolenbbloom: k then 1 is probably to account for whitespace
17:12dnolenbbloom: yeah I looked over that a few times.
17:14bbloomdnolen: is *cljs-gen-col*necessary? seems like one more thing to keep track of. couldn't you do: (let [last-segment (-> *cljs-mappings* last)] (+ (:gcol last-segment) (count (:name last-segment)))
17:14bbloomdnolen: (it is very hard to code in irc :-P you get the idea)
17:15dnolenbbloom: *cljs-mappings* doesn't contains segments, it contains lines, *cljs-gen-col* just seems faster/simpler in this case.
17:16bbloomsorry, i mean (-> *cljs-mappings* last last)
17:16bbloomdnolen: not super important anyway
17:16bbloomdnolen: I'm glad the *position* thing was already done :-) that makes all this much easier!
17:17dnolenbbloom: oh definitely, when I started digging in I realized your work makes this trivial :)
17:17bbloomdnolen: that's why i did it :-)
17:18bbloomdnolen: I'd be twice as clever if I wasn't trying to run a startup at the same time!
17:18dnolenbbloom: it's very clean, lets us keep the source mapping code very self contained.
17:19bbloomdnolen: yeah, mostly. i'm still not sure if :var is the only place we want to omit stuff
17:19bbloomdnolen: because there are other places we generate javascript names… basically anywhere we emits (:name foo)
17:19bbloomdnolen: that's one of those things where we'll have to feel it out once it's working in the browser
17:20dnolenbbloom: it most definitely is not, we also probably want to generate position information for anon functions etc.
17:21bbloomright. some of this source map stuff is going to leak into the repl implementation if we want to support source mapping of eval-ed code
17:21bbloomat minimum, compile-file needs to emit a // source map comment
17:21bbloomand there was some talk of adding an X-SourceMap header, but that probably belongs in Ring or something as a middleware
17:22dnolenbbloom: source mapping of eval-ed code is for later :) yes on the // source map comment
17:25bbloomdnolen: i see you added a json lib. do we really need that extra dependency… i mean… we're a compiler that emits javascript… we've already got all the escaping code we need :-)
17:27dnolenbbloom: we don't have anything for emitting JSON from maps.
17:27dnolenmaps/vectors etc I mean.
17:29bbloomdnolen: this is what i have in my local source-maps branch: https://www.refheap.com/paste/2982
17:31bbloomdnolen: no dependency & the encoded mappings are guarenteed to be valid JSON strings. i don't think the "names" key is necessary, but even then, it would just be (string/join ",") and emit-constant for file names
17:31dnolenbbloom: ah right, yeah that's better
17:31dnolenbbloom: good point, no need for data.json here.
17:32bbloomdnolen: just need to make sure you rebind the various dynamic vars used during compilation. don't want to override *cljs-mappings* while emitting source maps. which brings me back to the question "do we need *cljs-gcol*?"
17:33bbloomdnolen: IMO, we should merge all of those with *cljs-file* into a single dynamic var for the current compilation state
17:34dnolenbbloom: I'd be wary of performance
17:34dnolenbbloom: should be measured before going down that route.
17:35bbloomdnolen: *shrug* you'd know the perf stuff better than me.
17:35bbloomdnolen: I'd be surprised (and saddened) if a top level record wasn't fast enough
17:36dnolenbbloom: updateing top level record will never compete w/ updating top level atom, ever.
17:37bbloomdnolen: fair enough. did those are-we-fast-yet graphs include benchmarks for the compiler itself? or just the output code?
17:38dnolenbbloom: yes they benchmark compile times, things have a gotten a little slower as we do more analysis, more optimizations.
17:39bbloomdnolen: ok. shouldn't be an issue at all for interactive development, but luckily, it should parallelize well by file for larger projects
17:41bbloomdnolen: anyway, i want to make a lot more refactoring to compiler.clj — the limiting factor however may be your time to understand and review them :-)
17:44dnolenbbloom: sure, always good to write up your notes somewhere on what you'd like to see improved.
17:45bbloomdnolen: i did that a bit with Vars, but no one seemed to notice
17:45bbloomdnolen: i don't want to feel like i'm always pestering you to get my patches accepted
17:46dnolenbbloom: I've looked a bit at your vars stuff, that patch/enhancement is just not high priority.
17:48dnolenbbloom: things that'll move faster is anything related to compiler modularity, debugging, and performance.
17:48bbloomdnolen: fair enough. i'm just interested in helping improve the cljs environment & working towards CinC.
17:48bbloomdnolen: fair enough. re: modularity, take another look at my munging patch :-)
17:49bbloomdnolen: untangling the layers in compiler.clj are a big step towards the lua backend, but i'm more interested in digging down to the module layer, so that we can enable the various optimizations you have on core to apply to other namespaces. stuff like direct dispatch
17:50bbloomdnolen: both goals follow many of the same steps, however
17:50dnolenbbloom: ah thanks for updating that ticket, sounds good will look into.
17:50dnolenbbloom: direct dispatch already works on all namespaces.
17:51dnolenbbloom: I mean I'll review CLJS-294 patch more closely, and probably apply.
17:51bbloomdnolen: k, thanks.
17:51dnolenbbloom: analysis follows namespaces now
17:51bbloomdnolen: ah, ok — missed that
17:52dnolenbbloom: the only patch you've submitted that I'm dragging my feet on is the vars enhancement, excited about the others :)
17:53dnolenbbloom: your contributions are most welcome.
17:53bbloomdnolen: thanks :-)
17:54bbloomdnolen: RE: the vars stuff. i greatly scaled back that patch. no changes to dynamic vars, etc. no iwatchable, etc. just implemented the #' reader and (var ) form. it simply emits a wrapper object which enables stuff like (comp f #'g)
17:54bbloomdnolen: should be much less objectionable :-)
17:54dnolenbbloom: k, thx for the update I'll take another look. Also thanks for getting in touch with raph_amiard! sorry I didn't follow up about the mentoring stuff - just got back from a trip today.
17:55bbloomdnolen: no worries. i don't mean to pester. i'm just excited :-) haven't had this much fun coding in years
18:04johnmn3https://www.refheap.com/paste/2984
18:05johnmn3So, I'm getting noticable speedup with r/map with inc (after I cleaned up my chunkifier)
18:06johnmn3but when I try it with other workloads, I can't repeat this
18:16johnmn3trying to put together a simple example, but I'm working with a cellular automaton that has grown a little complex
18:17dnolenbbloom: nice patch, CLJS-294 patch merged into master. that removed quite a bit of ugliness thx.
18:18bbloomdnolen: cool, thanks
18:38johnmn3so, reduce applies a fun to the first element, and then applies the fn to the result and the next element
18:40johnmn3so for a 1d cellular automaton, I could reduce across by conjing the result.. but no, that wouldn't work
18:40tomoj(doseq [x cljs.core.PersistentQueue] (.log js/console x)) prints "null" for me
18:40tomojer, cljs.core.PersistentQueue/EMPTY ofc
18:42TimMcAnniepoo!
19:14Anniepoohey Tim!
19:14mheldis compojure worth following?
19:14Anniepoo8cD I'm getting back into Clojure!
19:15mheldcompojure over noir?
19:16weavejestermheld: Noir is a higher-level framework, but in some ways less flexible than Compojure.
19:16weavejestermheld: I'm kinda biased, but Compojure tends to be "simpler" while Noir tends to be "easier"
19:22mheldweavejester: I come from the rails world (but I'm a schemer) -- which would I be happier with?
19:22weavejestermheld: Noir is closest to the Rails/Ruby world, I think :)
19:23Anniepooon the other hand, that's a strong argument for compojure
19:23Anniepoo8cD
19:23weavejesterAnniepoo: I think so :)
19:23mheldweavejester: isn't it a little less resource-focused and more page-focused, though?
19:24dnolenweavejester: Noir is not close the the Rails world at all from what I've seen.
19:24dnolenmheld: Noir seems Sinatra-like, minimal with standard patterns for the usual stuff.
19:25dnolenmheld: Compojure is lower level - a tiny bit of sugar over Ring - which is like Rack
19:26weavejesterdnolen: It's closer than Compojure, I think. Though I agree it's pretty distant from Rails; it's more like Sinatra.
19:26dnolenmheld: Rail-ish stuff is not the kind of thing Clojure folks get excited about.
19:27Anniepoook, aaaargh, stupid question, started repl in foo, my sources are in ns tacos.core in tacos/src/tacos/core.clj, what's the arg to use?
19:27Anniepoo(brain's been twisted by prolog)
19:27weavejestermheld: Compojure tends to take the view that complex web applications should be compositions of smaller sets of routes.
19:27weavejesterAnniepoo: Arg to use for what?
19:27Anniepooto (use)
19:28mhelddnolen: I can appreciate that, I just like the idea of being able to structure my app based around resources that talk together
19:28mheldbut I guess that's not impossible
19:28Anniepooas in, I'd like to import into the repl's space.
19:28weavejesterAnniepoo: load ?
19:29Anniepoo8c( I've forgotten lots of details
19:29pepijndevosdnolen, I herad you're going to do something with cljs saturday at hackerschool :) Looking forward to meet you.
19:29dnolenpepijndevos: ah you got in!
19:29AnniepooI'd do (load 'tacos.core)
19:29Anniepooor somesuch
19:29pepijndevosdnolen, yea! They're amazing folks, had a picnic yesterday.
19:30dnolenpepijndevos: rad! congrats!
19:30dnolenpepijndevos: look forward to meeting in person as well!
19:34pepijndevosdnolen, there seem to be some ckanren related fns on github already. what's up with that?
19:34dnolenpepijndevos: half baked motions
19:34dnolenpepijndevos: got caught up in CLJS stuff so I haven't revisited.
19:35dnolenpepijndevos: challenge is coming up with good fast representations for the domains.
19:35pepijndevosdnolen, FYI, the only dead tree I brought is the reasoned schemer :D
19:35dnolenpepijndevos: haha nice
19:35dnolenpepijndevos: I can walk you through the cKanren stuff on Sat if you like.
19:36pepijndevosdnolen, That'd be amazing. I don't feel like I really understand minikanren itself though.
19:38dnolenpepijndevos: I can give you a run through on that as well
19:39dnolenpepijndevos: my talk won't be that long
19:39dnolenpepijndevos: taking off for a bit, talk soon.
19:39pepijndevosok, splendid.
19:40pepijndevossee you Saturday
19:55johnmn3how do I get the full stack trace from lein2 run?
19:59sc_OO people have UML and several methodologies for large S/W design. What techniques do lisp people normally use for large S/W design?
20:01bbloomsc_: avoidance of writing large software by careful use of abstractions and layering :-)
20:01Anniepoothe question's less often an issue because programs tend to be about 10% of the length.
20:04johnmn3is this inefficient? (drop 1 (drop-last (range (count coll))))
20:06bbloom,(doc drop-last)
20:06bbloom&(doc drop-last)
20:06lazybot⇒ "([s] [n s]); Return a lazy sequence of all but the last n (default 1) items in coll"
20:06bbloomsays it's lazy :-)
20:07bbloom&(first (drop-last (range)))
20:07lazybot⇒ 0
20:07bbloomjohnmn3: looks efficient to me
20:08johnmn3does it matter if coll is a vector or a list?
20:08johnmn3or no
20:08johnmn3I mean (drop 1 (drop-last (vec (range (count coll)))))
20:09bbloomwell the "vec" will be eager
20:10bbloomlaziness happens on seqs (that is: 'seq?) but anything that is 'sequential? supports the first/rest/lazy-cat/lazy-seq pattern
20:10bbloomvia coercion to a seq: (seq [1 2 3])
20:48frozenlo`I'm stuck again... The worse part is that I'm sure the solution is really simple. I have a function taking as argument an input (data) and an output (stream). I can easily send the output to a file, but how can I simply get the result directly?
20:49frozenlo`Here is the function I'm playing with: https://gist.github.com/1858654 . More precisely `gunzip'
20:49bbloom&(doc *out*)
20:49lazybot⇒ "; A java.io.Writer object representing standard output for print operations. Defaults to System/out, wrapped in an OutputStreamWriter"
20:50bbloom&(doc binding)
20:50lazybot⇒ "Macro ([bindings & body]); binding => var-symbol init-expr Creates new bindings for the (already-existing) vars, with the supplied initial values, executes the exprs in an implicit do, then re-establishes the bindings that existed before. The new bindings are m... https://www.refheap.com/paste/2985
20:50bbloom&(doc with-out-str)
20:50lazybot⇒ "Macro ([& body]); Evaluates exprs in a context in which *out* is bound to a fresh StringWriter. Returns the string created by any nested printing calls."
20:50bbloomfrozenlo`: does that help?
20:51frozenlo`The last one is gold, thank you very much!
20:51bbloom:-)
20:52frozenlo`Works flawlessly. I can't believe I was stuck on this for more than a hour.
20:52bbloom&(source with-out-str)
20:52lazybotjava.lang.RuntimeException: Unable to resolve symbol: source in this context
20:52frozenlo`Thank you very much indeed
20:52bbloomaw, no source…. run that one in your repl
20:52bbloomtake a look at the source of it — it's not magic! :-)
20:52amalloy~def with-out-str
20:53bbloomamalloy: no luck...
20:53amalloyhe'll notice eventually
20:53amalloyi bet
20:53bbloomheh
20:54frozenlo`Interesting. Should I try to use StringWriter manually? Or is rebinding *out* common practice?
20:55bbloomFrozenlock: rebinding *out* is as designed — just wanted to show you how you could dig into the various things to understand how they work
20:55bbloomFrozenlock: for example, check out the source of prn, prn-str, pr-str, print-str, etc
20:56Frozenlockbbloom: That's what got me in this rabbit hole in the first place.. I was looking at slurp, then reader... Started in the wrong direction :P
20:58bbloomFrozenlock: heh, yeah. printing is quite the rabbit hole for sure. there are a bunch of printing vars worth understanding. see: http://clojure.org/other_functions#Other%20Useful%20Functions%20and%20Macros-Printing
21:03FrozenlockNow I see `str' (which I use quite often) with new eyes!
21:04_atoI wouldn't use *out* rebinding for gzip, because you're dealing with binary data (streams) not string data (readers)
21:06bbloom_ato: ah, good point. I didn't even look at his gist, had no idea it was binary
21:07bbloomFrozenlock: still, the pattern is worth mirroring for your use case
21:07Frozenlock_ato: So it only worked because I was encoding strings?
21:09_atoprobably, not sure what you did, but if you're passing things through readers/writers/strings it'll likely break on byte sequences that aren't valid UTF-8 characters
21:10_atopersonally I'd just keep it how it is in your gist and add an extra helper like gunzip-text-lines that passes a ByteArrayOutputStream
21:11_atogunzip-to-array or something
21:12_atobeware that I'm not sure I'm fully understanding the question though
21:12lynaghkjimduey: ping
21:14FrozenlockIn my case it isn't really a problem, as I intend to encode only strings. Still, could you point me towards a solution to convert a stream to an array?
21:14tomojFrozenlock: a demonstration https://gist.github.com/6fe33dc93b1b15634245
21:15tomojer, except leave out the io/input-stream of course :)
21:21Frozenlocktomoj: thanks :)
21:21FrozenlockI should really come here more often
21:22TimMcAnniepoo: Did your question about loading namespaces get answered? Form the REPL you'd do something like (use 'tacos.core)
21:22Anniepoono, never got answered
21:22Anniepooand actually, I got distracted, now I'm back at it
21:22Anniepooso I'm still trying to figure out the filename/require mapping
21:23TimMcAnniepoo: tacos/core.clj is the file in which the namespace tacos.core lives.
21:23Anniepooyes- hang on, lets talk absolute paths a moment
21:23TimMcAnniepoo: Hyphens in namespaces map to underscores in file and folder names (because the JVM is limited.)
21:24bbloomdnolen: http://dev.clojure.org/jira/browse/CLJS-297 I've got a big ol bag of refactors in me :-)
21:24AnniepooC:\development\lein\tacos\src\tacos\core.clj contains this short file
21:24Anniepoo(ns tacos.core)
21:24TimMcAnniepoo: OK. src/ is a classpath root, one of many. That's something Leiningen knows about, so it adds that to the classpath.
21:24Anniepooah, ok
21:25Anniepooso my namespace is tacos.core
21:25TimMcAnniepoo: When Clojure's loader looks for the *namespace* tacos.core-with-hyphen, it asks the JVM for the *resource* tacos/core_with_hyphen.clj, and the JVM finds it in one of the classpath roots.
21:25TimMcGot to go, but that's the basics of namespaces and classpaths.
21:26Anniepoohmm
21:26Anniepoook, but I can only start lein repl in dev\lein
21:29jimdueylynaghk: pong
21:29TimMcAnniepoo: Call it from the project root.
21:29Anniepoook
21:30lynaghkjimduey: hey, I'm just reading your blog. I was going to ask about the ring testing DSL you talked about at Clojure/West but I found the source on the githubs.
21:30TimMcThen it will see the project.clj and read it, loading the right classpath.
21:30jimdueyFor anyone interested in monads, I just put up a new post:
21:30jimdueyhttp://www.clojure.net/2012/06/03/Monad-Protocols/
21:30Anniepoogripes about
21:30jimdueylynaghk: cool. Hope it's understandable.
21:31lynaghkjimduey: I have some time to clean up an old project (API that spits out charts), so I'm looking around for a good way to put together a test suite.
21:31Anniepoogripes it can't find the lein self install jar
21:31lynaghkjimduey: do you have any suggestions for doing http tests in Clojure? At this point I'm thinking about just using clj-http with Midje
21:32jimdueylynaghk: Not really other than what's in that library.
21:33Anniepooah, clue - the complaint is it can't find leiningen-1.6.2-standalone.jar
21:33lynaghkjimduey: okay, cool. I didn't know if you wrote that up for funsies or if there was a big work project behind it or somethin
21:33Anniepooand running lein self-install asserts that leining-1.7.7-standalone.jar already exists
21:34jimdueylynaghk: I needed it for a personal project. What's there was enough for me. It should be easy to extend
21:35jimdueyIf you want to add anything, I'd be glad to help.
21:37lynaghkjimduey: okay, thanks! Yeah, my needs aren't really huge. Half of what I'm wondering about is whether there are clever things out there for doing parallel requests or structuring/generating tests for a RESTful API.
21:41TimMcAnniepoo: Deleting ~/.lein (and if necessary, the ~/.m2/repository cache) has helped some folks in the past...
21:42TimMcthen lein self-install again
21:42Anniepoook, will do that next
21:42AnniepooI decided to try grepping my whole drive for lein
21:43TimMcNah, it's all in those two places.
21:43AnniepooI actrually have an old one in c:\Program Files (x86)\Clojure Box\swank-clojure
21:44Anniepoo(an old leiningen directory)
21:46Anniepoooooh! I now have 25 hits
21:46AnniepooI think I should clean up some of this
21:46Anniepoo=8co
21:50johnmn3confused by this:
21:50johnmn3Caused by: java.lang.NoSuchMethodError: clojure.lang.Numbers.lt(II)Z
21:50johnmn3what is .lt(II)Z
21:51TimMcI = Integer, I think. Z = Long?
21:52TimMc&(class (boolean-array []))
21:52lazybot⇒ [Z
21:52TimMc&(class (int-array []))
21:52lazybot⇒ [I
21:52TimMcOh, that makes sense. Wonder what's up.
22:15mheldnoir vs conjure?
22:20technomancycompojure!
22:21weavejesterI haven't heard a lot from conjure in a while.
22:21weavejesterConjure also seemed not very Clojure-like...
22:22weavejesterI agree with technomancy's choice, too ;)
22:29johnmn3weird errors
22:29johnmn3Exception in thread "main" java.lang.NoSuchMethodError: clojure.lang.Numbers.min
22:29johnmn3us(I)I
22:29johnmn3Exception in thread "main" java.lang.NoSuchMethodError: clojure.lang.Numbers.minus(I)I
22:30johnmn3is this because I'm using clojure 1.5alpha1?
22:30johnmn3do Numbers not implement minus?
22:31johnmn3in the repl (- 1) works fine
22:32johnmn3but the top of the stack trace points to this line: (let [left-index (- (int (/ the-width 2))) ...
22:32mheldyeah, I don't see much going on with conjure
22:32tomojjohnmn3: it sounds like the clojure version at runtime probably doesn't match the clojure version used to AOT compile some code you're using
22:33mheldI'm going to secede from trying to use anything *other* than compojure
22:33johnmn3tomoj: I did a lein2 dep again
22:33mheldwhat do y'all use for url routing?
22:33tomojbut did you AOT compile, or do any of your deps contain AOT compiled clojure code?
22:34johnmn3I have a main class, but none of the namespace declarations ask to be :aot compiled
22:34tomojyou have a (:gen-class)?
22:35johnmn3no
22:35tomojwhere does the stacktrace on the error lead?
22:35johnmn3should I just empty out the libs and bin folder and re-dep?
22:35johnmn3it leads back to the main class
22:36tomojclojure.main? or how do you have a main class without (:gen-class) ?
22:37johnmn3-main
22:39tomojcan you gist the stack trace?
22:42johnmn3https://www.refheap.com/paste/2986
22:43tomojhuh
22:44johnmn3ewe, my pasting lost the line numbers
22:44johnmn3I can re try that
22:44tomojerror is on line 68 in your paste I assume
22:44tomojso looks like aot is not the problem?
22:45johnmn3well, for some reason it is saying: All namespaces already :aot compiled.
22:45tomojI guess just try `lein2 clean` `lein2 compile` to be sure
22:45johnmn3k
22:45tomojalso check lib and lib/dev for multiple copies of clojure
22:46dnolenbbloom: heya looks like CLJ-294 broke ^:export
22:46dnolenCLJS-294 I mean.
22:46johnmn3hah, that worked
22:47johnmn3strange. Now pmap is beating reducers
22:48tomojwith fold?
22:59johnmn3tomoj: yea, the new reducers/fold thing
23:02bbloomdnolen: can you elaborate on "broke" ? will it be obvious if i try it?
23:06dnolenbbloom: it will be obvious
23:06dnolenbbloom: goog.exportSymbol("cljs.foo_bar", cljs - foo - bar)
23:06dnolenbbloom: :export is now broken.
23:07bbloomdnolen: ok, ill look at it in a few minutes. should be a quick fix
23:07bbloomdnolen: i'll also try to get a test case in there
23:07dnolenbbloom: great thx
23:14bbloomdnolen: yeah, trivial fix -- just add a call to munge on line 463
23:15bbloomdnolen: can you just make that change for me?
23:16bbloomdnolen: or ill just make a patch :-P
23:17dnolenbbloom: I see it thx
23:18bbloomdnolen: it's actually two calls
23:18bbloomi'm uploading the patch now
23:18dnolenbbloom: k thx
23:19bbloomdnolen: updated http://dev.clojure.org/jira/browse/CLJS-298
23:22bbloomdnolen: sorry i missed that!
23:28rhdoengesis there a way of mapping over a seq without worrying about the return value? ie (map println a-bunch-of-strings) but without returning a big list of nils?
23:28rhdoengesI mean, map works fine
23:28bbloom&(doc doseq)
23:28lazybot⇒ "Macro ([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."
23:29bbloom&(doc do all)
23:29lazybotclojure.lang.ArityException: Wrong number of args (2) passed to: sandbox7502$doc
23:29bbloom&(doc doall)
23:29lazybot⇒ "([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through t... https://www.refheap.com/paste/2987
23:29bbloomrhdoenges: does that help?
23:31rhdoengesah
23:31rhdoengesok
23:31rhdoengesthanks!
23:31bbloomrhdoenges: although, for println, you may want apply
23:31bbloom&(apply println [1 2 3])
23:31lazybot⇒ 1 2 3 nil
23:32bbloomprintln takes a variable number of arguments & apply can operate on lazy collections
23:33rhdoengesoh no I'm using a more complicated function
23:33rhdoengesI was just using that as an example.
23:34bbloomrhdoenges: ah, ok. well you want to use dorun, doseq, doall, etc with side effects
23:34rhdoengesoooh while I'm in here: is there something like apply that applies to the rest of its args instead of a list of args?
23:34tomojjohnmn3: what's the size of the collection?
23:34rhdoengesie (magic-function println 1 2 3)
23:35bbloomisn't that just (println 1 2 3) ?
23:35tomojjohnmn3: did you already try passing a different n to fold?
23:35johnmn3tomoj: was 100,000... just bumped it to 1,000,000
23:35johnmn3playing with the dials
23:36bbloomrhdoenges: i'm not sure what you're asking
23:36tomojI wonder if there are performance differences between jdk7 and jsr166y
23:36tomojor is it pretty much the same thing?
23:38rhdoengesbbloom: well currently I am doing (map #(apply % []) list-of-functions)
23:38johnmn3not sure.
23:38rhdoengesbbloom: and I wanted a better way of doing it
23:38bbloom&(doc juxt)
23:38lazybot⇒ "([f] [f g] [f g h] [f g h & fs]); Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"
23:38rhdoengess/better/shorter/
23:39rhdoengesooooh
23:39rhdoengesI forgot about juxt
23:39bbloomrhdoenges: juxt is awesome. took me a while to get used to it, but now i find excuses to use it surprisingly frequently
23:41bbloomrhdoenges: it would simply be ((apply juxt list-of-functions) xyz)
23:41rhdoengesneato
23:41rhdoengesthanks! :D
23:41bbloomrhdoenges: you're welcome!
23:41rhdoengesas an aside, quil is making my brain hurt and it is wonderful.
23:43bbloomrhdoenges: damn. i hadn't even seen quil. too many cool projects to play with!
23:43rhdoengesso much to do so little time, right?
23:44bbloomrhdoenges: way too little time.
23:44rhdoengesit beat out opengl for my attention because opengl involves more...
23:44rhdoengestyping?
23:45bbloomopengl is a pretty old API. it's this weird hybrid between a nice API & what was fast back in the day on older gfx cards & vendor specific extensions for actual perf of modern games/etc
23:46bbloomespecially from java -- it's just not much… um… fun. yeah. fun is the word.
23:46rhdoengesI was writing c but yeah
23:46rhdoengesnot much fun :(
23:46bbloomit's main problem is that it tries to be both high level & expose the hardware at the same time
23:47bbloomdirectx actually much better represents the underlying hardware architecture & layers the higher level stuff on top in terms of batching
23:47rhdoengeshmm
23:47bbloomit's the logical equivilent of building a file system on top of a block storage device. opengl tries to do the former without the later
23:47rhdoengeshahaha, good analogy
23:47bbloomas a result, all modern opengl apps just use nvidia and ati extensions that emulate the direct3d api
23:47bbloomlol
23:48bbloomi worked on xna/xbox/directx/etc at msft for a bit -- say what you will about msft's dev tools, but damn direct3d is a solid piece of software
23:50rhdoengesI've never done serious win dev
23:51muhoowhat's the trick for adding a non-clojars, non-maven repo to a clojure heroku project?
23:52technomancymuhoo: s3-private-repo is currently the best bet
23:53muhoothanks
23:54muhootechnomancy: this? https://github.com/technomancy/s3-wagon-private
23:55technomancyyeah