#clojure logs

2011-11-30

00:01dnolenambrosebs: have you tried loading up the compiler and analyzing some forms?
00:01ambrosebsYes, with a REPL
00:01dnolenand?
00:02ambrosebsI guess the problem is I don't really know where Clojure ends and ClojureScript begins. Can I just jar up the Compiler and add it as a Clojure dep?
00:04ambrosebsdnolen: I've checked out the AST, and it's perfect for my needs. I just want to use the AST in a prototype type checker from Clojure
00:04ambrosebsdnolen: not necessarily for Clojure (JVM) code, but just to get a feel for walking/deconstructing the AST
00:09dnolenambrosebs: simplest thing, copy a swank-clojure jar into $CLJS_HOME/lib/dev
00:09dnolenambrosebs: create a project.clj that looks something like this in $CLJS_HOME, https://gist.github.com/1408092
00:10dnolenambrosebs: then you can start lein swank as usual, and compile compiler.clj
00:11ambrosebsdnolen: ah! that makes sense. Trying..
00:11devndnolen: refresh the gist ;)
00:12dnolenambrosebs: soon as I compiled compiler.clj, I can do nice stuff like (analyze {} '(+ 4 5)) at the REPL
00:12dnolendevn: thx
00:13ambrosebsI just realized I can yank out compiler.clj and put it in any leingnen project... right?
00:13hiredmanman, you should make clojurescript a lein project :)
00:13devni don't see why not ambrosebs
00:14ambrosebsLOL that's is all I wanted. That is awesome!
00:14dnolenambrosebs: yeah, I think compiler.clj is all you need :)
00:14devndnolen: what about that require cljs.core in compiler?
00:15dnolendevn: oh yeah the compiler macros
00:15ambrosebsso I'd need just those two files?
00:16dnolenambrosebs: I think so
00:16ambrosebs:D
00:18devndnolen: are you going to clojure/west?
00:18dnolendevn: pondering it
00:19devnsame. a bit more pricey than my typical trip, might need to actually submit a talk this time. :)
00:21devndnolen: hopefully by the time the conference rolls around I'll have built a startup idea generator in core.logic
00:21dnolendevn: ha!
00:21devngotta play to those sandhill rd. folks!
00:25technomancyamalloy: I was halfway considering doing the base64ing print-method on java.util.Serializables as part of serializable-fn
00:25technomancybut I'm not sure that's where it belongs
00:26amalloynah, i think it's separate
00:27technomancythe problem is it's like six lines, so it's just soooo tempting =)
00:27amalloytechnomancy: what might be more interesting is to use #= to turn your round-trip into pr-str/read-string, without an eval
00:28amalloyseems like it might sorta work?
00:28devnglowing endorsement
00:28amalloybut i don't know enough about how #= behaves. like, it generally doesn't evaluate its arguments
00:29technomancyall I know is if I do that then Rich will use his look of disapproval on me.
00:30ambrosebsdnolen: 1001 twitter followers :) nice
00:30dnolenambrosebs: heh, who are all these people?
00:30devndnolen: i've met you. damned fools. I've been trying to tell them.
00:31ambrosebsdnolen: must have heard of you somewhere
00:31amalloytechnomancy: you'd get the same look from me. it'd be one Eye of Disapproval, and one Eye of Awesommmme
00:32devntechnomancy: think: Adam Sandler "They're all gonna laugh at you!"
00:34ambrosebsdnolen: so what happened to fairKanren?
00:34dnolenambrosebs: just didn't work :)
00:34ambrosebs:D
00:35dnolenI obsessed over it, and had some good results, but it only seemed like it worked.
00:35dnolenI have some other ideas now - but I'm putting it aside for the time being. working on cKanren and core.match.
00:36devnmind bender, that one (for me anyhow)
00:36dnolencKanren in Clojure will be fun since we have polymorphism … some neat performance tricks we can do I think.
00:36ambrosebsdnolen: I've been spending all my time checking out Typed Racket, I'm sure I'll meet you back at core.logic soon :)
00:37dnolenambrosebs: nice! I've always meant to check it out. would be cool to see a blog post from ambrosebs :)
00:38ambrosebsdnolen: Implementing a prototype of Typed Clojure with CLJS compiler in Clojure would make an epic blog post xD
00:38dnolenseriously
00:39devni've only gotten as far as racket proper -- i'm no ambrosebs
00:39ambrosebsdevn: LOL, I'm learning racket by browsing the typed racket source code
00:39ambrosebssome foreign concepts coming from clojure
00:39devnambrosebs: have a decent link handy? docs seem hit or miss w/r/t racket
00:40ambrosebsfor typed racket?
00:40devn*nod*
00:40ambrosebsusage or impl?
00:41devneither. I haven't looked into it. You'd probably save me 10-15 minutes of hunting if you have some decent docs or links handy
00:41ambrosebschecked out the readme? https://github.com/frenchy64/typed-clojure
00:42ambrosebsthat's mostly implementation
00:43ambrosebsusage: http://docs.racket-lang.org/ts-guide/index.html?q=typed
00:44devnoh man, I think I'm watching your project and my chrome suffered a horrible death that killed my tabs
00:45ambrosebsdevn: :)
00:45ambrosebsdevn: drracket comes with a local copy of the docs which I find useful
00:46devnambrosebs: my experience with racket is damned limited. I'm using drracket but about all I've done is make some ridiculous slideshow stuff :)
00:47dnolenCLJS analyzer is pretty neat
00:47devn"why yes, I would like 100 smiling blue fish in my repl"
00:51ambrosebsdevn: the drracket online code analyzer is awesome
00:51devnwhA?! online code analyzer?
00:51ambrosebsdevn: use 5.2, click red button on bottom right
00:51ambrosebserrors as you type
00:51ambrosebsreally, really cool
00:51ambrosebsso jealous
00:51dnolenone day!
00:51devnambrosebs: i really love the way it draws arrows in check syntax
00:51ambrosebssupposedly is slightly buggy
00:52devni posted a feature request on clooj
00:52ambrosebsdevn: yes! that is SO cool that it works with different reader languages
00:52ambrosebsknowing how diverse they are
00:52devnambrosebs: yes, pretty incredible stuff. racket is a playground. it's fantastic
00:53devn+1, Like button, etc.
00:53ambrosebsdevn: I saw your issue on clooj, I spent a few minutes thinking how to approach it
00:53ambrosebsnot that I know much about the internals of clooj
00:53devnambrosebs: geoffrey's response about it being a scoped search with highlighting...he seems pretty sure about it.
00:54devnI don't know better, but that seemed like it might be reductionist
00:55devnas in, i would need to be convinced that's all there is to it.
00:55ambrosebsdevn: right, I didn't post because I didn't have a good enough idea
00:55devnit seems go magical, if it's so easy why don't more editors have it?
00:56devni suppose to a lesser degree you could get the same thing by modifying the face of all the words that match the word your point is on in emacs
00:57devni just love the visual of the arrows sort of drawing the path. i'm pretty visual
00:57ambrosebsdevn: the work I'm going to do with Typed Clojure might be related. At least the inference of local variables
00:57ambrosebswho knows
00:58devnambrosebs: i didn't get a chance to say much to you other than "nice talk" at the conj, but you guys have been doing awesome work. thanks.
00:59ambrosebsdevn: thanks!
00:59devnand to your point on typed racket providing some clues: definitely looking forward to hearing what you discover there as well
01:00ambrosebsdevn: choose a cool racket library that Clojure doesn't have, and you can join in too :D
01:00devnhaha! that's actually not a bad idea!
01:00G0SUBambrosebs: yo!
01:00devnthat's like a double word score in scrabble
01:00ambrosebshello :)
01:02devnyo dawg i herd u liek mudkipz so i put mudkipz in ur mudkipz so u can mudkip while u mudkip
01:03devn*swish*
01:05G0SUBambrosebs: is there any type system where I can differentiate between mutable & immutable objects even though they implement the same interfaces?
01:06devnI know precious little about scala, but, they don't do that, right?
01:07devni know the interface is damned similar between collection types, but you said "same"
01:07G0SUBdevn: since you can accidentally pass a mutable object to an Actor in Scala without the compiler warning you, I guess no.
01:07ambrosebsG0SUB: I've only really looked at Typed Racket, I'm new to type systems
01:07ambrosebsG0SUB: typed racket has a type for mutable references
01:08G0SUBambrosebs: I see.
01:08devnG0SUB: what is the intended use case for such a type system?
01:08ambrosebsand that's about the extent of my knowledge
01:08G0SUBdevn: to prevent such mistakes from happening.
01:08amalloytechnomancy: btw, i don't think you support double-round-tripping, because your ::source is (fn ...). in many evaluation contexts if you eval that you'll get back a clojure.core/fn, which isn't printable. any reason not to have the ::source be (serializable.fn/fn ...)?
01:09G0SUBambrosebs: can you give me a link to a ref?
01:09G0SUBambrosebs: looking for docs in the subject.
01:09devnG0SUB: http://docs.racket-lang.org/ts-guide/index.html?q=typed
01:09G0SUBthanks
01:09devnambrosebs gave me that. thank him. :)
01:10ambrosebsI'll try and find something more specific
01:10amalloybtw, can someone tell me how to release to clojars with lein? i've generally used cake but i'm putting together a mini-tutorial
01:10G0SUBdevn: did we meet at the conj this time?
01:10devnhttps://docs.google.com/viewer?a=v&q=cache:pnKPeSXnUNEJ:www.ccs.neu.edu/racket/pubs/icfp10-thf.pdf+typed+racket+mutable&hl=en&gl=us&pid=bl&srcid=ADGEESjSjOciYCwM9WlXGQFlbhCnfvOo6xfbc2QO6RFihNO0aY9e81jQbkERLdo1fF3TBYCGsE79NHGN9vMKFvIqHhDQcxqxEPIqoe0NHi32Rg3Dp4-76lSk-Xm2kNpGjBaa4-UXurM1&sig=AHIEtbQLLZmNlnI3DBZEiUMtolF-n2hNnQ&pli=1
01:10devnyuck. sorry.
01:11devnhttp://bit.ly/sAWbin
01:11devn"Logical Types for Untyped Languages*"
01:11G0SUByeah
01:11G0SUBlooking
01:12ambrosebsG0SUB: yes, that's the paper I was going to look for.
01:13ambrosebsG0SUB: If you want some examples from the source I'm sure I could help
01:13devnhttp://whiley.org/2011/06/03/what-a-racket/
01:13devn^-not a bad overview based on a brief skim
01:14G0SUBambrosebs: nothing specific, looking for some ideas. thank you!
01:14devnwhen the expression (and (number? x) (> x 100)) is true, the type system should know that x is a number, but x might or might not be a number when the expression is false, since it might be 97 or "Hello"
01:14devn^-quote from the above link
01:14devnthat's cool. "occurrence typing"
01:16devnAnother one that looks like fun: http://www.ccs.neu.edu/racket/pubs/sfp10-kth.pdf
01:57jacortinasare there any real world use cases of Avout, or something like Avout within the Clojure community?
02:04devnjacortinas: it was just released today
02:04amalloyi think anything that someone's had time to put together can't possibly be real-wolr
02:04amalloyugh, world. so bad at typing today
02:05jacortinasI know that it was just released, but I would like to think that most libraries are built for a purpose, a purpose that exists before the libraries inception.
02:06devnjacortinas: give it 5 days.
02:06jacortinasCan someone see this replacing anything they already use in their everyday work? Such as zmq or rabbitmq
02:39scodeI am probably being dense. How do I zip two vectors together? I want to do:
02:39scodeI mean without implementing the zipping, I'm assuming there is a library function somewhere
02:40scode(for [[thing other-thing] (zipvec [vector fo things] [vector of other things])) ... )
02:40scodeclojure.zip/vector-zip seems to do something entirely different
02:42scodeI can use zipmap and destructure it, but that's a bit indirect
02:42alexbaranoskyscode: (map vector [vec1 vec2 vec3 etc]) ??
02:42lazybotalexbaranosky: Uh, no. Why would you even ask?
02:42alexbaranoskyscode, well I zipped 3 vectors
02:43alexbaranoskyscode, (map vector [1 2 3] [4 5 6]) ;; that's better
02:43scodealexbaranosky: Thanks :)
02:44alexbaranoskythus: (def zip (partial apply vector))
02:44scodeI was being dense after all...
02:44alexbaranoskythus: (def zip (partial apply map vector))
02:44alexbaranoskysoemthing like that, its late and no repl
02:46scodealexbaranosky: Thanks again :)
02:47G0SUBAvout shows how simplicity, power & focus can kick a$$ in the real world.
02:50mytrileHey, guys. Anyone tried avout ? I've got this when trying to load 'avout.core https://gist.github.com/51383bd538821881e5fc
02:51mytrileI don't know how and where to configure log4j
02:51jacortinasmytrile: I tried it from a repl
02:51jacortinasgot the same error, but no exception
02:52mytrilejacortinas: The warning disappeared when I switch to clojure 1.3.0
02:52jacortinasso the easiest use case I can think of is shared configuration across multiple systems
02:53jacortinasmytrile: I'm on 1.3.0
02:53jacortinasI think it might just be the first time it's used
02:53mytrilecool
02:53jacortinasa < 1mb config map
02:54alexbaranoskyman, people are making some badass stuff w Clojurethese days
02:56jacortinascould this feasibly be used for a message queue?
02:56jacortinasavout being "this"*
02:56jacortinasI'm trying to think of a fun example to write, something compelling
03:02G0SUBjacortinas: a distributed caching system with DB backed persistence.
03:03jacortinasG0SUB: zookeeper is persistent?
03:03jacortinasI don't know too much about it
03:04jacortinasmaybe implementing Avout on redis would be a good idea actually
03:04pyrjacortinas: yep, but in the case of avout, persistence is achievied by going to a DB
03:04G0SUBjacortinas: not necessarily, but avout refs/atoms can be "backed" by a persistent store.
03:05pyrzk is only used for locking
03:05pyrwhich is what it's meant for
03:05jacortinasI see
03:05G0SUBjacortinas: a redis backend will be trivial to write.
03:05jacortinasyup
03:05G0SUBjacortinas: take a look at the mongo example.
03:06jacortinasG0SUB: yeah I'm seeing that, it's very interesting
03:06G0SUBprotocols FTW!
03:09jacortinasthe distributed locks provided by Avout could have been their own library release
03:09amalloy~zip
03:09clojurebotzip is not necessary in clojure, because map can walk over multiple sequences, acting as a zipWith. For example, (map list '(1 2 3) '(a b c)) yields ((1 a) (2 b) (3 c))
03:10amalloyfwiw, scode, this question is so common clojurebot can answer it
03:12jacortinas,(map list '(1 2 3) '(a b c))
03:12clojurebot((1 a) (2 b) (3 c))
03:12jacortinas,(map list '(1 2 3) '(a b c) '(z y x))
03:12clojurebot((1 a z) (2 b y) (3 c x))
03:13jacortinas,(map str '(1 2 3) '(a b c) '(z y x))
03:13clojurebot("1az" "2by" "3cx")
03:15robbe-,(map #(map list %) '((1 2 3) (a b c) (z y x)))
03:15clojurebot(((1) (2) (3)) ((a) (b) (c)) ((z) (y) (x)))
03:15robbe-hm .. of course
03:16robbe-,(map #(map list %) '(((1 2 3) (a b c) (z y x))))
03:16clojurebot((((1 2 3)) ((a b c)) ((z y x))))
03:17jacortinaslists all the way down
03:34sunngI like the idea behind avout. It could be a clojure abstraction to all centralized data management solution.
03:35sunngMaybe someday, our clojurians don't have know about mongodb/redis/mysql, we just (dosync!!) and (alter!!).
04:02BahmanHi all!
04:06BahmanIs is possible to mass :import java classes? Like javax.swing.* ?
04:07clgvBahman: not with standard clojure - maybe someone wrote a custom 'ns or 'import, yet?
04:07BahmanThanks clgv.
04:07BahmanDoes anyone know a good and almost comprehensive tutorial for Swing?
04:08clgvthe one from sun/oracle: http://docs.oracle.com/javase/tutorial/uiswing/
04:09BahmanI'd seen that but since normally Sun/Oracle is not good at documentation I forgot about it.
04:09BahmanThanks again.
04:10clgvit's a start.
04:10clgvI usually fell back to it for a quick overview before googling specifics...
04:33tolstoyWhen I have an agent and set :handler-fn and also :error-mode :continue, how come the handler-fn never gets invoked on an error?
04:33tolstoyThe docs seem to imply that handler-fn will be called regardless.
04:44tolstoyAh. I'm using :handler-fn rather than :error-handler. Duoup!
04:50lucianheh, Crockford uses explicit recur in javascript for memoization
04:50lucianhttp://www.youtube.com/watch?NR=1&amp;v=ya4UHuXNygM
04:51lucianhe doesn't mention it, but it's constant space as well
05:09olamboHi 320 Clojure people
05:29clgvwhy does java -jar -cp lib/clojure-1.2.1.jar MyJar.jar give me a "Exception in thread "main" java.lang.NoClassDefFoundError: clojure/lang/IFn"?
05:30raekclgv: you shouldn't have -jar in there
05:30clgvhuh?
05:31raekjava -cp lib/clojure-1.2.1.jar MyJar.jar clojure.main
05:31clgvbut I want to start the main method of MyJar.jar
05:31raekyou cannot use -jar and -cp at the same time, unfortunately
05:32raekif -jar is used, -cp is silently ignored
05:32raekclgv: have you looked at lein uberjar?
05:32clgvraek: yeah, for testing I wanted to run the jar standalone
05:33raekanyway, "-jar -cp" tells java to use the jar file called "-cp"
05:33clgvthat works now: jar -cp ... Main
05:34clgvups again: java -cp lib/clojure-1.2.1.jar:MyJar.jar Main
05:35raekoops, seems like -jar does not take the following word as its argument, but the first non-option argument
05:35clgvyep
05:36raekso your syntax makes perfect sense, but java's interpretation of it does not... :-)
05:37clgvhumm, I am still struggling with the question "how to determine if my code is running in a jar or not?" - I need it since the "recursive" search for config files has to have a different implementation when run in a jar
05:38notostracaI have compiled a clojure file to several .class files using (compile), but now I don't know the correct way to put them into a jar for use from a java project
05:38clgvthese or not "normal" configs more like persistent setups that are included in the jar
05:38clgvs/or/are/
05:39notostracaI am using Maven, although I am very unfamiliar with the tool
05:39clgvnotostraca: use "lein jar"
05:39notostracaclgv, so... create a lein project?
05:39clgvyes
05:39raekwhy does the search for config files has to have different implementations?
05:40clgvraek: you cant use file abstraction for it in the jar
05:40clgvraek: I guess thats due to that there are no real folders in it
05:40notostracaok, I am even less familiar with lein. how should I create a new project inside the existing Eclipse project?
05:41raekah, so your use case is more complex than just "open a file on the classpath"?
05:41clgvraek: yes. it is "find files in a subdirectory". brb
05:46notostracawoah, leiningen is not working at all, weird
05:47notostracaI get an NPE double-clicking the standalone jar , and running with java -jar
05:48notostracaoh, and when I run the .bat, "wget: unrecognized option `--no-check-certificate'"
05:50vijaykiranHello all .. noob question here : is there a better way to do this https://gist.github.com/1408604 ?
05:54Wild_Catvijaykiran: if I were you, I'd make two separate functions: one that calculates the average of any number of numbers (supplied as a vector), and one that asks the user to input their numbers
05:54samaaronWild_Cat: I was going to say exactly the same thing :-)
05:55vijaykiran:) thanks guys. I was just trying to "translate" examples from "How to solve it LISP" using clojure - one-to-one..
05:55vijaykiranAgree that the function is indeed doing two things :)
05:56Wild_Catplus, it makes the program easier to test because the "average" function is stateless, and the stateful one is smaller.
05:57Fossiand then the loop/recur won't make much sense
05:57Fossiat least i wouldn't code entering n numbers that way
05:57vijaykiranis there a simpler way of reading numbers from "command line" ?
06:00raekvijaykiran: clojure does not come with many functions for that, but you could use (read)
06:00notostracavijaykiran, Scanner?
06:01raekthen the numbers will be read using the clojure reader
06:02raekvijaykiran: you can also use the various Java classes (eg. Scanner, as notostraca suggested)
06:03raekvijaykiran: when you test code by hand it's more common to do it in the repl
06:04notostracahas anyone encountered the issues I described with leiningen? technomancy_, are you available if it isn't too much trouble?
06:04raeksay your average function takes a sequence of number and returns a number. then you can just invoke it like (average [1 2 3]) in the repl
06:05raekyou get reading and printing of value for free from the REPL
06:06raeknotostraca: did you execute the lein script? I don't think you're supposed to run the jar.
06:06notostracalein.bat self-install
06:06notostracawget: unrecognized option `--no-check-certificate'
06:07notostracaand I can run wget, and that is not an option
06:07raeknotostraca: ok. my guess is that you have an old version of wget installed.
06:07notostracaI just installed it with the GNUWin32 installer, could be a path thing
06:07pyrfound myself writing deep-merge
06:08pyrwith a recursive merge-with
06:08pyri was a bit surprised it didn't exist elsewhere
06:08pyrdid i miss it or does it just not exist ?
06:08pyr(there used to be a deep merge with in contrib but it's gone and didn't solve the easiest case)
06:15clgvraek: so, do you have an idea to determine if the code is running within a jar?
06:16notostracaraek, hey, it works. path didn't update when I installed wget
06:16notostracanow lein is self-installing, thanks
06:16notostracaraek++
06:21clgv$inc raek
06:21lazybot⇒ 12
06:21clgv;)
06:22ejackson(inc lazybot)
06:22lazybot⇒ 1
06:22clgv(dec ejackson)
06:22lazybot⇒ -1
06:23clgvuuh that works as well
06:23ejacksonno then.... what's all this about
06:23clgv(inc 1)
06:23lazybot⇒ 3
06:23clgvmuhaha
06:23ejackson(inc ejackson)
06:23lazybotYou can't adjust your own karma.
06:23ejacksonbah !
06:24ejacksonit was worth a try
06:24clgv,(println "(inc clgv)")
06:24clojurebot(inc clgv)
06:24lazybot⇒ 1
06:24clgv;)
06:24ejacksonnice one
06:25clgv(+ 1 1)
06:25clojurebot2
06:25clgvhmm interesting to see when which bot answers^^
06:29G0SUBejackson: yo!
06:29ejacksonhowy
06:29ejacksonhowdy
06:29G0SUBejackson: BG here (in case you didn't know)
06:29ejackson!!!!!
06:29G0SUBejackson: how's life?
06:29ejacksonI did not
06:29ejacksonlife is cracking !
06:30ejacksonhow about yours
06:30G0SUBejackson: good :-) Did you see Avout?
06:30ejacksonoh yeah, its stunning
06:30ejacksonif it lives up to my expectations we've got a crazy weapon in our hands
06:31G0SUBI remember David telling me about it at the Conj. Didn't expect it to be production ready, but it is!
06:31G0SUBejackson: looks good to me. I am going to play with it today.
06:32samaaronI'm interested to know how it interacts with zookeeper
06:33G0SUBit seems zookeeper provides all the coordination mechanism for avout. especially in the form of distributed locks.
06:33samaaronG0SUB: so the two are therefore inseparable?
06:33clgvI am still wondering if there is any *pure java* lib for doing the distributed job dispatch
06:33G0SUBsamaaron: indeed, yes.
06:34samaaronG0SUB: is zk a jar?
06:34G0SUBsamaaron: yes, just a simple jar, but it has start/stop scripts, etc.
06:35G0SUBsamaaron: ZK is inherently distributed. you can have 5K clojure nodes and 100 ZK nodes all playing together :-)
06:35samaaronG0SUB: so the start/stop scripts are separate ways of firing up a zk server, but i'm asuming that there is also a java api for firing up servers
06:35G0SUBsamaaron: possibly, but I haven't explored those possibilities.
06:36G0SUBsamaaron: however, single node, embedded ZK is not the usual use-case.
06:36G0SUBsamaaron: ZK is a distributed orchestrator, it's designed to be run separately from your app.
06:37samaaronah ok
06:37samaaroni like the idea of a distributed orchestra better though
06:37samaaron;-)
06:37G0SUB:-)
06:38samaaronG0SUB: how's india today?
06:38G0SUBsamaaron: sunny right now.
06:38samaaronsuper :-)
06:38G0SUB:-)
06:39G0SUBGood day for Clojure. Not so much for Scala unfortunately.
06:40samaaronyeah, i'm reading Coda's email right now
06:40G0SUBsamaaron: read it. it's interesting.
06:41samaaron"comic buffoonery"
06:41samaaron"The first guy and the second guy seem to hate each other"
06:44G0SUBcemerick
06:45ejacksonCEMERICK !
06:45samaaronCEMERICK!!!!
06:46darqhello. has someone experience putting maps into a tree (using zippers)... similar to a family tree ... the map holds the keys and values and can have children (a map)...
06:50G0SUBholy sh!t. Avout works!
06:50samaaronG0SUB: you're surprised?
06:51G0SUBsamaaron: elated, actually.
06:51ejacksoncan you share your use case ?
06:51samaaronare you going to do a BeeGee jig about the room?
06:52samaaron"staying alive"
06:52G0SUBbuilding a PoC distributed caching system on top of avout.
06:52ejacksonPoC ?
06:52ejacksonPrinciples of Clojure
06:52G0SUBProof of Concept
06:53ejacksonaaah
06:53G0SUBimagine extending clache/unk to use avout which in turn persists the cache in Redis.
06:53clgv"but at some point a best practice emerged: ignore the community entirely." :O
06:53ejacksoni'm smelling killer app
06:53G0SUB:-)
06:54G0SUBI am setting up a few nodes in the office for some testing.
06:56G0SUBit's amazing how Clojure's design principles lend themselves to such elegant solutions to incredibly complex problems.
06:56G0SUBit almost feels like cheating.
06:57samaaronG0SUB: i know how that feels
06:57G0SUByeah
06:58samaaronone thing that interested me about the ant-scala email was the focus on optimising code
06:58samaaronyou rarely see that being used as an argument against clojure
06:58samaaroni wonder if that's because we're tryign to solve tricky problems rather than trying to replace stuff which works well in Java already?
07:00G0SUBsamaaron: I for one, don't understand how a statically typed language like Scala can need InvokeDynamic.
07:00G0SUBI feel they are doing something too clever, whereas Clojure sidesteps such needs entirely.
07:00samaaronor why a statically typed langauge needs to rely on conventions to avoid library collision issues
07:01G0SUBScala, FWIW has a turing complete type system.
07:01G0SUBor so they say.
07:01samaaronG0SUB: yes, exactly - I see this kind of thing in the labs all the time - people focussing on efficiency far too easily and in my opinion needlessly
07:02samaaronusing an On^3 algorithm is *find* for small values of n
07:02samaarons/find/fine/
07:02hiredmanright, but some people have big ns
07:02G0SUBsamaaron: I don't think it's just algorithmic. Scala is trying to marry Haskell & Java semantics. imagine that!
07:02hiredmana lot of people these days actually
07:02samaaronhiredman: sure, so then you worry about it
07:03samaaronbut worryign about it all the time for everything seems non-sensical to me
07:04samaaronand probably contributes to super complicated codebases
07:04cemerickeh, usually the simplest things are the fastest
07:04samaaronalso, I remember having a chat with Joe Armstrong about this matter
07:04samaaronhe said one of the core Erlang contributors wrote a super fast XML parser using all his knowledge of Erlang internals
07:04samaarontricks and special moves everywhichway
07:05samaaronit was pretty fast
07:05samaaronthe next year, he wrote a different XML parser
07:05samaaronthis time he focussed on making the code readable and simple - purely with the intention of making something people could learn from
07:05samaaronit turned out to be more effecient
07:05samaaronefficient
07:06samaaronfasterer
07:06samaaronso there's a super smart, crazy knowledgeable hacker using a language he has deep knowledge about - and still surprising himself about efficiency
07:07notostracaok, I have lein working, but I want to rename core.clj
07:07notostracaand it can't find utils.clj when I rename it and the namespace
07:07notostraca*when I rename the file
07:07samaaronnotostraca: what can't find utils.clj?
07:07notostracalein compile
07:08samaaronnotostraca: ah ok, i've never needed that so i'm unlikely to be able to help :-)
07:08notostracaI have :aot set to vc.utils , which is the ns declared in utils.clj
07:09clgvnotostraca: like in java your namespaces have to reflect the path to the file. so vc.utils has to be in vs/utils.clj
07:09notostracait is
07:10clgvno typo?
07:10notostracaif project.clj is in vc/ , utils.clj is in vc/src/vc/utils.clj
07:10algalpossibly a dumb question, in clojure 1.3 what's the canonical way to check if one string contains another? I notice "substring?" was in contrib and it doesn't live in clojure.string.
07:11clgvnotostraca: sounds fine
07:11notostracalein compile throws a file not found exception
07:12notostracaException in thread "main" java.lang.RuntimeException: java.io.FileNotFoundExcep
07:12notostracation: Could not locate vc/utils__init.class or vc/utils.clj on classpath:
07:12notostracadoes it need to look in src?
07:12AWizzArd|workOMG, what a troll: http://scottlocklin.wordpress.com/2011/11/30/only-fast-languages-are-interesting/
07:12notostracaand how would I set it to look in there?
07:13notostracahey, it works
07:13notostracaI had set :source-path "src/vc"
07:13notostracawhich apparently screwed it up
07:14clgvnotostraca: yeah. skip it (default is "src") or set it to "src"
07:14notostracaah
07:14notostracawell, it works
07:14notostracanow to call it from java
07:25notostracaOK, now it doesn't seem to export any class
07:25notostracado I need an init function?
07:27raeknotostraca: you need to add something like :aot [your-ns] to tell Leiningen to emit class files for that namespace
07:27notostracayes, I have that
07:28notostracabut "lein jar" generated something weird
07:28raekok. then you need a :gen-class in the ns form of that namespace
07:28notostracait has, for example, a vc.lib package in the jar
07:28notostracayes
07:28notostracaI have thar
07:28notostraca*that
07:30notostracahttp://pastebin.com/5F4heU6b
07:31notostracaI am prefixing my function names with -
07:31notostracaI don't quite know what that does
07:33notostracaI am just typing "lein jar" -- do I need an argument?
07:33raeknotostraca: check the documentation for 'gen-class'. you need to list each method you want to have in the generated class
07:33notostracaoh?
07:34raeknotostraca: also, nesting def forms probably don't do what you think
07:34raekuse 'let'
07:34clgvraek: the "-" prefix should work afair
07:34notostracahttp://clojure.org/compilation doesn't seem to be a problem?
07:34notostracayeah that's why I used -
07:34raekdef mutates *global variables*
07:35notostracaI will refactor once I have something working
07:35clgvnotostraca: looking at your code you should definitely take the time to read some introductory material ;)
07:35notostracaand I should use "defn -read-obj" instead of "defn- read-obj" right?
07:36notostracaclgv, yeah I was going off of memory
07:36raeknotostraca: if you just need an object that a java program can interact with (and not a named class), it is probably easier to just write an interface in java and then implement it with proxy
07:36notostracaI learned a bit of clojure a long time ago
07:36raekdefn- means private defn
07:36raekthe - prefix is the default prefix of gen-class
07:36notostracaraek, I think I need a named class
07:37raekhttp://clojuredocs.org/clojure_core/clojure.core/gen-class
07:38raeksorry, you don't need to list all methods. that's what the prefix is for.
07:39raeknotostraca: your file should generate a class called "vc.utils" with the methods load_tsv, read_obj and write_obj
07:40raekdon't forget the this parameter
07:40notostracawhich parameter?
07:40notostraca:name ?
07:40raekif a method is not static, it will take an additional argument corresponding to "this" in java
07:41notostracaah
07:41notostracaok
07:42raekI'm not sure what happens when a method is not listed in :methods and does not appear in an interface the class implements
07:42raekmaybe it is not included
07:43raeka simple call to "javap" with the generated class file should answer the question
07:46notostracahuh
07:47notostracathe file it generates only has a method static {} and a constructor, plus some auto-generated stuff like a hashCode() and equals()
07:47notostraca(from javap TSVReader)
07:49raektry :methods [^{:static true} [load-tsv [string] Object]] ...]
07:50raekthe clojure compiler needs to know the type signatures of the methods, so it makes sense that only inherited and explicitly declared methods are included
07:53notostracaah OK
07:53notostracathey should be typed now
07:54notostracahuh, compiling I get: Not a valid method name: load-tsv
07:54raekalso I'm not sure how thne hyphens in the method names end up
07:54raekmaybe they are translated to underscores
07:54notostracawell how do I rename them?
07:54raekheh
07:55clgvraek: I solved the "running in jar" issue by examining the property "sun.java.command"
07:55raekI think you have to name the function loadTsv instead...
07:55raekI'm not aware of any renaming mechanism in gen-class
07:55notostracaraek, syntax for that?
07:55notostracaor do I rename the actual methods?
07:56raeknotostraca: i.e. write (:gen-class :methods [^{:static true} [loadTsv ...] ...]) and (defn loadTsv ...)
07:56notostracaah OK
07:57raekit looks like the clojure compiler receives the name directly as it is, which means that you cannot use hyphens since those are not allowed by the JVM
07:57raek(but they are ok in the prefix)
08:09notostracaraek, it only seems to generate the first function in the file
08:10notostracaor rather, in the list
08:11notostracahttp://pastebin.com/ftnQ5r5E I am sure I have some syntax wrong somewhere
08:13raeknotostraca: yes. there should be one vector for each method, and each one needs the :static metadata
08:13cemerickOT: is there an equivalent to with-open in ruby?
08:13raeknotostraca: :methods [^{:static true} [loadTSV ...] ^{:static true} [readObj ...] ^{:static true} [writeObj ...]]
08:13notostracagot it
08:14hiredmancemerick: a lot of things take blocks for iterariting
08:14notostracathanks raek
08:15cemerickhiredman: oh, open a file for reading, pass it a proc or something, and it manages itself after the proc has consumed its lines, etc?
08:15hiredmanIO.readlines
08:15hiredmanbroadly
08:18francislHi guys!
08:18francislI'm starting with clojure and I want to create a jetty context handler, is gen-class the way to go?
08:21notostracaraek, if I want to have the functions return Java collections instead of just Objects, how would I do that? I actually can't be certain of the types of the values in the map...
08:21pyrfrancisl: if you want to handle http queries with clojure
08:21pyrfrancisl: use ring
08:22pyrfrancisl: (or anything built on top of ring)
08:22fdaoudlove ring & friends
08:22notostracaeh, I will puzzle this out later, it is 5:13 AM here
08:22notostracanow for the sleeping times
08:23francislok, I already made a prototype with scala and jetty, so I tried to follow the same path
08:23fdaoudshee, notostraca you're going to bed 45 mins before I wake up..
08:23ejacksonfdaoud: you're sleeptyping ?
08:23notostracahahaha
08:23fdaoudlol
08:23francislthank you, I'll take a look at ring
08:24fdaoudejackson: yes, I just hope I save whatever I write, my best work is done by my subconcious
08:51jweissamalloy_: saw you did more commits on serializable.fn last night, tried it this morning, looks better! thanks. It works fine w clojure 1.3, just had to change ^Writer to ^java.io.Writer. maybe the project.clj shouldn't depend on 1.2.1 (that would pull it into any project that uses serializable.fn, right)?
09:48paulK_hello, I have a question concerning type hinting of anonymous functions
09:48Raynesjweiss: No.
09:48Raynesjweiss: Whatever version that your project depends on wins.
09:49jweissRaynes: ah good
09:49paulK_Can I pass a type hinted (primitives) anonymous to another function and call the type-hinted version?
09:51ejacksonI’d rather suck a dog’s nose dry than lend a hand to the nerd slapfights on Hacker News
09:51ejacksonLOL
09:51ejacksonhttp://codahale.com/the-rest-of-the-story/
09:51cemerickIt seems to have gotten rather slapfightesque.
09:52ckirkendall`word of the day slapfightesque
09:52cemerick"of, or pertaining to a slapfight"
09:53hiredmanyesterday's was idioglossi
09:53ejacksonand tomorrow; idioglossesque
09:54pareidoliaHi all ! Can anyone hint me with Noir/Ring ? Or point me to another channel? I would like to let the wrap-multipart-params middleware use a byte-array-store. But just adding the function doesn't work, I need to replace the old one (I think). Thanks!
10:07fdaoudejackson: that was quite interesting, thanks
10:08fdaoud"The essence of it is that the friction and complexity that comes with using Scala instead of Java isn't offset by enough productivity benefit or reduction of maintenance burden for it to make sense as our default language."
10:09luciani was just disgusted by the syntax
10:10fdaoudlucian: +1
10:10lucianand then scared a little by the overly complex type system
10:10fdaoudand it's all at the other end of the spectrum with clojure
10:10Wild_Catwhat little I saw of Scala made Haskell's type system look trivial.
10:10lucianthey had the chance to at at least do Ruby-like syntax, or even better, Python-like
10:10fdaoudvery little syntax, very consistent, few types, lots of functions to get things done
10:11lucianWild_Cat: it's not trivial, just less complex (because it works around nothing)
10:12lnostdalis there some verbose mode or something for lein? .. lein deps is taking ages, and i have no idea why
10:13Wild_Catlucian: well, I remember reading a blog post by... I think it was Steve Yegge, that mentioned Scala's type system had something called "complexity complexity<T>"
10:14Wild_Catat that point, I really felt like it was a parody of a type system.
10:14lucianWild_Cat: yeah, it's pretty terrible
10:14ChousukeHaskell's type system is interesting, but it gets more interesting once you read all the papers about possible extensions to it
10:15TimMcejackson: Wow, small internet. Two clicks from that article and I see the name of a friend of a friend from a non-programming context.
10:15Chousukeeg. that one about typed kinds and whatnot :P
10:15lucianChousuke: the main plus is that it's not 1) useless (like java's) or 2) insane (like Scala's)
10:15Chousukeyeah. It has its limitations though
10:15ejacksonTimMc: weird.
10:16Chousukelucian: To be honest though, Scala's type system is only made insane by its requirement to be JVM-compatible.
10:16Wild_CatHaskell's type system looks really badass, but I feel the rest of the language and its ecosystem suffer from a distinct lack of pragmaticism
10:16Wild_Cat(see: docs where they dedicate 10 pages to proving stuff about their lib, but don't even give you a 1-line "how to use it")
10:17ChousukeWild_Cat: That may just be because Haskell is the favourite of most programming language researchers
10:17cemerick~scala
10:17clojurebot{((x: Any, y: Any) => (f: Function2[Any, Any, Any]) => f(x, y))(1, 2)((x: Any, y: Any) => x)}
10:17OlegYchsteve yegge is a comedian
10:17Wild_CatChousuke: likely. If anything, I agree with the statement that before designing a new language, one should look at Haskell, because that's where the new cutting-edge stuff happens
10:17ChousukeWild_Cat: A lot of the research subjects have surprisingly real applications though. It's just hard to see.
10:18Chousukefunctional reactive programming seems really interesting for example.
10:18fdaoudI love clojure
10:18TimMcejackson: Also, I don't think I needed the mental image of sucking on a dog's nose this early in the morning. :-(
10:18fdaoudto those who are afraid of parens, amit does a neat trick in clojure in action book where he turns xml into scheme
10:18Wild_CatChousuke: yeah, for network programming, right?
10:18ChousukeWild_Cat: UIs
10:18Wild_CatUIs?
10:18Wild_Catinteresting.
10:18cemerickTimMc: there are a *lot* of other metaphors he could have gone with :-P
10:18ejacksonTimMc: It was rather creative....
10:18ChousukeWild_Cat: but it seems usable for anything with non-pure interactions.
10:19ChousukeNot that I understand it very well yet.
10:19ChousukeI'm not well versed in haskell at all, just a casual observer
10:20Wild_CatI'm deferring attempting to learn Haskell again until I've become proficient in Clojure
10:20ChousukeOne big problem for functional languages nowadays is that they're pretty bad at frontend stuff... user interaction.
10:20Wild_Catyeah... That's a problem with purity: UIs and i18n are anything but.
10:20Chousukesince most UI paradigms are completely at odds with functional programming
10:21gtrakisn't it kinda hard to run out of things to learn in lisp?
10:21ChousukeWild_Cat: That's not really the problem. You can describe an UI and its interconnections perfectly in a declarative manner.
10:21Wild_CatChousuke: yeah, but i18n, for example, requires runtime decisions and I/O.
10:22ChousukeWild_Cat: think eg. interface builder generating XIBs
10:22ChousukeWild_Cat: that's not really an issue for functional programming. You can do IO using monads and you can in principle write a declarative description of how the UI reacts to varying input lengths
10:23ChousukeWild_Cat: the main thing is that most UI toolkits just assume you have, and can't avoid, shared mutable state everywhere in your UI
10:23Wild_CatChousuke: actually, I'm thinking of the simpler stuff: the static strings you have in your UIs -- those can be described declaratively, but which string to display is a runtime decision based on a config variable
10:23Wild_Catyeah, that too.
10:24ChousukeWild_Cat: in the UI description you can use a that config variable. The UI rendering engine can then do the IO
10:24hiredmanI've been sort of fiddling around with rules engines, and uis seem like the killer feature for them
10:25hiredmanor I should say, plumbing uis together with the rest of the code
10:25ChousukeWild_Cat: the rendering of UIs will always be a side-effect (obviously). The formation of the UI doesn't have to be.
10:25fdaoudhiredman: which rules engines did you try out?
10:25Chousukeit's similar to how the IO monad works
10:25Chousukean IO monad value is just a description of the IO that is performed. it's a pure, non-side-effecty value.
10:25hiredmanfdaoud: :) I haven't actually got that far, reading and looking through drools code to see if I can get it to let me write rules in clojure
10:25Chousukeand as such, perfectly composable
10:26gtrakhiredman, core.logic?
10:26Chousukethe side-effect happens when you do the run, but that's the point where you know you're exiting the pure functional world :)
10:26hiredmangtrak: no, I don't want to implement a rules engine
10:27gtraki mean, i thought we already had one, wondering if you've looked at it
10:28hiredmancore.logic has the pieces you could use to implement one, I think
10:28gtrakah ok
10:30fdaoudfor ui programming, couldn't you use clojure's state mgt facilities to use a simple event-based/pub-sub system to update the ui?
10:31Chousukefdaoud: that only handles one part of the issue.
10:31hiredmanuis tend to result in a lot of complex conditionals throughout the code
10:31Chousukefdaoud: you still need to work with UI toolkits designed for OO programming
10:31fdaoudright, right
10:31Chousukeand it's ugly. you don't get fully composable UIs
10:32fdaoudif (admin) { showDeleteUserButton() } and so on
10:32gtrakah, that would be awesome with a rules engine
10:32fdaoudat some point you'll need some glue code to your ui toolkit, I guess
10:32hiredmanI think straight up clojure code is pretty nice for creating uis, it's the logic of the interactions that is a pain
10:32Chousukethere was this cool haskell paper that was about a declarative UI API, it allowed you to do things like write an UI, then transform it with a "mirror" function, and then render the UIs side-by-side
10:33Chousukeand they'd update in sync, and respond correctly to user input
10:33Chousukeexcept the other half was mirrored, while the other wasn't.
10:33Chousukehow easy is that to do with eg. Qt?
10:33gtrakyou could do it if the ui descriptions were a layer separate from the rendering, like a MVVM
10:34Chousukeyeah, the description part is key. If you're working with descriptions, it's perfect for functional programming.
10:35Chousukesince descriptions can be transformed and copied and in general treated as immutable as values without affecting other descriptions
10:35gtrakdeclarative views, and a data binding glue
10:37hiredmanis oop a bad thing for guis?
10:37Chousukeprobably not.
10:37ChousukeI tend to think inheritance is though.
10:37gtrakyou guys ever used Mate framework on flex?
10:37hiredmansure, the bad bits of oop are bad everywhere :)
10:38gtrakhttp://mate.asfusion.com/assets/content/diagrams/two_way_view_injection.png
10:40fdaoudsay, what is the best way in clojure to have a queue of "things to be done"? on one end, A puts in a request to "do something" (like insert a record into a database), returns immediately, and on the other end, B takes that request and executes it?
10:40lnostdalclj-http can't send cookies? O_o
10:40fdaoudnot really publish subscribe I guess, since only one guy should execute the action
10:41gtrakfdaoud, agents?
10:41hiredmanfdaoud: a queue
10:41hiredmanfdaoud: there are a number of different ones to choose from
10:41fdaoudgtrak: that's what I'm thinking, but I'm not sure.. agents have this state.. I don't need to update a state
10:41hiredmanjava.util.concurrent.LinkedBlockingQueue is my go to
10:42gtrakfdaoud, queues have a state as well
10:42fdaoudhiredman: yes, a basic queue, certainly not rabbitmq or activemq
10:42fdaoudgtrak: true
10:42gtrakfdaoud, although agents don't guarantee in-order execution
10:42hiredmangtrak: agents are state + a queue of actions
10:43gtrakwhat's on a queue is also a lot like state, no?
10:44hiredmanhow so?
10:44clgvgtrak: agents dont guarantee order? that would be new, wouldnt it?
10:44fdaoudhiredman: how do you use j.u.c.LBQ in clojure?
10:44fdaoudjust make calls to it?
10:44hiredmanfdaoud: same way you use any bits of java
10:44fdaoudok
10:45gtrakclgv, it's executed in a thread-pool, transactionally, within the transaction you'll get order
10:45hiredmangtrak: no
10:45clgvgtrak: the agent has only one thread afaik
10:45hiredmangtrak: agent actions are queued up, so from a single thread actions are executed in order
10:45fdaoudhiredman: I just want a basic way of saying "I want this to get done, but I don't want to know who does it, and I don't want to wait." does LBQ sound good for that?
10:45gtrakah, I thought it was concurrent
10:46hiredmanfdaoud: no, sounds like you want an executor
10:46hiredmanclojure has two
10:46hiredmanmost likely you just want to use future
10:46clgvfdaoud: FixedThreadPoolExecutor should fit
10:46hiredmanclgv: but you don't want to create new executors
10:47hiredmanfdaoud: I see now your question about queues was a red herring
10:47clgvhiredman: actuall I already wanted and did create them ;)
10:47fdaoudhiredman: I'm sorry, it was not intentional
10:47clgvI wanted a producer-consumer-scenario with limited thread number
10:48hiredmanclgv: right, and so did every other framework you use, and now you have 10 threadpools sized to n+2 cores
10:48hiredman:(
10:48gtrakhmm, what does this mean? " Actions dispatched to an agent from another single agent or thread will occur in the order they were sent, potentially interleaved with actions dispatched to the same agent from other sources."
10:48clgvhiredman: no! I have the threadpool with the desired number of threads,
10:48gtrakthey still will be executed serially I guess
10:49hiredmangtrak: it means actions are FIFE (first in first executed)
10:49fdaoudhiredman: in my mind, I visualized a queue of things to get done, with people putting stuff on it on one end and others taking them and executing them on the other
10:49fdaoudsorry if that was misleading
10:50fdaoudI just want to decouple "add a user" from "how that gets done", and I also want the caller to return immediately
10:50hiredmanfuture
10:50fdaoudthanks hiredman
10:51fdaoudhiredman: so what do you use LBQ for?
10:51gtrakfuture uses the unbounded agent thread pool, right?
10:51hiredmanfdaoud: if I want to shuttle data around
10:52hiredmangtrak: yes
10:52gtrakfdaoud, you don't actually care about the order of execution, so you don't need to manage the details of a queue
10:53hiredmanyou just want fire and forget
10:53gtraklike for multiple requests, i mean
10:53fdaoudgtrak: good point
10:53fdaoudyes, fire and forget
10:53fdaoudbut also not know too many details of "fire"
10:53fdaoudi.e. the guy who fires "add a user" should have no idea of databases etc.
10:54gtrakthe OS already has a thread scheduler, that's your queue
11:03Kototamahi, can somebody help me two combines two handlers into one with compojure? tried with (routes) without success
11:04gtrakckirkendall`, why'd you cincyfp guys go with wordpress over meetup? do you think meetup would be worth the cost?
11:12kevin_8019Rich Hickey mentioned a paper in one of his presentations about state and identity. Does anyone know the paper?
11:13Fossimeetup actually costs money?
11:13gtrakyea
11:14Fossiwow. the damn thing annoys me to death even without having to pay
11:14gtrakyea, it does have critical mass though
11:15gtraki think maybe i'll spring for it if I can get something regular established first
11:15gtrakI don't want to responsible for entertaining tons of people without some help :-)
11:16gtraki'm a total newb at this
11:16Fossipoint in case: i wanted to check out their registration and it won't let we create a group because i somehow lack topics
11:17Fossino clue what they want :>
11:17gtrakthey should make it free up to like 5 people, or ads or something
11:18Fossi"75 people dedicated to making this the very best way to get Meetups going" wth
11:18ambrosebsclojurebot: why don't you run core.logic? you'd probably be smarter
11:18clojurebotchouser: Some high-tech profiling with Activity monitor and println shows that I'm doing 100% of one core and not so much IO, though the number of files being read is huge(I estimate 5 per second).
11:19gtrakit's not expensive, it's just the principle of the thing
11:19Fossii didn't even know it's not free
11:20Fossiwe've been hacking a homepage for the hamburg.de usergroup for a while now to get rid of the thing
11:20Fossibut since we only meet once a month progress is real slow ;)
11:21kevin_8019Rich Hickey mentioned a paper in one of his presentations about state and identity. Does anyone know which paper it was?
11:21gtrakkevin_8019, 'Are we there yet?'
11:21gtrakah, a paper
11:22kevin_8019yeah, exactly
11:22gtrakFossi, yea, I'm expecting to take the brunt of the effort until the group gets going
11:23gtrakkevin_8019, you mean the Bagwell paper?
11:24gtrakhttp://lampwww.epfl.ch/papers/idealhashtrees.pdf
11:25kevin_8019maybe that was it...
11:25kevin_8019I thought he mentioned a paper which defined his point of view on state/identity/time
11:26gtraki think he just reference alfred north whitehead a lot, i just glanced over the slides
11:26gtrakand he referenced this: http://www.amazon.com/Process-Lectures-Delivered-University-Edinburgh/dp/0029345707
11:27raekkevin_8019: This could be related too: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.23.9999&amp;rep=rep1&amp;type=pdf
11:27raek"Equal rights for functional objects or, the more things change, the more they are the same"
11:28kevin_8019Yeah, I'm pretty sure the last one is it
11:28kevin_8019Thanks!
11:29raekthere it is argued that an equality operator makes much more sense when value and state are separated
11:33gfredericks,(= (atom nil) (atom nil))
11:33clojurebotfalse
11:41TimMc&(= @(atom nil) @(atom nil))
11:41lazybot⇒ true
11:57jweissis there a way to suppress printing of namespaces with pr?
11:57clojurebotamespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it
11:57jweissgee thanks clojurebot
11:57cemerickprinting of namespaces?
11:58hiredmanon symbols and keywords I imagine
11:58hiredmanjweiss: no
11:58jweissyeah, like i don't want to see clojure.core/fn* just fn* or whatever
11:59cemerickjweiss: what are you trying to do?
11:59jweisscemerick: print out lists in a readable way, but i don't want indentation like pprint
11:59clgvwhy should on not try to use namespaces without a period in it? they work fine as the others do
11:59raekbe able to read the output of macroexpand for a non-trivial expression? :P
12:00TimMcclgv: Single-segment namespaces are allegedly trouble. *shrug*
12:00clgvTimMc: why?
12:00TimMcI've never seen a good explanation.
12:00cemerickjweiss: sounds like lists of macroexpanded code, if you've got 'clojure.core/fn* symbols around
12:00jweisscemerick: that was a bad example, more like clojure.core/deref and the like
12:01jweissi'm doing data driven testing, so the data used for each test contains not just strings, ints, lists, etc but fn's. i serialize the fn's but i just want to be able to see what it does, generally, not necessarily deserialize it
12:02jweissso not having ns's is more readable for me
12:02cemerickSo you're never going to try to load the code back in?
12:03jweisscemerick: no, not if i disable the printing of ns. if i later really decide i want it to be deserializable, i'll switch back. for now i'm just using serialization for readability
12:04jweissIOW, i want someone to look at the serialization and know what the test *does* but not necessarily copy/paste it and run himself
12:05cemerickThere's no reasonable way to make symbols print without their namespaces. You could use clojure.walk to replace namespaced symbols with their unqualified equivalents.
12:05clgvjweis: cant you walk the forms and replace the symbols by their (name %) ?
12:05replaca_jweiss: you could use pretty print with a custom dispatch func
12:06jweissreplaca_: i was thinking of using pprint, since it does what i want except for whitespace formatting
12:06jweissshould be able to set right margin to 100000 or something :)
12:06replaca_then you can get all the "cleanup" that pprint does, but skip the newlines and whitespace
12:06jweissok, i'll look into that
12:06replaca_yeah, I think you might be able to just set it to nil
12:09replaca_there might be an issue with performance these with very large structures
12:09replaca_but with reasonable stuff you should be OK
12:10jweissreplaca_: perf shouldn't be an issue, small structures
12:10jweissi'll try that, thanks
12:10replaca_cool, enjoy
12:11TimMc&[*ns* (namespace `x)]
12:11lazybot⇒ [#<Namespace sandbox11845> "clojure.core"]
12:11TimMc,[*ns* (namespace `x)]
12:11clojurebot[#<Namespace sandbox> "sandbox"]
12:11TimMcI'm having trouble understanding lazybot's response there.
12:12gfredericksthe former is resolved at compile-time I think, while the latter at read-time
12:12gfredericksso who knows what sort of witchcraft-discrepancies lazybot produces between the two
12:12TimMcSo, what is lazybot doing to make the two different?
12:12TimMcyeah
12:13gfredericksI don't even know if it's correct to say *ns* is resolved at compile-time
12:13gfredericksprobably runtime?
12:14gfredericksat compile-time I think the '*ns* gets resolved to #'clojure.core/*ns*
12:14hiredmancorrect
12:14hiredmanthe var is then deref'ed at runtime producing a value
12:14gfrederickswoohoo!
12:14gfredericksa year of getting corrected by hiredman and finally I know a bit about vars.
12:15gfredericks:)
12:16TimMcSo... (ns) changes the value of *ns*?
12:17gfredericksat compile-time I think
12:17gfredericksI was just trying to work out where the second value comes from
12:17TimMcThe reader handles `, yeah?
12:17gfredericksyeah
12:17TimMcMacros get symbols fully resolved.
12:17gfredericksis *ns* rarely used at runtime? I'm not even confident what its value would be...
12:18hiredmandepends on how you run your code
12:19hiredmanvia -jar or clojure.main or lein run it'll typically be clojure.core
12:19gfredericksokay, so *ns* at runtime isn't very useful
12:20hiredmanthe current ns is the top of a stack, in-ns pushes a new ns on to the stack for compilation
12:21gfredericksthat makes sense
12:23TimMcHow do you pop the stack?
12:24RaynesProgram in Factor. ;)
12:28TimMc(And what would that even mean?)
12:29RaynesTimMc: It'a a stack-based programming language.
12:30jamiltronIt's also one of the most awesome languages around, imho.
12:31TimMcRaynes: I was referring to my previous statement.
12:31RaynesTimMc: lrn2beclear.
12:32TimMcHow can I speak clearly when my thoughts are muddled?
12:39dnolenambrosebs: how's using the analyzer going?
13:01leo2007Can swank-clojure show java functions arglist?
13:02technomancy_leo2007: sure, just use C-S-i and enter a java class, it will list all the methods
13:04rickmodeI'm trying to dispatch to multiple functions based on class. I did it via multimethods. Is there a way via datatypes? defprotocol / deftype?
13:04leo2007technomancy_: that's something new to me. Thanks. However, can it show the arglist in the echo area when typing SPC?
13:05leo2007much like what happens to clojure functions.
13:05technomancy_rickmode: if multimethods are working for you, keep using them.
13:05technomancy_leo2007: no, because generally types aren't known at that point
13:05jweissi wish the inspector would show constructors
13:06technomancy_jweiss: I wish constructors were just methods
13:06jrabbitSomeone whos familiar with clj-processing: can the applet be defined in a function or some how automatedly called? I get a scope problem with the applet if it wrap it all in a defn
13:06rickmodetechnomancy_: it's working fine. I was totally lost on the dispatch fn originally (I wanted to add extra parameters to my functions than the discriminant and it took me a good while to grok the dispatch fn and the isa? check.
13:06jrabbit#<CompilerException java.lang.IllegalStateException: Var rosado.processing/*applet* is unbound. (NO_SOURCE_FILE:0)>
13:06technomancy_it's so idiotic; they have no excuse for not just cribbing from smalltalk
13:06leo2007technomancy_: thanks.
13:06technomancy_leo2007: theoretically you could hook into type hints, but those aren't used enough for anyone to have bothered going to the trouble of implementing that
13:07hiredmanthe inspector could show constructors
13:07hiredmanwhoever wrote it just didn't put them in
13:07technomancy_jochu!!!!11
13:07hiredmanthey are available via reflection just like method information
13:09hiredmanyeah emacs-inspect :class just gives you fields and methods, constructors could be added
13:09technomancyyeah, somebody should go do that
13:09technomancybut not before wiring clj-stacktrace into swank
13:09technomancybecause that's way more useful
13:09hiredmanmeh
13:10technomancyI should put a bounty on that or something
13:10technomancyone signed leiningen t-shirt
13:10hiredmanit would take something like 20 minutes to write constructors in
13:10technomancywhat I really want is argument names in the inspector
13:10technomancybut those aren't reified in the bytecode. ;_;
13:11hiredmanmeh
13:11hiredmanthey are
13:11hiredmanjust not via the reflection api
13:11technomancyoh?!
13:11technomancyiiiiiinteresting
13:12technomancyyou can get them via javap then?
13:12jrabbithttps://github.com/rosado/clj-processing/blob/master/src/rosado/processing.clj#L18
13:25fdaoudhiredman: about futures, "They are a way to get code to run in another thread, and obtain the result." However, I don't need/want to obtain the result. Does that mean there is a solution better-suited to what I am trying to do?
13:25hiredmanfdaoud: future
13:25fdaoudstill future, even if I never deref?
13:27fdaoudhiredman: so if never doing a deref on the future is not a problem, ok then--thanks
13:33gtrakhmm, a future won't get GC'd until it's done executing right?
13:34TimMcgtrak: There will still be references to it until it has executed.
13:34gfredericksif it could get garbage collected I would think that indicates a deeper problem, i.e. it's been forgotten about
13:34TimMcNow I'm imagining a "weak future".
13:34gtrakTimMc, in a thread-pool executor or something?
13:34TimMcgtrak: That's my guess.
13:35gfredericksTimMc: a "forgettable" future :)
13:35TimMcIf a future falls off the reference graph, does it make a sound?
13:35gfredericksnot in the present
13:37gtraka weak future seems more functional
13:37TimMcgtrak: As in, it can't be used reliably for side-effects?
13:37gtrakhaha yea
13:39gtraki guess if you're using a future at all, it should be a side effect
13:41TimMcIs that true?
13:44gtrakhmm, well at the very least it's a complection of the method of computation with a value
13:44gtrakmaybe that's not the same as a side-effect?
13:47TimMcI'm trying to think of a scenario where you might want to start computing a value but it's possible that you stop caring at some point.
13:48TimMc...in a separate thread of execution.
13:48gtrakit's a side-effect in the sense of having to be conscious of cpu and mem i/o?
13:48TimMcmeh
13:49gtrakat any rate, it's no longer pure-value functional
13:49TimMcwhy?
13:49clojurebothttp://clojure.org/rationale
13:49gtrakhmm...
13:49gtrak:-)
13:50gtraknope, i'm wrong, it's still functional, it just has no meaning without thinking in non-pure terms
13:50TimMcyeah
13:52TimMcMaybe it would be complecting a calculation's dependency graph with a particular optimization method (explicit calls to the threading API.)
13:53TimMc(At least Rich has us thinking about that, even if no one is using the term quite the same way.)
13:53gtrakyea
14:08TimMcRaynes: So... why does lazybot give "clojure.core" for (namespace `x)?
14:09RaynesBecause it feels like it, I guess.
14:09TimMcclever bot
14:10amalloyhiredman: really, you can get argnames out of the bytecode? my experience has been that even very-mature products like eclipse don't do that, so i've been assuming it's impossible
14:10TimMc"very mature"
14:10TimMcis that euphemism ;-)
14:10TimMc+a, etc.
14:11hiredmanamalloy: it might just be locals
14:12hiredmanno, the localvariable table can hold the names of arguments to methods
14:13hiredmanhttps://gist.github.com/1410334
14:14hiredman"x"
14:19amalloywell dangit, now i want to know why eclipse didn't do this for me. would have saved me a lot of time figuring out how to get it to convince it of where javadocs for external libs live
14:22hiredmanwell, who could ever be bothered trying to get anything to do anything with eclipse?
14:23gtrakamalloy, eclipse can use maven to download source for deps
14:23gtrakit's pretty slick, actually
14:24amalloygtrak: yeah, during the time i was using much eclipse, maven wasn't around/popular
14:25gtrakthe integration's improved a lot
14:25gtraki think I caught it magically downloading source for libs in projects that weren't using maven
14:27licenseranyone read the long letter about scala? Chrisshouser posted a link on twitter.
14:27amalloyi skimmed in the middle
14:28gfredericksapparently @chouser is somebody else, less popular
14:29licenserI wonder if clojure will be facing some of the same problems
14:30gtrakthere's the languages people hate and the languages no one uses?
14:30licenserheh
14:30tensorpuddinghttp://codahale.com/downloads/email-to-donald.txt
14:31tensorpuddingis what you're talking about right?
14:31licenseryap this one
14:31licenserI found it quite interesting
14:32ckirkendall`licenser: I actually switch from scala to clojure because I felt the language complexity itself made it unusable for the average developer. I do not have the same feeling about clojure.
14:32licenserso I kind of fear that some of the problems are problems clojure might face too
14:33licenserckirkendall`: that is true clojures code isn't complex
14:33gtraklicenser, read alex miller's post yet? http://tech.puredanger.com/2011/11/29/language-criticism/
14:33ckirkendall`The culture is a lot more unified in clojure also. Scala suffers from trying straddle the fence so you get zelots on both sides. Clojure just jump the fence so we only have one kind of zelot
14:33TimMclicenser, tensorpudding: http://codahale.com/the-rest-of-the-story/ <-- the author's response to his leaked letter
14:33licenseroh cool :)
14:34TimMcfeturing some interesting turns of phrase
14:36licenserTimMc: I did not in any way meant to talk against scala I know nothing about the language ;
14:36licenser0
14:36TimMchmm?
14:36licenserI just figured both are 'new' JVM languages so some of the problems might be the same :)
14:37TimMcOh, I know nothing about Scala either.
14:38TimMcClojure would not have the *same* problems.
14:38gtrakclojure could have similar problems in terms of getting people to use it, libraries
14:38TimMcI've been meaning to start and curate a "Clojure gotchas" page.
14:39licenserwell for once the build tool storry reminded me of my trouble with clojure :P even so I think since lein and cake combine forces we might get the perfect one ^^
14:39TimMcThe lack of Javadoc in clojure.lang is troubling.
14:39TimMcThat's a serious impediment to integration from the Java side.
14:39licenserAlso I wonder if clojure would face the same performance issues that were mentioned
14:39gtrakintegration's pretty smooth, isn't it?
14:40licenserthe one time I had code heavy enough to actually optimize it was for once back in 1.0 time and then I probably sucked writing it :P
14:40gtraklicenser, I think clojure's persistentMap is faster on reads than java.util.Hashmap up to 3 levels deep, right?
14:42licensergtrak: that is cool
14:42licensersee that is why I ask things here :) smrt people around!
14:42gtraklet me try to find a source for this :-)
14:43gtrakbut bagwell invented the thing and he works on scala's data structures too
14:43amalloygtrak: hopefully your source will clarify what "3 levels deep" means :P
14:43licenseramalloy: perhaps you can write your code in the third sub level of the basement and it is still faster
14:43gtrakthree levels of array-mapped lookup
14:43licenseronly if you go deeper the heat of the earth core crushes the performance
14:43licenserjust a theory so
14:44amalloygtrak: right, but that's not meaningful/sufficient in itself. it tells you how many items are in the map (32^3, ish), but not how the java hashmap is configured
14:44gtrakjava hashmap performance doesn't change though except for cache misses, right?
14:45amalloyno, you can configure how much space it's willing to waste in the interest of avoiding hash collisions
14:45amalloy$google java.util.HashMap loadFactor
14:45lazybot[java - Performance of HashMap with different initial capacity and ...] http://stackoverflow.com/questions/1324064/performance-of-hashmap-with-different-initial-capacity-and-load-factor
14:45gtrakah, I wasn't talking about the linked-list traversal
14:46gtrakamalloy, but do you remember where that is? i think it might be in the ants talk
14:46amalloyno
14:47amalloygtrak: i find it ~impossible to believe that clojure hashes that look up three levels deep are faster than java hashes if there's no hash collision. division can't be *that* slow, can it?
14:48gtrakdivision's classically quite slow on a cpu, but I don't know for sure
14:49gtraki remember a figure like 19x slower than multiply, but it's hazy
14:49amalloyoh, i see that j.u.HashMap always uses 2^n buckets, so it doesn't have to divide either
14:51licenser^^
14:55licenserand for once the clojure community is perhaps the best I've ever seen
14:55amalloygtrak: fwiw, just did a quick benchmark on that and j.u.HashMap is ~3x faster
14:55gtrakah
14:56amalloywith, in fact, three lookups. sounds about right
14:56gtrakhmm, I'll look around for where i heard that
14:56gtrakpretty sure it was Rich though
14:57amalloyhttps://gist.github.com/1410496 if you're interested in my methodology, though it's not very interesting
15:02TimMctmciver: there you are
15:03licenseranother rather interesting thing, there was recently a discussion about using clojurescript for shell scripting by running it on node.js
15:04licenserI believed that to be a totally strange idea, now I stumbled about joynet using node.js to manage kvm on solaris
15:04gtrakha
15:05licenserha?
15:05licensergtrak: was it you I was discussing with?
15:05gtraka couple weeks ago i think yes
15:05licenserheh
15:05gtraki was at clojure conj
15:05TimMclucky chump
15:05gtrak:-D
15:06licenserI was browsing their repo and looked at their commands and was just like wtf
15:06TimMclicenser: Germany?
15:07licenserTimMc: aye
15:07licenserBerlin to be precise
15:09TimMctmciver: I think I'm going to hit Anna's Tacqueria before heading over to Sprout.
15:10licenserI think germans like clojure, there are may of us
15:10tmciverTimMc: OK, that's not a bad idea.
15:11TimMclicenser: Yeah, I've seen a few .de blog posts.
15:11lnostdal_is the author of aleph around here? .. got a quick question
15:12TimMcAsk it in case they are.
15:12amalloyhe's not
15:12amalloybut you could try #aleph, or he's very responsive on the aleph google group
15:15lnostdal_ok, thanks