#clojure logs

2013-03-05

00:23muhooyou can't use emacs with your pinky removed
00:23muhooor vi, either, how else will you reach the ESC key?
00:32jeremyheilermuhoo, I use my middle finger for the ESC key :-P
00:33Licenserjeremyheiler you have your pinkies removed?
00:33jeremyheilerjeremyheiler, No haha. But in order to hit ESC with my pinky I have to lift my harm. I can just side my hand up to hit it with my middle finger.
00:34Licenseralso I'm pretty sure there is a no-pinky-mode.el out there somewhere
00:34jeremyheilerLicenser, wow..
00:34Licenser^^
00:47tomojit sort of blows that map-indexed is basically a copy of map
00:47tomojand it only does one coll
00:50bbloomtomoj: it's really easy to do mapped index with multiple collections:
00:50bbloom(map vector (range) [:a :b :c] [\a \b \c])
00:50bbloom,(map vector (range) [:a :b :c] [\a \b \c])
00:50clojurebot([0 :a \a] [1 :b \b] [2 :c \c])
00:50tomojgood point
00:50clojurebotthe point of moby dick is "be yourself"
00:50tomojthat's better that map-indexed
00:51bbloomi think this is a case of core being a bad example to look at the code
00:52bbloomthe fact that it's a copy paste job rather than delegating is clearly a performance thing
00:52bbloomrather than allocating a lazy, infinite range
00:53tomojyeah
00:53tomojit still blows :(
00:53bbloommight be nice if it supported multiple collections tho
00:53bbloomcould trivially implement those as a slower version by just delegating to map with range :-)
00:54tomojI almost said (partial map (range)) :O
00:54bbloomheh
00:54tomojI wonder what would have to change about clojure to get rid of some of these copy-paste jobs
00:55bbloomtomoj: a lot.
00:56bbloomin order to get good perf out of core core core functions, you need to specialize and inline to a degree that you simply can't do without a lot of inherent assumptions, type information, etc
00:56tomojah right
00:56bbloomand by the nature of how clojure is bootstrapped, you have a very limited environment in order to work with to build up these functions
00:56tomojneeds to be haskell :P
00:56bbloomgenerally, the way this sort of thing is accomplished is via a metacircular compiler toolchain
00:57bbloomwhere you have a bootstrapping compiler/runtime, which is either a simplified toolchain (as is the case with factor) or is an older version of the real thing (as is the case with most C toolchains)
00:58tomojso then you can write fancy macros which define the core functions?
00:58bbloomtomoj: yeah, see clojurescript for an example :-P
00:58bbloomalthough clojurescript has it's own terrible issues with respect to bootstrapping
00:58bbloombootstrapping is *hard*
00:59bbloomand the benefits are relatively small for a language like clojure
00:59bbloomclojure's core semantics and library are so small that it's easier to just tune everything by hand and then not really worry about it
01:00tomojright, I guess it doesn't suck so bad
01:01tomojsince only rich has to do it
01:01bbloomheh
01:04Hendekagonthm_prover: you can write most cljs code as normal clj code anyway - just separate logic from gui stuff
01:05thm_proverHendekagon: in theory yes, in practice, I found it very different.
01:05Hendekagondebug in your favourite environment as you would normal Clojure, except for the gui stuff, then you get cryptic errors
01:05Hendekagonit is quite troublesome
01:06Hendekagonbut it will get easier...CLJS will overtake CLJ!
01:06thm_proverlet others tame this CLJS beast
01:06thm_proverI will use it when it's easy
01:07thm_prover:-)
01:08Hendekagonthere's people working on it...you've got Lighttable, Session, Catnip, Himera, source maps on the way - lots of experiments on the go
01:09technomancyugh I hope not
01:11Hendekagon...but I use a text editor and lein cljsbuild
02:19luxbockhey, I'm taking a edx.org stats course and trying to get familiar with Incanter at the same time but I ran into some confusion with standard-deviation
02:20luxbockor variance I should say
02:20luxbockhttps://www.refheap.com/paste
02:20luxbockmy definition of variance follows the courses example, and I get the same result
02:20luxbockso I'm wondering why is Incanters different
02:25ambrosebsThis should be a little fun for those who know Haskell and are interested in core.typed https://github.com/clojure/core.typed/blob/master/src/test/clojure/clojure/core/typed/test/hole.clj
02:25ambrosebsWatch the video first.
02:34noidiambrosebs, is it hard to add new types to core.typed? I played with it a bit yesterday, and noticed that it doesn't support ratios (e.g. 1/10)
02:34noidiif it's not terribly hard, I might give it a go :)
02:35ambrosebsIs there a literal syntax?
02:36ambrosebsIf so, I probably just haven't added a case for it.
02:36noidi&&1/10
02:36lazybotjava.lang.RuntimeException: Invalid token: &1/10
02:36noidi,1/10
02:36clojurebot1/10
02:36noidi,(type 1/10)
02:36clojurebotclojure.lang.Ratio
02:37ambrosebsnoidi: look at "clojure/core/typed/constant_type.clj"
02:37ambrosebsPatch welcome!
02:38ambrosebsIf you can think of any other syntax I've missed, please add them also.
02:38noidiambrosebs, do I need a signed contributor agreement now that typed clojure is a core project?
02:38ambrosebsnoidi: yes
02:39noidicrap, haven't got one :)
02:39ambrosebs:)
02:39noidioh well, I would've run into it sooner or later, so better get it over with
02:40ambrosebsCool!
02:40noidianother core.typed question: is it possible to create custom subtypes of existing datatypes?
02:40noidie.g. to subtype lengths from numbers and meters from lengths
02:41ambrosebsI don't understand the example.
02:44noidiambrosebs, I was thinking about something like scala's value classes and haskell's newtype
02:45noidiif I deal with two kinds of numbers, say lengths in meters and weights in grams, if I type them both as Number, there's a risk of getting them mixed up
02:45ambrosebsNot currently. I'm still thinking about the best way to add it, it's high on the priority list.
02:46ambrosebsTyped Racket has Refinements, but I'm not entirely sure if its what I want.
02:49ambrosebsMaybe something pretty much like newtype would work fine.
02:59ambrosebsnoidi: how might you create an instance of Meter? `1` is a Long... would you expect a wrapper ctor for this sort of feature?
03:04noidiambrosebs, I haven't given it much thought (and don't even know if the idea makes sense). it's just something I've seen in some scala posts, and would've liked to give it a try if core.typed supported it :)
03:04noidie.g. http://www.blog.project13.pl/index.php/coding/1769/scala-2-10-and-why-you-will-love-implicit-value-classes/
03:04noidihttp://docs.scala-lang.org/sips/pending/value-classes.html
03:05ambroseb_noidi: thx
03:06noidiyeah, you'd probably need functions for "wrapping" and "unwrapping" to convert between the primitive and refined type (of course the value itself would remain unwrapped)
03:09ambrosebsok
03:10ambrosebsSeems useful but it isn't clear if it fits with core.typed.
03:13noidiyes, implicit wrappers may not work as well in a mostly untyped language
03:13noidiand explicit wrappers such as [1 :m], [20 :kg] may fit in better with dynamic, REPL-centric development
03:19ambrosebsnoidi: well there probably won't be any actual wrappers. Only on the static type level.
03:19ambrosebs(for a potential core.typed implementation)
03:21noidiand I'm wondering whether actual wrappers would make more sense in Clojure :)
03:21ambrosebsOne idea I've been thinking about is using an intersection type.
03:21ambrosebsDon't you just want to pass these Meters to functions like + and -?
03:21ambrosebswithout further ceremony
03:22noidiI don't think that would work. Meter * Meter -> Meter^2, Meter + Meter -> Meter
03:23noidiah, stupid me, of course * and + would return Numbers, which then should be wrapped by the caller
03:24noidiso unwrapping could be automated, even though re-wrapping can't be
03:24ambrosebsYes exactly
03:28ambrosebsI'm not sure how useful that would be.
03:28ambrosebs(kilometer (+ meter1 meter2)) doesn't really mean much.
03:30ambrosebsAs you said before, Clojure already has a cheap, ad-hoc "boxing" strategy in maps and vectors.
03:31ambrosebsand core.typed supports heterogeneous versions of both
03:33ambrosebs"cheap" to type, that is :)
03:37noidiambrosebs, btw. one more question: is there a reason why check-ns isn't typed?
03:37noidiwhen I've played around with core.typed, I've just added (check-ns) at the end of a typed ns to check it upon reload
03:37noidibut since it isn't typed, I've had to wrap it in (tc-ignore)
03:38ambrosebsnope. Should just be able to just (ann clojure.core.typed/check-ns (Fn [Symbol -> Any] [-> Any])
03:40noidigreat
03:41noidiso far the biggest issue the Java/Scala crowd seems to have with Clojure is its lack of typing, I hope that core.typed will change that :)
03:43noidiI'm sure that Clojure will be a much easier sell at Java shops once core.typed becomes production ready
03:43noidi(and I hope to be able to chip in to make that happen, but unfortunately can't make any promises)
03:44ambrosebsYep, it's easy to dismiss Clojure because of dynamic types.
03:45ambrosebsI think it'll also be very useful for beginners. Error messages don't suck as much.
03:47ambrosebsThere's no pleasing the Scala folk though, core.typed isn't a "real" type system :)
03:47ambrosebsIt's a "verification environment", which sounds better to me :)
03:48ucbheh
03:50RazLaptopIs there a way to store a reference to a list like a pointer? Or is there another way to approach it?
03:51RazLaptopI want to store many thousands of combinations but I want to make sure they're stored once uniquely
03:54amalloythat's really the only way to store a list
03:55RazLaptopamalloy: clojure has pointers?
04:03amalloyRazLaptop: you should read http://en.wikipedia.org/wiki/Persistent_data_structure, especially the section on linked lists
04:16ikitommiis there a clean way to get line source code numbers working with clojure.tools.logging?
05:48lantigaweavejester: Hello James, I was researching for a way to generate codox-like docs based on Compojure routes. I guess that's not possible right now. Do you think it's something it makes sense pursuing?
05:50weavejesterlantiga: My current thought is that we need a more restrictive but more transparent way of constructing routes. Compojure routes are just nested functions, which are opaque. If there was another system that allowed routes to be constructed from data instead, that would be more restrictive (not turing complete) but easier to document and reason about.
05:53lantigaweavejester: Agreed 100% and it sounds like fun too. As to more restrictive, I think you could actually get pretty far by separating routes in a few basic functions and data. Do you have something in the works?
05:54abp_weavejester: using functions to route is ok, but some structure should cary information about those routes
05:56lantigaabp_: Thinking about the codox thing for routes, my first thought was to leverage on meta, but probably a whole rethink might be beneficial
05:56abp_lantiga: I'm working on a vector based route dsl that compiles to clout calls
05:59lantigaabp_: very interesting, looking forward to take a peak when you release it
06:00abp_lantiga: I still need to separate the dsl from what it's supposed to integrate with, same goes for resulting routing functions. A lot of work to do still. What's that codox thing for routes?
06:04lantigaI need to generate documentation for a REST API implemented using Compojure and I would have liked to do it the same way you can generate documentation for a Clojure API using Codox. The fact that they are nested functions gets in the way of a clean implementation, though.
06:04lantigaabp_: Sorry, I forgot to prepend your nick to my last message
06:05weavejesterlantiga: I haven't been working on any alternative routing system. It's currently not an "itch to scratch" so to speak.
06:08abp_lantiga: np. Documentation generation for routes is quite a problem, yes. I think having specific functions as route handlers would ease that.
06:09abp_lantiga: Just had a cool idea on how to integrate the routing dsl with my system but also with plain clojure. :)
06:09lantigaweavejester: abp_: There's cgrand's Moustache that is more data-driven than Compojure, but it's unclear to me what are the downsides of it. It could provide a very good reference in any case.
06:10lantigaabp_: I'm all ears
06:10abp_lantiga: I looked at it while building the dsl
06:10abp_lantiga: Well, it would basically be mapping named routes to functions in namespaces
06:10honzaany ideas why (slurp) on a local file would add a leading and a trailing space?
06:11abp_lantiga: More interersting to me is mapping named routes into prismatics graph
06:11abp_lantiga: So two named route to implementation mapping strategies there.
06:12lantigaabp_: Mapping to functions in namespaces is what I had in mind too but wondered if it was the way to go - it looked klunky. The graph way, I hadn't thought about it, that's interesting. I actually worked with plumbing myself.
06:13abp_lantiga: What did you do with it?
06:15lantigaabp_: I'm using it for a project involving integration sources of information, running numerical optimization on them and producing outputs. I'm playing with a distributed version of it on the side, you can see something at https://github.com/lantiga/hyperplumbing
06:16lantigaabp_: I still have to entirely wrap my head around how it would fit a routing library, but the idea is pretty bold.
06:16lantigaabp_: Just curious, what did you take home by looking at Moustache?
06:21abp_lantiga: Yeah I'm thinking about graph-based webapps for quite a while. Honestly, I haven't looked into moustache in detail. Mostly to "confirm" ideas around structure of vectors and parameter binding. But I think what clout does is perfectly fine and a viable target for any routing dsl.
06:23lantigaabp_: I also like clout, nice and lean
06:23abp_lantiga: Yes, try reading Moustache. I J
06:23abp_I just could not beat me to it
06:25lantigaabp_: yep, cgrand's style is amazingly clever in general
06:32michaelr5251hello
07:19tickingI wonder if the equivalence problem is still solvable for clojure/java regex, being able to do (= #"x|y" #"y|x") would be cool
08:10mpfundsteinhi, can i somehow "break" a doseq?
08:11mpfundsteina hwile
08:11vijaykiranmpfundstein: you probably want to filter out the unwanted values from the seq
08:13clgvmpfundstein: yeah you can with :while
08:15notostracaOK, I'm trying to evangelize Clojure a bit to a friend who knows Racket and Java, and is currently using Java and hating it. He's using Java because of a library it has, but not Clojure because he thinks the macros will be too different from what he writes in Racket. Are Clojure macros hygienic?
08:15clgv,(doseq [x (range 10)] :while (< x 4)] (println x))
08:15clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>
08:15clgv,(doseq [x (range 10) :while (< x 4)] (println x))
08:15clojurebot0\n1\n2\n3\n
08:17notostracaI have been using Clojure on and off for a while now, still haven't made the effort to really learn the language via 4Clojure or whatnot, so I don't really grasp macros yet
08:18michaelr5251notostraca: usually you don't really need to write macros at all..
08:20notostracamichaelr525, that's what I have observed by not knowing them :-)
08:20notostracaI have been getting by writing simple apps
08:20mpfundsteinvijaykiran: i am trying :-)
08:21mpfundstein(def test ({:id 73333, :time 1362488571357, :priority 9, :action "whatever", :args nil, :group nil} {:id 50252, :time 1362488575325, :priority 9, :action "whatever", :args nil, :group nil}))
08:21noidinotostraca, clojure macros are not hygienic, but syntax-quote namespaces all symbols which practically eliminates accidental name capturing
08:21noidi,`(+ 2 2)
08:21notostracaI made one that looks up nutrition data from the FDA's offline data dumps and displays it in a seesaw form, a simple 2-button app meant for the elderly
08:21clojurebot(clojure.core/+ 2 2)
08:21mpfundstein(filter #(= (50250 (:id %))) tet)
08:21mpfundstein(filter #(= (50250 (:id %))) test)
08:21mpfundsteinthrows
08:21Pupnik-oh hey notostraca ;)
08:21notostracahey Pupnik-
08:21notostracaguess who I'm talking about in here...
08:22Pupnik-hehe
08:22Pupnik-I did my part! the link i posted had hickey talking about how you can use macros without stuffing up your namespaces
08:22notostracathat's cool noidi, also thanks Pupnik-
08:22Pupnik-but as my understanding of the subject is very limited, i cant really say much
08:23clgvmpfundstein: because you try to use the integer 50250 as function
08:23mpfundsteinclgv: AH :D
08:23mpfundsteinclgv: thx
08:23mpfundsteinclgv: haha works now :-)
08:23mpfundsteinclgv: stupid
08:25clgvyou could also use: ##(filter (comp #{50250 4711} :id) [{:id 4} {:id 5} {:id 50250} {:id 4711}])
08:25lazybot⇒ ({:id 50250} {:id 4711})
08:30mpfundsteinclgv: thx
08:30mpfundsteinclgv: thats awesome
08:30mpfundsteinclgv: :-)
08:31notostracaso comp returns a function, that's convenient
08:32clgvnotostraca: yeah it is a higher-order function
08:59Foxboronjust wrote a little IRC Bot in Clojure as my first project. Would anyone mind take a look at it and maybe give some feedback?
09:01ambrosebsGo ahead.
09:01ambrosebsAs in, sure, post the code :)
09:02Foxboronhttps://github.com/Foxboron/Parjer
09:03FoxboronI should probably add a better readme
09:09meliponehello, is this a good place to ask a lein question?
09:10notostracamelipone, don't know a better one
09:10meliponeI am using lein 1.7.1 and I've noticed that it's using clojure-1.2.jar in its script. Does it matter and does the specified clojure gets loaded at the repl?
09:11notostracait loads a clojure version in your project.clj
09:11notostracai think your code is separate from lein's clojure
09:11meliponeokay, thanks. That will do for me!
09:11clgvmelipone: better upgrade to lein 2 anyway
09:11notostracayes
09:11notostracathe repl in lein 2 is great
09:11meliponeyes? I didn't see anything new in 2.0
09:12notostracaauto-complete in the repl
09:12clgvmelipone: there is plenty new in 2.0
09:12meliponeis it easy to upgrade?
09:12clgvmelipone: compare the two project.clj examples
09:12meliponeokay, will do.
09:12meliponethanks
09:13clgvbtw there is #lein
09:13meliponeokay
09:13notostracareally? I did not know
09:13clgvah no #leiningen
09:14meliponeI can never remember how to spell leiningen
09:15gfredericksit's spelled exactly how it's not pronounced
09:15ambrosebsFoxboron: Looks good to me. I'm no web guy so I can't comment on functionality, but idioms are fine.
09:17ambrosebsFoxboron: have you used another FP language?
09:17Foxboronambrosebs: nope.
09:17Foxborononly done Python before this :P
09:17ambrosebsAh, close enough. :)
09:18Foxboroni'll take that as good news :D
09:18ambrosebsFoxboron: If you felt like it, you could make `add-event` a macro, so you could have a sort of defmethod syntax.
09:19ambrosebsIt would be a good exercise.
09:19Foxboronambrosebs: thats what i did. But my friend (a clojure guy) thought it would be better that way :P
09:19ambrosebsYep, I agree.
09:19ambrosebsJust sounded like fun. :)
09:19Foxboronso at the start i basically did (defevt eval "eval" [x y z] (body))
09:20Foxboronabused the docstring as the event trigger :3
09:20ambrosebsVery easy to make sugar for the most common case though.
09:20Foxboronbut i do believe a macro would look better as you'd avoid the (fn (body)) all together
09:21Foxboronfunny thing tho. The eval didnt have a sandbox. So my friend ended up making files in the project folder with the eval command :P
09:21ambrosebs:)
09:23ambrosebsI might try and type check this with core.typed and send it back.
09:26Foxboronambrosebs: yay :D
09:27ambrosebsFoxboron: what are the [c x] in events?
09:28Foxboronambrosebs: c is basically the connection ref used. So the functions that write back to the IRC knows where the output should go
09:28Foxboroni did copy pasta parts of the connection code as i really didn't bother reading much into the java stuff :/
09:28Foxboronx is the refference to what was typed
09:29Foxboronwhich is parsed with a regex.
09:29ambrosebsc is a (Ref '{:in BufferedReader, :out PrintWriter}) or something like that?
09:30Foxboronyes
09:30Foxboronx is basically this:
09:30Foxboronhttp://mybuddymichael.com/writings/a-regular-expression-for-irc-messages.html?utm_source=dlvr.it&amp;utm_medium=facebook
09:30Foxboroni should name them something better :P
09:33ambrosebsFoxboron: what is the `serv` argument to network/connect?
09:33ambrosebsand where is it created?
09:34ambrosebsAh, thats the configuration map?
09:34Foxboronambrosebs: yes. I newly added it.
09:35ambrosebsCool.
09:35Foxboronambrosebs: it is just using the :server and :port from the map.
09:36Foxboronambrosebs: i have been reading like 200 pages in Clojure Programming but never really gotten to a point where i found something interesting to code. I buddy wanted me to try make an IRC bot. So been spending 2-3 days with it now ^^
09:36ambrosebsGreat!
09:36ambrosebsIt shows that you've been studying.
09:37Foxboronambrosebs: i procrastinate too much. Wanted to learn Clojure since november but never really sat down and did anything D:
09:37ambrosebs(def-alias Serv '{:nick String
09:37ambrosebs :server String
09:37ambrosebs :port AnyInteger
09:37ambrosebs :chan String
09:37ambrosebs :owner (APersistentSet Symbol)
09:37ambrosebs :mark String})
09:37ambrosebsFoxboron: is this right for the config?
09:37ambrosebs(lol I'll paste it somewhere next time, sorry)
09:37Foxboronyes. Looks god.
09:40ambrosebsFoxboron: does `conn` also have an :exit key?
09:40Foxboronambrosebs: i am actually not sure.
09:40ambrosebsIt isn't added anywhere, but `conn-handler` uses it.
09:40Foxboronjudging by (nil? :exit @c) i doubt it.
09:41ambrosebsFoxboron: write-to-out is usually preferred over writeToOut
09:42Foxboronah, sure :)
10:15jtoycan someone help me figure out what I am doing wrong here: https://www.refheap.com/paste/12125 when I run that it returns the whole category_groups
10:16preyaloneHello World prints in Mac, but in Windows it silently quits. https://gist.github.com/mcandre/5091006
10:18Foxboronpreyalone: add (-main) at the end
10:18Foxboronclj execute the file, it dosnt care if -main is there.
10:19preyaloneFoxboron: I want the program to work like Java, in that main is only executed for "clj <program>", not in cases where the program is imported by other Clojure code.
10:20Foxboronpreyalone: well, clojure dosnt work like that :)
10:20Foxboronif you use lein it will use -main
10:20Foxboronbut normal clj <script> dosnt
10:21Foxboronto get around that, you need to do it like in python.
10:33jtoyI think Im closer, but I still get the wrong answer: https://www.refheap.com/paste/12127
10:37canweriotnow,(reduce + '(1 2 3 4))
10:37clojurebot10
10:45mpfundsteincan someone help me on this?
10:45mpfundsteinhttps://gist.github.com/MarkusXite/10bdd101e16ee7e4ba82
10:45mpfundsteinthe macro somehow doesnt expand the & more in the argument list
10:47ambrosebsmpfundstein: have you tried using macroexpand to debug it?
10:47mpfundsteinambrosebs: no i am not so far yet
10:48clgvmpfundstein: it seems questionable whether you need a macro for that at all.
10:49mpfundsteinclgv: :-) i try to figure out how to use variable parameters etc. :D some stackoverflow post refered to macros so i tried
10:49clgvmpfundstein: what do you want to do? examples?
10:50mpfundsteini want a wrapper around
10:50mpfundstein(assoc my-map k1 v21....)
10:50mpfundstein(assoc my-map k1 v1....)
10:51clgvwhat exactly needs to be wrapped? what should the final form look like?
10:51mpfundsteinthat instead of assoc
10:51mpfundsteinthe name of the function is
10:51mpfundstein(update-job
10:51mpfundsteinthats all :-)
10:52llasram(a) You probably just want to use `assoc`; (b) You can just use a function -- no macro necessary
10:52mpfundsteinllasram: to (a) -> true, but i dont want to :-) ; (b) -> yeah but how
10:52clgvmpfundstein: then write a function named update-job ;)
10:52llasram(def update-job assoc)
10:52mpfundsteinllasram: lol :-) thats what i want
10:53mpfundsteinllasram: didnt think so "easy"
10:53clgvplain renaming of assoc has hardly any use though
10:53tomojoh
10:53clgvexcept obscuring your code if you do that repeatedly
10:54mpfundsteinclgv: well, its a bit of information hiding
10:54mpfundsteinclgv: update-job is implement as assoc ok, but who says it must.. if i want to change it later and i keep the interface the same
10:54mpfundsteinclgv: than no end user would need to do a s/assoc/new_method/g
10:56clgvmpfundstein: I'd bet there will be a rewrite of that soon ;)
10:56llasrammpfundstein: For a more real answer, where maybe you want to do more than *just* assoc, check out `apply`
10:57mpfundsteinclgv: :D its purely educational what i built
10:57mpfundsteinbuid*
10:57mpfundsteinbuild* sry
10:57mpfundsteinllasram: Ok will do :-) thanks
10:57clgvwell now you lost the end user argument ;)
10:59mpfundsteinclgv: ok ok ok :D
11:27sundbphi. not that long ago i remember seeing a project advertised that had to do with macros, quoting and namespace resolution. can't seem to find it now - anyone know which one i'm talking about?
11:29blrmsundbp: not familiar, but it might be here: http://www.clojure-toolbox.com/
11:30sundbpblrm: i'll take a look. have a feeling it'd be too new to have ended up there yet
11:31chronnosundbp: Maybe you are talking about https://github.com/brandonbloom/backtick ?
11:31sundbpchronno: that sounds and looks like it - great. thanks!
11:32chronnosundbp: np
11:33sundbpchronno: yes, that's the one. now i jsut need to work out if my gut feel that this would be helpful to me is correct :)
11:35chronnosundbp: he he, well that parts is always fun :-)
11:35chronnosundbp: (at least with clojure libraries...)
11:36sundbpchronno: indeed
11:40ambrosebsnoidi: whenever I use `check-ns` in a namespace, I usually get an infinite loop because check-ns calls require.
11:40ambrosebsDoes it work for you?
11:40sundbpchronno: and in this case my foggy memory is right, it will make it easier to write the macro i'm writing
11:41chronnosundbp: great!
11:43chronnosundbp: I haven't had the opportunity to use it, but it looks like a welcome addition to our toolset
11:59jtoywhere is the repl history for my command line?
11:59sundbpchronno: yes, i'm sort of doing the template approach manually right now for generating some code for defrecords etc
11:59jtoyI started my reply with lein repl
12:03jweissis it bad for to do (let [f (fn [x y] ...)] (def add (partial f true)) (def remove (partial f false))) ? eg, a top level let so you don't pollute the namespace with a utility function in a top level var
12:05sundbpchronno: done - it "just worked" :)
12:05technomancyjweiss: opinions are mixed. I prefer private vars since they retain more metadata, you can jump to their definition, etc
12:05jweisstechnomancy: private as in defn- ?
12:05technomancyalso I get twitchy about defs in non-zero columns
12:05technomancyyeah
12:10chronnosundbp: Nice
12:12mpfundsteinjtoy: its a hidden file .lein_repl_history in the same folder as where you started your repl
12:21jtoympfundstein: thanks
12:22jtoympfundstein: hmm, mine only has .lein-deps-sum
12:22mpfundsteinjtoy: hm
12:22jtoybut i have history
12:22mpfundsteinjtoy: did you run it from within a lein project folder?
12:22jtoyim on lein 1.x, not 2.x
12:23jtoympfundstein: yes
12:23mpfundsteinjtoy: ah k than i cant help you
12:23jtoympfundstein: ok, thanks
12:24technomancylein1's repl was really not very good
12:25jtoytechnomancy: ok, ill upgrade real soon
12:25Pupnik-leins repl takes a billion years to start up
12:25mpfundsteinyah :D
12:25jtoyPupnik-: in general or in 1.x ?
12:25Pupnik-im using 2.0
12:26Pupnik-so in general
12:26mpfundsteinjtoy: in general, its a pain
12:26ToBeReplacedif I map over a set multiple times, is the order passed through to the map guaranteed to be the same?
12:27jtoythats too bad
12:27jtoyis there a better way to get a repl?
12:29jtoyI just dont exit
12:36josteinkyou do discover that throwing up a JVM is a bit costly when running lein on a raspberry pi with a soft-float JVM
12:39ambrosebsFoxboron: I've fully type checked your IRC bot. https://github.com/frenchy64/Parjer
12:39ambrosebsAnd hallelujah I found a type error!
12:40ambrosebsline 125 of parjer.commands
12:44fbernierIs there a way to know if I am at the last element of a sequence when using map ?
12:46krlfbernier: http://clojuredocs.org/clojure_core/1.2.0/clojure.core/map-indexed
12:52Foxboronambrosebs: awsome. I am cooking so can't read code atm :)
12:52ambrosebs:)
12:55ambrosebsFoxboron: I had to make a lot of trivial changes to get around current core.typed limitations. eg. (v 1) -> (nth v 1)
12:56ambrosebsFoxboron: I also turned add-event and friends into macros so I could sneak in some type annotations.
12:56Foxboronambrosebs: i will take a look at it :D Awsome. I did not expect this!
12:57ambrosebsFYI: core.typed isn't AOT yet, so it takes awhile to load.
13:14ambrosebsstuartsierra: Any ideas why core.typed isn't compiling?
13:15stuartsierraambrosebs: Haven't had time to look at it since my last email, I'm afraid.
13:16ambrosebsOk, I've released onto Clojars in the meantime.
13:18mechazoidalIf I've got a non-native type that can't be automatically cast to a ref/atom, do I need to wrap it with deftype and provide accessors?
13:19solussdwith a defprotocol I can specify doctorings for each function of the protocol- but I have no wa to enforce that the implementation adheres (e.g. "This function takes a Thing and returns a set of OtherThings"). I could enforce thet with pre/post conditions with a regular function, but protocol function declarations don' support pre/post conditions. Is there a good reason for this?
13:19bbloommechazoidal: do you just need the resulting type to implement IDeref?
13:19bbloommechazoidal: you can use reify
13:20stuartsierraambrosebs: The dependencies in the pom are still confused.
13:20stuartsierraambrosebs: net.intensivesystems is not in Maven Central.
13:20stuartsierraambrosebs: And neither is trammel.
13:21bbloomsolussd: the common pattern is to define protocol methods with a dash as a prefix, like '-foo and then provide a free function `foo that calls it. you can put the pre/post conditions onto the free function
13:21mechazoidalbbloom: basically I've got a JNA pointer that I want protected, all operations that work on it are wrapped-JNA.
13:21technomancyI thought trammel was deprecated?
13:21stuartsierraI don't even know what it is.
13:21solussdbbloom: I can live with that, thanks!
13:21bbloommechazoidal: what do you mean "protected" ?
13:21ambrosebstrammel is core.contracts
13:22ambrosebsbut fogus just added the features I needed about 30 minutes ago.
13:24stuartsierraambrosebs: OK, so you can replace trammel with core.contracts and then figure out what 'arrows' is.
13:25mechazoidalbbloom: The pointer is opaque, it's the entry point for stack operations. I want to have a reference to the pointer to manage operations when I pass values to/from its stack.
13:25ambrosebsstuartsierra: there's also `analyze` which I'm trying to get into contrib.
13:25stuartsierraok
13:25bbloommechazoidal: yeah, use deftype
13:25mechazoidalbbloom: (note that I'm still a bit green with clj concurrency, so I may have the wrong idea how to manage it)
13:26bbloommechazoidal: if you're working with external pointers, you're far outside the range of problems clojure's concurrency primitives can help you with
13:26ambrosebsstuartsierra: I was more worried about the compilation failure TBH, forgot about the deps.
13:26RaynesGood morning sirs.
13:26bbloommechazoidal: java.concurrent is available :-P
13:26stuartsierraambrosebs: I can't do much to debug the Maven compile step until the dependencies are sorted out.
13:27ambrosebsstuartsierra: np
13:27stuartsierraGood luck!
13:27ambrosebs:)
13:30mechazoidalbbloom: My hope was to manage clj's access into the structure in a concurrent way, since I'm basically trying to plug a script interpreter into clj, and have clj provide backing support for any I/O the interpreter needs.
13:31mechazoidalbbloom: (the end result of this rube goldberg experiment is to see if I can plug it into aleph as a worker service)
13:31bbloommechazoidal: all of clojure's concurrency primitives assume that you are working with immutable and equatable values
13:32bbloommechazoidal: can you guarantee that the native code won't change the value (in a strict functional programming sense of that word) out from under you? can you compare those values for equality?
13:42mechazoidalbbloom: the pointer itself shouldn't be changed by the native code, as you're expected to work on it purely through its C stack api
13:42bbloommechazoidal: what about the data the pointer points to?
13:42bbloomthe *value* of that pointer
13:42mechazoidalbbloom: the structure itself is mutable, you're right. :/
13:42bbloommechazoidal: yeah, you need locks :-P
13:43bbloomie not clojure's concurrency primitives
13:43mechazoidalyeah. :|
13:43gfredericks,(doc locking)
13:43clojurebot"([x & body]); Executes exprs in an implicit do, while holding the monitor of x. Will release the monitor of x in all circumstances."
13:43mechazoidalI'm still a little bit confused on how overtone's doing it, since I'm also using clj-native.
13:43mechazoidaloh
13:45pepijndevosI remember this quote that went something like "it is more useful to have 100 functions over 10 types than 10 functions over 100 types", any idea what that could have been?
13:46technomancyperlis IIRC
13:47gfredericks(defmacro docking [] `(doc locking))
13:49pjstadig~9
13:49clojurebotCool story bro.
13:49pjstadighmm
13:50arcatanpepijndevos: "It is better to have 100 functions operate on one data structure than 10 functions on 10 data structures." -Alan Perlis
13:51hiredmanpjstadig: huh
13:53pjstadigi thought there was a way to get clojurebot to recite the epigrams
13:54pjstadig#9
13:55pepijndevosarcatan: yay, thanks
13:58hiredman~#9
13:58clojurebot9. It is better to have 100 functions operate on one data structure than 10 functions on 10 data structures. -- Alan J. Perlis
13:58hiredmanah
14:01ivan~#73
14:01clojurebot73. It is not a language's weakness but its strengths that control the gradient of its change: Alas, a language never escapes its embryonic sac. -- Alan J. Perlis
14:30drorbemetHi, does anybody know which companies in Germany are using Clojure in their projects?
14:33chronnodrorbemet: I think I once saw a video of some guys using it at Deutsche Bank
14:34chronnodrorbemet: http://skillsmatter.com/podcast/scala/real-world-clojure
14:37aravindThis is a little off-topic, but I am looking for some help with incanter. I have a dataset which has data generated via a lazy seq. When I try to use (view) that dataset, I get a ArrayIndexOutOfBoundsException the first time, but subsequent calls to it display the data just fine.
14:38aravindI guess the question is how do I use this (lazy seq) correctly?
14:47llasramaravind: Sounds like a bug in Incanter to me, although I'm not sure how. What happens if you `doall` the seq?
14:52aravindllasram: hmm.. this might not be an incanter bug, when I generate that plain sequence (without any incanter fanciness), and do a doseq println on it, it works for a little while before it dies with the same exception.
14:53aravindI assumed the doseq would run for a while before it finished, but it seems like I am running into some other problem.
14:55llasramaravind: Oh, that actually makes more sense. Once generation of the lazy seq throws an exception, further generation is terminated, and you're just left with what had been produced thus-far
14:56aravindyeah.. I am debugging the part when the sequence is generated..
15:00bbloomfor all those interested in clj/cljs code sharing, i'd appreciate some feedback on this idea i had: http://dev.clojure.org/display/design/Feature+Expressions?focusedCommentId=6390066&amp;#comment-6390066 (last comment)
15:00bbloomwould love to push along the design and implementation of *something* for conditional compilation
15:02drorbemetchronno: Ah, thanks for the hint :-)
15:03chronnodrorbemet: You're welcome :-)
15:03llasrambbloom: Oooh. And the forms are nestable, if you need to conditionally evaluate how you determine what to conditionally evaluate
15:03bbloomllasram: i mean, who wouldn't want to conditionally compile their conditionally compiled conditional compilation?
15:04hiredmanI still think it is a mistake to put the conditional stuff in the reader
15:04RazLaptopSo I'm confused about something, in C, I could store a gigantic list as a dynamic array with a linked list and doing malloc or calloc. In Clojure.. if I need to store an extremely large amount of data, do I just stick it all in one list? (def giganto-list) and append to it? It would contain hashes, vectors, anonymous functions, etc... possibly running into gigs of size?
15:04hiredmanyeah, I know
15:05hiredmanbut the problem is they then become opaque to anything post reader
15:05bbloomdrewc: what do you do about if/else conditionals? just #+foo and #-foo ?
15:05drewc#+win32 #+sb-thread #+(or)
15:05drewcor #-
15:05bbloomhiredman: lots of stuff is already opaque post reader
15:05kaoDbbloom: couldn't you just do a macro for that ?
15:05hiredmanif you make a code analysis tool that walks forms after the reader has read them, the analyzer won't see conditionals
15:05hiredmanbbloom: yeah, and it sucks
15:05kaoDor what are the benefits of reader syntax besides it being concise ?
15:06bbloomdrewc: hmm had not considered #+(or), wouldn't that just be the same as not specifying #+ at all ?
15:06hiredmanbut I've said all that on the wiki page
15:06bbloomhiredman: but we can't change that now. it's too late: if you want to make an analysis tool, you have no choice but to operate with a special class of reader
15:06bbloomhiredman: which i agree is unfortunate, but it's waaay too late to fix :-(
15:07bbloompersonally, i'd rather specify namespaced symbols for all special reader syntax to be expanded to, which is still possible even if you add more conditional reading stuff
15:07bbloomfor example `foo really should be (clojure.core/syntax-quote foo)
15:08drewcbbloom: yeah, exactly. Sometimes you want to 'comment' out a whole sexp. #+(or) is perfect (at least on CL, no idea about the clojure commenting syntax, been 6 years since I had a clojure contract)
15:08bbloomand there is no reason you can't have #~foo be (clojure.core/reader-unquote foo) visible to an analysis phase
15:08bbloomdrewc: clojure has #_
15:08bbloom,(+ 1 #_2 3)
15:08clojurebot4
15:09bbloomhiredman: although, you're STILL screwed if you're building a live code analysis tool in an editor, b/c there is no where to hang comments and significant whitespace :-P
15:10hiredmanbbloom: I am not opposed that, a set of reader macros that expand in to information preserving s-expressions that are handed off to the compiler
15:10drewcbloom: but what about, for example : #+(or win32 win64 macosx) ... that are supposed to be reader conditionals for a reason ...
15:10bbloomhiredman: also, this is the point where i should mention small talk's comment syntax is just a string: http://www.inf.ufsc.br/poo/smalltalk/ibm/tutorial/chap3.html#3.30
15:10hiredmanbut I don't think anyway besides me cases
15:10hiredmanme cares
15:11hiredmanbbloom: *shrug*
15:11bbloomhiredman: heh. i think tools.reader could pretty easily be extended to return information preserving forms
15:11bbloommaybe there should be a clojure.reader namespace for those things, so there is no concern of conflict
15:12bbloomi agree it's a mistake to lose info in the reader, i'd rather it be a configurable translation pass
15:13hiredmanthe non-reader conditional feature expressions could be implemented as a library
15:14bbloomhiredman: yes. if others like my unquote/unquote-splicing suggestion, then phase 1 is to implement the feature expressions as a macro library
15:14hiredman(defmacro feature-condition [...] ...) and it does some sniffing of the environment to see if it is being expanded in clojure or clojurescript
15:14bbloomactually, that's all phase 2. phase 1 is to define what info is stored where
15:15hiredmans/library/single simple macro/g
15:15bbloompersonally, i think a set of flags is a bad plan compared to a map or a collection of vars
15:20hiredman~hyperspec
15:20clojurebothyperspec is not applicable
15:20rplacaclojurebot: it is for clojure.pprint/cl-format :)
15:20clojurebotYou don't have to tell me twice.
15:20bbloomsomebody totally needs to make a clojure hyperspec :-)
15:20bbloomclojurebot: hyperspec is http://www.lispworks.com/documentation/HyperSpec/Front/
15:20clojurebotIn Ordnung
15:20bbloom~hyperspec
15:20clojurebothyperspec is http://www.lispworks.com/documentation/HyperSpec/Front/
15:21rplacabbloom: of course, that assumes a spec to start from
15:21bbloomrplaca: what's a spec? never heard of it. :-P
15:22hiredmanrplaca: the hyperspec would lead you too believe clojure.pprint/cl-format can format numbers as roman numerals, but last time I tried it just barfed at me
15:22rplacabbloom: the hyperspec is based on the CL spec. Clojure doesn't have a spec to start from
15:22rplacabbloom: that should work
15:22bbloomrplaca: i know... i was kidding around...
15:23rplacathere tests in the test suite that do it
15:23rplaca*there are
15:23bbloomhiredman: so one reason you need conditional compilation at read time is for things like extend-type (via deftype, defrecord, etc)
15:23hiredmanbbloom: that is not true
15:24bbloomhiredman: how would i conditionally implement a protocol?
15:24hiredmanbbloom: there are lots and lots of ways
15:24bbloomhiredman: lol share with me just one
15:25hiredman(feature-cond :clojure (extend-protocol ...) :clojurescript (extend-protocol ...))
15:25hiredmanthe simplest
15:25bbloomhiredman: that's not a good enough solution b/c deferring extend-protocol has performance implications
15:25hiredman(feature-cond :clojure (deftype ...) :clojurescript (deftype ...))
15:26rplaca,(clojure.pprint/cl-format true "It is now the year ~@R~%" 2013)
15:26clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: clojure.pprint>
15:26bbloomit also means that i can't conditionally implement a single method of a multi-function protocol without duplicating the boilerplate
15:26hiredmanbbloom: fortunately lisp has a great mechanism for dealing with that
15:26rplacawell, it would work if clojurebot would let it :)
15:26bbloomhiredman: i shouldn't be expected to write per-use-case macros for everything i want to conditionally compile
15:27bbloomhiredman: i'd need to recreate the parsing and semantics of each macro in order to create a meta macro that supports conditional compilation
15:27hiredmanbbloom: no, but you can build generic macros on top of that
15:27bbloomhiredman: wouldn't that generic macro just be like my backtick library?
15:27bbloomie code templating
15:27hiredmanbbloom: or deftype can actually macroexpand things instead of expecting literal names
15:28bbloomie unquote and unquote-splicing ?
15:28hiredmanbbloom: sure, but not at read time
15:29bbloomhiredman: ok, so basically i just wrap my whole file in (conditionally-compiled-block ...) and then delegate to backtick
15:29bbloomwhich is honestly what i was about to do for some conditional code i'm gonna write
15:29hiredmanbbloom: I don't follow
15:29hiredmanyou put conditionals where you want them
15:29bbloomhiredman: github.com/brandonbloom/backtick
15:30hiredmanI am familiar with backtick
15:30bbloomhiredman: i'm just gonna wrap a whole file with that and now ~ and ~@ work for splicing in code like the reader changes i proposed
15:30bbloomit's one example of a "generic macro" you suggest
15:30bbloomyou look for forms that demarcate conditional blocks & then rewrite them
15:31bbloombut you don't do symbol resolution like a normal syntax quote, you just leave the symbols alone
15:31bbloomwhich is what backtick's template does
15:31bbloomin theory, we don't even need to change the grammer, if we just used ~ and ~@ and the whole file was in an implicit syntax-quote with symbol resolution turned off
15:32bbloomunfortunately, clojure also doesn't have anything like racket's #lang
15:32bbloomso you can't achieve implicit whole file stuff before the 'ns form
16:33pppaulmls
16:33pppaulug, stupid synergy
17:18Rich_MorinIs Clojure's architecture (ie, an evaluator/compiler, coupled to a VM) particularly new? For example, do any other Lisps employ this approach?
17:24technomancyRich_Morin: I don't know of any other lisps which piggyback on an existing VM apart from Kawa/ABCL, which are just ports of existing lisps
17:24S11001001Rich_Morin: could you be more specific about the aspects you're looking for? "evaluator/compiler coupled to a VM" describes *lots* of things.
17:26Rich_MorinI'm trying to create an overview page for Clojure's architecture (http://wiki.cfcl.com/bin/view/Projects/Clojure/Key/Architecture). I was wondering about similar technologies.
17:28technomancyI guess elisp is coupled tightly to a VM, albeit a VM implemented solely for the purpose of running elisp.
17:28mpenetRich_Morin: there is joxa
17:28S11001001Rich_Morin: well, that diagram can be used unchanged to describe the two technomancy mentioned, plus sisc. If you're willing to substitute "JVM", there are many more examples that still fit that diagram.
17:28technomancyS11001001: sisc is an interpreter though, isn't it?
17:29craigbroscheme48
17:29craigbroscsh
17:29craigbrolisp in pop11 vm
17:29craigbropoplog that is
17:30craigbroPoplog is a reflective, incrementally compiled software development environment for the programming languages POP-11, Common Lisp, Prolog, and Standard ML, originally created in the UK for teaching and research in artificial intelligence at the University of Sussex.
17:30S11001001technomancy: ah, yeah.
17:30craigbrothe scheme48 VM is special purpose for scheme tho
17:30S11001001craigbro: right, swap JVM out and there are lots of examples.
17:31craigbronetlogo
17:31craigbronot a lisp
17:31craigbrobut lispish in many ways
17:31S11001001craigbro: I'm also assuming this applies: "If the evaluator detects invocation of a macro, it sends the current data structures off for macro expansion. The expanded versions are accepted in place of the originals. This process is repeated until all macros have been resolved."
17:32S11001001except s,evaluator,evaluator/compiler,
17:33craigbrothat's compilation
17:33craigbrono matter how you slice it
17:45brehautwhat advantages does core.contracts have over just using regular clojure :pre and :post conditions?
17:45Rich_Morinhttp://wiki.cfcl.com/bin/view/Projects/Clojure/Key/Architecture - updated; comments welcome...
17:45gfredericksbrehaut: adding contracts to existing functions outside their definition?
17:45brehautgfredericks: excellent :)
17:46gfredericksif you're not altering a var's root, you're doing it wrong.
17:46gfredericks--perlis
17:46brehautive never seen that one before
17:48technomancyperlis apocrypha
17:48brehauttechnomancy: i hope theres one about a dragon
17:52technomancythere is if you want there to be
17:52technomancythat's the great thing about apocrypha
17:52gfredericksit knows how to say yes?
18:00Rich_MorinIs there a "link" stage (eg, as the bytecode is loaded into the JVM)?
18:00technomancyRich_Morin: there is classloading, yeah
18:01technomancyI don't know enough about C to say whether it's like linking
18:02Rich_MorinTraditional linking mostly has to do with symbol resolution. Dunno how this applies to Clojure or the JVM.
18:03S11001001Rich_Morin: all the symbol resolution is delayed on a symbol-by-symbol basis; every class has its own init, only invoked when the class is demanded at runtime
18:03S11001001Rich_Morin: clojure eagerly demands a lot more, though, and has its own mutable tables of symbol mappings.
18:03S11001001Rich_Morin: you really have to separate clojure's environment from java's.
18:03Rich_MorinDoes that include situations where some Java code is calling a Clojure function?
18:04brehautjava code calling a clojure function (rather than a method implemented on a type in clojure) indirects at least once through the same symbol table (vars) that clojure code uses
18:04Rich_MorinBasically, does the JVM need any sort of plumbing to be set up when a new Clojure function is added?
18:05S11001001Rich_Morin: Java code calls clojure functions by looking them up in clojure envs, which are ordinary data structures. The clojure code has to be loaded to be found in the env.
18:09Rich_MorinCool; thx
18:09brehautS11001001: you know about core.typed right?
18:10S11001001brehaut: a bit
18:11brehautS11001001: is it reasonable to use on only some namespaces in a project, or once you start using it, do you have to type everything and your deps too?
18:12S11001001brehaut: the former. You'll get more out of it if you type bottom-up, rather than top-down, though.
18:12brehautS11001001: awesome; im thinking about giving it a shot on a new project, so i would be working bottom up
18:12brehautS11001001: but i'd like some escape hatches if i run into hard to check stuff
18:12S11001001brehaut: great; new code is best
18:13technomancyare there plans to make it honor existing metadata-based type hints?
18:13brehautS11001001: thats good news :)
18:13S11001001brehaut: tc-ignore is there so you can say "frell it, this implementation is fine"; you can still attach a type to syms defined in a tc-ignore and it's cool with it
18:14brehautsweet :)
18:14brehautthis is exciting
18:14technomancyusing not-metadata for types struck me as a very strange implementation tactic
18:14S11001001brehaut: you can also attach types to syms in a module that is itself not checked at all
18:14S11001001brehaut: which is how clojure.core syms have types
18:15brehautS11001001: right, that makes sense
18:15S11001001technomancy: the existing metadata isn't really very good. Seqable isn't enough, you want (Seqable A) for some A
18:16technomancyS11001001: sure, but you can encode the latter as metadata
18:17technomancyI just don't like inventing new channels for expressing things we already have a good way to express.
18:21brehautS11001001: so it would be possible to declare all the types in, eg, a test namespace so that core.typed is only a dev dependancy?
18:24S11001001brehaut: Maybe. There are a few clojure.core functions and macros with constrained alternatives in typed that are easier to type, so if you want typed versions of those... also, having your ann forms next to the defns they're typing is pleasant.
18:24S11001001brehaut: I wouldn't try it; better would be lazy loading for typed itself
18:24brehautS11001001: sure, im just slightly concerned about having all that extra dependancy (and memory usage) in my built product
18:27S11001001hg st
18:27S11001001:D
18:58bendlasDoes anybody currently have ritz working with nrepl and emacs?
19:27tjgilliesis there a way to install a package for one time use from lein repl?
19:27tjgilliesif i just want to test some functions
19:29abptj
19:29abptjgillies: You mean without a project?
19:29tjgilliesabp: yes
19:31abptjgillies: http://www.learningclojure.com/2013/02/runtime-require-downloading-new.html
19:31tjgilliesabp: thnx
19:34papachansomebody here use IntelliJ for clojure?
19:56ravsterWhat is the clojure equivalent of common lisp's 'push'. I want to add something to a list
19:56hiredmanlists are immutable
19:57ravsterokay, how to I create a new list of the first one plus something else?
19:57mroweravster: conj maybe?
19:58ravstermrowe: thanks. conj is what I need.
19:58ravsterI figured there would be something, I'm just not familiar with the set of clojure functions yet.
20:06ambrosebsFoxboron: had a browse through my Parjer?
20:17tjgillies(defn push [element lst] (dosync (alter lst conj element)))
20:23RaynesParjer. God, the names, make it stop.
20:24technomancyparjer.core
20:24rasmustotechnomancy: haha, I saw the LEIN_IRONIC_JURE thing in leiningen, cracked me up
20:28technomancywe all have a part to play to make the world a better place
20:32papachanhi there
20:32papachananybody using intellij here?
20:33papachanjust trying to make my project running my main function with intellij
20:35hiredmanwin /win 15
20:46nopromptcould i gather some thoughts regarding a clojurescript macro?
20:47nopromptit's for use with angularjs if anyone's worked with that framework.
20:47noprompthere's the gist https://gist.github.com/noprompt/5095995
20:47nopromptwith some explanation.
20:47nopromptit's the first cut at it and it feels a little messy.
20:49nopromptlynaghk: if you're around, you're thoughts would be much appreciated since you've had some experience working with cljs and angular.
20:59thearthu1I'm de-contribing and old 1.2.1 library and trying to figure out where prxml went (it's not in "where did contrib go")
20:59thearthu1anyone here catch where it got to if anywhere
21:01amalloythearthu1: there's no direct replacement, but migration to data.xml isn't bad. sexp-as-element takes input prxml-style, and emit outputs strings
21:02thearthu1thanks amalloy, I'll try sexp-as-element
21:30Hendekagonpapchan: yes, sometimes
21:45papachanHendekagon: but do you use main function to start your project?
21:46papachani cannot give arguments to my main script
21:47Hendekagonpapchan: 2 options: use the la clojure plugin + leiningen plugin and run your code from the la clojure repl....
21:48Hendekagonpapchan: ok have you got la clojure installed ?
21:50papachanla clojure?
21:50papachani have clojure installed in my intelliJ plugins
21:51Hendekagonpapachan: ok - then you can either run clojure code from the la clojure repl, or using run...
21:51papachanok i will look for it
21:53papachanyeah i have La Clojure installed Hendekagon
21:53Hendekagonyou can set arguements under project structure>modules><your module>>Clojure
21:54papachanoh i am lost
21:54papachani see the edit run configs
21:55papachanproject-settings?
21:56Hendekagonfile>project structure...
21:57papachanoh isee
21:57papachanwhere i have clojure.main
21:58Hendekagon- add any JVM options there
21:58papachani try that
21:59Hendekagonif you want to run your code as a Java program, and your Clojure code has a -main function, you follow the rules for normal Java apps under the Run menu
21:59papachanbut if i want to call a main function from a class?
22:00Hendekagonthen you need to add a function (defn -main [& args] (code here)) to one of your Clojure namespaces
22:00Hendekagonthen you can run it as if it were a Java app
22:01Hendekagonusing the settings given under Run>edit configurations>
22:01frozenlocker... how does one make a jar with a bunch of java files? (there's a build.xml in the lot)
22:01papachanHendekagon ok. do i check run script in REPL or not?
22:02Hendekagonfrozenlock: add the java source to your leiningen project.clj & do lein uberjar
22:03frozenlockHendekagon: it's not a clj project... it's a library I want to use as a dependency. I want to upload it to clojars, but I need a .jar beforehand
22:03Hendekagonpapachan: if you want a repl to talk to your app
22:03Hendekagonfrozenlock: ummm, has it gone through all the maven hoops ?
22:05frozenlockI think so, I used to upload the .jar myself with a carefully handmade pom file.
22:05frozenlockBut this time the author didn't jar it :s
22:17technomancyfrozenlock: you should yell at him for not putting it in a repository
22:18technomancybut you can also use the scp upload method
22:18george`hi, I have a problem with future-call that I don't understand; I do (future-call my-function), where my-function calls println, then enters a while loop, then calls println. When I make the call I get the first println, but when the while-test fails, it just returns nil, and I don't get the second println (at the repl)
22:18george`a paste is here if it helps, https://www.refheap.com/paste/12147
22:18frozenlocktechnomancy: it's in CVS :s
22:19technomancyfrozenlock: might have to yell louder then; he's probably hard of hearing.
22:19george`testing a simple while loop with the same behavior at the repl works fine
22:19frozenlockIndeed. What an horrible interface..
22:20frozenlock(on sourceforge that is)
22:21george`also testing (future-call simple-while-loop) at repl works OK
23:03xeqigeorge`: does (myfunction) throw an exception?
23:18george`xeqi: no, but I'm wondering if the last println output is somehow getting redirected...I don't rebind anything though
23:20xeqiah, you might be looking for #(doc boundfn)
23:20xeqi&(doc boundfn)
23:20lazybotjava.lang.RuntimeException: Unable to resolve var: boundfn in this context
23:20xeqidoh
23:20xeqi&(doc bound-fn)
23:20lazybot⇒ "Macro ([& fntail]); Returns a function defined by the given fntail, which will install the same bindings in effect as in the thread at the time bound-fn was called. This may be used to define a helper function which runs on a different thread, but needs the same bindings in place."
23:24george`thanks that looks useful
23:24george`but a future should not rebind normally, right?
23:26xeqiI think that a future doesn't bring along the bindings, so things like *out* (which is implicitly used by println) get the value System/out
23:26RaynesFutures do not bring bindings.
23:26xeqi##(println *out*) ##(future (println *out*))
23:26lazybot(println *out*) ⇒ #<StringWriter #<StringWriter > nil
23:26lazybot(future (println *out*)) java.lang.SecurityException: You tripped the alarm! future-call is bad!
23:26xeqisilly lazybot
23:27RaynesFutures really are bad.
23:27Raynes:p
23:27xeqijust like ##(Thread. (constantly nil)) s
23:27lazybot⇒ #<Thread Thread[Thread-7602,5,sandbox]>
23:28RaynesNaw, threads are fine.
23:28xeqifutures get block because they use a threadpool?
23:28xeqi*blocked
23:29RaynesYes.
23:29abp(if (not-any ::unbound cells) ...)
23:29abpneat :D
23:29Raynesxeqi: Not promising any of it makes sense, but that's how it works. :p
23:29george`System/out in Emacs repl is still the repl though? Or Not? Because the first println in the function called by future prints to the repl
23:29xeqiRaynes: heh, I'm tempted to find a way to make a thread stick around
23:29abpmore like (if (not-any? ::unbound cells) ...)
23:30RaynesIt probably wouldn't be hard, xeqi.
23:30Raynesxeqi: You already know how to forkbomb him though.
23:31xeqigeorge`: I think it ends up there, but there are some interleaving issues with multiple writeres, but this hits my limits of understanding
23:33abpThat's not bad as well: (assert (not-any? ::unbound cells) ("Got unbound param: " (some ::unbound cells)))
23:33abpI want to write Clojure dsls forever.
23:55TimMcRaynes: WTF, I thought futures conveyed bindings!
23:57TimMcRaynes: (let [f (binding-conveyor-fn f) ...] ...) from future-call -- I think it conveys bindings just fine.
23:57dcolishis a future a 1:1 for java Future?
23:58RaynesTimMc: Then apparently I'm wrong.
23:58RaynesI've been known to be this way before.
23:58TimMcBOOYAH
23:58TimMci mean
23:59TimMc"Yeah, I guess so."
23:59RaynesWe should arrange for a bout of fisticuffs, sir.
23:59TimMcI'll have my people contact your people.