#clojure logs

2011-04-01

00:03amalloyscottj: i like cake as much as the next guy, but i don't see much relation between those statements
00:04cemerickI have some thoughts if we're tossing off proclamations. ;-)
00:04scottjthey're unrelated, the second is purely a result of Day changed to the date changing
00:04scottjor yeah
00:05cemerickright, time to turn off the internet for the next ~30 hours
00:05amalloyindeed
00:05amalloyor spend that time working on your Google Romance profile
00:05cemerickI was going to put out a preview of a new project tomorrow, but I think I'll scrap that idea…
00:06cemerickamalloy: well-played, sir.
00:14hiredman~tell me about scala
00:14clojurebotScala often gets in the way when trying to write neat code -- seen in #scala
00:15Deranderscala always makes me want to learn haskell better
00:17scottjscala makes me wish clojure's slime were as good as ensime.
00:44johnmn3hello
00:45johnmn3I'm looking for a function much like partition, but that returns the last part of the collection, even if there are less than n in the remaining bit
00:46johnmn3and that preferably allows me to add padding to that last bit so that it becomes the length of n
00:47johnmn3I've built a function that does exactly that, but it's a 12 line loop recursion monster, with two if branches
00:47johnmn3and I figure there's probably a cleaner way
00:50hiredmanclojurebot: partition
00:50clojurebotpartition is probably not what you want; see partition-all.
00:53johnmn3https://gist.github.com/897755
00:55johnmn3hiredman: ok, that should greatly simplify my problem then
00:58amalloyblast, i'm too late. i was so looking forward to asking clojurebot about partition, when i saw johnmn3's question
00:59amalloyjohnmn3: partition includes a padding arg, you know
00:59johnmn3did not know
01:00johnmn3it's not in the doc
01:00amalloy&(partition 4 1 (repeat 100) (range 10))
01:00sexpbot⟹ ((0 1 2 3) (1 2 3 4) (2 3 4 5) (3 4 5 6) (4 5 6 7) (5 6 7 8) (6 7 8 9) (7 8 9 100))
01:00amalloyoops
01:00amalloy&(partition 4 4 (repeat 100) (range 10))
01:00sexpbot⟹ ((0 1 2 3) (4 5 6 7) (8 9 100 100))
01:00amalloyand yes it is, it's right there: ##(doc partition)
01:00sexpbot⟹ "([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complet... http://gist.github.com/897763
01:01devn8 9 100 100?
01:01johnmn3is that in 1.2?
01:01amalloyjohnmn3: i suspect it's in 1.0. it's certainly in 1.2
01:02amalloydevn: supplied (repeat 100) as the padding arg
01:02devnoh...right
01:02johnmn3oh, you're talking about partition, not partition all
01:02devnand on that note
01:02devngood night
01:02devn:)
01:02johnmn3goodness gracious.. just what I needed
01:02amalloyindeed
01:07johnmn3mmm, much prettier
01:10johnmn3night time for me too. Thanks amalloy!
01:46no_mindin clojure how do I declare application wide constants ? (app is multi module)
02:10amalloyhuh? the same way you declare anything. you def a var, and then refer to it from whatever namespace you want
02:12brehautno_mind: constant is the default remember
02:15brehautthe http Do Not Fail extension is a brilliant idea
02:16brehauterr
02:16brehautdo not fool
02:23amalloybrehaut: i preferred do not fail. i wish my servers all supported that
02:24amalloyalso: wow. i see \\\\\\\\\\ in clojure-mode.el
02:24brehautamalloy: regexp escaping?
02:24amalloyyeah
02:24amalloyi'm actually not sure if just that snippet is worse, or the whole line: "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *"
02:24brehautelisp is a little famous for its falling toothpicks
02:25amalloyyeah. i have a soft spot for perl regexes, but in elisp i want to kill myself if i have to use one
02:26brehautamalloy: i dont know which i think is better :P
02:29scottjrx will let you write emacs lisp regexes in sexp
02:33amalloyscottj: any applications out there to transform from elisp to perl?
02:33amalloy(just the regexes, obviously)
02:33scottjmaybe perl to elisp, there's pcre I think
02:34amalloyscottj: one of the things i'd like to fix about clojure mode is an indentation issue, but the *very simple* elisp regex is so foreign to me i can't figure out what it's doing
02:34scottjre pcre maybe not
02:59joshua__Hmm. I just C-zed out of a REPL that had a server up. When I'm trying to grab the server it is saying the port is taken.
03:00joshua__s/grab the server/open another server on the port/
03:00sexpbot<joshua__> Hmm. I just C-zed out of a REPL that had a server up. When I'm trying to open another server on the port it is saying the port is taken.
03:00joshua__sexpbot, thanks
03:01joshua__Is there some Unix-fu that I should know to free the port? Do I have to close the server prior to exiting the REPL in the future?
03:02raekjoshua__: the repl is just suspended. you can use 'fg' get it back
03:03amalloyjoshua__: C-z does not kill processes
03:03amalloyit just starts giving them 0% CPU time until you say otherwise
03:04amalloyuse C-c to kill a process (but if you're using eg cake, that just kills the frontend process that's communicating with the jvm daemon)
03:04amalloymore often, use C-d to send "end of file" to a process: "i'm done typing now, please let me go"
03:06amalloyhm. do we use C-a as "start of line" because really old terminals sent that keystroke as 0x0a, carriage-return?
03:08joshua__raek, nice. Thanks
03:10greghC-a and carriage-return (C-m) are unrelated
03:11joshua__Ugh. So I did that and it didn't work.
03:12joshua__I should have mentioned this was on a remote server.
03:12joshua__It turned out I had a screen inside a screen inside a screen inside a screen..
03:12joshua__or something.. so I didn't realize one of them had a server up..
03:12joshua__I've been getting lost in screen rather frequently of late =/
03:13joshua__I think I'm using it well than I type exit twenty times and still am not out of the screen =/
03:13joshua__Anyways, servers up, so thanks everybody.
03:13joshua__amalloy, woo.. content: http://173.255.212.42/
03:14amalloygregh: right, of course, i keep rediscovering that one :P. M for 13=0x0d, J for 10=0x0a, and both of them do vaguely newline-y things. i wonder what 0x01 is
03:15greghSOH = Start Of Header
03:15greghI don't think it's meaning as SOH has anything to do with its Emacs-dervied usage of "start of line"
03:15amalloyjoshua__: does everyone render markdown in client javascript?
03:16amalloyit seems kinda gross, and is just slow enough that i can see a disorienting flash of motion when i load your page
03:19joshua__amalloy, No. I was being lazy.
03:20joshua__amalloy, The right way to do it would be to pull out the wiki code and make it so you can store the processed markdown and the unprocessed markdown.
03:20joshua__amalloy, when someone wants to edit the wiki they are given the markdown, when someone wants to view a page you give them the markdown html.
03:25joshua__I know that it can be improved in a million ways. I see the room for improvement. I'm just glad that I'm building things =p
03:25amalloyputs you ahead of me, these days. i just write utilities, blog posts, and php
03:27joshua__amalloy, Nope. You actually write tons of amazing code. Really. It feels like half the stuff I write has your hand in it somewhere. The other half doesn't run.
03:27amalloywell yes. i do rather enjoy writing other people's code
04:29amalloy$source pop
04:29sexpbotpop is http://is.gd/g0HpVI
04:39amalloyhmmm. suppose i want to get at least one element from a sequence. which is a clearer test? (when-not (or (zero? n) (empty? coll))) ... vs (when (and (pos? n)) (seq coll)))
04:41ejacksonI think the latter
04:43AWizzArdamalloy: what is n?
04:43amalloyAWizzArd: the number of elements to take in total. i'm doing it recursively, so i need n to be nonzero, and coll to be nonempty
04:44amalloyif n is greater than coll, i only take one at this step, and find out later which constraint runs empty first
04:44AWizzArdok
04:52amalloythanks for the opinions, folks. i'm headed to bed
05:10raekshould you be able to edit these page if you have signed the CA? http://dev.clojure.org/display/doc/Getting+Started
05:13ejacksonwhat it the function equivalent of the sugar (. as in (.method-name Object args) ?
05:16ejacksonah, memfn.
05:16brehautejackson: thats old
05:16brehautejackson: i believe that the idiomatic way now is generally #(.methodName obj args)
05:17brehautmemfn is apparently from before the existence of #( ≥ )
05:17brehautalso args should be %1 %2 etc obviously
05:18ejacksonyes, that is usually what I do. But I'm making a macro and don't know (gonna check of course) that I can do things like `(.~method-name ...) and have it work.
05:18brehaut(that being said, sometimes memfn can be useful because the explicit argument names can add clarity)
05:18ejacksonif not, I'd like a fallback before I proceed
05:19brehaut,`(.trim " abc ")
05:19clojurebot(.trim " abc ")
05:20ejacksonI'm getting a space between . and the method name :)
05:20ejacksonso (defmacro create-command [name & args]
05:20ejackson `(with-redis
05:20ejackson (.~name *connection* ~@args)))
05:20ejacksonwhen expanded goes to
05:20ejackson(macroexpand-1 '(create-command set "k" 3))
05:20ejackson(redis.clojureclient/with-redis (. set redis.clojureclient/*connection* "k" 3))
05:20brehautmy guess is that is because of the ~
05:21ejacksonexactly. I think using memfn should allow me to get around that
05:22brehaut(let [n 'foo] `((symbol (str "." n)))
05:22brehaut,(let [n 'foo] `(~(symbol (str "." n)))
05:22clojurebotEOF while reading
05:22brehaut,(let [n 'foo] `(~(symbol (str "." n))))
05:22clojurebot(.foo)
05:23ejacksonsneaky !
05:23clgvejackson: there is another equivalence -> (.instanceMember instance args*) ==> (. instance instanceMember args*)
05:23ejacksonaaaaah
05:23ejacksonthat looks most direct
05:23ejacksonlemme give it a spin
05:23brehautclgv: much better
05:24clgvgot it from here: http://clojure.org/java_interop ;)
05:24ejacksonI'd forgotten than form
05:25clgvI vaguely remembered and looked it up ;)
05:25Chousuke_yeah, that's the form you should use in macros. Not worth using sugared forms in generated code :)
05:25ejackson"No thank you Turkish, I'm sweet enough"
05:26ejacksonThanks for the help guys
05:27ejacksonand it even works :)
06:15ejacksonAnother tip ?
06:15ejacksonyou can't partial macro's because they aren't functions
06:16ejacksonso how do you create the equivalent of (partial redis* "localhost") on a macro like
06:16ejackson(defmacro redis* [host name & args]
06:16ejackson `(with-redis
06:16ejackson ~host
06:16ejackson (. *connection* ~name ~@args)))
06:16ejacksona macro returning another macro ?
06:16ejacksonwrapping in a function and partial that ?
06:22GuySenseianyone amongst you who has worked with mongodb?
06:22GuySenseiand clojure
06:23clgvejackson: a macro returning a macro is your best bet
06:23GuySenseiboth in a single project.. ?
06:23ejacksonclgv: Eeek ! That's above me :)
06:23GuySenseii am a newb..could you please elaborate?
06:23clgvejackson: since there is no real equivalent for partial. you wouldnt save much anyway
06:24fliebelclgv, ejackson: what kind of a monster are you building?
06:24clgvejackson: it's easy to do. I'll fetch you an example
06:24ejacksonI guess its time for a gist.... 1 sec
06:24GuySensei:)
06:25GuySensei@fliebel i bet its a good monster
06:26ejacksonok this is it: git://gist.github.com/897978.git
06:26ejacksonits meant to be the opposite of a monster
06:26ejacksonwhat I want at the end is to be able to use any of the jedis functions (nice java wrapper around redis) like (redis get keys "*")
06:26fliebelhttps://gist.github.com/897978 I prefer http ;)
06:27ejacksonright now something (redis* "localhost" keys "*") works
06:28ejacksonbut I'm trying to get rid of the necessity of including the host each time. My thinking is to do the macro equivalent (whatever that may be) of returning a clojure of the host
06:28ejacksonfliebel: oops, sorry.
06:28fliebelGuySensei: Are you new to IRC? :) You don't need to prefix names with @, and usually it works best to just ask what you want to know.
06:29GuySenseihaha.. yes i am
06:29GuySenseiit is my second day
06:29GuySenseito IRC and to clojure
06:29ejacksons/clojure of/closure over/
06:30ejacksonGuySensei: as an aside, I briefly got Mongo + Clojure working using https://github.com/somnium/congomongo
06:30ejacksonbut it was a whiles ago
06:30fliebelejackson: I have seen people use a macro over binding like (with-db db body)
06:30GuySenseiyeah..so any noteable comments? I am currently using mongodb with java.. was thinking of experimenting with that in clojure... just for kicks
06:31ejacksonGuySensei: yeah, it works :)
06:31GuySenseiok.. thanks :) let me go ahead and try :)
06:31ejacksonenjoy, enjoy.
06:31clgvejackson: you can simply do (defmacro m1 [& args] `(defmacro m2 [& otherargs] `(do-something ~~args ~otherargs)))
06:31ejacksonaint nothing about that ... :P
06:31ejacksonlemme give it a swing
06:34fliebelDoes Brian Carper come in here? ( http://briancarper.net/blog/520/making-an-rpg-in-clojure-part-one-of-many )
06:34ejacksonclgv: nope, it complains about "can't use qualified name as parameter
06:34ejacksonfor otherargs
06:34clgvah right use a "#"
06:35ejacksonyeah, thanks, I also just tried that :)
06:36ejacksonand it works :)
06:36ejacksonmuch obliged clgv :)
06:37clgvsure it does ;)
06:38ejacksonok, here is the full gist https://gist.github.com/897978
06:38ejacksonit was the ~~ trick I was missing in all this :)
06:39ejacksonI might even blog (with appropriate credits) this little exercise.
06:39clgvyou could also do without "~~" by let-ting with "~" in-between
06:40ejacksonoh right, that took a second to parse, I get you
06:40clgv:)
07:00ejacksonwhat is that which is to defmacro as fn is to macro ?
07:01ejacksons/macro/defn/
07:01sexpbot<ejackson> what is that which is to defdefn as fn is to defn ?
07:01ejacksonoh for the love
07:01ejacksonwhat is that which is to defmacro as fn is to defn ?
07:01AWizzArdejackson: you want an anonymous macro, generating it on-the-fly?
07:02ejacksonyes please
07:02AWizzArdCan you provide pseudo code for a minimal example of what you want to achieve?
07:03ejacksonsure, it proceeds from my last discussion
07:03ejacksonin line 17 of https://gist.github.com/897978
07:03ejacksonwe have a defmacro
07:03ejacksonthis causes issues if we want to use the outer macro from another namespace as it won't let us
07:03fliebelYou can use a macro and a gensym to sortof generate an anonymous macroe, I think there is such a thing in amallow-utils.
07:03ejacksonhence I'd like it to return an anon macro and def it to a var in the calling namespace.
07:04clgvsomething like a template comes close to an anonymous macro: `(do-something ~args)
07:04ejacksonits a morning of much learning for me
07:05fliebelejackson: You can not do that. ##for
07:05fliebel,for
07:05clojurebotjava.lang.Exception: Can't take value of a macro: #'clojure.core/for
07:05fliebelso what you can do is return the list that would be your macro, and defmacro that.
07:05clgv$source defmacro
07:05sexpbotdefmacro is http://is.gd/sFSa15
07:06fliebel(. (var defmacro) (setMacro))
07:06clgvejackson: as you can see there, a macro is only a fn with setMarco being called on the var
07:06clgvas fliebel quoted ;)
07:07ejacksonnow that is interesting... so maybe I could return an anonymous function, bind to a var, the .setMacro it ?
07:07clgvwhy would you want to operate on that low level?
07:08ejacksonideally I don't :)
07:08fliebelhttps://github.com/amalloy/amalloy-utils/blob/master/src/amalloy/utils/macro.clj#L18
07:08ejacksonits just that current code is unusable outside of its own namespace on acocunt of the defmacro in the macro
07:09ejacksonfliebel: oh-hello !
08:05fliebelfutures run in a bound treadpool, right? So can I create tons of them and expect them to do something useful?
08:06AWizzArdfliebel: currently futures and agents use the same pool.
08:07fliebelAWizzArd: with send, that is? because send-off does use unlimited threads.
08:07AWizzArdI think n=cores+2 threads go into that pool. On a quadcore with hyperthreading ==> 10 threads.
08:07AWizzArdsend-off tries to take one of those 10 first, and if none is free it creates a new one.
08:09fliebelSo what happens if I run more than 10 forever-running futures?
08:09pdkhow does send handle running out of pool threads then
08:09pdki've heard "use send for cpu bound stuff and send-off for i/o bound stuff"
08:09pdkbut noone explained how they're implemented that makes this distinction
08:09AWizzArdsend will just block until one of those 10 is back available
08:10fliebelAWizzArd: Right, so send/future will just not run the 11th forever-running thread.
08:14nachtalpfliebel: http://s-expressions.com/2010/06/08/medusa-0-1-a-supervised-thread-pool-for-clojure-futures-2/ according to this, future uses the same threadpool as send-off (unbounded)
08:16AWizzArdfliebel: a future would start off new threa... yes what nachtalp said
08:16fliebelokay
08:20AWizzArdejackson: there is also http://richhickey.github.com/clojure-contrib/macro-utils-api.html#clojure.contrib.macro-utils/macrolet
08:20ejacksonAWizzArd: thanks. I did come across that, but realised I'd waded out into waters deeper than I should have, and just gave up :)
08:21AWizzArdOooh, Oracle just decided that from Java 8 on there will be high license fees for the JDK :-(
08:22cemerickAWizzArd: watch those april fool's stories…
08:23AWizzArdcemerick: actually this was *my* AF story ;)
08:23cemerickah, sorry for ruining your mojo :-)
08:24cemerickAWizzArd: try again in another hour or two when a few more timezones are online
08:24ejacksonit drives me mad ! pollutes my mental namespace.
08:24nachtalpAWizzArd: good one :)
08:26fliebelI could use a second brain more seasoned in FP than mine for my game engine. So imagine the game loop, which iterates on a set of objects. I could just call a function on every objects and use the result as the new object. Now say the object is jumping. It'd be hard to tell whether it should go up or down.
08:26ejacksonits like historical fiction - after a while you have no idea was *actually* happend in reality. Poison.
08:28ejacksonfliebel: i guess you'd need to so have it store the state of how long its been ascending, with someway of know to start descending at some point ?
08:29fliebelejackson: Possible… But I'm also looking at lazy seqs or Lamina. Such that it can return multiple states using some closures.
08:30ejacksonyeah, if you had as state a seq of vertical displacements representing a jomp and at each frame you affected the first and returned the rest you might get away with it...
08:32Chousukefliebel: you can use a movement vector for the jumping perhaps? have some gravity and when a jump occurs, set movement vector to something pointing upwards.
08:33fliebelChousuke: Okay, so using velocity, a jump would work. But I'm sure there will be actions that span more than a single frame, jumping being just a simple example of that.
08:35fliebelBut to tell you the truth, I can't think of much. So maybe it would work to just have functions.
08:35Chousukea seq of deltas might be useful then I guess.
08:36Chousukethat's what I'd try if I were to write something that needs to update a display.
08:36Chousukesince redrawing all the time is not very efficient :/
08:37fliebelChousuke: And you'd put (rest that vector) on the object, so that it knows what to do next?
08:39Chousukeperhaps
08:40ChousukeI have no idea how it'd work in practice but that's what I'd start with :)
08:41ejacksoni think Chousuke's idea of attempting to calculate the state each frame based on that of the previous time is the best. That way upward velocity will slow, and eventually become negative.
08:42ejacksonthe seq of deltas, calc'd ahead of time, would be brittle to changes in environment during the jump.
08:42ejacksonjust guessing here though
08:42fliebelejackson: But that is still only jumps
08:43ejacksonit should generalise, surely ?
08:43fliebelyea, beyond my wildest imaginations :)
08:44fliebelI think Lamina goes pretty far.
08:45ejacksonlink ?
08:45fliebelhttps://github.com/ztellman/lamina/wiki/Channels
08:51maaclLauJensen: hey!
09:08mecIs there a function like into that just converts rather than conjing
09:09Chousukeconverts?
09:10Chousukemec: if you mean mutates the vector, then no, not really.
09:10Chousukethere are transients but transients are not mutable either.
09:11meclike vec or apply list
09:11Chousukeah, hm
09:11Chousukeno.
09:11mecbecause (into '() ) reverses the coll
09:12Chousukeyou can use seq if you need something that looks like a list
09:19ahihi2what should I use to show a rational in decimal format?
09:19mecyou can cast to double or float
09:20powr-tocstuartsierra: hey, how're things going with cljque? :-)
09:21stuartsierrabeen talking about it with some folks here...
09:21stuartsierrastill committing on branches
09:22powr-tocstuartsierra, Yeah, so I've seen
09:22powr-tocI saw your video on it... and I've even played about with it at the repl
09:23stuartsierracool
09:24powr-tochow closely have you been following Rx's lead?
09:24fliebelcljque?
09:26powr-tocbecause it looks like some of the behaviours differ... for example Rx's select-many lazily subscribes to observers... but your map-events didn't seem to
09:27stuartsierrapowr-toc: I started from Rx as an inspiration, but drifted away
09:27gtrakdoes clojure have a distributed story?
09:28fliebelwhat is the goal of cljque?
09:28powr-tocI'm curious as to why you've chosen to drift? Don't you think Rx cuts it in terms of event stream composition?
09:30powr-tocdamn, I've got to shoot off and catch a train... I'd love to speak more about cljque sometime though
09:31stuartsierraI don't really know Rx that well, and haven't been able to find comprehensive documentation on it.
09:32powr-tocthat is a problem... there's a pretty good pdf file that covers some of the basics knocking about somewhere
09:32stuartsierraI think I have that; but that's the only doc I've found.
09:33powr-tocand the gui describes all of the combinators etc with marble diagrams quite well
09:33stuartsierragui?
09:34powr-tocthe RxSandbox
09:34powr-tocok I've got to go
09:35stuartsierranuts, windows-only
09:39fliebelstuartsierra: What can I read to understand what cljque is about?
09:44stuartsierrafliebel: The .NET Rx documentation
09:44stuartsierraOr the video of my presentation at Clojure NYC.
09:48fliebelah http://vimeo.com/18970727
09:49fliebelit oopses :(
09:50devnfliebel: oopses?
09:51fliebeldoes not work
09:51devnoh...works for me
09:51devnblue hair and all
09:53fliebelstill no go. :(
09:56ejacksoni've got it, might be your browser etc ec
09:56fliebelfirefox works
10:01fliebeloh, long talk, so lang the stuart as already left before I can ask him questions about it.
10:03devnfliebel: if you've got a question i can try and bug him
10:08stuartsierrafliebel: Cljque is an attempt to design a framework for handling asynchronous events in Clojure with the same level of higher-order functions you have to manage lazy sequences.
10:09fliebelstuartsierra: So how is it different from Lamina? (I havn't reached that part of the vid yet)
10:09stuartsierraThey're both aiming for the same goal.
10:10stuartsierraLamina is more oriented towards queues, which I'm trying to avoid.
10:10fliebelstuartsierra: Ah, so what is you main 'thing'?
10:14stuartsierraTwo protocols: Observable (things which produce events), and Observer (things which consume them.
10:36kephale00Any recommendations for finding bottlenecks in parallel code?
10:38stuartsierra kephale00: try to find points where 1 thread is blocked waiting for other threads.
10:42kephale00stuartsierra: I have a bunch of agents but only 2 significant send calls. I am wondering if there is a way of discovering which resources/variables they might be competing over. I'll probably have to go into a number of functions and print output, is there a good way to discover how many threads are currently active?
10:42pdkhn
10:42pdkhas anyone here tried running cake on win
10:42stuartsierrakephale00: try YourKit
10:43stuartsierraor some other JVM profiler.
10:43pdkapparently it expects a server jvm installed that isn't
10:43pdkprob doesn't help that it's looking in the 32 bit program files :|
10:43kephale00stuartsierra: thanks!
10:44stuartsierra'welcome
10:48ejacksontoo funny: http://www.atlassian.com/en/angrynerds
10:49kephale00a quick guess: if I am passing a map containing functions that read globals to the agents, could that lead to blocking?
10:49stuartsierraReading global vars will not block.
10:49kephale00ok
10:49kephale00ty
10:49kephale00thats what i suspected
10:54powr-tocstuartsierra: so I'm really just wondering what your plans for cljque are... Do you see yourself as competing with aleph? Or do you see yourself as providing a new event stream abstraction?
10:55powr-tocI've not really looked too much into alephs pipelines and channels, but they don't seem as nice as the kinds of abstraction Rx provides
10:56stuartsierraI aim to produce a low-level abstraction upon which libraries like Aleph could be based.
10:57powr-tocgreat!
10:57fliebelstuartsierra: What can events do that lazy seq cant? OH, I think someone in the vid asked that...
10:57stuartsierraIt could potentially be useful for network applications, GUIs, and faster I/O.
10:58stuartsierrafliebel: waiting for an event doesn't block a thread; consuming a slow lazy seq does.
10:58powr-tocfliebel: sreams are different from lazy-seqs as they're push based rather than pull based
10:59powr-tocstuartsierra: agreed... what are your thoughts on extending the observer/observable protocols to other java types, and possibly other apis?
10:59stuartsierrapowr-toc: I'm all for it. I experimented with extending them to Netty ChannelFutures.
11:01powr-tocyes I saw...
11:03powr-tocbasically I have a bit of a dillema... cljque currently seems to be very much a playground for ideas, and I'm not yet convinced of alephs abstractions
11:04powr-tocso basically I've built myself a simple stomp broker on top of netty directly... but obviously I've reinvented some bits of aleph / cljque in doing so
11:05stuartsierraYeah, I kept doing the same thing, which is why I went to work on cljque.
11:06powr-tocanyway, I'm really wanting to start making use of event stream composition, so I can more elegantly handle the application level concerns
11:07powr-tocthe low level network streams etc... I'm ok with being handled in my code just now, but ideally I'd like to bring them in line with whatever abstraction I use higher up too
11:08powr-tocso I was wondering what you think I should do :-)
11:09stuartsierrapowr-toc; Afraid I can't help much.
11:09powr-toclol
11:09stuartsierraI'm hoping to nail down the low-level API within the next few months.
11:09powr-tocby low-level api, you mean observer/observable and combinators right?
11:10stuartsierrayes
11:10powr-tocwell, that's the bit I really want :-)
11:10stuartsierraIf you need it right now, you can always pick a commit that has what you need and use it in your code.
11:11powr-tocstuartsierra: Is there a mailing list for cljque?
11:11stuartsierrano
11:12@rhickeyname game - so, we're doing factory fns for records and deftypes - one positional, one taking a map (deftypes get only the former)
11:13@rhickeythe fns will be generated in the ns of the defrecord
11:13stuartsierraooh, naming! Always fun.
11:13@rhickeyand will involve the record/type name
11:14@rhickeyso we need two names, one for positional, one for map
11:14@rhickeye.g. ->MyRecord, map->MyRecord have been proposed
11:14fogus`Those are my current favorites
11:14@rhickeymake-, create- new- Record
11:14dakroneis there a class to (extend ...) that will dispatch on 'nil'?
11:15stuartsierradakrone: you can extend nil
11:15stuartsierrarhickey: I always disliked -> in names because there's no way to pronounce it, and the order is backwards from how s-exprs are evaluated.
11:15fliebelrhickey: Are these fns created with the types, or a separate function, like new vs .object
11:16@rhickeystuartsierra: it's pronounced "to"
11:16stuartsierrayeah, I know, but it still goes in the wrong direction.
11:16@rhickeystuartsierra: you are proposing Record-from-map ?
11:17fogus`MyRecord<-map :p
11:17fliebelwell, <-MyRecord then "[instance] from record"
11:17dakronestuartsierra: thanks
11:17stuartsierraNo, I like names that are nouns. "record"
11:17@rhickeyfliebel: I don't understand
11:17stuartsierraIf it needs to be more specific, then "noun-from-noun"
11:18fliebelI'ts just the pronunciation. if -> is to <- is from
11:19@rhickeyooh - Record: ... currently unreadable
11:20stuartsierraEnglish suffers here from "record" also being a verb.
11:20fliebelfor the map, into-record/type
11:20@rhickeyFoobar: ...
11:20fliebeloh, no type
11:20@rhickey(Foo: 1 2 3)
11:20powr-tocstuartsierra: If I was to pick a commit, what would be a good starting poi
11:21powr-tocnt?
11:21clojurebot¢
11:21fogus`rhickey: Guaranteed not to clash with existing names. :-)
11:21@rhickey(Foo:: {:a 1 :b 2 :c 3}
11:21stuartsierrapowr-toc: whatever serves your needs really. Different branches have different levels of complete-ness.
11:21powr-tocstuartsierra: then what are the goals of each branch?
11:22stuartsierra'master' is my first complete attempt, but has buggy state handling in the combinators.
11:23stuartsierra'agents' was an attempt to solve the state problems with agents.
11:23stuartsierra'combined' is my latest work, attempting to get state handling right without forcing the use of agents everywhere.
11:24powr-tocso combined, is the future of cljque?
11:24fliebelrhickey: So, will : become legal in symbols? Fun for ticking Ruby and Perl people Foo::bar
11:25@rhickeyfliebel: : is only reserved at the beginning or end
11:25@rhickey,(def foo:bar 42)
11:25clojurebotDENIED
11:25fliebel,'foo::bar
11:25clojurebotInvalid token: foo::bar
11:25sritchie,(let [foo:bar 42] foo:bar)
11:25clojurebot42
11:26stuartsierrapowr-toc: yes
11:26fliebelSo, why the end?
11:26@rhickeyalso "A symbol can contain one or more non-repeating ':'s"
11:26@rhickeyreserved so I have it for things like this :)
11:27fliebeloh, good :) I like it. Only, the distinction between a single and a double one is weird.
11:27powr-tocstuartsierra: whats your current focus on?
11:27@rhickeyjust throwing stuff out there in the absence of input
11:27fliebelI vote for -into for the map case
11:28@rhickey?
11:28raekI like the recemblance between Foo. and Foo:
11:28fliebel(into-foo: {:bar 1 :baz 2})
11:28stuartsierrapowr-toc: flexibility around threads: e.g., if you're using a library that manages its own thread pools, you can stay on those threads
11:28fogus`-into implies some operational semantics to me. But the same could be said about ->MyRecord I suppose
11:29@rhickey(into-Record {:a 1})?
11:29powr-tocstuartsierra, Yeah, I can imagine that would be useful
11:29raekso Foo: will be be just #(Foo. %1 %2 ... %n) ?
11:30fliebelraek: I hope it caries across nses better than that
11:30fliebeloh wel.. yea
11:30powr-tocok, I'm going to have to head off again
11:30@rhickeyraek: no, there will be a fn named Foo: , which you'll get from require, unlike the type name which you don't
11:30raekah, forgot about that point
11:30powr-tocstuartsierra: Thanks a bunch for your comments on cljque... I'll maybe invest some more time in looking at it
11:31powr-tocis it ok, to drop you some emails if I run into problems/issues?
11:32stuartsierrasure
11:33powr-tocgreat!
11:35raekis CamelCaps preferred for names of types and records?
11:35thickeyi would prefer Record: over some (currently legal) prefix/suffix like into-Record
11:36raekif so, the Foo:/Foo:: look has the advantage that it doesn't mix the CamelCaps and hyphen-separated-words conventions in the same identifier
11:38fogus`The only problem that I have with Foo: and Foo:: is that the names tell me nothing about the expected arguments. Which one is :, map? I forgot already.
11:39stuartsierrawhat if there's just one name: with one arg, that arg is a map
11:40raek"{Foo" à la JVM type descriptors, anyone? :-)
11:40raekand for a record with only one field?
11:42fliebelOr anonymous classes? $Foo
11:42dnolenstuartsierra: makes things awkward with apply I think. I like being able to use apply w/ my current ctor fns.
11:42fliebelIs # currently used for anything? Otherwise that would eb cool as a *hash*map veriant.
11:42raek, `foo#
11:43clojurebotfoo__4805__auto__
11:43fliebel,#bar
11:43clojurebotNo dispatch macro for: b
11:43@rhickeygotta run
11:46dnolennice write up on compiling with continuations - http://matt.might.net/articles/cps-conversion/
11:46fogus`fliebel: The pattern #bar is in the works for other usage
11:47fliebelfogus`: What?
11:49raekhrm, my confluence account does not have write acess to the wiki.
11:49raek(I have signed the CA)
11:49fogus`fliebel: The basis for record literals
11:49fliebeloh! :)
11:50raekso, is the old Assembla account supposed to work in Confluence? I recall that I couldn't log in with my old credentials, so I tried to create an account with them, but the username already existed. so I created a new account...
11:51fliebelfogus`: But than, isn't the factory fn for records just the same as (into #record-literal {:foo 1})?
11:52fliebeldnolen: So this is what you continuations lib does basically?
11:53dnolenfliebel: I think my transformation is naive, this covers the topic much more in depth. I need to dig into it, looking forward to updating delimc based on whatever I learn.
11:54fogus`fliebel: Not entirely. I am writing up the current thinking on the Clojure Wiki. I'll probably be done later today
11:55thorwilhmm, what is this thing that prints as #<models$created_t tlog.models$created_t@25ca623f>, and how do i get the content?
11:55dnolenfliebel: from a quick look, he covers avoids introducing unnecessary bindings, would probably make delimc much more efficient then.
11:55fliebeldnolen: I'd think so :)
11:55fliebelfogus`: Okay, interesting :)
11:56fogus`I'll post a call for opinions to the dev mailing
12:05AWizzArdOooh, Oracle just decided that from Java 8 on there will be high license fees for the JDK :-(
12:06raekAWizzArd: link?
12:07thorwilit's not the right day for final decisions and announcements
12:07raekthorwil: try (class that-thing)
12:09thorwiltlog.models$created_t
12:10thorwilwhat i expected was some kind of empty value
12:11thorwilarg, i apparently don't know my own code, nm :)
12:13ejacksonAWizzArd: I saw what you did !
12:17dnolenhmm, interesting that conj on a map only supports vector and not a list or seq.
12:17dnolen,(conj {} '[a b])
12:17clojurebot{a b}
12:17dnolen,(conj {} '(a b))
12:18clojurebotjava.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.util.Map$Entry
12:18TimMc,(conj {} (seq '(a b)))
12:18clojurebotjava.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.util.Map$Entry
12:20TimMc,(into {} '([3 4] [5 6])) dnolen: It takes a list as a seq of entries
12:20clojurebot{3 4, 5 6}
12:21TimMcThat's not documented, though.
12:22hiredman,(type [1 1])
12:22clojurebotclojure.lang.PersistentVector
12:22hiredman,(ancestors [1 1])
12:22clojurebotnil
12:22hiredman,(ancestors (type [1 1]))
12:22clojurebot#{clojure.lang.IFn java.io.Serializable clojure.lang.AFn clojure.lang.Sequential java.util.concurrent.Callable clojure.lang.IObj clojure.lang.Counted clojure.lang.Associative java.util.List clojure.lang.APersistentVector ...}
12:22fliebelAWizzArd: Oh, really? Well, that was to be expected, when do we get JDK-Jenkins?
12:23hiredman,(->> (ancestors (type [1 1])) (filter #(.startsWith (.getName %) "clojure")))
12:23clojurebot(clojure.lang.IFn clojure.lang.AFn clojure.lang.Sequential clojure.lang.IObj clojure.lang.Counted clojure.lang.Associative clojure.lang.APersistentVector clojure.lang.Seqable clojure.lang.ILookup clojure.lang.Indexed ...)
12:23hiredmansomewhere in there is mapentry, which is why it is conj'able onto a map
12:24dnolen,(into {} '((3 4) (5 6))
12:24clojurebotEOF while reading
12:24fliebel&(key [1 2])
12:24sexpbotjava.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.util.Map$Entry
12:24dnolen,(into {} '((3 4) (5 6)))
12:24clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to java.util.Map$Entry
12:24dnolenTimMc: in anycase I want to use conj, already looked at the Java source, it's not possible. It's okay I'll just reify IMapEntry.
12:25AWizzArd:)
12:25TimMchiredman: I don't see it.
12:26fliebelIs there any way to have some hierarchy in records without methods?
12:26dnolenhiredman: TimMc: it's not there. line 23-45 in APersistentMap.java, it special cases vector of length 2
12:27TimMcew
12:27TimMc(into {} [3 4 5])
12:27hiredmanmust have changed, two element vectors used to implement mapentry
12:27TimMc,(into {} [3 4 5])
12:27clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer
12:27fliebelSo that I can have a record that is guaranteed to have the same key, and till have its own type.
12:28fliebelI believe Java interfaces do have instance variables in them.
12:29TimMcfliebel: Never heard of that.
12:29TimMcJava interfaces can carry what are effectively static constants, though.
12:30fliebelhm, okay.
12:32fliebelWell, look, the reason to use records would be that you know they'll have all the keys you expect and they have a type. Now I need some sort of subtype of that. There is no way to make that explicit, is there?
12:33TimMcClojure doesn't like subtyping of concrete classes.
12:33dnolenerg, APersistentMap looks for concrete Map.Entry instead of IMapEntry.
12:34fliebelTimMc: How is it any way concrete to define a class will have the specified keys? It doesn't have implementations, does it? I just need a contract for a few types that they'll be able to give me a set of keys.
12:35fliebelJust as if I had defined a few getters and setters, but then only dictionary keys.
12:36TimMcI guess I don't understand what you're asking, then.
12:36@chouserjava.util.Map$Entry is an interface that clojure's MapEntry implements
12:36@chouser^ dnolen
12:38fliebelTimMc: Well, say I define a interface that has getX and getY, any class implementing that would need to be able to provide me with an X and an Y. Now I'm not using getters, but idiomatic Clojure records. Now I need to enforce the same thing, that a record can provide X and Y.
12:39TimMcOh wait, I got into and conj mixed up earlier. >_<
12:40dnolenchouser: ah yeah, great thanks. Map$Entry == Map.Entry
12:42TimMcfliebel: Do you just want records that have Java-like getters attached?
12:42stuartsierraFor those I was talking to about Cljque, I just merged the 'combined' branch into 'master'
12:44fliebelTimMc: No, I want something that can't be done. I want to have a contract that says (defrecord a [x y z]) and (defrecord b [w x y]) can both provide me with x and y.
12:45fliebelstuartsierra: yay
12:46fliebelAnd if that is not possible, can I use derive to at least tell Clojure a is a child of b, if only for the sake of multimethods?
12:48mduerksenif someone is interesented, i uploaded my own clojure port of peter norvigs sudoku solver: https://github.com/toofuu/sudoku/blob/master/sudoku.clj . i would be glad to hear some suggestions to improve my coding style
12:51dnolenfliebel: how do you want to enforce such a contract in your code?
12:52dnolenfliebel: as is the enforcing just for debugging purposes while developing?
12:52dnolens/as/and
12:52sexpbot<dnolen> fliebel: and is the enforcing just for debugging purposes while developing?
12:54fliebeldnolen: The enforcing is just for security, the hierarchy is for saving some multimethod. I think this might be possible with derive.
12:56amalloyfliebel: security? you can't mean actual security like hackers
12:57fliebelamalloy: No, security, that I know that if I do (get record :x) it will actually returns omething.
13:13amalloyhey technomancy, did you ever talk to monsieur planet-clojure? page looks like it's still down, and it looks like only SO links are getting tweeted
13:19jweiss_is there a standard way of getting around this - my macro doesn't work because I want macros in the args I pass it to be expanded first, but they aren't. should i just call macroexpand in my macro or something?
13:19amalloyjweiss_: you could do that, but it seems wrong. could you clarify why you want this behavior?
13:22jweiss_amalloy: my macro is generating a map. part of the reason i used a macro, is some items in the map are functions that takes arguments. i wanted access to all the names of the arguments so i could tell callers what info those functions are going to need.
13:22jweiss_but i was finding most of my function defs i am passing to my macro looks about the same
13:23jweiss_so i wanted to shorten the syntax even more with another macro to expand into `(fn [] ...)
13:27amalloyummm. still a little too abstract for me. but i think you probably only want one macro. have the map-generator be a plain function that the wrapping macro can call
13:29jweiss_amalloy: yeah, the problem with the one-macro solution is that the extra sugar i want to add is something my macro shouldn't know about. it refers to symbols it shouldn't know or care about.
13:30hsuhhow i tell leiningen not to delete my jar in /dev even though it is not listed as a dependency on project.clj ?
13:30hsuhor perhaps i should add another directory with this jar as a repository? if possible..
13:31jweiss_(macroexpand '(+ 1)
13:31jweiss_oops
13:32amalloyhsuh: if you depend on it, list it in your dang dependencies
13:32jweiss_consequence of using erc - irc and swank windows look the same :)
13:32hsuhamalloy: but it doesnt exist on clojars and shit :)
13:33amalloyso find a place where it does exist, or install it locally
13:33hsuhyes, locally... what that means ?
13:33hsuhinstall a repository locally?
13:33amalloyyou already have a local repository
13:33amalloyyou just need to put this jar in it
13:34amalloyi think cake install has a way to install third-party jars wherever you want
13:34amalloymaybe not
13:36amalloyi know you can do it, somehow, with mvn package and/or mvn install, but maven is a mystery to me. maybe technomancy knows the right way
13:36technomancyhsuh: you can put it in ~/.lein/plugins, but really it ought to go in a real repository.
13:36amalloyspeak of the devil
13:36technomancyif you put it in :dependencies and run lein deps; the error message will show you the right invocation to put it in ~/.m2
13:36clojurebotleiningen is a build tool designed not to set your hair on fire (http://github.com/technomancy/leiningen)
13:36amalloynice
13:36technomancyclojurebot: O RLY
13:36clojurebotCool story bro.
13:37hsuhyeah, i saw that and was scared
13:37jweiss_amalloy: the macroexpand solutioon seems to work, feel dirty using it but i'll stick with it for now :) thakns
13:37amalloynoooo, how will i ever beat chouser in next year's "most-thanked" list, if people are just going to thakn me
13:38hsuhtechnomancy: it did work though
13:38hsuh:)
13:38TimMcjweiss_: Remember to use syntax-quote unless you *want* non-namespaced symbols.
13:39jweiss_TimMc: yup, used syntax quote except for one symbol i wanted non-namespaced so i added ~'
13:40TimMchaha
13:40amalloyjweiss_: you should be fine until you get enough rope to shoot yourself in the foot
13:40jweiss_hehe
13:43hsuhis lein uberjar not "the right way" to deploy your apps ?
13:43TimMcIt's what I use.
13:44hsuhdoes it also make you feel dirty ?
13:44TimMcnope
13:44hsuhok :)
13:45TimMcI distribute my libs on clojars and github, and my apps (homework assignments, so far!) as uberjars.
13:46hsuhthen what do you do with a tar?
13:48technomancyhsuh: it's deployed with chef. I'd recommend using pallet instead though.
13:48technomancytar is needed if you have things like init scripts to go with your app.
13:49TimMcOh, right... jar/zip doesn't keep executable permissions around.
14:03hsuhtechnomancy: do you think pallet is useful even when you only intend to deploy to a single machine?
14:08technomancyhsuh: in some cases a shell script may suffice instead. what you want to avoid at all costs is deployment that takes human involvement.
14:09jolyamen
14:09TimMcjoly: Just put a dippy bird on the "y" key.
14:09hsuhsure, i just mean, its probably overkill to set automate something that is probably only need to be done once... (ok i realize other stuff could happen that would force me to reconfigure this one node)
14:09joly:D
14:09hsuhs/set//
14:09sexpbot<hsuh> sure, i just mean, its probably overkill to automate something that is probably only need to be done once... (ok i realize other stuff could happen that would force me to reconfigure this one node)
14:10TimMc(and don't tell your boss!)
14:10amalloyhsuh: if you ever write software that you only have to build once in your life you're probably the messiah
14:11hsuhi mean write software to automate something that i intend to do just once :)
14:12amalloy$findfn [1 2 3] true
14:12sexpbot[clojure.core/== clojure.core/sequential? clojure.core/reversible? clojure.core/distinct? clojure.core/boolean clojure.core/vector? clojure.core/counted? clojure.core/associative? clojure.core/< clojure.core/= clojure.core/> clojure.core/>= clojure.core/<= clojure.core/ifn? clojure.core/coll?]
14:13raek$findfn [1 2 3] false
14:13sexpbot[clojure.core/keyword? clojure.core/chunked-seq? clojure.core/fn? clojure.core/not= clojure.core/nil? clojure.core/string? clojure.core/sorted? clojure.core/false? clojure.core/true? clojure.core/symbol? clojure.core/number? clojure.core/integer? clojure.core/seq? cl... http://gist.github.com/898583
14:14amalloyhmph. what's a good way to test whether a vector is empty? i can call seq on it, but i'm planning to keep treating it as a vector and it seems like seq might be expensive
14:17hiredman,(doc empty?)
14:17clojurebot"([coll]); Returns true if coll has no items - same as (not (seq coll)). Please use the idiom (seq x) rather than (not (empty? x))"
14:18hiredmanhave you seen the impl of seq() in APVector?
14:18amalloyhiredman: not recently
14:21TimMcamalloy: zero? count ?
14:23amalloyyeah. i think i'll just rewrite the function to compute the interesting stuff once at the beginning rather than at each recursive step
14:23TimMc,(counted? (type []))
14:23clojurebotfalse
14:23amalloyTimMc: ##(counted? [])
14:23sexpbot⟹ true
14:23TimMcah
14:41TimMcAre there any colls that aren't Counted?
14:42TimMcI tried list, vector, array-map, and hash-map already.
14:42fliebelset? sorted- ?
14:43@chouserlazy-seq
14:43fliebelah, of course
14:43TimMcOh, right... seqs are colls.
14:46duncanmif i have a seq that's [a b c d], where a-d are vars, is there a quick way to turn it into {:a a :b b ... }
14:46@chouser,(take 6 (iterate rest (concat (range 2) (list 3 2 1))))
14:46clojurebot((0 1 3 2 1) (1 3 2 1) (3 2 1) (2 1) (1) ())
14:46@chouser,(map counted? (take 6 (iterate rest (concat (range 2) (list 3 2 1)))))
14:46clojurebot(false false false true true true)
14:47@chouserduncanm: Vars? Like [#'a #'b #'c #'d] ?
14:48duncanmchouser: hmm, (let [a 1, b 2, ...] ...) what can i put in ... to get {:a 1 :b 2 ...}
14:48opqdonut,(let [v ['a 'b 'c]] (interleave (map keyword v) v))
14:48clojurebot(:a a :b b :c c)
14:48__name__$(source interleave)
14:48duncanmi want a map from the name of the binding to the value of the binding
14:48__name__,(source interleave)
14:48clojurebotjava.lang.Exception: Unable to resolve symbol: source in this context
14:48duncanmi dunno waht to call them, binding, variable
14:49__name__$source interleave
14:49sexpbotinterleave is http://is.gd/DTpwq1
14:49duncanmkinda like the reverse of the :keys thing in destructuring
14:49__name__$(interleave [:a :b :c] [:d :e])
14:49__name__,(interleave [:a :b :c] [:d :e])
14:49duncanm__name__: i know about interleave
14:49clojurebot(:a :d :b :e)
14:51raekduncanm: that would need to be a macro, since you want to build a :foo foo pair for each foo (which presumes that the arguments are symbols in the code)
14:51duncanmraek: sigh
14:51__name__,(map [:a :b :c] [:d :e])
14:51duncanmi just don't want to type this
14:51clojurebotjava.lang.IllegalArgumentException: Key must be integer
14:51__name__,(map list [:a :b :c] [:d :e])
14:51clojurebot((:a :d) (:b :e))
14:51duncanm(let [[a b c d] [1 2 3 4]] {:a a :b b :c c :d d})
14:52@chousermacros have visibility into the names of all the locals in the scope where they're expanding
14:52duncanmdoesn't matter if it's :a or 'a
14:52raek(defmacro m [& syms] (into {} (zipmap (map keyword syms) syms))))
14:53duncanmraek: okay, i'll try that out - thanks!
14:53raek(just remove the last paren...)
14:54duncanmraek: that worked, thanks so much
14:55raeknow to the hard part: what name should the macro have? ;-)
14:55fliebelIs derive used anywhere besides multimethods?
14:55raekI'm thinking about "unkeys"
14:56amalloyduncanm: i wrote this a while back. called it keywordize
14:58amalloyhttps://github.com/cognitivedissonance/sexpbot/blob/master/src/sexpbot/utilities.clj#L16 and https://github.com/cognitivedissonance/sexpbot/blob/master/src/sexpbot/plugins/markov.clj#L194
15:06GuySenseihey guys .. whats the best way to pass on meta-information from one function to other?
15:07GuySenseiin an efficient way.. i would like the behavior of the next function be dependant on the meta-information fed by the previously called function.any efficient way?
15:09@chouserGuySensei: options that come to mind: pass another argument, attach metadata to one of the existing arguments that is guaranteed to support it, or bind a dynamic var
15:10GuySenseiwhat is a dynamic var?(sorry i am new to clojure) is it just a var you mean?
15:11chouserIt's a Var yes. You'd create one with 'def' and give it a thread-local value with 'binding'
15:12GuySenseiahh ahh.. i get it now :) it will be something visible to just this thread.and cease to exist beyond the scope within this thread.. thanks.. makes sense!
15:15chouserbeware, they act a bit squirrely in the face of laziness, multiple threads (such as with pmap), etc.
15:15chouserplease consider the other options, especially just passing another argument.
15:16GuySenseiis that squirelly behavior because of something lacking in the current platform?
15:16chouserno, it's real semantic mismatch
15:17dnolenchouser: is pmap still a problem with binding conveyance?
15:17GuySenseibut i get your point nonetheless.. multi function you mean?(passing another argument)
15:17amalloyGuySensei: it's because you're (considering) using them for a weird reason
15:17chouserdnolen: on 1.3 I think not
15:18amalloyjust pass another argument. why do you want to make function g "magically" aware of things that were said to function f, instead of just having f say "hey g, please behave in the following way this time"
15:18GuySenseiweird reasons? yeah could be :D
15:18chouserGuySensei: static scope and dynamic scope are different things and can change indepedently of each other. lazy sequences are built on static scope (lexical context) and dynamic vars are of course dynamic scope.
15:19GuySenseiok ok.. absorbing it....
15:19GuySenseithanks though..let me mull over it a bit.. and understand better
15:20amalloyhey chouser, what does "Approval: Test" mean in jira?
15:20chouserNot to project too much onto your situation, but I entirely empathize with the desire to write clever code. It is probably currently my most dangerous design temptation. hard to shake.
15:21chouserin the end, simple always makes me happier than clever, regardless of how I feel when I'm writing the clever code.
15:22chouseramalloy: I have trouble keeping track. I think it means they want some people to try it out and comment on whether the patches is good, does what it should, etc.
15:26cemerickI think I committed to putting together a proper JIRA workflow at some point, but it never struggles far out of the bottom of my list. :-(
15:28stuartsierraDiagram near the bottom, here: http://dev.clojure.org/display/design/JIRA+workflow
15:30chouserAny chance we could rename "test" to "screen" or "clojure screeners" to "clojure testers"? Just sayin'
15:31chouseranyway, thanks for that chart -- helps a lot!
15:31stuartsierra'welcome - I made that because I couldn't understand the process myself. :)
15:32dnolenstuartsierra: excellent diagram.
15:32stuartsierrathanks
15:46cemerickstuartsierra: ach -- except there is an actual workflow engine with state transitions and such that is self-documenting through the UI
15:47cemericknm, shouldn't complain unless I'm gonna go fix it :-)
15:49stuartsierracemerick: yes, I'd like it to be implemented directly in JIRA
15:49stuartsierraBy someone not me. :)
15:50cemerickstuartsierra: it's actually *really* easy.
15:50stuartsierraI'm sure it is, but I spend enough time on Maven. :)
15:50cemerickI just haven't wanted to shepherd that particular bit.
15:50cemerickright-o :-)
15:51cemerickstuartsierra: Did I see a tweet go by about spikes of a new c-m-p being done-ish?
15:53stuartsierravery ish, but yes
15:53stuartsierrahttps://github.com/stuartsierra/new-clojure-maven-plugin
15:53stuartsierraOnly 'compile' and 'eval' goals so far.
15:54stuartsierraCurrently trying to figure out if I can implement more of it in Clojure source code which get invoked as scripts from Java.
15:56cemerickstuartsierra: hugod experimented with building maven plugins using pure clojure a while back. Not sure it's suitable, but…
15:56stuartsierraI don't want any AOT-compiled Clojure code in the plugin, that's for sure.
15:57stuartsierraBut doing stuff like `binding` in Clojure source is certainly simpler.
15:59chouser"doing stuff...in Clojure source is certainly simpler."
16:00TimMcstuartsierra: Why not? (re: AOT)
16:13cemerickTimMc: because we want the same build of the clojure-maven-plugin to work with multiple versions of Clojure, and AOT compilation does not guarantee compatibility across releases.
16:47TimMcAh, that makes sense.
16:47TimMcVery good reason not to AOT.
16:56mecHow might I define a custom toString for a record
16:57mecOh wow, I can just use Object
16:57brehaut(defrecord MyRec [] Object (toString [this] "foo"))
16:57TimMcmec: Do you need toString, or is changing the behavior for Clojure's print methods sufficient?
16:59mecThis is so strange, i could have sworn defrecord, deftype, and reify only allowed protocols and interfaces
16:59brehautmec and Object
16:59mecya i see that now in all the docs
17:00brehautmec: think about it: if you couldnt define a type that derived from object, there is no way you could produce native types on a jvm host
17:00TimMcbrehaut: Hah, I never thought about that before.
17:00clojurebotI don't understand.
17:01brehautmec: however, without knowing what your usage is, overriding tostring does seem a bit of a smell
17:03brehautTimMc: having said that, i wonder if Object as the root class is a property of the jvm or of javac; even if it were javac, it seems that clojure would still want to abide by it for interop reasons.
17:04mecok reify says protocol-or-interface-or-object but (reify JPanel ...) says "IllegalArgumentException only interfaces are supported"
17:04TimMcI'm sure it's a JVM thing. Type erasure gives you an Object.
17:04TimMcAlso, I can't imagine the JVM supporting multiple hierarchy roots.
17:07brehautTimMc: i suspect you are right, but i dont want to claim definite things in domain im quite a noob in
17:07mecooo specifically Object not any object
17:19__name__Why does IPersistentSet have public Object get(Object key);?
17:24hiredman,(.get #{'a} 'a)
17:24clojurebota
17:27__name__hiredman: I don't understand the use.
17:27__name__hiredman: To use it as a dict that maps keys to itself.
17:28danlarkinthat's how sets are implemented in clojure
17:32dnolen__name__: (aset key) is faster then contains?
17:33__name__$source aset
17:33sexpbotaset is http://is.gd/hxIvQT
17:33amalloy__name__: poorly-chosen name. he meant "some-set"
17:33dnolen__name__: i don't mean aset the fn, I mean like a-set
17:33__name__Thank you, nice people of #clojure.
17:34amalloy&((juxt map filter) #{1 4 7 10} (range 10))
17:34sexpbot⟹ [(nil 1 nil nil 4 nil nil 7 nil nil) (1 4 7)]
17:35amalloyyou couldn't really do this kind of stuff as easily if all sets had were a contains? method and had to be treated differently from maps
17:36__name__I understand
17:38mecIs there any way to define the empty constructor of a defrecord or deftype
17:40amalloyno. why would you? that implies you either want mutable state (evil!) or plan to assoc keys in gradually - in which case you're losing the performance benefits of records over maps anyway
17:40amalloyyou can call (Myrec. nil nil nil) if it's a three-field record, but that has the same performance issues
17:42akhudekhey all, I'm encountering some very bizarre performance profiles in a project I'm working on
17:42mecmore for default values
17:42akhudekin particular, VisualVM is claiming that the vast majority of the time is spent in clojure.lang.Keyword.hashCode
17:42akhudekand clojure.lang.PersistentVector.count
17:43akhudekbut looking at the source, hashCode is just returning an int
17:43akhudekand vector count should be a small constant time op too I would think
17:44mecare you making a lot of keywords or counting a lot of vectors?
17:45akhudekwell, vector counts I could see happening
17:45akhudekand I certainly do hash code lookups on keyword number pairs
17:45akhudekbut why these two constant time functions would be dominated over, say, actually adding to vectors or maps, is beyond me
17:46akhudekI can't see any spurious tight loops around these functions, at any rate
17:47dnolenakhudek: adding anything anything to a collection will trigger a call to hashCode on the key.
17:49akhudekhm, interesting
17:50akhudekI really wish VisualVM would show me the call stack
17:50akhudeklooking at naked function calls make it really difficult to figure out what's going on here
17:50akhudekkeyword.hashCode is at 44% of the runtime, and Vector.count is at 28%
17:51akhudekVector.createOwning is next at 5.5%
17:52akhudekcould a large enough vector perhaps cause a display like this I wonder?
17:52dnolenakhudek: if your code is mostly bashing away at a collection those numbers might not be surprising.
17:54akhudekHmm, so I'm using the versioning on data structures in an odd way that may be the problem.
17:55akhudekEssentially, consider a world state to be a big long vector.
17:55akhudekEvery time the vector is modified, a new world is created containing the new vector.
17:55akhudekThe worlds themselves are stored in a vector.
17:56akhudekWhen worlds get into the high thousands, like 7-8k, then I'm observing a very, very, slow step size.
17:56akhudekerr step time rather
17:59amalloywhy store the worlds in a vector instead of a list/cons chain? vectors are fast, but they do have some overhead; unless you're doing random-access it might be faster to use a list
18:00akhudekI do need random access.
18:00akhudekThis is in a formal logic prover.
18:00akhudekAnd some worlds are "active" and moves are made on these.
18:01akhudekthe active worlds are not always exclusively at the end of the list either, mostly, but they can be interleaved with recently closed worlds.
18:01akhudekbut what I'm observing is some sort of quadratic slow down in speed
18:01akhudekso something else is going on
18:02akhudekfor instance, I'd expect this if for some reason, it was visiting every item in every world on each step
18:03akhudekI'm going to see if I can replicate the behaviour in a small example.
18:18Geisteskrankh,(symbol "I worship your shadow")
18:18clojurebotI worship your shadow
18:18Geisteskrankh,(symbol? (symbol "I worship your shadow"))
18:18clojurebottrue
18:19Geisteskrankh,(let [a-symbol (symbol "I worship your shadow")] (eval (list 'def a-symbol 3)))
18:19clojurebotDENIED
18:19Geisteskrankh=*
18:37akhudekwow, I can't replicate it
18:37akhudekand this profiler is returning some wonky things
18:38akhudekI did disable one part the prover and now it's supposedly spending 90% of it's time on Keyword.hashCode
18:38akhudekthat just doesn't make the slightest sense
18:40akhudekI guess it must be not catching something
18:42dnolenakhudek: what you're seeing sounds odd. are you giving the JVM enough memory?
18:43akhudekit's using less than 80mb at the moment
18:43dnolenakhudek: the only time I've seen "quadratic" slowdowns is when the JVM is running of memory. Then you see crazy GC thrashing, and things get very slow.
18:43akhudekhm, I'll try bumping it just in case
18:43dnolenakhudek: Clojure is memory hungry, I rarely do anything w/o at least 512mb
18:44dnolenakhudek: add multiple threads and you got start adding a lot more memory very quickly.
18:44danlarkinhaha yeah 80m to the jvm is nothing
18:44danlarkinthat's like the startup cost
18:49DantasHi everyone !!! Does anybody have a good link explain the clojure protocol ?
18:50akhudekhttp://min.us/lm9sVg
18:50akhudekhttp://min.us/lm4WqI
18:53Dantas$google protocols
18:53sexpbotFirst out of 5780000 results is: Communications protocol - Wikipedia, the free encyclopedia
18:53sexpbothttp://en.wikipedia.org/wiki/Communications_protocol
18:53lancepantzheh, yeah...
18:55TimMcI saw a video on clojure protocols recently...
18:55dnolenakhudek: interesting, what are the call counts?
18:56TimMcDantas: http://vimeo.com/11236603
18:56akhudekgood question, let me see if I can get it to count those
18:58TimMcDantas: http://clojure.org/protocols also exists, but doesn't really motivate protocols inmy mind
18:59akhudekah, I think I've found it, VisualVM "sampling" doesn't really work all that well, or rather always samples at some predictable time
18:59akhudekdoing an actual profile gives me different results
18:59akhudekthanks!
19:00akhudekmind you, a full profile is so slow I'll probably have to leave it here for a day to get useful results :/ such is life!
19:02DantasTimMc: Thanks for the video !
19:02DantasTimMc: i found this article , http://www.ibm.com/developerworks/java/library/j-clojure-protocols/?ca=drs-
19:03DantasTimMc: seems to be nice !
19:28ataggart,(into-array Byte/TYPE [1])
19:28clojurebotjava.lang.IllegalArgumentException: argument type mismatch
19:29ataggart*clojure-version*
19:29ataggart,*clojure-version*
19:29clojurebot{:major 1, :minor 2, :incremental 0, :qualifier ""}
19:29amalloy&(into-array Byte/TYPE [(byte 1)])
19:29sexpbot⟹ #<byte[] [B@f51e5b>
19:29ataggartthx
19:30ataggart&(byte-array [1])
19:30sexpbotjava.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Byte
19:30ataggartthink that discrepancy is a bug, missing feature, or works-as-intended?
19:30amalloydiscrepancy?
19:31amalloyyou mean the different error messages from byte-array and into-array?
19:31ataggartinto-array will make a byte array out of a seq of longs, but byte-array won't
19:31ataggartthe former does a cast, the latter doesn't
19:31amalloywhat? no it won't. you just tried doing it and saw it didn't work
19:32amalloy&(byte-array [(byte 1)])
19:32sexpbot⟹ #<byte[] [B@1ec452c>
19:32amalloythey both work under the same conditions: each element of the input vector is a Byte
19:32ataggartinto-arrya owrks without explicit casting
19:33amalloy&(into-array Byte/TYPE [1])
19:33sexpbotjava.lang.IllegalArgumentException: argument type mismatch
19:33ataggart&*clojure-version*
19:33sexpbot⟹ {:major 1, :minor 2, :incremental 0, :qualifier ""}
19:33amalloythis does not look to me like working
19:33ataggartthat's why
19:33ataggarttry 1.3
19:35ataggartyes, I'm not asking whether one works and one doesn't. I can see my terminal and look at the code for RT.seqToTypedArray. Just wanted input before I open the ticket
19:36ataggartnevermind
19:36dnolenataggart: does it work correctly in 1.3?
19:37ataggartin 1.3 into-array does not require explicit casting since RT.seqToTypedArray does a cast. Whereas byte-array throws a classcastexception because Numbers.byte_array just does a hard (Byte) cast.
19:38dnolenataggart: so a 1.2 bug yes?
19:39ataggartWith respect to casting, in 1.2 they both behave the same (an error), in 1.3 they behave differently.
19:40ataggartI'm inclined to think they should both have the same behavior, and in 1.3 I think that means automatically casting
19:43dnolenataggart: ah yeah, byte-array is broken.
19:43dnolenunpleasant in 1.3
20:53hiredmanmeta data getting eval'ed twice? https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L379
21:11TimMchiredman: I was able to observe that in a 1.2 repl
21:12TimMc(defn blah {:foo (println 5)} [x] x)
21:16amalloyhiredman: i asked a while ago on the mailing list about something that i think is related: http://groups.google.com/group/clojure/browse_thread/thread/09becb05362fb59c
21:19amalloybut now looking more at your link i think it probably isn't
21:37duncanmdoes anybody know how to tell emacs to indent the body of proxys differently?
21:37duncanmmaybe i just need to update my clojure-mode
21:38duncanmoh, amalloy has code in clojure-mode
21:38duncanmhmm, i really should update
21:39duncanmsigh, no updates from ELPA
21:41amalloyduncanm: elpa is for sissies. git pull
21:45duncanmheh
21:48duncanmamalloy: do you know what i mean about proxy and its indent?
21:48amalloyduncanm: i don't use proxy much. i suspect technomancy will tell you that if you get the latest version and/or enable backtracking indent, it gets proxy right
21:49duncanmamalloy: https://gist.github.com/899147
21:49duncanmso right now, i'm moving the arg list to its own line
21:50amalloyduncanm: c-h v clojure-mode-use-backtracking-indent
21:51amalloywith latest from git, and backtracking on, i get the right indentation
21:51duncanmwhat's the convention for a non-nil value in elisp?
21:51duncanmt?
21:51clojurebotWe don't have the time.
21:51TimMcI believe so.
21:51amalloyt
21:52amalloyor :holy-smokes-yes-please
21:52duncanmoh, awesome
21:56duncanmamalloy: thanks for the tip
21:59amalloyduncanm: welcome! feel free to accept other tips such as git pull :)
22:00sritchieguys, I'm a little wary posting about this bizarre macro again, but i've got one tiny little issue that's eluding me, and would love input -- https://gist.github.com/899155
22:00duncanmamalloy: didn't even do that, just turned on backtracking-indent ;-P
22:01amalloyi know. i meant, in addition to turning that on feel free to git pull :P
22:01duncanmoh, i was wondering about the doto macro
22:01amalloysritchie: s/example if/example of
22:01duncanmi changed the code already, but i think had trouble mixing methods and functions
22:02sritchieamalloy: thanks
22:02duncanmsomething like (doto obj (.someMethod foo) (a-function bar)) didn't work as I expected
22:02amalloyduncanm: really?
22:02duncanmi thought that would turn into (do (.someMethod obj foo) (a-function obj bar))
22:02duncanmi dunno
22:02amalloyah
22:02sritchieamalloy: actually, I promise I'm going to come up with a better solution in production code
22:02duncanmi had some issue with it, and i routed around it
22:03sritchiebut the problem is the when checkers is unrolled by the unquote spliced list comprehension, the vars inside of it aren't namespace qualified
22:03amalloyno, to get that you want (-> obj (doto (.someMethod foo) (a-function bar)))
22:03duncanmamalloy: oooh, that's a bit much
22:03amalloyer, i think my parens are wrong there
22:03amalloybut it looks vaguely like that
22:04amalloyi'm currently not-writing a blog post about how to combine doto and ->
22:04duncanmamalloy: oh great, that's basically it
22:04duncanmi think i want a way to get (do (.someMethod obj foo) (a-function obj bar) obj)
22:04duncanmand group all the objs together syntactically
22:05duncanmoh wait
22:05duncanmmaybe that's the issue
22:05duncanmmy clojure functions are functions....
22:05duncanmaha
22:05sritchieamalloy: so, since I have (defthreadfn phase-fn check-session), using (phase-fn [] first-form ..) will only compile in the namespace where check-session is declared
22:05sritchieanyway, just a weird one, no problem if it's too bizarre for treatment
22:05duncanmso what i wrote first was kinda correct
22:05duncanmamalloy: i get what you mean now
22:06duncanmamalloy: maybe a super 'with' macro could be written that merges the features of both 'doto' and '->'
22:06amalloysritchie: replace '~ with `~?
22:06amalloyduncanm: that macro is called let :P
22:06duncanmhaha
22:08sritchieyeah, (defthreadfn phase-fn check-session) returns No such var: pallet.crate.hadoop/checkers
22:10sritchieI'm doing a list comprehension on a collection of symbols, which is a problem -- would modifying the top-level let to include resolved-checkers (map resolve checkers) help?
22:10amalloysritchie: i don't think you want to do that
22:11amalloythen the user can't use any kind of checker except a top-level var
22:20hugodsritchie: should it just be ~checkers
22:22amalloyhugod: i don't think that will get it to resolve them. i'm not sure anything will do what he wants in every case
22:22sritchiethat almost works, yeah, but then the macroexpansion tries to evaluate check-session with no arguments
22:23amalloysritchie: ~(vec checkers) would do that
22:23amalloybut it's not really going to work in general
22:26sritchieamalloy: that helped, now (phase-fn [] (+ 2)) expands with (#<hadoop$check_session pallet.crate.hadoop$check_session@1a86ddb> "subphase ... etc
22:26sritchieI'm just getting loopy, I shouldn't be taking up time here with this
22:27amalloyyeah, i was about to retire. you're chasing unicorns here
22:27sritchiehugod had an idea for a different approach that's promising
22:27sritchieI may shift all resources there
22:27sritchieI'll let you know if I catch a unicorn
22:27amalloyheh
22:28sritchieI still like the idea of this! but this may be the point of monads, not special-case macro writing macros
22:29amalloygood idea
22:29sritchiethat's hugod's. okay, time to catch a mythical creature
22:30sritchieamalloy: thanks a lot
22:35mecanyone by chance have an emacs color theme like what is used on http://kotka.de/blog
22:35sritchieamalloy: actually, ~(vec checkers) works, for both top-level vars and functions passed in, defined on the fly
22:35amalloyneato
22:36sritchiethanks for the help, time to shelve this!
22:42TimMctechnomancy: I still can't get retest working.
23:13TimMctechnomancy: Specifically, it keeps whining about not finding robert/hooke, even though I've tried that both as a dep and dev-dep.
23:33technomancyTimMc: you re-ran deps after adding hooke?
23:33TimMcyeah
23:34technomancyit's pretty clear about only spitting out that message if (resolve 'robert.hooke/add-hook) fails
23:34technomancyand there's not really any way that could fail if hooke weren't on the classpath afaik
23:38TimMcOK, I've got [robert/hooke "1.1.0"] in deps, [lein-retest "1.0.0"] in dev-deps, and :hooks [leiningen.hooks.retest]
23:39TimMcI do lein clean, deps, test
23:39TimMc...and I get the error.
23:40TimMcBlowing away classes and lib doesn't help.