#clojure logs

2011-10-06

00:00duck1123there's 2 parts to it. The clojure server, and the emacs client in elisp. I believe there's something for VIM as well
00:01trptcolinah, looks like there's some fanciness going on, deprecated Thread.stop method and all
00:02alandiperttrptcolin: goodnight & godspeed, that would be a cool repl addition!
00:02trptcolinthanks man
00:02trptcolinand thanks duck1123 and amalloy too
00:03trptcolinnaptime for me as well
00:12tomojsuppose you have [[0 "foo"] [1 "bar"] [5 "baz"] [6 "bang"] [8 "bing"]] and want [["foo" "bar"] ["baz" "bang"] ["bing"]]. or you have [["foo" :x] ["bar" :y] ["baz" :y] ["bang" :z] ["bing" :z]] and want [["foo"] ["bar" "baz"] ["bang" "bing"]]
00:12tomojis there some slightly more general partitioning hof that can handle this kind of thing?
00:14tomojhmm, actually
00:16amalloytomoj: (partition-all 2 (map second foo)) for the first one?
00:17amalloyi mean, it's not entirely clear how your inputs and outputs are related
00:17tomojyeah..
00:18tomojin the first, partitions are runs where 'first' of each value increases by 1
00:19tomojin the second, it's just partition-by second I think?
00:19amalloytomoj: i wrote a more-general partitioning scheme you might like. let me find it
00:19amalloyhttps://github.com/flatland/useful/blob/develop/src/useful/seq.clj#L180
00:20tomojhttps://gist.github.com/56dc10b22a3d8fdc26c4 duh
00:20tomojoh, cool
00:21tomojI was trying to do something like that with (->> .. (partition 2 1) (partition-by ..))
00:21tomojbut it wasn't working
00:21amalloyyeah, partition-by is a special case of partition-between
00:29tomojhmm https://gist.github.com/9c059ff9d231b61c6bb7
00:29tomojI don't like either of those
00:31tomojbut they work, thanks
00:31amalloytomoj: the first one looks more like (partition-between (fn [[[x] [y]]] (not= y (inc x))
00:32tomojthat's better
03:25Blktgood morning everyone
03:25carkgood morning sir
04:24michaelr525hello
04:30kzarWhat causes null pointer exceptions generally? Any ideas how to get more information about why one happened?
04:31clgvkzar: strange compiler errors often do in clojure 1.2
04:31kzarclgv: I'm using 1.3
04:31clgvkzar: I can't say often then - maybe they improved a bit over there
04:32clgvkzar: do you get NPEs when compiling?
04:32kzarclgv: What's a NPE?
04:32kzaroh
04:32kzarsorry
04:33kzarclgv: Hmm well all clojure's compiled right? I get the error when evaling some code in the buffer, also when same code is run from within one of my tests with `lein test`
04:33clgvkzar: you get no hint where in the source it happens?
04:34raeksome functions indicate "failure" with NPEs
04:34raek,(let [[a b c] [1 2]] c)
04:34clojurebotnil
04:34raek*with nils
04:34clgvraek: but then you get the source line in most cases
04:35raekah
04:35raekkzar: you don't get a source line?
04:35kzarraek: Actually I do, sorry I didn't realise it was anything useful until you mentioned it
04:35kzarraek: That gives me a hint, thanks
04:36kzarraek: So much crap gets printed it's hard to pick out the one useful tid-bit eh?
04:36clgvkzar: use clojure.stacktrace and have a look for your files in there
04:37clgvis there a shortcut function to combine two map entries in a map similar to update-in
04:38clgvthe 1.2 cheat sheet doesnt tell me any
04:39cark,(update-in {:a {:b 1}} [:a] merge {:c 2})
04:39clojurebot{:a {:c 2, :b 1}}
04:39cark?
04:40carkmaybe not a shortcut, but short enough, if that's what you mean
04:40raekclgv: can you give an example of a desired output for a certain input?
04:40clgvI thought of something like: {:a 1 :b 3} [:a :b] + :c -> {:c 4}
04:40clgvI skipped other keys of the map
04:41carkok i was way off =P
04:42raekso :a and :b should be dissoced, and :c should be assoced with the result
04:42carki can't think of a one-liner for this one
04:42clgvyeah. thats what the intention was
04:43thorwila job for select-keys and vals, i guess
04:43clgvit seems to be a basic use case for a map, so I thought there might be something
04:43clgvthorwill: yeah that might do to implement it
04:44raek(defn combine-vals [m keys f key] (assoc (apply dissoc keys) key (apply f (map m keys))))
04:46thorwiloh
04:46raekit has three sub-expressions: 1) make a map without 'keys', 2) make a new value by applying 'f' to the values for 'keys' in the original map, 3) assoc 'key' with that value in the map from 1)
04:47thorwilclgv: keys in the map that are not in the list should be in the result
04:47thorwil?
04:47raekprobably looks more readable if you bind 1) and 2) in a let
04:47clgvraeks approach looks fine
04:48thorwilraeks approaches tend to do that :) i assumed other key-vals should be dropped, not kept
04:50raekthe argument order [m key f keys] feels more natural to me (this is very subjective and a different order may feel more natural for you in the context of your program)
04:53raekbut [m keys f key] is more consistent with update-in, though
04:53raek*shrug*
04:54clgvyeah, I used the latter
05:12zakwilsonMaybe I'm tired, but I haven't been able to find it. What do I put in my project.clj to get all of contrib 1.3?
05:14zakwilsonOr has contrib gone away and been replaced by libraries directly under org.clojure?
05:15BlafaselYes.
05:16thorwilzakwilson: see http://dev.clojure.org/display/doc/Clojure+Contrib
05:17zakwilsonthorwil: yeah, I found that just before you linked it. Looks like a bunch of stuff has moved though. This is going to require changes to my code, I think.
05:17raekand http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
05:18thorwilzakwilson: you might want to put ":repositories {"sonatype-oss-public" "https://oss.sonatype.org/content/groups/public/"}" into your project.clj
05:28zakwilsonHmm... append-spit seems to be gone. Is there a new name for it?
05:28raekzakwilson: spit now takes an :append option
05:28zakwilsonAhh.
05:28raekhttp://clojuredocs.org/clojure_core/clojure.java.io/iofactory
05:29raekit sends all its arguments to clojure.java.io/writer
05:29raekand therefore gains the superpowers of clojure.java.io
05:30raek(works on Files, URLs, strings (becomes file or url), byte arrays, sockets, &c)
05:31zakwilsonOk, this actually looks like it might be working with pretty minor changes then.
05:32zakwilsonIs there a replacement for read-lines?
05:32raekline-seq
05:33raekbut it does not close the stream like read-lines
05:34raekmost file operations are often used together with 'with-open'
05:35raekbut watch out so that you don't return the lazy line-seq out of with-open
05:36clgvis there a min function that uses compare automatically?
05:36raekeither process it inside with-open or wrap the line-seq call in a doall call
05:37zakwilsonGot it. Thanks.
05:44ejacksonmorning all
06:23kzarraek: It's this line that's giving a null pointer exception, but I can't see why! https://github.com/kzar/ring-hmac-check/blob/master/src/ring/middleware/hmac_check.clj#L29
06:23kzarraek: When called from here https://github.com/kzar/ring-hmac-check/blob/master/test/ring/middleware/hmac_check_test.clj#L24
06:29raekkzar: it's hard for me to tell too (I don't spot anything obvious) without the stacktrace
06:30kzarraek: http://paste.lisp.org/display/125118
06:47raekkzar: I think the "or" form should be a map and not a vector
06:48raekpred becomes nil because the :or didn't work
06:48raekit was probably treated as {0 forbidden-handler, 1 (fn [req] ...), 2 ..., 3 ...}
06:49raeksince vectors can be seen as maps from indices to values
06:49raekbut it would be good if the compiler could complain when you try to do this
06:55raekkzar: maybe you could open a ticket in Jira regarding that the :or form is silently ignored if it's of the wrong kind (a vector in the case of map destructuring)
07:42michaelr525i'm falling asleep here
07:54kzarraek: Thanks! I've got it working, new version pushed also I opened that ticket http://dev.clojure.org/jira/browse/CLJ-848
08:21fdaoudRest in peace, Steve Jobs
09:06bhenryif you use and require inside a do, is it only available inside the do?
09:09raekbhenry: no
09:10raek"use" and "require :as" mutate the current namespace when they add aliases
09:23thoeferIs there any particular reason why the and macro uses stack consuming recursion instead of recur?
09:23thoeferI´m quite new to clojure so excuse me if I don´t see a obviouse point
09:23joegallomacros only work with the code that's sitting there in front of you
09:24joegalloi would be pretty surprised if somebody wrote a big enough and for it to blow the stack
09:24clgvthoefer: it is a macro hence it consumes no stack but is expanded on compile time
09:25clgv&(-> '(and a b c d) macroexpand-1 pprint)
09:25lazybotjava.lang.Exception: Unable to resolve symbol: pprint in this context
09:25clgv&(-> '(and a b c d) macroexpand-1)
09:25lazybot⇒ (clojure.core/let [and__3468__auto__ a] (if and__3468__auto__ (clojure.core/and b c d) and__3468__auto__))
09:25clgv&(-> '(and a b c d) macroexpand-1 macroexpand-1)
09:25lazybot⇒ (let* [and__3468__auto__ a] (if and__3468__auto__ (clojure.core/and b c d) and__3468__auto__))
09:25clgv&(-> '(and a b c d) macroexpand-1 macroexpand-1 macroexpand-1)
09:25lazybot⇒ (let* [and__3468__auto__ a] (if and__3468__auto__ (clojure.core/and b c d) and__3468__auto__))
09:26clgvhumm I would have like macroexpand to expand the inner as well for demonstration ;)
09:26chouserclgv: this is a common desire
09:26thoeferthanks guys I think I see your points!
09:27chouserclgv: there are bits of code that simulate that, but it a form with inner macros expanded never actually exists in memory while the Clojure compiler is running, so such an expansion is a bit of a lie
09:29clgvchouser: huh? the compiler has hidden magic ways of dealing with macros?
09:29chouserwell, they're not magic, and they're no more hidden than everything else the complier does... but other than that, yeah. :-)
09:31clgvI never checked the jvm source of macro handling... ;)
09:31chouserthe compiler transforms the forms you give it into a new tree of data that has a lot more information about each form. The shape of this analysis tree is roughly the same as what was read, but each node looks very different.
09:32clgvok, so macroexpands aim is to have a user friendly look at macroexpansion?
09:32chousermacroexpansion happens as nearly the first step of analyzing a form, and only after the analysis for that form is complete are the children macroexpanded as needed.
09:32clgvok
09:33chouserwell, the macroexpand you can call is the same one the compiler uses. the very one.
09:33chouserbut then more work is done on it before the kids are expanded.
09:33chouserSo there's never an expanded outer form with expanded inner forms all put together at once.
09:33thoeferhow would you guys implement a basic binary search tree in clojure? I tried but the absence of state, even with atoms, refs etc. is quite new to me. Just a basic outline of the implementation would help enormously...
09:34clgvthoefer: I would use a sorted set that should be very similar ;)
09:34chouserthoefer: you're doing this as a learning experience? if not, just use a sorted map or set
09:34chousersorted-map and sorted-set are red/black binary trees inside.
09:35thoeferdo I have to rebuild the tree everytime I add a new node? It´s some kind of evaluation for a smaller university project :)
09:35chouserevaluation of you or the language?
09:35fdaoud:D
09:35thoeferboth :)
09:36Blafaselis there a way to have something like (fn [&varargs] ..) in the #() form? Is there a magic % way?
09:36chouserBlafasel: %&
09:37Blafasel,(#(println %&) [1 2 3] [4 5 6])
09:37chouserthoefer: so I still don't understand if you want to write your own code to do binary tree stuff, or if you're wanting to understand sorted-map better.
09:37clgvblack magic O.O
09:37clojurebot([1 2 3] [4 5 6])
09:37BlafaselAh..
09:40thoeferchouser: I want to implement my own binary search tree, maybe my problem can be reduced to the question if I have to rebuild the entire tree when I add a new node?!
09:42chouserthoefer: ah, yes you'll need to recreate all the nodes in the path from the root to the node you're adding.
09:42thoeferchouser: that sounds really expensive... anyway thanks!
09:42clojurebotchouser: it's tougher with guards (arbitrary tests), where grouping is less clear. I need to work that out still.
09:43kzarCan you def a variable in another namespace? like (def some-other.namespace/*whatever* 42)
09:43chouserthis is why the most commonly used collections in Clojure are not binary
09:43chouserthoefer: they have up to 32 children per node so that trees are very shallow and not so many nodes need to be recreated for changes
09:44chouserthoefer: also transients allow batches of changes to be made without creating new intermediate nodes
09:44thoeferok, that´s a reasonable optimization
09:45chouserthoefer: but yes, it is both less fast and more complicated than a mutable tree. But the benefits in code simplicity and clarity are almost always more than worth it.
09:45thoeferwill need to read more about transients :)
09:45chouserkzar: no, not without actually switching to that namespace. why do you think you want to?
09:45chouser:-)
09:46kzarchouser: Why do you think I think I want to?
09:46kzarheh
09:46kzarI'm using noir and I want to save the mode like :dev / :prod in another namespace so I can check it later
09:47thoeferchouser: thanks a lot for your help! making a coffee break now... :)
09:47bhenrykzar def an atom in that namespace and use it in the one that defines :dev / :prod
09:48bhenrymaybe?
10:05pandeirois there any example online of using ClojureScript's clojure.browser.net xhr wrapper? I'm new to Clojure and don't get what I am supposed to do with the IConnection protocol to use it
10:43chridohi, i have a simple problem: i have a set which i get from the database in this form ({:id "someid", :classification 2} {:id "2ndid", :classification 3})
10:44chridofor usage in my rest of clojure i want to map it to ({:id "someid", :classification "urgent"} {:id "2ndid", :classification "very urgent"})
10:45chridoso map 2=> "urgent" and 3 => "very urgent"
10:46chridothere must be something short to do this without if/else...
10:46clgvchrido: use a self-written function urgency on those maps via (update-in m [:classification] urgency) and urgency can be implemented via case
10:46clgvor you can use a map insteady of that function
10:47clgva map like: (update-in m [:classification] {2 "urgent", 3 "very urgent"})
10:47raek(def classifications {2 "urgent", 3 "very urgent"}) (defn convert-entry [entry] (update-in entry [:classification] classifications)) (defn convert-entries [entries] (map convert-entry entries))
10:48chridoraek, clgv: thanks a lot! wasn't aware of update-in
10:48cark,(let [values {2 :urgent 3 :very}] (map #(update-in % [:classification] values) [{:classification 2} {:classification 3}]))
10:48clojurebot({:classification :urgent} {:classification :very})
10:49raekclgv: you beat me to it ;)
10:50chridocan it be done shorter? ;)
10:50chridocark: thanks!
10:50clgvchrido: yeah, you can store it in the database ;)
10:51raek(for [m entries] (update-in m [:classification] {2 "urgent", 3 "very urgent"}))
10:51raekI prefer 'for' in this case
10:51chridoclgv: or create a view :D
10:51carkraek : why ?
10:52raekyou get less of a gap between m and entries in the code
10:52Blafaseljava.lang.OutOfMemoryError: Java heap space
10:52Blafaseloops :)
10:52raekat least it looks better for bodies larger than one line
10:53carkraek: i don't know, map is so pervasive, it should be very readable
10:58clgvcark: define a function or macro that expands to the map
10:58clgvbut I dont think it gets more readable then
11:47Blafasel... 1025 lines of stacktrace? Seriously? For a 20 line file?
11:49stuarthallowayWhat's the correlation between file size and stack trace size? Aren't they orthogonal?
11:49BlafaselSure.. I guess I would find 1025 excessive in any case.
11:51stuarthallowayWhat's excessive: Existence, or reporting?
11:52stuarthalloway1.3 repl reports 1st 10 lines, while providing access to the rest if you care
11:57BlafaselI just ran a couple of (probably stupid) things via java <putOptionsHere> my.clj which outputs everything. I didn't use the repl for this to check if I can get line numbers in error messages.
12:26PPPaulhow do i kill a long running function in clojure?
12:26PPPaulvia slime emacs
12:35robermann_C-c C-c
12:38robermann_bye
12:55BlafaselCan someone help me understand what exactly happens if I declare something as (fn [[& as]] ..) vs. (fn [& as] ..) ?
12:57joegallo,((fn [& xs] (prn xs)) 1 2 3)
12:57clojurebot(1 2 3)
12:57joegallo,((fn [[& xs]] (prn xs)) [1 2 3])
12:57clojurebot(1 2 3)
12:58joegallothe first will take many arguments and turn them into a seq, called xs
12:58pcavsBlafasel: The first [[& as]] is destructuring the first argument as a rest argument. The second is actually taking only a rest argument.
12:58pcavs,((fn [&as] as) (range 10))
12:58clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: as in this context, compiling:(NO_SOURCE_PATH:0)>
12:59joegallo,((fn [xs] (prn xs)) [1 2 3])
12:59clojurebot[1 2 3]
12:59pcavs,((fn [&as] as) (range 10)))
12:59clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: as in this context, compiling:(NO_SOURCE_PATH:0)>
12:59pcavs,((fn [& as] as) (range 10)))
12:59clojurebot((0 1 2 3 4 ...))
13:00pcavs,((fn [[& as]] as) (range 10)))
13:00clojurebot(0 1 2 3 4 ...)
13:01Blafaselpcavs: joegallo: Thanks.
13:12sridin clojurescript, (.foo o) compiles to o.foo; but foo is a function (prototype method), and I had to write (.foo o nil) to force compile it to o.foo(); is this a bug?
13:13chousersrid: it is not a bug.
13:13srid(.bar o 234) works, and .bar always takes that one argument.
13:14chouserOn th JVM, o.foo can only be an method or field. You can't get the method as a "value"
13:14chouserso there's no ambiguity. This isn't true in javascript, so you have to resolve the amibuity for Clojure.
13:15chouserClojure has an older interop syntax that helps out here.
13:15chouser(. o bar) for fields, (. o bar (arg1 arg2)) for a method call, and just (.o bar ()) for a method call with no args
13:15sridI also see this syntax (. o (bar)) which does o.bar()
13:16chouser(.bar o null) is actually doing o.bar(null), which is *almost* always the same as o.bar()
13:16chouserbut if bar were to check its arguments.length, it could tell you passed a null arg, so (. o bar ()) is safer.
13:17ibdknoxI find (. o (bar arg1 arg2)) clearer, but I think that's just personal preference
13:17duck1123a
13:18chouseroh, am I mistaken? maybe my examples were wrong.
13:18sridibdknox: does -> work with that form? eg: (-> o (foo arg1) (bar arg2 arg3))
13:18ibdknoxno
13:18sridshame
13:18ibdknoxdoto will, though... I think
13:18sridbut i want to call bar on the object returned o.foo
13:19ibdknox..
13:19chouserheh.
13:19ibdknox(.. o (foo arg1) (bar arg2 arg3))
13:19ibdknox,(doc ..)
13:19clojurebot"([x form] [x form & more]); form => fieldName-symbol or (instanceMethodName-symbol args*) Expands into a member access (.) of the first member on the first argument, followed by the next member on the result, etc. For instance: (.. System (getProperties) (get \"os.name\")) expands to: (. (. System (getProperties)) (get \"os.name\")) but is easier to write, read, and understand."
13:20ibdknoxchouser: are you sure that (. foo bar ()) doesn't pass an empty list as the first arg?
13:20zippy314Hi, can anybody point to instructions (or tell me) on how, in my lein project.clj, to refer to my own fork of github project that's a dependency normally on clojars? I feel like the answer should be really straight-forward, but haven't been able to figure it out. Thanks.
13:21chousersrid, ibdknox: I think I was wrong in my examples.
13:21chousershould be (. o (bar arg1 arg2)) and (. o (bar))
13:21ibdknoxk
13:21sridibdknox: .. is exactly what I need.
13:21ibdknoxI know those word
13:21ibdknoxwork*
13:21ibdknoxwithout caveat
13:21chouserI always disliked that syntax as was happy we got (.foo bar) and (Foo/bar)
13:21chouseralas
13:22ibdknoxhaha
13:22ibdknoxback again!
13:22sridchouser: me too
13:22technomancyzippy314: look in the readme for the section on "checkout dependencies"
13:22srid((.foo bar))?
13:22ibdknoxdon't do that
13:22chouseryeah, that's something else again
13:22chouserbar will see a "this" of null
13:22sridjavascript, oh my!
13:25PPPaulif i spin up an infinite amount of futures (one a second or something) will i run into any problems? (i'm waiting for each one to finish before i start a new one, i know it's not really a good use of a future)
13:25technomancyPPPaul: it's fine as long as you have infinite hardware
13:25PPPauloh
13:26PPPaulshould i be reusing a future or something?
13:26hiredmanit's fine
13:26technomancyI'm just messing with you
13:26PPPaul:P
13:26technomancythey'll use a thread pool
13:26zippy314technomancy: I don't quite understand. You mean if I clone my fork, and symlink that clone into myproject/checkouts then lein will include the files from that directory as if I had named them as a dependency?
13:26hiredmanfutures will be garbage collected when you are done with them
13:26technomancyzippy314: right
13:26hiredmantechnomancy: I don't think checkout deps are what he wants
13:26PPPaulcool, that's what i was hoping for. just wondering if i had to do any cleanup
13:27zippy314technomancy: sweet! Thanks!
13:27technomancyzippy314: but if you want it to be usable by others you should consider a clojars-hosted fork
13:27technomancyas hiredman alludes to
13:27chouserPPPaul: you'll have to shutdown the agent pools to exit cleanly, but that's all. see (shutdown-agents)
13:27technomancyorg.clojars.zippy312/mylib
13:28PPPauli'm not really sure what that means
13:28zippy314technomancy: Nah, this is only because the main fork hasn't pulled a feature I need yet. Have you considered adding a way in lein just to be able to point directly to a git repo?
13:29technomancyzippy314: checkout deps should work with submodules
13:29PPPauli want my program to run forever, making futures forever... so i don't think i'll be calling shutdown agents
13:30technomancyzippy314: without using submodules you should think through the fact that no one else working on the project will have the checkout deps set up for them
13:30technomancyso it should be able to work from the clojars version as well to play nicely with others
13:32zippy314technomancy: No, I was thinking just in general that it would be nice simply to be able to put in a the url of a git repo of a project (instead of a repository hosted name) and have lein pull down that repo, build it right in the checkouts directory.
13:38arohnerdid to-byte-array make it into new-contrib?
13:44cemerickGoogle Closure seems to insist on defining some top-level functions even if the code it's optimizing is entirely contained within a single closure. Has anyone noticed this / needed to get around this?
13:45chousercemerick: haven't noticed, no.
13:46chousercemerick: a friend of mine (and until recently a co-worker) is actively looking at ClojureScript for CouchDB as well
13:46cemerickI've got views and such working just fine
13:47chouserok, so you may be ahead of where he is.
13:47cemerickThey're tightening up what's acceptable in a view function definition in 1.2 though — must be a single expression
13:47cemerickI can wrap what cljs produces with (function () { … })(), but gclosure puts a bunch of top-level `function B () { …}` sorts of definitions when it optimizes.
13:48hiredmanλ lifting I imagine
13:48cemerickThe bottom line being, it works, will work even in couch 1.2 with simple optimizations, but that a *lot* of code in a view fn. :-P
13:49cemerickhiredman: right; there may be an option for controlling that in gclosure's API, but I haven't gone spelunking yet.
13:50cemerickIt has a functionally top-level scope already though, so I don't see the utility of defining those fns outside of it.
13:50cemerick(since you're supposed to give the compiler all the js you're optimizing anyway)
13:50hiredmangood point
13:50hiredmanhuh
13:51cemerickI'll dink around. Got to get the deck ready for tonight. I'll probably msg the dev list with my set of demands^H^H^H^H^H issues next week.
13:52jodaroquick lein question: is there project metadata available, i.e. does the project's version get stashed into a var somehwere?
13:53jodaromy use case is to have the project version as part of the user-agent string in a restful api client
13:53jodaroand not have to remember to update it in > 1 place
13:55jodaroactually i'm not even sure how that would work
13:55jodarobut
14:01gfredericksjodaro: my limited knowledge doubts it
14:01technomancyjodaro: it's set as a system property
14:01technomancy(System/getProperty "myproject.version")
14:02jodaroahh
14:02jodarothat makes sense
14:03gfredericksdoes anybody know what an unbound fn is? I'm trying to call a clojure function from java via RT.var(...)
14:03gfredericksand getting an exception after casting to IFn
14:03gfrederickswell I mean the casting works fine, the exception comes from fn.call()
14:04hiredmanthe namespace the var is in isn't loaded
14:04hiredman(the var hasn't been initialized)
14:04gfrederickshiredman: ah ha
14:04gfrederickshiredman: so I gotta require it somehow
14:10gfredericksalright, does anybody know how to load a namespace from RT? Do a gotta load a "(require ...)" string?
14:14cemerickgfredericks: RT.var("clojure.core", "require").invoke(…)
14:15cemerickJava Swing method names and Clojure internals, these are the things I remember. :-P
14:15gfrederickscemerick: not sure why I didn't think of that. Quite thanks.
14:17gfredericksI'm curious why Var#invoke exists. I assume it's some kind of optimization, but not sure what for.
14:18hiredmanthe opposite, it just makes things easier
14:19gfredericksmy intuition fails me again!
14:21gfredericks(Symbol/create "foo")
14:21gfrederickswhoops not my repl
14:27devthwhen i use a (future) it makes it very hard to debug anything since exceptions inside the future call aren't relayed back to the repl. is there a way to peer inside and see if there are exceptions?
14:29hiredman(try … (catch Throwable t (.printStacktrace t)))
14:29hiredmanor use clojure.tools.logging
14:30devthhiredman: thanks, i'll try that.
14:50dafrahi there
14:50dafrahow to require some clojurecode from clojurescript ?
14:52zerokarmaleftwhat does RT stand for in clojure.lang.RT? reader types?
14:52technomancyruntime
15:01dafraanybody knows how to require or use clojure code from clojurescript ?
15:01ibdknoxadd :require or :use to your ns decl
15:02dafrai didnt manage to :require nor :use *.clj from *.cljs
15:02dafrai have to duplicate the file
15:02ibdknoxah sorry
15:02ibdknoxmisread
15:02ibdknoxyou can't yet
15:02dafrai hope its planned
15:03ibdknoxit's on the list
15:04dafrawher's that list ?
15:06ibdknoxI don't believe there's a physical list. I meant more metaphorically that it's on the minds of those working on it
15:07RaynesIt's in my sock drawer, underneath my internets.
15:07dafrajust looked at the clojurescript jira, and no ticket there
15:07ibdknoxRaynes, good place for it really
15:08ibdknoxdafra, feel free to add one, but its been discussed a fair amount both here and on the clojure-dev mailing list
15:08ibdknoxhow exactly it should be done hasn't been decided
15:08dafraibdknox: googling for clojurescript clojure require is of little help
15:09dafraibdknox: google still barely aware of clojurescript
15:12gfrederickssince duck-streams is deprecated, is there an append-spit anywhere, or do I have to make my own?
15:13ibdknoxgfredericks, I don't think it made it anywhere
15:13gfredericksibdknox: :/ oh well
15:15amalloyibdknox: really, it's planned? i thought rich's whole thing was that you can't easily "reuse" clj code in cljs and so you shouldn't try
15:16ibdknoxamalloy: I can't remember which thread brought it back up, but rich didn't comment on it
15:16ibdknoxDnolen and I have been going back and forth on how to do it some
15:16ibdknoxI see no reason why we can't share algorithmic code
15:17gfredericksdnolen made his match library work for both, right?
15:17ibdknoxyes
15:17dafrayou usually duplicate some controls in server and client
15:17dnolenamalloy: rhickey was not against the idea of reuse between Clojure/ClojureScript. There's a ticket assigned to him. I don't expect rapid movement on it though since a solutions needs to be carefully considered as it will change Clojure.
15:18ibdknoxdnolen, I'm still not convinced it *has* to change Clojure. What's the forcing function there?
15:18dnolenmacro-centric stuff (which is a lot of what I do) of course is easy to port. library stuff much more challenging.
15:18dafradnolen: jsut parse clj file as cljs
15:19dafrawe can have a polyglot subset
15:19ibdknoxwell, you'd want meta-data saying it should be parsed as such, but yes
15:19gfredericksfoo_bar.clj[s]
15:19ibdknoxlol
15:20dafraibdknox: why is this metadata needed ?
15:20dafraibdknox: simple functions work the same in both languages
15:20ibdknoxdafra, why parse a bunch of files that are guaranteed not to work?
15:21ibdknoxdafra, it should be an explicit choice
15:21dnolenthere subtle issues around the fact that types don't map cleanly, nor interfaces, nor protocols.
15:21dafraibdknox: maybe *.clp for polyglot files
15:21ibdknoxsupporting both cljs and clj from a single file will require deliberate care
15:21cemerickThis seems like not-a-problem, fundamentally.
15:22ibdknoxcemerick, doing it? or needing it?
15:22cemerickworrying about portability
15:22cemerickPeople that need it (library authors) can take care when possible.
15:23cemerickEspecially at this early stage, thinking about how to maximize portability seems like a waste.
15:23gfrederickscemerick: you don't think it'd be common in app code? e.g., user data validation?
15:23ibdknoxI agree, I just want it to work :)
15:24dafrasame here
15:24ibdknoxreally it's probably a couple line change in the cljs compiler to enable such a thing
15:24ibdknoxpick up *.clj files, if their ns decl doesn't have :cljs-compat or something in it, move on
15:24cemerickgfredericks: common? Probably not. You need to have *zero* interop. That takes a lot of code off the table.
15:25dafradnolen: how are protocol different ?
15:25ibdknoxcemerick, I have a number of things that I would definitely factor into code to be used in both places
15:25dnolendafra: ClojureScript has protocols early on, Clojure relies on a lot of interfaces.
15:25cemerickibdknox: you're a library author ;-)
15:25ibdknoxcemerick, touche
15:25ibdknoxlol
15:25dafradnolen: for new code we can use protocols for both
15:26ibdknoxcemerick, templates are a good example, outside of lib code though
15:26cemerickI'm just saying, it's a rat's nest of little details. There's nothing to gain from anyone working on the problem too hard (or doing anything 'simple' and thereby guaranteeing a constant stream of "it doesn't work" messages on the list).
15:26ibdknoxcemerick, with my impl of hiccup in pinot, they can be used transparently from client or server
15:26cemerickclojure : cljs :: clojure : ClojureCLR, IMO
15:27dnolencemerick: I'm skeptical, as people beging to realize that ClojureScript is NOT "Clojure Light" - they'll want some level of interoperability.
15:27cemerickibdknox: symlink to .cljs?
15:28ibdknoxhah, now I feel dumb
15:28gfredericksdnolen: that makes more sense with s/beging/begin/ than with s/beging/begging/ :)
15:28kzaribdknox: Is there a way to filter a route variable and store the result of running the filtering function? Say if I want to query the database to see if a post exists before I decide if the route's valid, but I want to save the result in the case that it is, so I can display it.
15:28cemerickdnolen: ClojureCLR is certainly not 'clojure light'; all the same issues apply
15:28dnolencemerick: what about a common graphics library that can target Java surfaces and the browser
15:28ibdknoxkzar, just do that in the body using a when-let
15:29dnolencemerick: not even remotely the same. JS is the most widely deployed language in the entire world except for C.
15:29dnolenClojureCLR has a low adoption ceiling, ClojureScript not so much.
15:29cemerickThat doesn't speak to the portability challenges.
15:29ibdknoxkzar, if the handler returns nil, it's the same as it not being valid
15:29hiredmanworking on backend data processing is great, I don't have to care about any of this
15:29cemerickhiredman: seconded
15:29kzaribdknox: Ah, cool thanks
15:30cemericksays the fool talking about clojurescript views in couch
15:30ibdknoxcemerick, :p
15:31dnolencemerick: macro-centric stuff has shown me how small the differences really. But all my workarounds are very ad-hoc.
15:31cemerickdnolen: to clarify, I think portability would be great, I just don't think anyone really knows how to do it right yet. And cljs will almost surely be the first target for whatever solutions are devised.
15:31dnolencemerick: not disagreeing there's no reason to rush into a solution.
15:31gfredericksdnolen: doing macros kind of sidesteps any runtime differences, doesn't it?
15:31cemerickThen let's just get a drink.
15:32gfredericksnot sidesteps, but doesn't come into contact with
15:32cemerickdnolen: have you twiddled with gclosure's compiler options any?
15:32dnolengfredericks: not entirely. for example try/catch in Clojure / ClojureScript not the same.
15:32gfredericksah ha
15:32dnolencemerick: no not much.
15:32hiredmanand macros themselves are different
15:32hiredmanyou have to load macros differently in clojurescript
15:33dafradnolen: how is try/catch different ?
15:34dnolendafra: in JS you just catch the error and bind it to a name, in Java you have to specify the exception type.
15:35dafradnolen: i've read about some plan to replace exceptions with default handlers, dont know if its done alreasy
15:36dafraalready, certainly not easy
15:36dnolencemerick: any other early ClojureScript impressions?
15:37winkwhat? no catch Throwable e? ;)
15:37dnolendafra: yeah I'm not sure where the Clojure exception stuff is headed.
15:43TimMcIt would be nice to have an alternate catch (with no specification of exception type) in Clojure so that code could be compatible.
15:43gfredericks(inc TimMc)
15:43lazybot⟹ 3
15:48sridis there a primitive to iterate items in *serious* of collections that may have overlapping items? I can't use (seq (conj coll1 coll2 ...)) here because when conj'ing a map, i'll lose duplicate elements
15:48srid*series*
15:49hiredmanserious?
15:49brehautjavascripts try/catch doesn't just have to bind a name; the catch clause can have a guard expression too
15:49hiredmanwell, conj won't give you a series of collections anyway
15:49amalloymapcat?
15:49amalloyor just concat? it's not clear what you want
15:51sridamalloy: concat works. trying to solve conj
15:51srids/conj/http://www.4clojure.com/problem/69/
16:03PPPaulhow do i use (binding []) to have a threat print to the slime console?
16:05leafwhi. Where can one find the jar for the monads library that used to be in clojure-contrib.jar ?
16:06leafwor, what does one write in the project.clj from lein?
16:08brehautleafw: the new algo.monads is [org.clojure/algo.monads "0.1.1-SNAPSHOT"] and you need to also add :repositories {"sonatype-snapshots" "https://oss.sonatype.org/content/repositories/snapshots/&quot;} to your project.clj to get leon to search the snapshots repo
16:10leafwthanks brehaut, that helped lots. Is there any webpage where this is explained, or one has just to find out here?
16:10brehautleafw: no idea actually; i figured it out by watching IRC for a few days and piecing things together
16:11brehautleafw: remember to switch your use or require stuff to clojure.algo.monads too
16:11leafwindeed, thanks
16:11zerokarmaleftleafw: for the library itself? https://github.com/clojure/algo.monads has tutorial links
16:11leafwthanks zerokarmaleft
16:12zerokarmalefti imagine they were written pre-1.3, though
16:12brehautleafw: out of curiosity, what are you using it for?
16:12sridamalloy: through #128 I discovered that maps can take a 2nd argument.
16:12zerokarmaleftbrehaut: how'd you figure out where the jar was hosted since it's not on clojars?
16:13leafwa file text parser, with (def parser-m (state-t maybe-m)) and then defining my own domain language for the parsing.
16:13brehautzerokarmaleft: watching IRC; i think hiredman mentioned something about the snapshot repo
16:13zerokarmaleftfair enough
16:13brehautleafw: cool :) before you get to far, you know about fnparse right?
16:13hiredmanI don mention stuff about things sometimes
16:14leafwthe github.com/clojure/algo.monads could explain what brehaut knows about lein and the jar ... would help more people than just me
16:14leafwbrehaut: no, didn't know about fnparse
16:14leafwbrehaut: I am just adapting existing code to 1.3.0, and the clojure-contrib disappeared.
16:14hiredmanthere are a number of different parsing libraries for clojure
16:14brehautleafw: there also a variety of clj-parsec ports too, but fnparse is the most used parser combinator lib for clj at the moment
16:15leafwwill definitely checkout fnparse, thanks for the tip
16:15brehautcgrand's parsley sounds interesting too
16:17leafwok, found the jar, back to work. See you all later and thanks for the help.
16:19leafwquit
16:22PPPauli want to bind a var used in a future, that is declared outside of the future... i'm trying (binding [varName 0]...) but it's not working in the future
16:22hiredmanPPPaul: declared?
16:23hiredmanI suspect var does not mean what you think it does
16:23cemerickI guess I need to understand gclosure better: it will 'optimize' "a.someRealName" into "a.L" or whatever. Shouldn't that not happen?
16:24bprcemerick: iirc that won't occur if you "export" the name
16:24PPPaul(def varName 100)
16:24PPPaul(binding [varName 0] function)
16:25PPPaulwhen the function isn't a future, it works, but in the future it doesn't work
16:25cemerickbpr: in that example, `a` is a function argument…
16:25bproh
16:25hiredmanPPPaul: what version of clojure?
16:25cemerickI suppose that doesn't matter. (aget a "someRealName") is a bummer, tho.
16:25PPPaul1.2
16:25PPPaulwill this be different in 1.3?
16:26hiredmanvars are not dynamic by default in 1.3
16:26hiredmanand how are you binding it in the future?
16:26PPPauli'm binding it before calling the future
16:27technomancycemerick: a bit late on the discussion, but this seems relevant re: sharing code across runtimes: http://blog.ianbicking.org/2011/03/30/js-on-server-and-client-is-not-a-big-deal/
16:27PPPaul(binding [varName 0] (future ...))
16:27amalloybindings are thread-local
16:27hiredmanthat is not in the future
16:27technomancyI think templates are probably one of the few places it makes a lot of sense for app code
16:27PPPauloh
16:27dnolenbrehaut: good point, though still, different than Java
16:27PPPaulhow would i force the var to be different in the future, from outside the future?
16:28amalloyjust...(future (binding ...))
16:28PPPaulor is that impossible?
16:28PPPauloh
16:28PPPaulwhat if that future makes more futures?
16:28amalloyas of 1.3 they're a little bit less thread-local so your original version would probably work, but this is clearer
16:28cemericktechnomancy: yeah, and honest-to-goodness algorithmic stuff e.g. core.logic
16:28amalloyPPPaul: then you're probably abusing futures :P
16:28PPPaul^_^
16:29PPPauli'll try 1.3 first
16:31PPPauloh, my -main doesn't work anymore in clojure 1.3
16:32PPPauloh shit, my deps don't work in clojure 1.3
16:32PPPaul:(
16:33amalloyPPPaul: this is god telling you not to abuse futures and bindings
16:34Bronsawhat if PPPaul is atheist :P
16:34gtrakanybody think about using clojurescript with XUL or something for desktop apps yet?
16:35arkhgtrak: I've thought about it ; ) I was looking at prism, tho
16:35rbransonmake clojurescript generate actionscript, use adobe air #winning
16:37gtraklooks neat
16:37gtrakrbranson, there is las3r
16:38gtraki know some flex already, actually clojure there would be pretty sweet
16:40gtrakwhat about haxe?
16:52dabdI'd like to use a Java lib that defines an interface that I need to implement. what is the best way? reify?
16:59amalloyyes
16:59amalloyi mean, defrecord or deftype may be best in some circumstances, but reify is a generally-useful tool for this
16:59arohnerdabd: http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/
17:00dabdarohner:ty
17:02dabdI don't want to define a new type I just need to implement an interface so I am not sure if reify or proxy should be used. I'd like to implement this interface http://commons.apache.org/math/apidocs/org/apache/commons/math/analysis/UnivariateRealFunction.html
17:11PPPaulwhen i do (future (binding [var val] f)) i get a thread error
17:12hiredman"thread error"
17:14PPPauloh shit, it's working now
17:14PPPaul:(
17:28PPPaulwould someone be able to help me with my binding problem?
17:29amalloydabd: you do want to define a type, because you need to implement an interface, which java requires types for
17:29amalloybut proxy should be used only when reify isn't enough
17:30dabdamalloy: yeah it looks like I need proxy
17:30amalloywth, why?
17:30amalloyyou definitely do not need proxy to implement some interface
17:30dabdamalloy: bc I need to pass an instance of the implemented class
17:31amalloy&(.size (reify java.util.Collection (size [this] 10)))
17:31lazybot⇒ 10
17:31amalloydabd: reify gives you an instance, that's the whole point
17:32dabdamalloy: ok then reify should do it
17:33dnolenPPPaul: if you don't get an answer here, you can always ask on the mailing list as well.
17:35cemerickdnolen: you asked before, but I didn't answer: my bottom line impression of clojurescript right now is, it's fabulous as long as you know where the potholes are. The biggest potholes being around interop.
17:35cemericki.e. the map / object / array strangeness has tagged me many, many times so far.
17:36meliponehow do I convert a string to a keyword? for example "D" to :d ?
17:37dabdamalloy: with proxy I don't get any errors but with reify this: (reify org.apache.commons.math.analysis.UnivariateRealFunction (value [x] x)) gives me an error: Can't define method not in interfaces: value
17:37amalloy(value [this x] x)
17:37cemerick,(-> "D" .toLowerCase keyword)
17:37clojurebot:d
17:37cemerickmelipone: ^
17:37meliponethnaks!
17:37dabdamalloy: the method value is in the interface http://commons.apache.org/math/api-2.0/index.html
17:37sridis there a primitive that does negation of a function? #(not (p %))
17:37cemericksrid: complement
17:38dnolencemerick: yeah the map / object / array thing didn't bother me much since I was expecting that.
17:38pjstadig,(doc complement)
17:38clojurebot"([f]); Takes a fn f and returns a fn that takes the same arguments as f, has the same effects, if any, and returns the opposite truth value."
17:38amalloydabd: see my previous answer
17:38dnolencemerick: I've found interop less of an issue but I'm not trying to use it for CouchDB views either.
17:38dabdamalloy: ok I need the 'this'
17:39cemerickThere's nothing couchdb-specific about it, I don't think.
17:39dnolencemerick: excepts that views are meant to be small snippets of JS. And Clojure brings along a huge API.
17:39amalloyproxy is an older construct; since then all the "type-oriented" functions require an explicit this parameter
17:39cemericke.g. I needed to call a fn with a javascript array. Figuring out (apply array [1 2 3]) took 60 seconds, but it's unfortunate that that's the case.
17:40cemerickdnolen: That's an implementation detail. ;-)
17:40dnolencemerick: what's the alternative? (array example)
17:41dnolencemerick: Perhaps. Not sure how to get around it tho, calling seq pulls in a lot of code.
17:41dnolenand by a lot of code - not for scripting or browser stuff - just CouchDB views.
17:42cemerickre: arrays, there may not be an alternative. I've not looked at core.cljs in any seriousness yet.
17:43cemerickThe fact that e.g. cljs vectors are js objects just makes for a confusing state at first — at least, compared to the jvm, where having a wrong type usually fails faster.
17:43cemerickMy overfamiliarity with Java stuff probably accentuates that issue for me, though.
17:44cemerickdnolen: "lots of code" isn't really a serious problem for couch views. spidermonkey slurps it all in and keeps chugging away.
17:45cemerickI can imagine hitting some implementation-specific limit on code size somewhere (esp. in nonstandard couch builds perhaps), but it hasn't happened yet.
17:45dnolencemerick: well, glad you're digging in, curious to see where this stuff goes.
18:19prokiiI am trying to embed a repl in my gui so I can interact with the running program. But I am having trouble..
18:21prokiiI have an agent in one of the namespaces which my gui watches.. but when I use send to update the agent it returns the agent w/o the update.
18:27amalloythat's what agents do. they are asynchronous - the change you send can happen anytime on another thread
18:27prokiibut the gui never updates..
18:28prokiiit works when I send to the agent through a slime conection
18:41jlino one should talk about jline anymore
18:42jliso I stop getting false alerts
18:45hiredman.win 11
18:49sridi seem to be able to access functions a in cljs file even without declaring them with ^:export. what is the point of export, then?
18:51dnolensrid: are you compiling w/ advanced optimizations?
19:09sritchie,(flatten {:1 2 :3 4})
19:09clojurebot()
19:10sritchieis that the expected behaviour?
19:10hiredman,:1
19:10clojurebot:1
19:11sritchiethat's in 1.3.0
19:11hiredman,(doc flatten)
19:11clojurebot"([x]); Takes any nested combination of sequential things (lists, vectors, etc.) and returns their contents as a single, flat sequence. (flatten nil) returns nil."
19:11hiredman^- "...sequential things..."
19:12sritchie,(for [[k v] {:1 2 :3 4}] k)
19:12clojurebot(:1 :3)
19:12hiredmanmaps are not sequential
19:13hiredman,(flatten (seq {1 2 3 4}))
19:13clojurebot(1 2 3 4)
19:13sritchietrue, good point
19:13sritchie,(flatten #{1 2 3})
19:13clojurebot()
19:13hiredmanalso not sequential
19:13sritchieyeah, just clarifying for myself
19:13sritchieI was just surprised that it returned an empty sequence
19:15no_mindWhat is the best way to run compile on a namespace ? I want to do this during build time.
19:15hiredmanlein compile
19:15hiredman(go read the docs)
19:15no_mindwill this not compile all namespaces ?
19:16hiredman^-
19:16khaliGhiredman, except the array-map? :P
19:21sritchie,(sequential? (array-map :1 2 :3 4))
19:21clojurebotfalse
19:22hiredman 58.259 hiredman maps are not sequential
19:23technomancyno_mind: looks like the docstring fails to mention you can do lein compile :all
19:23khaliGwrap it in seq
19:23sritchieapply concat's fine for me
19:23sritchie,(apply concat {:1 2 :3 4})
19:23clojurebot(:1 2 :3 4)
19:34eanxgeekping clojure trying to build a package w/ lein on Mac OS X lion and am getting java.lang.IllegalArgumentException: Duplicate key: clojars (NO_SOURCE_FILE:0)
19:34_khaliG,(sequential? (seq (array-map :1 2 :3 4)))
19:34clojurebottrue
19:34eanxgeekI am new to clojure and this is my first attempt at doing this on Mac
19:35technomancyeanxgeek: probably something wrong with the :repositories key in project.clj
19:37eanxgeektechnomancy: this project.clj someone else wrote but looks good, :repositories {"clojars" {:url "http://clojars.org/repo&quot; :snapshots {:update :always}}}
19:38technomancyeanxgeek: that's going to conflict with the defaults
19:39technomancyeither remove it or add :omit-default-repositories and add central to your list
19:40eanxgeektechnomancy: ok I commented out the lines with ;;
19:40eanxgeekand now get a java.lang.Exception: EOF
19:41technomancycomment out the whole map
19:46eanxgeektechnomancy: ok as I mentioned I'm very new to this, if I wanted to go the other route, so as to do minimal damage to the project.clj how would I specify the :omit-default-repositories and add central?
19:47eanxgeekI tried doing :omit-default-repositories under :repositories
19:47eanxgeekbut not sure how or where to specify central
19:48gary_posterHi. I don't understand something. I can give a type hint in defrecord for float (and other things) but not keyword. Why not? This is 1.3.0. Here's my example in the REPL:
19:48technomancysomething like this http://p.hagelb.org/project.clj.html
19:49eanxgeektechnomancy: cool I did get the comments to work too
19:49eanxgeekthanks!
19:49gary_posteruser> (defrecord Test [^float value])
19:49gary_posteruser.Test
19:49gary_posteruser> (defrecord Test [^keyword value])
19:49gary_poster; Evaluation aborted.
19:49gary_posterUnable to resolve classname: keyword
19:49gary_poster [Thrown class java.lang.IllegalArgumentException]
19:49technomancyeanxgeek: no problem
19:50gfredericksgary_poster: use a pastie next time
19:50hiredmangary_poster: why do you need to type hint a keyword?
19:50gary_posteryeah sorry gfredericks, I thought it was just under the limit. I'll adjust smaller
19:50hiredman(short answer: you don't, so don't)
19:50gary_posterhiredman, I was doing it for documentation
19:50hiredmanit's not documentation
19:50gary_posterwhy not?
19:51hiredmandoncumentation starts with ;;
19:51gary_posterIt is advertised somewhere or other as a reasonable way to document stuff
19:51gary_postercitation eeded I know
19:51hiredmanso?
19:51gary_posterbut it seemed reasonable
19:51hiredmanI don't really care what a blog says somewhere
19:51gfredericksgary_poster: irrespective of whether it's a good idea, my guess is that you would have to use ^clojure.lang.Keyword
19:52gary_posterso...I liked it...and it seems like it ought to work...and it doesn't. No, this is either Joy of Clojure or Programming Clojure.
19:52hiredmanand?
19:52hiredman(none of that changes the fact that it is not documentation)
19:53hiredmanfor documentation you have comments and doc strings
19:53gary_posterhiredman, you seem unnecessarily peeved by me question! I'm learning clojure and using some standard well known books to do so. The advice comes from them
19:53hiredmanthe advice is incorrect
19:53gary_posters/me/my/
19:53lazybot<gary_poster> hiredman, you seem unnecessarily peeved by my question! I'm learning clojure and using somy standard well known books to do so. The advice comys from them
19:53gary_posteroh bah
19:53gary_posterto lazybot
19:54hiredmanhttp://dev.clojure.org/display/design/Library+Coding+Standards
19:56gary_posterack hiredman, thanks
19:56hiredmanI peeved because it annoys me to give sound advice to people who are learning the language and then have them say "well, this book/blog post/motivational speaker says to do it like X"
19:58gfrederickshiredman: somebody who's learning the language probably doesn't have a good way to compare the merits of you vs a blogger
19:59hiredmangfredericks: fine, then why are they so attached to the bad advice they get?
19:59devnIs there a way to get the cheat sheet fns that can be called, on, a seq?
19:59devn(in clojure.repl or something)
20:01pjstadighttps://github.com/technomancy/corkscrew
20:02technomancypjstadig: aw man, why you gotta go digging through my closet?
20:02gfrederickshiredman: my guess is he's hoping to write code that's in line with what's accepted by the community. Maybe by countering he was testing your confidence. You could have been also a beginner who tends to sound oversure, and upon hearing that JoC says the opposite, backed down.
20:02_khaliGwhere does JoC say that?
20:02hiredmanugh, I really hope it's not the JoC
20:02pjstadigtechnomancy: it's all up on github
20:02hiredman(but I will admit I never finished my copy of JoC so it could be)
20:03technomancypjstadig: I'd delete it, but there's the small matter of the language highscore board
20:03gfredericks_khaliG: no idea, I think gary_poster just mentioned it
20:03_khaliGJoC is a horrible book in any case, but i dont remember reading it there :/
20:03devnreally? you think that?
20:03devnI completely disagree.
20:04devnJoC is a great book.
20:04pjstadigtechnomancy: hehe you and your gaming of github
20:04technomancypjstadig: we gotta make a comeback after coffeescript passed clojure
20:04devnJoC has so much extra knowledge in it that you don't get out of most books.
20:04technomancyare you doing your part?
20:04_khaliGdevn, not on my book shelf :)
20:05devnIt's a cultural document and a great general programming book, and a great Clojure book.
20:05pjstadigi forked die-roboter
20:05devn_khaliG: different strokes I suppose. I really enjoyed it.
20:05technomancypjstadig: you got Big Plans?
20:05gfrederickshiredman: in any case, my impression is that documentation is an abstract term, distinct from comments and docstrings. type hints are totally capable of documenting the expected types of arguments. Whether or not you think it's a _good_ way to document expected types is more up for discussion, IMO
20:05pjstadiglooking for projects at capclug
20:06devngfredericks: I tend to agree that there isn't a concrete reason to choose not to use type hints, but I think they can be overused and are sometimes completely inappropriate.
20:06hiredmangfredericks: type hints communicate information to the compiler for generating faster code, they are not designed for communicating information to people, documentation is
20:07_khaliGdevn, i've got SICP, PAIP etc down as great books. I found JoY really hard to understand - i still dont think i've learnt anything out from it. The other book Practical Clojure is excellent though.
20:07gfrederickshiredman: they may not be designed to do that, but they certainly can
20:07devngfredericks: I think it is more idiomatic (w/r/t to 3rd party libs and so on), to talk about what you expect and return in the actual :doc meta on the function
20:07gfrederickshiredman: I just think "type hints are not documentation" is too strong
20:07gfredericksdevn: I don't disagree
20:07devnbut I don't disagree with people using type hints if that's a key area you want to highlight
20:07hiredmantype hints are bad style, clojure 1.3 requires less type hints to get good performance for a reason
20:07hiredmanthat reason is we don't want them
20:07gfrederickshiredman: no disagreement there
20:07devnin general though I do not believe in using type hints, but I sometimes use them when I "concretize" some function
20:08devnI will say and represent that something is "stable" or "hard" in the program by using a type hint to represent how strict it is
20:08devnbut I rarely use them in practice. I generally opt for the docstring
20:08devnYou can say way more there.
20:09devntype java.lang.String or something in your docstring instead of in the binding form or something, y'know?
20:09gfredericksyep
20:09devnat the same time I don't think anyone *must* do it a certain way, I just tend to think the community feels the style is more in line with what I'm prescribing
20:09hiredmanbe kind, use CharSequence (but I guess that ship has sailed)
20:10devn:D
20:10gfredericks:)
20:10devnjust wrap all of your types! (+ (int x) (int y))!
20:10devnThat's the key to performance!
20:11devn:)
20:11devn,(time (int (int (int (int (int (int 32)))))))
20:11clojurebot"Elapsed time: 0.07 msecs"
20:11clojurebot32
20:11hiredmanactually the key is the compiler inlines (+ x y) into (clojure.lang.Numbers/add x y), and in some cases can inline the call to clojure.lang.Numbers/add as an iadd
20:12devn,(time (int 32))
20:12clojurebot"Elapsed time: 0.068 msecs"
20:12clojurebot32
20:12devnhiredman: that's interesting
20:12devnI didn't know that.
20:12gfrederickshiredman: how can it do that? because 1.3 doesn't let + be dynamic?
20:12devnmethinks that sounds like a totally reasonable answer
20:12gfrederickscan't the root binding still be changed?
20:12devngfredericks: ewww
20:13gfredericksdevn: ??
20:13lazybotgfredericks: What are you, crazy? Of course not!
20:13devn(alter-var-root fail)
20:13hiredmanno, actually the compiler has inlined the 2 arity version of + into clojure.lang.Numbers/add since 1.2 at least
20:13gfredericksdevn: I'm not saying it's fun to change var roots, I'm wondering why the compiler is allowed to inline it semantically
20:13hiredman,(doc definline)
20:13clojurebot"([name & decl]); Experimental - like defmacro, except defines a named function whose body is the expansion, calls to which may be expanded inline as if it were a macro. Cannot be used with variadic (&) args."
20:13hiredmanit more or less uses the definline mechanism
20:14gfrederickshiredman: so is this an exception to the normal behavior of vars?
20:14gfredericksor do I not know how vars work?
20:14hiredmanyes, that is how definline works, it adds some metadate to the var which the compiler uses for inlining
20:15hiredmanturning clojure.lang.Number/add into an iadd is a late addition to 1.3
20:15hiredmanhttps://github.com/clojure/clojure/commit/e92978783e1ba7ac0e2617fdabfed576209d7fa4
20:16hiredmanit's semantically allowed to do it because it makes math fast
20:16gfrederickshiredman: what happens if you alter the root of an inlined var?
20:16hiredmandon't
20:17gfredericksweird to have forbidden parts of the language
20:17hiredmanyou'll get different behaviour based on if the compiler determines it can inline or not
20:17gfredericksdo the other lisps use vars?
20:17hiredmansimilar to alter-var-rooting macros and similar
20:18hiredmanvars are sort of like dynamic vars from common lisp
20:18hiredman(less so in 1.3)
20:20gfredericksvars have always seemed weird to me. They're often discussed as a way to achieve thread-local (dynamic-scoped?) values, but at the same time they're so much more mundane than refs/agents/atoms
20:21gfredericksand then in 1.3 we change it so by default they _don't_ give you thread-local state anymore
20:21gtrak`` gfredericks feels bad for the vars
20:21gfredericksit feels like there's two concepts being complected together, which I'm not used to in clojure
20:22hiredmanthey give you indirect linking
20:22technomancyvars have to be reference types or you couldn't update functions interactively
20:22hiredmanright
20:22gfredericksyeah :/
20:22technomancyin ml-descendants IIRC redefinitions don't apply retroactively
20:22hiredmanso they are very useful, but the same time you do pay a cost for them
20:23hiredmanso there are ways to avoid that cost, definline, defstatic, etc
20:24gfrederickshmmm
20:24hiredmanvars are also useful as serializable function pointers
20:25hiredman,(prn-str #'group-by)
20:25clojurebot"#'clojure.core/group-by\n"
20:25hiredman,(read-string (pr-str #'group-by))
20:25clojurebot(var clojure.core/group-by)
20:25gfrederickshiredman: that is quite an interesting way to look at it
20:26hiredmanif I ever write a book, the implmentation and design decisions around vars get a chapter
20:27gfrederickshiredman: if you ever write a book [about clojure], I will read it.
20:27hiredmanIIX. Vars: WTF?
20:29gfredericksIIX -- :D
20:29gfrederickshiredman: I want every chapter to be numbered by fake roman numerals
20:29hiredmanhow do roman numerals work again?
20:29hiredmanright, the other way
20:29duck1123Chapter #'IIX
20:29gfrederickslol
20:30duck1123I like vars because they allow me to write multimethods that dispatch on the function
20:30gary_poster_khaliG, gfredericks, hiredman, FWIW I found where I read about using type hints for documentation. In the current beta of Programming Clojure (Bedra and Holloway, clojure/core AFAIK) it says "These type hints serve three purposes: [o]ptimizing critical performance paths[, d]ocumenting the required type[, and e]nforcing the required type at runtime."
20:31gary_posterThat's not to contradict hiredman or the obviously authoritative page to which he pointed, but sharing where I got it.
20:31gary_posterI haven't reviewed JoC; I've been reading the PC beta more recently.
20:31gary_posterIt might or might not be in JoC, I mean
20:31gfrederickswell now we can all sleep soundly
20:32gtrak``there's no downside to too many hints I guess, unless they're wrong?
20:32hiredmanthey make the code harder to read and less general
20:33gfrederickscan you type hint with a protocol?
20:33technomancygtrak``: they're wrong more often than you think
20:33hiredmanprotocols are not types
20:33technomancybecause the code will still work if they're incorrect, so it's easy to change the code without changing the hints
20:33technomancy(in that respect they're just like comments)
20:34gtrak``i don't use them except to silence the compiler
20:34hiredmanthey do generate an interface you could type hint with, but you can breaks things
20:34gfrederickstechnomancy: isn't there some context in which a type hint changes the behavior?
20:34duck1123I think that'll get better with 1.3 now that they're checked more
20:34hiredmanbecause not everything that satisfies the protocol will implement the interface
20:34gfrederickshiredman: specifically things that are extend-type'ed?
20:34hiredmansure
20:35gfredericksI swear I remember being surprised at some point when I found out that a type hint could change a program's behavior
20:35duck1123gfredericks: if you have 2 classes that have the same method name, but you type hint the wrong way, you get odd errors
20:36gtrak``i've seen some rumors about optional static typing being not out of the question
20:36technomancygfredericks: a wrong type hint will result in reflection
20:36technomancyafaik
20:36hiredmandepends how wrong it is
20:36gfrederickstechnomancy: I mean beyond those sorts of performance implications
20:36technomancyhiredman: oh?
20:36gfredericksin some case, contradicting the type hint would cause it to break
20:36hiredmanlike what duck1123 said
20:37technomancyaha
20:37hiredmanif the type hint apears correct in that way, the compiler will generate a cast+method call
20:37hiredmanso the error will be a classcastexception
20:38dnolentype hints are not and never will be idiomatic beyond performance and interop, http://clojure-log.n01se.net/date/2008-09-21.html#16:56
20:38devnbut no need to point that out
20:38devnI think you just arrive at that conclusion on your own
20:39devnIt takes very little mental agility to realize they're just adding noise.
20:40hiredmanwell halloway is apparently saying they are good for documentation
20:40hiredmanthe idea of arguing with him about it is just exhausting
20:40devnIt's like being explicit for the sake of it. Why? It's like adding metadata to everything you build about their birthday or something.
20:41devnI don't see any problem with that either.
20:41gfrederickshiredman: it might just be left over from the first version
20:41gfredericksit's certainly there in the first version
20:41dnolenit's left over from the first version
20:41dnolenand it's wrong
20:41hiredmanmaybe, I never finished that book either
20:41devnwrong...to a point
20:42dnolenonly the first point is relevant. there's no enforcment, and useless as a general form of documentation
20:42devnI can conceive of a scenario where an explicit type hint might be a nice way of documenting a particularly hairy area of "typestuff".
20:42devnbut again I'll say what I did earlier -- you rarely need this, but you *could* use it for some light documentation in a dark corner here or there.
20:42devnIt might just make *sense* to use it there.
20:43gfredericksdevn: you can document with docstrings and comments though
20:43devnThe majority of cases do not require it, nor do they even suggest it as a possibility.
20:43devngfredericks: I think I said that earlier.
20:43gfredericksdevn: probably :)
20:43devnI'm surprised you guys are still talking about it. :)
20:43hiredmantypes tend to be simple carriers of stuff, most complex clojure stuff is nested maps and vectors
20:43devnIt's such...minutae.
20:43devnMight as well build something instead...
20:44gfredericksMaybe it means the language is well designed, since we _could_ be sitting here griping about why our language doesn't have closures or integers.
20:44devnlol
20:44devnYeah, I think that's a fair statement.
20:44devnAlthough, beware the dogma stick. People don't like assholes.
20:44devnEven if they're right.
20:46gfredericksdevn: in saying so you're both right _and_ not an asshole!
20:46devnSorry, didn't mean to say that to you specifically gfredericks-- I just am being wary of it.
20:47devnI see this in dysfunctional communities: "You don't like type systems so *fuck you*." "You can't possibly appreciate how expressive my language is so *get lost*.", etc.
20:48duck1123I think too many people here are also Haskell fans
20:49devnStrong opinions rule. We just need to be careful about being dickish about them. I think the type hints as documentation thing is minor. There is absolutely no reason for "calling out" people or being like "HOW DARE YOU!" over it.
20:49dnolenduck1123: cuz we know they're are evil and up to no good.
20:50devndnolen: haha
20:50devnbtw, dnolen, i have this sinking suspicion you can give me some insight on this...
20:50devndnolen: are chunked sequences at all related to haskell "iteratees"
20:51dnolendevn: I don't know anything about iteratees
20:51hiredmanthere is a lot of poorly written clojure code out there, it irks me
20:51devndamn!
20:51hiredmanthey are not
20:51devnhiredman: pull requests, brother!
20:51devnI've converted a haskeller or two's libraries to a more idiomatic clojure style. They were accomodating.
20:52devnJust find a way to replace regex and spaceshipish function names and you're off to the races!
20:52devnerr replace via regex camelCase
20:53hiredmanchunked seqs and iteratees have some similarities, stream fusionish stuff
20:53devn(defn <|fooThingToBuyBread|> [argumentTheFirst argumentTheSecond] stuff)
20:54devnhiredman: i thought i might be nuts in thinking that. i see some "similar" features, but I just don't know them well enough to know *how* close they are.
20:55devn,(symbol "<-_->")
20:55clojurebot<-_->
20:55devnI think that should replace -main
20:59gfredericksdevn: they really make function names like <|this|> ? or is that an exaggeration?
21:00gfredericksI don't know enough haskell to tell
21:00devngfredericks: a library I idiomaticized had some interesting naming involved
21:00devnit was related to parser combinators so some of them make sense
21:01gfredericksah ha
21:01devnbut even still it just made things look a bit...messy
21:01gfredericksI wonder if scala refugees are worse
21:01devn(defn <|> [])
21:01devnetc.
21:01devndum dee dum: (<|> ...)
21:02duck1123it would be fun to name a bunch of clojure functions to look like html elements just to troll people
21:02devnit just reads weird. maybe I'm being emotional about it, but my experience is that those naming styles are just weird
21:02devni like having freedom in clojure to use UTF-8 craziness
21:02devnbut don't let the freedom lead you astray and so on
21:02devnwith great power comes great responsibility and so on
21:03devn,(defn æ [])
21:03clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
21:03devnawww
21:04devn,(defn <-Ã->¸ [])
21:04clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
21:04gfredericks,(let [defn list] (defn æ []))
21:04clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
21:04gfrederickshaha
21:04devnhiredman thought of everything, unfortunately
21:04devn;)
21:04gfredericksbut that one was harmless
21:04gfredericks&(let [defn list] (defn æ []))
21:04lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
21:04gfredericksack
21:05duck1123better safe than sorry
21:05devnwhitelist, dont blacklist
21:05devnthat's the rule of rules
21:05devnor it seems to be anyway
21:05devnso gfredericks duck1123 i dont know you guys
21:05devnhi!
21:05gfrederickshi devn!
21:06duck1123hello
21:06devnwhat are you guys getting into? should i know you already? you guys work in clojure or just hobbying?
21:07gfredericksI do webbish development for a medical university, and use clojure a good portion of the time. I'm currently agonizing over whether I'd be happier doing more development for the rest of my life or trying to be academic.
21:07devnlearning it for fun, for profit, for job security, because your friend won't shut up about how awesome it is?
21:07duck1123I'm working on an OStatus-compatible microblog. (similar to identi.ca)
21:07gfredericksI also use it for nearly all my personal projects
21:07devngfredericks: very cool
21:07devnduck1123: equally awesome
21:08duck1123I'm so glad I'm finally able to use Clojure for my projects at work
21:08devnyeah that's great to hear
21:08devnit seems like work in that area is heating up
21:08duck1123up to this point we've been using Ruby
21:08gfredericksI was first introduced to clojure at work, two years ago
21:08devnYeah I work at a Ruby shop primarily. We've done bits of clojure work here and there, and I think I'm slowly converting-- but it takes time to show people the why
21:08gfrederickssix months after I was first introduced to ruby/erlang, which was the first I had heard of functional programming
21:09technomancydevn: where is that?
21:09devngfredericks: whoever introduced you must be pretty awesome
21:09devntechnomancy: bendyworks
21:10gfredericksdevn: he definitely stood out
21:10devni feel like an old fuddy duddy saying this because there is so much more happening now than there was then
21:10gfredericksbased on bendyworks.com I'd say it's a typography shop
21:10devnbut seeing this place grow out of a crack in the cement has been so incredibly fun to watch
21:11devngfredericks: it's a shop that hired a designer ;)
21:11gfredericksdevn: that right there is so far out of my range of experience...
21:11gfredericksit's a pretty slick front page though
21:12gfredericksI've never seen such a scrolling effect before
21:12devnthe scrolling effect thing is sort of glitchy but we've just been really busy on other projects
21:12gfredericksdevn: you're one of the eight faces?
21:12gfrederickslooked fine to me. I didn't try to break it though.
21:12devni am. i'm the hipster-ish photo
21:12gfredericksyou mean the yellow one? :)
21:12devnhaha! precisely!
21:13devni think I'm leading our crew in terms of hipsterdom
21:13gfredericksso that's where "devn" comes from
21:13devnerr, I'm one of the top 3 anyways
21:13devngfredericks: correct. I used to be defn, which once upon a time was for def n ... end, as in ruby
21:13devni found clojure and then started to feel sort of like a putzy fanboy what with (defn) and all
21:13gfrederickshaha
21:13devnso I converted to devn :)
21:14duck1123ok, so you're defn
21:14gfredericksdevn: better than people calling you "girl frog"
21:14devnhahahaha
21:14duck1123you must have gotten sick of people highlighting you all the time
21:14devnduck1123: you have no idea
21:14devnas soon as i started idling in here I'd get back to my highlight buffer and be like WTF
21:14gfredericks(devn foo [x y] (+ x y))
21:14devnbut it was sort of informative
21:15devnif you want to learn about a language just make yourself a constructor-ish nickname
21:15devnand watch your buffer fill with examples
21:15devnirssi
21:15devnby nerds, for nerds.
21:15gfredericksgosh dangit I stopped using irssi when everybody said "use emacs and erc"
21:15devni like erc and all, but I never got into it
21:15duck1123they were right
21:15devnmainly because irc in my code buffer = major fucking distraction
21:16gfredericksI started using erc but never started using emacs for anything else. Now I use erc and vim.
21:16devntechnomancy: fair enough, im just not as disciplined
21:16devnI wish I had paren matching though :X
21:16technomancydevn: well it's mostly because emacs is useless at concurrency
21:16technomancybut yeah, paren matching in irc is awesome
21:16devntechnomancy: i suppose i could run erc in a remote emacs instance
21:16technomancydevn: it's easier than running a bouncer
21:17devni run the nextstep GUI emacs on OSX primarily
21:17devni run irssi in screen on a remote box
21:17devnso it's not insane to use erc in a remote emacs
21:17devnbut it always feels sort of bulky
21:17devnirssi is so light
21:17duck1123I just switched back to using stumpwm today
21:17technomancydevn: yeah, it's basically the same except you get to extend it with elisp instead of perl
21:17devntechnomancy: SOLD!
21:17devn;)
21:17technomancyheh; and you get ido for switching, M-/ and stuff. =)
21:18gfredericksI think I only switched to erc because I was trying to integrate IRC and IM, which I now realize I never did
21:18devnhow did I justify using irssi for so long?
21:18technomancysecret fondness for perl?
21:18devnhippie-expand FTW
21:18technomancysorry, that was uncalled-for =)
21:18devnI think I just like other languages for the sake of them
21:18devnif computers and programming didn't mean jobs
21:18devnI would just be a linguist I think
21:19technomancydevn: how obscure have you gone?
21:19devntechnomancy: in terms of what? programming languages?
21:19technomancyyeah
21:19technomancyhipster challenge!
21:19devnhahahaha
21:19devnidk, I tried out APL, J, K recently -- that was interesting
21:19devnI'm not on fogus' level
21:20devnI tried to install a working eiffel setup for like 4 days and gave up
21:20technomancynice
21:20technomancyI've written a bit of ocaml and played around briefly with factor
21:20devnYeah, factor still has me interested
21:20devnalthough I found forth
21:20technomancyI tried to get into smalltalk via opencobalt, but I couldn't get it to launch, and the stack trace mentioned SOAP, so I fled.
21:20devnthat looks really interesting
21:20devntechnomancy: oo! want a brainfsck?
21:21devninstall inferno-os and run it on OSX
21:21technomancyjoegallo is your man for that
21:21technomancyoh, not the language?
21:21devnwrite LIMBO on infero-os
21:21devnand tell me your brain doesn't implode
21:21devninferno*
21:21technomancyheh. closest I've gotten to that is running wmii
21:21technomancybut I've got mad respect for plan9
21:22devni did google summer of code in 2007 for the inferno project
21:22devni was so underqualified
21:22devnthat is a jungle of ideas
21:22devnso much to learn. rob pike is a hero due to that adventure.
21:23devnand caerwyn jones. that guy. read his inferno programmer's notebook.
21:23devnit's brilliant stuff.
21:23devntechnomancy: what have you been toying with?
21:23technomancydevn: mostly just ocaml
21:24technomancywondering how much work it would be to get ocsigen running unofficially on heroku =)
21:24devntechnomancy: I don't expect a rational answer, but...why?
21:24devnoh! right! :)
21:24devni love that heroku is embracing clojure
21:24gfredericksand php?
21:24technomancydevn: actually my original ocaml interest was because I need something that launches quickly without a VM
21:24technomancyand I don't care about concurrency because for long-running processes clojure has that covered
21:25devnocaml is um, fast.
21:25devnwidefinder 2, for instance.
21:25technomancyocaml has a quirky standard library, but it at least has enough to make quick lil guis
21:25devnyeah it's like the functional equivalent of tcl/tk
21:25devnit's weird like that.
21:26technomancydevn: http://technomancy.us/152 <= thoughts and rationale for ocaml
21:26devntechnomancy: will read.
21:26TheBusbyany issue with the type system? When I took a look at it I thought ocaml required a different function for each type to support something like "map"
21:26technomancyoh, I guess mirah is pretty obscure too
21:26technomancyI think I was like user #8 for mirah
21:26devnfuckkkkk. not another type system chit chat...
21:27devnTheBusby: im sorry, not trying to be a jerk to you at all -- it's just...damnit...this issue of type systems
21:27technomancyTheBusby: my program was only 40 lines, so the type system never got a chance to get in the way
21:27devnit seems to come up ALL THE TIME, and some people cannot see the forest for the trees
21:27_khaliGtechnomancy, what about now - how do you deal with the quick start VM issue w/ clojure?
21:27TheBusbyjust curious about personal experience, not debating details
21:27gfredericksdevn: I think your profile on the site has a typo.
21:27devni spoke to erik meijer briefly after his talk at strange loop and he was talking about "little erik"
21:27devngfredericks: likely
21:27technomancy_khaliG: I learned ocaml so I would have a better way to write programs that have to start fast.
21:28devnerik was talking about he was like "HELL YEAH FUNCTIONAL PROGRAMMING!"
21:28devnand then "HELL YEAH TYPE SYSTEMS!
21:28devnand now he sort of only kind of believes in either of them
21:28technomancy_khaliG: I wouldn't hold my breath for quick-launch clojure
21:28technomancybut it would be nice!
21:28devnuse clojurescript and node!
21:28TheBusbytechnomancy: great blog post. Exactly the type of info I was looking for, thank you!
21:28_khaliGtechnomancy, that makes too much sense :P what about railgun nailgun or whatver it is? reason i ask if i've got a clojure app i want people to use and the slow VM thing will need a solution for me
21:29technomancy_khaliG: a daemon works for a certain class of problem
21:29technomancyit's not a good general-use solution though
21:29devntechnomancy: agreed
21:29technomancy_khaliG: jark looks promising on the daemon side
21:29hiredmanreally?
21:29hiredmanall my stuff runs as daemons
21:30dnolendevn: +1. Learning OCaml or SML not a bad either.
21:30devnimagine if a narrator was narrayting IRC: He'd say "a malloy is now a malloy underscore"
21:30dnolenbad idea either.
21:30technomancyhiredman: you have a lot more patience to set that kind of stuff up than most people
21:30devnnarrating*
21:31devntechnomancy: familiarity vs ease, though. ;)
21:31hiredmanpatience is a useful quality to cultivate
21:31technomancyhiredman: but not to require of your usesr =)
21:31technomancy*users
21:32hiredmanbut daemons start when they open their laptop and are always there
21:32hiredmanlike magic
21:32devnactually, no wink on that -- I did not want to wink. I truly believe all of this nonsense about "BUT IT TAKES 3 HOURS TO MAKE IT PERFECT FOR ME" are completely well founded, but they're also completely irrational. It cannot be a perfect environment when you start it, because you are unique, and no it should not takes 10 years to configure it.
21:32technomancyhiredman: like memory-hungry magic =)
21:32hiredmanI have 8gigs
21:32_khaliGooh jark does look nice - i hope it succeeds
21:32devnpft I scoff at your 8 gigs
21:33devnI have 512 gigs of RAM.
21:33hiredmanthe most my macbook will hold
21:33devnThat's how I roll, hiredman.
21:33gfredericksdevn: you lie!
21:33technomancyhiredman: that's why I qualified it with general-purpose
21:33devnI can't run on a machine that isn't made by Azul.
21:34hiredmanthe run scripts lein generates are very useful
21:34TheBusbythe problem with 512GB of ram though, is that the JVM will use all 512GB of ram to read a small text file ;)
21:34devnbahahaha
21:35devnso incidental complexity at the language layer: check.
21:35devnincidental complexity at the tooling layer: hmmm
21:35devnlet me just pass 12 args to my java command!
21:36hiredmanagain, I fail to see the problem, launchd launchs the daemons and they are just there to use
21:37devnhiredman: there's no problem, there's just a lack of familiarity
21:38TheBusbyhmm, I wonder what 'wc -l' would look like as a daemon though...
21:38technomancywhat I want is a sexp-aware git merge strategy
21:39devntechnomancy: i think such a thing exists
21:39devnhiredman: remember dinner?
21:39hiredmanTheBusby: wc is a command executed by the "shell" daemon
21:39devnhiredman: what was that?
21:39technomancydevn: from what I could find a year or two ago, most of the research was on XML
21:39devnhiredman: alan was talking about it IIRC.
21:40hiredmanyeah, uh, alan said he thought the scheme guys had solved it
21:40devnThere is a way to do what you're suggesting technomancy.
21:40TheBusbyhiredman: I was thinking in refernce to nailgun/etc
21:40technomancydevn: that's just an example of something the JVM's going to do a crappy job of
21:40devnhiredman: yeah I can't remember the details
21:40devntechnomancy: we talk about abstractions.
21:40devntechnomancy: we can do better.
21:41gfredericksAJVM
21:42hiredmanit's not like we spin up a whole new process to deliver a website (unless your rails) so why should we constantly spin up new processes locally?
21:42technomancybecause unix?
21:42hiredmanjust about all the apps I use I never close
21:43hiredmanfirefox, fluid apps, iterm, and emacs
21:43devnhttpd?
21:43hiredmanquicksilver
21:43hiredmanmy twitter client
21:43devnand a partridge in a pear tree
21:43hiredmanthe all just run
21:43TheBusbycat, sed, awk, wc?
21:43devnand a partridge in a pear tree
21:43gfredericksfive golden pings!
21:43hiredmanthe processes are in fact still an expensive abstraction
21:44hiredmantechnomancy: what about it?
21:44devngfredericks: a friend of mine has proposed that the squart root of 1225 is the square root of christmas
21:44devnas in march 5th is the square root of christmas
21:44hiredmanyou seem to be under the impression that unix is X rather than unix is a vague idea in a bunch of people's heads that changes over time
21:45devnThe 10-day interval between the Square Root of Christmas and Pi Day shall be known as Nerdigras.
21:45devnOn the twelth day of nerdigras I sent my ISP...
21:45devn❧ 12 fracking fractals
21:45devn❧ 11 puns so stunning
21:45devn❧ 10 bits a twiddling
21:45devn❧ 7 pointers dangling
21:45devn❧ 6 trees a splaying
21:45devn❧ Fiiiive RFID rings
21:45devn❧ 4 calling stacks
21:45devn❧ 3 unmatched parens
21:45hiredmanthe google go guy had a rant recently about how he dislikes modern unix
21:45devn❧ 2 Power Gloves (all together now!)
21:45devn❧ ... and a hash map in a B-treeeee!
21:46devnsorry for the nastiness, but I couldn't resist.
21:46hiredmanwhich certainly would not be the case if unix was a perfect ideal
21:46TheBusbyhiredman: link?
21:46devnhiredman: you're talking about pike. I think pike is peeved because some of the great ideas behind plan9 never made it to Linux.
21:46hiredmanthe reason "unix" is sucessful is the ability to change
21:46technomancydevn: yeah, he was complaining because modern systems aren't process/file-oriented enough
21:47technomancywhich is the opposite
21:47hiredmandevn: oh, no doubt
21:47devnhe wants "everything is a file"
21:47devnI don't know if I agree, honestly
21:47gfrederickswhat things could be files? processes?
21:47devngfredericks: everything.
21:47devnplan9
21:47devninferno-os
21:47devninferno-os could have beaten Java
21:47gfredericksdevn: mice?
21:47gfredericksintegers?
21:48devninferno-os was better than java. you can boot up a fast instance in 1M of RAM
21:48devnacme was an insanely interesting editor and continues to be
21:48hiredmanbut want I mean is, if you read his comment, he seems to feel that the plan9 ideal is really the inheritor of the "unix" mantle and modern unixes have some how betrayed their lineage
21:48devnhiredman: why wouldn't the creator of that alternative path reassert his passion for his own ideals?
21:49devnrhetorical. of course he wants that.
21:49devnhe invented it.
21:49hiredmandevn: he had an idea of what the true "unix" is, as does technomancy
21:49hiredmanand they are different
21:49devnYeah I don't disagree with you I guess
21:49hiredmanso just going around saying "because unix" is noise
21:50devnI'm just pointing out some obvious bias
21:50hiredmanugh
21:50devn?
21:50hiredmanI did not say he was right about anything, or agree with him about anything, or anything
21:50devnhiredman: sorry -- I think I follow, you're just suggesting that unix is not a static thing -- it changes. is that right?
21:50hiredmannothing to do with the factual content of what he said regardless of bias
21:51hiredmanI am suggesting "because unix" is as useful a thing to say about something as "because it's awesome"
21:51hiredmanthere is no information there
21:52devnhiredman: so that's interesting because what I got out of Pike's comment is that, while he is not enthused it didn't go his way, he is ultimately happier with the """""""UNIX"""""""" philosophy that currently exists, moreso than alternative philosophies.
21:52devns/that/than
21:52lazybot<devn> hiredman: so than's interesting because what I got out of Pike's comment is than, while he is not enthused it didn't go his way, he is ultimately happier with the """""""UNIX"""""""" philosophy than currently exists, moreso than alternative philosophies.
21:52devn./kick lazybot
21:53devnman I can't type.
21:53devnI hope you can pick up on the gist of that incoherent rant.
21:53gfredericks(dec lazybot)
21:53lazybot⟹ -1
21:53devn(dec lazybot)
21:53lazybot⟹ -2
21:53hiredman*shrug*
21:54devnhiredman: I'm just saying. It could be a lot worse. It could also be a lot better.
21:54devnThat leaves us here, now.
21:54devnNo mystery there.
21:54devnhiredman: not saying this to you specifically, again just ranting
21:55hiredmanI really don't understand what you are talking about, you seem to be trying to talking about what pike said
21:55hiredmanI am not
21:56devnhiredman: I'm missing you then. Why bring up his comment if you don't wish to discuss its content?
21:56hiredmanI am saying this and only this: saying something "is unix" is empty of content
21:56technomancyI'm just saying "everything must be a daemon or slow to respond" is a crappy requirement.
21:56hiredmansure
21:56hiredmanand that is a statement that conveys meaning
21:56hiredmaner, content
21:57technomancyunix traditionally is composed of lots of small processes that interact over pipes
21:57hiredmantechnomancy: sendmail, bind, etc?
21:57devncomposability
21:58hiredmandevn: I brought his content only to point out there are differences of opinion over what unix is and what it's strengths are
21:58hiredmancomment
21:58hiredmanits
21:58technomancysendmail runs both as a daemon and as a quick-launching process afaik
21:58devnhiredman: sorry to branch the hell out of that statement. I must have taken your statement wrong.
21:59hiredmantechnomancy: so? does that not suggest a broader view then "lots of samll processes that interact over pipes"?
21:59hiredmanthan
21:59hiredmansmall
21:59devnDoug McIlroy
22:00technomancyhiredman: the only reason it runs as a daemon is to accept incoming network connections
22:00hiredmanmany of your small processes are shell builtins
22:00hiredman(or realisticly in your case elisp functions)
22:00technomancyI'm not saying "unix means no daemons", just "make things daemons that have good reason to be daemons"
22:02devn"good reason"
22:02devnso intuitive and obvious!
22:02hiredmanis omnipresence not a good reason?
22:02hiredmanquicksilver is great like, always running, never there unless I need it
22:03devnexcept when its indexing when you dont want it to
22:03devnit's*
22:03hiredmanI dunno, does it do that?
22:03devndepends on your config
22:03devndepends on whether you do enough in the right places to make it annoying
22:03devndepends on whether that CPU time matters to you
22:04devndepends on whether that disk access matters to you
22:05hiredmanmy emacs uptime is only 19 days :/
22:11devnlol
22:11devni don't even know how to respond to that
22:13hiredmanweep, sometime 19 days ago I lost where I was in most likely around 40 open buffers
22:13devnSounds like my browser
22:13devnI keep my editor clean
22:13hiredmanah, firefox restores everything when I open and close it
22:13devnI treat it like a temple
22:14devnhiredman: no that's what I'm saying -- I make a mess of my browser for that very reason. I trim my editor like bonsai.
22:14hiredmanI've been digging through infinispan's source recently, it is some what twisty so I have lots of buffers for various java files
22:15devnah, gotcha
22:15devnthis is where i try to use eclipse and then just get a shit-ton of buffers going
22:16technomancyis it hard to get a tags file for something like that?
22:16devnmaybe?
22:16hiredmandunno, me neither
22:16devnI haven't either.
22:16hiredmanrgrep
22:16duck1123I love emacs because you don't even notice it and have 119 buffers open
22:16devnduck1123: im militant about buffers!
22:16hiredmanyeah 40 was a conservative guess, I have 80 open right now
22:16devnmore militant than an angry librarian!
22:17hiredman(81)
22:17hugodemacs with 900 open buffers uses about the same as safari with a couple of tabs
22:17devn(81) "Poop Hatch" http://www.youtube.com/watch?v=KKZSf3WHrKI
22:17devn^hiredman
22:17hiredmanhugod: good to know
22:18hugodsame memory that is
22:18duck1123I close buffers all the time, but sometimes you don't even notice
22:18devnI will force this upon all of you: http://www.youtube.com/watch?v=KKZSf3WHrKI
23:24ivan__Any thoughts on which book is better? 'The joy or clojure' or 'Clojure in action' ?
23:25ataggartprobably whichever is newer
23:25ivan__of*
23:25ivan__well Clojure in action is newer, but the joy of clojure is only march 2011 :)
23:28amalloyi would recommend JoC personally
23:28technomancyI wasn't impressed by the sample I read from clojure in action
23:28amalloybut i haven't actually read CiA
23:28technomancyit was a while ago though
23:28technomancyJoC is pretty much universally-acclaimed
23:29ivan__i was leaning towards it based on what i had seen
23:31gtrak``ivan__, JoC is core language stuff only, but it has a lot of examples and rationale which is fun to read. it makes you think about what's going on
23:32_khaliGivan__, practical clojure is really good
23:33ivan__gtrak``: yes, i only really want language stuff, which is why i was leaning towards it
23:33ivan___khaliG: manning published books only :)
23:33_khaliGivan__, ah k, i wouldn't bother then :P
23:34_khaliGjoy is unreadable imho
23:34gtrak``_khaliG, that's not true at all, in fact it is a joy to read
23:34ivan__i probably wont actaully read it <.< but hopefully will be ok language reference
23:34_khaliGi'd say PC is a joy to read
23:35gtrak``reviews: http://www.amazon.com/Joy-Clojure-Thinking-Way/product-reviews/1935182641/ref=sr_1_1_cm_cr_acr_txt?ie=UTF8&amp;showViewpoints=1
23:36_khaliGgtrak``, thanks, let met give it a 1 star to balance things out :)
23:36gtrak``no skin off my back :-)
23:36gtrak``I'll give it a 5 if you give it a 1
23:36amalloyPC is like super-old, right? the number of people who've come in here sad that they don't know how to get clojure.contrib.duck-streams to work in clojure-1.3...
23:37_khaliGamalloy, I meant practical clojure, not programming clojure (which is pretty crap)
23:37duck1123Practical or Programming?
23:37amalloyi don't actually know which is which; i just associate PC with "out of date"
23:37ivan__the only book ive ever bought since my first year of uni is land of lisp, and that was only cos of the video
23:38duck1123Programming Clojure was the first, so of course it's the most out of date
23:38_khaliGamalloy, yeah programming was the first one, it's fairly old, i think from 2009, practical is new (2010ish)
23:38ivan__i have the interwebs
23:38amalloyi'm a pretty good book reviewer as long as you don't care whether my review is correlated with the book i claim to be reviewing
23:38ivan__haha
23:38_khaliGamalloy, lol
23:39gtrak``after reading this book, the hardest thing in clojure for me was learning emacs
23:39gtrak``but i haven't tried macros yet
23:41ivan__gtrak``: forget learning emacs, i cant even get all the clojure stuff installed for emacs lol
23:41gtrak``ha, yea, it's more overwhelming than the language itself
23:41gtrak``but the emacs starter kit is a good starting point
23:42gtrak``i still haven't figured out how to debug, but it's not as necessary when you have pure functions
23:43alandiperti'm like emacs a lot now, but i wish i knew that you don't need swank and stuff to get started
23:43gtrak``i guess you can use inferior-lisp, but it's not as good of an experience
23:43gtrak``I'm doing that right now with clojurescript