#clojure logs

2011-09-08

00:07nickmbaileynew question, is there an easy way to prevent lein from shutting down agent threadpools if the main function returns but the process still runs due to non-daemon threads?
00:07jliit seems like multimethods and protocols can solve a lot of the same problems. is there a preference, when either could work?
00:14brehautjli: multimethods are a lot more general
00:14brehautbut protocols are a bunch faster
00:14jlibrehaut: is that because they can dispatch on anything and aren't really tied to types?
00:15brehautcorrect
00:15jliprotocols also seem a bit heavier weight
00:15brehautmultimethods can also dispatch on more than just the first argument
00:16jlioh, is that because protocols are java interfaces?
00:16brehauti guess
00:16brehautive not looked at the implementation
00:30bartjwhat is the best way to preserve the inner-most sequences, but still flatten a sequence
00:30bartjfor eg: [[(1 2 3) (4 5 6)] (7 8 9)]
00:30bartjI would like to have '((1 2 3) (4 5 6) (7 8 9))
00:34nickmbaileyif anyone else cared about the answer to my question above ^^: doing '(.join (java.lang.Thread/currentThread))' at the end of the main function is an easy way to stop it from returning
00:35Tcepsabartj: Can you guarantee that there won't be both atoms and seqs in a given seq?
00:35bartjTcepsa, no atoms
00:36bartjI tried: (flatten above-sequence)
00:36Tcepsa(using atom here to be not-a-seq)
00:36bartjwhich obviously tries to flatten everything
00:36brehautbartj: apply concat ?
00:36brehaut(apply concat [[(1 2 3) (4 5 6)] (7 8 9)])
00:36brehaut,(apply concat [[(1 2 3) (4 5 6)] (7 8 9)])
00:36clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
00:38Tcepsa,(apply concat [['(1 2 3) '(4 5 6)] '(7 8 9)])
00:38clojurebot((1 2 3) (4 5 6) 7 8 9)
00:38brehautoh right
00:38TcepsaHmm, close, but I'm guessing not quite
00:38bartjyes, maybe pass it through reduce
00:39TcepsaSince they're at different levels... hey, would this be a case where a zipper might be useful?
00:40TcepsaGo until you hit a leaf, then bounce back up one and that's a seq, add it to an accumulator and continue through the "tree"
00:40bartjI can guarantee that there will only be lists and vectors
00:40clojurebotGabh mo leithscéal?
00:40bartjditto
00:41TcepsaLet me give it a try...
00:42brehaut,(mapcat (fn [s] (if (vector? s) s [s])) [['(1 2 3) '(4 5 6)] '(7 8 9)])
00:42clojurebot((1 2 3) (4 5 6) (7 8 9))
00:42TcepsaNice
00:42brehauteverything is better with a mapcat
00:42TcepsaWhat does it do?
00:43brehautroughly (def mapcat (comp (partial apply concat) map))
00:43TcepsaAhh
00:43brehautits the plumbing of list comps basicly
00:44TcepsaSo would your solution be able to handle more deeply nested things? (Mostly just curious; I don't know if it would need to for this situation)
00:44brehaut,(for [s [['(1 2 3) '(4 5 6)] '(7 8 9)]] (if (vector? s) s [s])) ; is identical
00:44clojurebot([(1 2 3) (4 5 6)] [(7 8 9)])
00:44bartjthere are multiple/different levels of nesting
00:44brehauthuh no its no. what have i do wrong
00:45brehautTcepsa: not without recursing explicitly in the mapcat fn
00:47TcepsaHmm, okay. I'd need to spend some more time with it when I'm not also trying to learn zippers ^_^
00:47bartj, (mapcat (fn [s] (if (vector? s) s [s])) [[['(1 2 3) '(4 5 6)] '(7 8 9)] '(10 11 12)])
00:47clojurebot([(1 2 3) (4 5 6)] (7 8 9) (10 11 12))
00:48jlibrehaut: that for is just map, right? there's no concat
00:49brehautjli ?
00:49brehautbartj: (defn flatten-vectors [s] (mapcat (fn [s] (if (vector? s) (flatten-vectors s) [s])) s)
00:50jlibrehaut: your (for ...) isn't identical to your original mapcat because the for just does the "map" part, no?
00:50brehautjli for is definately mapcat, but ive screwed something up and its too late in the day for me to work out what
00:51bartjbrehaut, I am writing one with a loop/recur
00:51brehautsounds complicated ;0
00:51brehauts/0/)/
00:51lazybot<brehaut> sounds complicated ;)
00:54bartjactually I think I am approaching it wrong
00:54bartjI have (merge-with concat {:a (list 1 2 3)} {:a (list 4 5 6)})
00:54bartjand I do a (apply merge-with vector)
00:54bartjto get {:a [(1 2 3) (4 5 6)]}
00:54bartjwhich is inturn causing multiple vectors to get formed unnecessary
00:55jlibrehaut: I'm not sure why. the function for mapcat needs to return a collection, but the expression in a (for) doesn't
00:56bartjif I have this: {:a (list 1 2 3)} {:a (list 4 5 6)} {:a (list 7 8 9)}
00:57bartjI am trying to get: {:a ((1 2 3) (4 5 6) (7 8 9))}
00:57brehaut,(for [a [1 2 3] b [:x :y]] {:a a :b b})
00:57clojurebot({:a 1, :b :x} {:a 1, :b :y} {:a 2, :b :x} {:a 2, :b :y} {:a 3, :b :x} ...)
00:57brehautjli: thats why its mapcat not map
00:58jlithat's only when you're using it with more than 1 collection though
00:59brehautbartj: (merge-with (fn [a b] (if (vector? a) (conj a b) [a b])) …
01:00brehautjli: theres two reasons im not going get more detailed. 1) its late in the day and 2) amalloy will mock me for talking about monads again
01:00brehaut(not that for is actually implemented with monads)
01:00jliand doesn't mapcat work over its collections in parallel, and for iterates nested?
01:01jlianyway, okay :)
01:01bartj,(merge-with (fn [a b] (if (vector? a) (conj a b) [a b]) {:a (list 1 2 3)} {:a (list 4 5 6)} {:a (list 7 8 9)})
01:01clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
01:01bartj)
01:01brehautmapcat isnt magical, its just concat and map
01:02bartj,(merge-with (fn [a b] (if (vector? a) (conj a b) [a b]) {:a (list 1 2 3)} {:a (list 4 5 6)} {:a (list 7 8 9)}))
01:02clojurebotnil
01:02jliyeah, I know. I just don't think it's equivalent to mapcat :)
01:02jlior, to for
01:03brehautwell, your welcome to think that, but its wrong ;) go read about the list or sequence monad, and how bind is mapcat
01:03jliI know. but how is for equal to bind?
01:04brehautfor isnt, for is a comprehension. comprehensions can be generalised over bind
01:06brehautjli, it helps if you realise that mapcat where the function returns a single value wrapped in a sequence is equivalent to map
01:07jliright. mapcat is more general.
01:07brehautexactly
01:07jliI think mapcat can do more than for.
01:07jliwhich is why you can't write the function you wanted with for
01:08jliall list comprehensions can be written with monad operations, but not vice versa
01:08brehautyeah probably
01:12brehautactually its because i did my transformation wrong
01:12brehaut,(for [s [['(1 2 3) '(4 5 6)] '(7 8 9)] a (if (vector? s) s [s])] a)
01:12clojurebot((1 2 3) (4 5 6) (7 8 9))
01:18TcepsaNice
01:18Tcepsabartj: Sorry, no luck with the zipper thing. I think it still might be a (messy) option, but I'm not up for getting it working tonight
01:19Tcepsa(where messy==more than one line ~wry grin~)
01:20TcepsaGood night, and good luck!
01:23jlioh I'm wrong. you're right. any mapcat should be expressible as a for.
01:24brehautcool :)
01:24jliand you're right, it's too late to think about monads :P
01:24brehautyou can make that claim at any time of day
01:25brehaut(def time-to-think-about-monads? (constantly false))
01:26jli:)
01:50aloiscochardyo hackers, I'v just installed cljr on a computer at job, but when trying to do 'cljr repl' I got a class not found "jline/ConsoleRunner" ... same thing worked yesterday on an other computer, any idea ? something went wrong during setup ?
02:19aloiscochardanyone alive ?
04:32neotykGood morning everyone!
04:33Fossihi
04:33mduerksengreetings
04:34neotykdo you know how to get contrib.logging/tools.logging to log using current *ns*?
04:37neotykhere is what I do and results I'm getting: https://gist.github.com/1202938
04:38neotykbasically my current *ns* is not used but "clojure.tools.logging" is used
06:13wunkiis there a clojure function for (if x x y) ?
06:13wunkiso, return x if x exists, else y
06:15khaliGwunki, (or x y) ?
06:15khaliGbut then y need be true
06:15khaliGnevermind
06:16khaliGalthough if its nil, its fine - so yes or ;P
06:16wunkikhaliG: no, that's fine, y, in this case, is always true.
06:16khaliGyep!
06:16wunkikhaliG: I'm a bit ashamed though, because it's so obvious
06:17khaliGwunki, haha don't be ashamed - sometimes you can see it straight away other times not
07:23kzarI don't understand the question for this puzzle, how come in the first example it can go from 1 to 3, surely it has to go from 1 to 0 or 2? http://4clojure.com/problem/79
07:28kzarOh I see it means adjacent as in directly to left or right, not as in 1 higher or 1 lower
07:29raekI don't see any zeros in the triangles...
07:29kzarwell exactly heh
07:32raekI think valid moves are diagonally down to the left and diagonally down to the rigth (since there is no element straight down if you think of the rows as "centered")
07:35kzarraek: Yea I think I just misread it
07:48ZabaQThink I might ditch emacs for netbeans.
07:51khaliGZabaQ, for enclojure?
08:02ZabaQkhaliG: More for Java integration.
08:04khaliGZabaQ, makes sense to me. Honestly i'm not really using many features of slime myself so I could probably change over to netbeans too. Would be nice if matisse spit out clojure code!
08:05mklappstuhlhey..
08:06mklappstuhli am just playing a bit on 4clojure and have problems with the #6 problem... when i type my solution into a repl it asserts true... the unittests on 4clojure however fail
08:06mklappstuhl (= '(:a :b :c) (list :a :b :c) (vec '(:a :b :c)) (vector :a :b :c))
08:08khaliGthere should be a 4clojure channel ..
08:09mklappstuhloh okay :)
08:13mklappstuhlkhaliG: there are only very few people in #4clojure ...
08:24chousermklappstuhl: It's perfectly ok to ask here about 4clojure things.
08:33solussdDoes marginalia ignore docstrings created as the second argument to defn? e.g. (defn my-func "a function" [x] (…))
08:35manutterZabaQ: if you're looking at emacs alternatives, have you looked at Intellij IDEA? They have a free community edition, and a nice La Clojure plugin
08:36mklappstuhlchouser: so, do you have any idea how this is wrong? "'(:a :b :c)" is the koan
08:37manuttermklappstuhl: are you typing the parens into your answer?
08:39chousermklappstuhl: I think manutter's on to it -- the square brackets are in the question already.
08:39manutter,(= [(:a :b :c)] (list :a : b :c) (vec '(:a :b :c)) (vector :a :b :c))
08:39clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Invalid token: :>
08:40manutteroh, duh, missed a quote
08:41manutter,(= ['(:a :b :c)] (list :a : b :c) (vec '(:a :b :c)) (vector :a :b :c))
08:41clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Invalid token: :>
08:41manuttertime to go suck on some coffee...
08:44Chousukemanutter: you have a space between : and b there
08:45manutterah, the old "can't see the spaces because they're empty" ploy, I see
08:45manutter,(= ['(:a :b :c)] (list :a :b :c) (vec '(:a :b :c)) (vector :a :b :c))
08:45clojurebotfalse
08:45manutterthere
08:45manutterI either need a better font or better keyboarding skills
08:59chouser4clojure is fun. https://gist.github.com/1203334
09:01manutterchouser: what's in that gist? I don't want any spoilers now :)
09:02chouserspoilers are in the gist!
09:02chousersorry, should have labelled that better
09:03chouserThat was my solution for reading roman numerals
09:03manutterAh, I've done that one, I'll take a look then :)
09:04mklappstuhlmanutter: chouser, it was as easy as
09:04mklappstuhl,(= [:a :b :c] (list :a :b :c) (vec '(:a :b :c)) (vector :a :b :c))
09:04clojurebottrue
09:05manutteryeah, that one tricky by virtue of seeming TOO easy.
09:05manutterI wanted to try something more complicated first.
09:06manutterchouser: oo, nice use of ->>
09:07chouser:-)
09:23mindbender1
09:36clgvIs there any other approach than "jark" to use clojure in script form?
09:43manutterDoes "other" need to mean "as good as"?
09:43clgvmanutter: no. but a persistent vm running as daemon would be great for performance.
09:43manutterI would think you could use the same kind of nailgun-based approach that jark does
09:44manutterbut it seems like jark has bundled that up for you already, so I don't think there'd be much advantage
09:45manutterout of curiosity, do you have a good use case for writing scripts in clojure?
09:45chouserdoesn't cake provide a persistent vm?
09:45chouserthere's also now the possibililty of clojurescript + nodejs
09:45manutterchouser: that sounds familiar too
09:45manutteryeah, I was going to mention that
09:46manutterI'm thinking that for scripting you want a platform with good hooks into the local OS, and I don't have the impression that OS hooks are Java's strong point
09:47manutter(which doesn't mean I wouldn't LOVE to write scripts in clojure)
09:49chousernodejs solves both the fast-startup and to some extent the OS-hooks problems.
09:49manutterI suspected it might :)
09:50chouserand the only drawbacks are slow compilation speeds and an embriotic development environment. :-)
09:51manutterindeed. kind of hard to make a good case for not just whipping up a quick bash or perl script for most tasks you'd use a script for
09:52manutteror python or whatever
09:52manutterbut not php.
09:52manutter:p
09:54clgvmanutter: I have bootstrap script to build all my projects for a newly cloned git repo
09:54manutterah, cool
09:55clgvI use leiningen for it ;)
09:55clgvit's kinda hack to load its jar but it works. cant wait to have leiningens core as lib ;)
09:56manutterrun it once, it builds a bash script, then run the bash script as needed :)
09:57chouserthat's clojurescript, but substitute nodejs for bash. *shrug*
09:57poetmanutter: probably a lot more time than it would take to write the bash script :P
09:57manutterbut if it works, and would compile good scripts, there might be a break-even at some point
09:58clgvI hate bashscripts. the syntax is so awful^^
09:58manutterwell that's the beauty of DSL's, you never have to see the underlying code
09:59manutter(except if you're the one *writing* the DSL, then god help you)
09:59clgvlol
10:00hugodmanutter: pallet's stevedore is a clojure-to-bash DSL…
10:00manutterHa, I call vindication
10:00chousermanutter: http://pragprog.com/magazines/2011-07/growing-a-dsl-with-clojure "Our goal will be to define a DSL that allows us to generate various scripting languages. The DSL code should look similar to regular Clojure code."
10:00manutterPallet is on my to-learn-more-about list
10:01hugodstevedore is an independent library these days, so no need to use the whole of pallet
10:02manuttertrue, but it seems like I'm setting up a lot of vm's these days, and I hear pallet's a good fit for that
10:02manutterstevedore is just icing on the cake.
10:03neotykIs there an idiom for doing: (let [m {:a 1 :b 2}] (assoc (dissoc m :a) :a 3)) ?
10:03neotyk,(let [m {:a 1 :b 2}] (assoc (dissoc m :a) :a 3))
10:03clojurebot{:a 3, :b 2}
10:06neotykthere is
10:06neotyk,(update-in {:a 1 :b 2} [:a] #(+ 2 %))
10:06clojurebot{:a 3, :b 2}
10:07manutter,(assoc {:a 1 :b 2} :a 3)
10:07clojurebot{:a 3, :b 2}
10:08neotykmanutter: true, though I need previous val for calculation
10:10manutter,(let [m {:a 1, :b 2}] (assoc m :a 3))
10:10clojurebot{:a 3, :b 2}
10:11manutteryeah, I don't think you need anything fancy, plain old assoc does what you're looking for (if I understand correctly)
10:13neotykassoc version reads better
10:13clgvneotyk: if you need to calculate the new value based on the old one use update-in
10:14neotyk (assos params :birthday (long (or (:birthday params) 0)))
10:14neotyk (update-in params [:birthday] #(long (or % 0)))
10:14neotyk
10:15manutteryeah, update-in to do a direct calculation
10:34sauaHey, I'm trying to learn about lazy-evaluation. I
10:35sauaIf you look at the code here http://pastebin.com/R3bqcQkx, what I don't understand is why you need to (def fib (fib-maker)), why can't you just use fib-maker directly?
10:37clgvsaua: you dont have to
10:37saua(take 10 fib-maker)
10:37sauajava.lang.IllegalArgumentException: Don't know how to create ISeq from: Euler$fib_maker
10:37saua(take 10 fib)
10:37saua(0 1 1 1 2 3 5 8 13 21)
10:37saua?
10:38Chousukesaua: the code doesn't even work as you pasted
10:38Chousukesaua: the fib calls in fib-maker should be calls to fib-maker
10:38Chousukeand there is no need to def the fib sequence. in fact, deffing it is bad practice
10:38sauaoh yes, i just copied it from a stackoverflow post, had to change it first
10:39Chousukeyou want to do (take 10 (fib-maker))
10:39sauaah, that makes more sense
10:39sauaoh, right. because fib-maker is a function, while (fib-maker) is the actual sequence
10:39Chousukeyeah
10:40sauaty
10:40Chousukedeffing an infinite sequence is usually a bad idea :P
10:40sauaoh?
10:40Chousukeif you take too many items from it, you end up with a large amount of memory that will never be gc'd
10:41Chousukebecause defs never go away (unless you redef, but that's not usually done in application code)
10:42khaliGoops, really? :0
10:42Chousukemore precisely, because defs never go away AND lazy seqs cache generated items, you're essentially creating a permanent reference to something that may grow indefinitely
10:44lpetitChousuke: ns-unmap to the rescue ?
10:44Chousukethat works, but also isn't really used in application code :P
10:44lpetitclearly :-D
10:44lpetit(I'm jumping in the chat, slowly recovering context :-p )
10:48clgvlpetit: how is CCW progressing?
10:48sauaWould making an inner function like this http://pastebin.com/nSFJJpVq fix the gc problem?
10:49clgvsaua: not if you still def the output of fib - it's all about that def^^
10:51Chousukesaua: the function itself is completely fine
10:51Chousukeit's binding the resulting sequence to a var that is a problem
10:54bendlassaua: it's called holding onto the head
10:55TimMcI wonder at what threshold fib would be better off using floating point math to find the answer instead of iterating up to the index.
10:56clgvTimMc: much better when you use the explicit solution - the higher index the better. ^^
10:57TimMcclgv: Explicit solution meaning exponentiation + rounding?
10:57TimMcOf course, that also only gets so you high up.
10:57clgvTimMc: as far as I remember that solution, yes
11:01lnostdal_anyone tried running clojure using the jamvm? .. is it solid?
11:01lnostdal_-the
11:02lnostdal_(jamvm is a "jvm mode" included with openjdk it seems)
11:02lnostdal_(faster than "server mode")
11:02lnostdal_or faster startup time that is
11:02clgvTImMc: but there seems to be an optimization due to a property of the golden ratio ;)
11:05TimMclnostdal_: Never heard of it. If you experiment with it, let us know how it goes!
11:09bendlaslnostdal_: Is that the new mode where the -client JIT gets used at first, transitioning to the -server JIT over time?
11:22choffsteinHello everyone! I have a pretty stupid question, I think. I am using a library that requires reading a file from disk. I generate the data I want to pass the library then do something like: (do (ds/spit file-name file-data) (library/library-call filename)). My concern is whether or not ds/spit (and other such file-writing operations) are going to be completely blocking and whether or not there is a potential issu
11:22choffsteinthe library call getting called before the file is completely written.
11:24Cozeychoffstein: spit closes the file, which flushes its content
11:24choffsteinperfect
11:28lnostdal_bendlas, i'm not sure, but i don't think so .. TimMc, ok! .. :)
11:31edwIf http-agent has been deprecated since clojure-contrib 1.2, what is not the recommended way to do an HTTP request?
11:32bendlasedw: clj-http is the best for that, IMO
11:32bendlashttps://github.com/dakrone/clj-http
11:32edwbendlas: Thanks. Is there something cooking for 1.3 on this front, or is this something that is now considered outside the scope of the core (contrib) libraries?
11:35arohneredw: not everything good has to be in core
11:35TimMcedw: clj-http has been unmaintained for a bit, so dakrone is taking over.
11:36choffsteinanyone familiar with using cemerick's rummage library?
11:37edwarohner: Notice I mentioned contrib...
11:38arohneredw: there are no plans for an http library in 1.3, and https://github.com/dakrone/clj-http is your best bet
11:42edwarohner: Thanks for seconding TimMc's pointer. SLURP has been swapped out with CLIENT/GET for about seven minutes now.
11:48choffsteinAnyone have any idea why when I run my code through swank, it "exits", but when I run it as a jar, it hangs?
11:48choffsteinand by idea, I mean "ever heard of anyone else having this issue?"
11:52arohnerchoffstein: what kind of code are you running?
11:52devnanyone here toying with clojurescript and nodejs?
11:52choffsteinBasically, I download some data from an internet source, play with it a bit, and then send it out via an email.
11:52arohnerand knowing nothing else, my first guess is it has to do with the agent threadpools
11:53choffsteinThe email delivery is the last statement, and I get the email to my test inbox … but the code never seems to return.
11:53arohnerchoffstein: are you using threads? a webserver? agents?
11:53choffsteinpmap is the closest I come to using threads.
11:53devn(def os (node/require "os")), (defn get-hostname [] (println (.hostname os))), (get-hostname), (set! *main-cli-fn* get-hostname)
11:53arohnerchoffstein: have you tried waiting more than 60 seconds after the last statement?
11:53devnthat should work right?
11:53choffsteinunless I am doing something behind the hood that I am not aware of.
11:54arohnerchoffstein: try adding (shutdown-agents) after the last statement
11:55choffsteini'll give that a whirl.
12:02choffsteinHmm. Now I just keep getting a RejectedExecutionException. This is confusing.
12:02arohnerchoffstein: there's a lein bug that covers that. one sec
12:03arohnerchoffstein: https://github.com/technomancy/leiningen/issues/265 and http://tech.puredanger.com/2010/06/08/clojure-agent-thread-pools/
12:03arohnerbasically, your code needs to block until it's done
12:04arohneryou'll probably need google cache for that second link
12:05choffsteinAh, I see...
12:07choffsteinhow do I explicitly block?
12:07bendlaschoffstein: def a promise called exit-status
12:08bendlasderef it in your main
12:08bendlaswhen you're ready to exit, do (deliver exit-status 0)
12:08nickikIs there e fix for the (read-line) problem in swank?
12:09choffsteinThanks
12:09technomancychoffstein: I'm thinking about backing that out in the next lein release
12:09technomancychoffstein: if you want to block forever you can just do @(promise)
12:09technomancy(System/exit 0) or Ctrl-c or whatever will still work
12:11choffsteinAlright. Time to give this a spin!
12:11technomancythe prettier approach is to .join whatever thread's keeping the JVM open
12:12nickmbai`that was my solution. .join the current thread at the end of the main function
12:13choffsteinNope. Still getting all sorts of beautiful RejectedExecutionExceptions.
12:15chewbrancaso I've officially been corrupted (enlightened?) by clojure/lisp, I'm using a java stack and I switched over to emacs... two things I never thought I would hear myself say
12:15chewbrancahiredman: technomancy decided to test out emacs again after our debate on emacs vs vim the other night, was impressed enough that I'm progressively switching
12:18mindbender1
12:18manutterWoot! Finally solved that pesky graph tour problem on 4clojure :D
12:18choffsteinIf I just do "lein swank", connect from emacs, and try something like (pmap #(println %) [1 2 3 4 5]) I get the RejectedExecutionException.
12:18choffsteinThat's harsh.
12:19technomancychoffstein: half a second
12:20technomancychoffstein: lein upgrade
12:20choffsteinokay
12:21choffsteinRunning 1.6.1.1
12:22choffsteinAH! It works!
12:23technomancy~o/
12:23clojurebot\o ... High five!
12:28choffsteinAh, I wonder if cemerick's rummage is keeping some threads open and preventing me from exiting when I run the jar.
12:33technomancychewbranca: welcome to the club
12:34technomancydon't let me forget to teach you the secret handshake at the next meeting
12:34choffsteinInteresting. If I don't put a (System/exit 0) at the end of my main function, it just hangs.
12:34choffsteinThat's strange to me.
12:35technomancychoffstein: see the puredanger link above; that's a clojure issue
12:35choffsteinokay. that explains a lot of issues in some old code. I was running cron jobs and they wouldn't freakin' die.
12:36chewbrancatechnomancy: hahaha sounds good
12:37choffsteinI love clojure, but these corner issues sometimes make me pull out my hair. I've gotta stop trying to solve them myself and just come to irc sooner :)
12:37chewbrancatechnomancy: yeah I'm actually using vimpulse which I'm impressed with. I've been thinking a lot latey about the different approaches between emacs and vim. I would say the defining feature of vim is modal editing, and one of the big defining features of emacs is its customizability and its ability to run background processes
12:39chewbrancatechnomancy: and the thing I started to realize about lisp, (which dnolen's match library helped me realize) is that you can build on these features of other languages and tools if you have the underlying infrastructure, so really, modal editing is a feature, and one that can be built on after that fact in emacs, so its more important to have the underlying infrastructure to do things like run background tasks and have a solid wa
12:40sridis there a clojure library for user registration (including email confirmation)?
12:40srideg: there is ring-basic-authentication, but that is only basic auth
12:40srid(and no registration)
12:43chewbrancatechnomancy: btw emacs-starter-kit and clojure-mode have been very handy, thanks!
12:43technomancyyeah, awesome
12:44edwsrid: I would doubt it. I don't tihnk ring, compojure, noir, or any other web framework has gotten to that level of django-esque-ness.
12:47edwsrid: In my experience--in Django--I've had to do a lot of hand-rolling with registration because all of these libraries make assumptions that are often not the case in many particular situations. They *have* to do that of course, but I've found user registration one of those things that is hard to simply bolt on to your product.
12:49TimMc~rejectedexecutionexception
12:49clojurebotRejectedExecutionException is fixed in Leiningen 1.6.1.1, so give it an upgrade
12:49chewbrancasrid: edw while it won't help on the clojure side of things, I think devise in the ruby world does a good job of a bolt on registration system: https://github.com/plataformatec/devise
12:50chewbrancasrid: edw one of the things that I really like is they broke everything down into self contained modules, so provided email confirmation on registration, or validations or password recovery is all separate modules and you can pick and choose what you want
12:50sridinteresting, i'll take a look
12:51chewbrancasrid: yeah its interesting, they also decoupled the actual authentication system so you can use: https://github.com/intridea/omniauth which is basically an oauth wrapper providing 3rd party login support to just about everything under the sun
12:52aaelonyit seems [org.clojure.contrib/sql "1.3.0-SNAPSHOT"] has moved from clojars, can anyone point me to where the current version might be for my project.clj ?
12:53chewbrancaaaelony: https://github.com/clojure/java.jdbc
12:53aaelonychewbranca: thank you
12:53chewbrancaaaelony: np
12:56seancorfield[org.clojure/java.jdbc "0.0.6"] will get you the latest
12:56seancorfieldshould be completely compatible - with additional functionality added
12:58edwchewbranca: That sounds nice.
13:06chewbrancaedw: yeah wanted to point it out because if anyone is going to rebuild an auth system for clojure, devise/omniauth is a nice pattern
13:13aaelonyseancorfield: looks great, thx
13:38wwmorganSo I've checked out a new project and I want to start hacking on it with vimclojure. Right now my process is adding a couple of :dev-dependencies to the project.clj, then running lein deps, then a nailgun server, then I open vim on the project. I feel like this ought to be possible without editing the project.clj. Any ideas?
13:38seancorfieldlein plugin install?
13:39seancorfield(so instead of them being dev dependencies, they're installed for all projects)
13:39wwmorganseancorfield: awesome :-)
13:42jliI wanted to deploy a clojure webapp to heroku. I was using swank during development, but then it wouldn't start in heroku
13:42chewbrancawwmorgan: I would recommend checkign out slimv, which works very well and also just uses the standard lein swank plugin
13:43wwmorganthanks chewbranca, I will
13:43jliI was swank via lein plugin, so it wasn't in project.clj at all. adding it as a dev-dependency wasn't evough either. I'm guessing I would have to have it as normal dependency for it to start?
13:43jlithe heroku error was not being able to find swank
13:43poetchewbranca: I found slimv to be pretty sluggish for Common Lisp dev, have you had a good experience with it?
13:44chewbrancapoet: it was working well for me on clojure dev, and did some proof of concept common lisp dev (ie got it working with clisp and sbcl), didn't notice any performance issues
13:44jliperhaps I'm just using swank incorrectly. I have a conditional "swank/start-server" in my main function
13:44chewbrancaalthough to be honest, I just switched over to emacs lol
13:45chewbrancaI figure, the primary issue is that vim doesn't support background tasks, so slimv or vimclojure is always going to be a hack
13:45poetchewbranca: ha yeah I hear ha. if I didn't hate emac's documentation system so much I probably would switch over too
13:45poet*emacs'
13:46chewbrancapoet: oh? I haven't used it long enough to have an opinion on the docs, seem to be an abundance of them which is always nice, also, vimpulse works well, enjoying emacs +vimpulse
13:47poetyeah, just seems overly complex compared to my experience with vim. stuck in a hard place though because i think clearly elisp plugins + slime support > vim + vimscript
13:48Apage43I really like vimclojure -when i can get it to work-. And of course, vim is ingrained -hard- in my muscle memory.
13:48Apage43I sometimes feel like i should learn emacs for working with lisps but it always seems so daunting
13:48wunkiI'm about to open-source a web application written in clojure. Some things need to stay secret though (like twitter auth keys). Any tips on how to create a production settings file?
13:48poetyou pick it up quick enough, but it's defintely a different design philosophy
13:49poetif only vim was written in lisp TT
13:50chewbrancapoet: Apage43 yeah I hear that, been using vim for better part of a decade, but I setup slimv with a repl and paredit for clojure dev, and realized that I stopped typing as much and that I also stopped needing as much of the text manipulation tools vim provides as I get most of it with paredit
13:50poetyeah after using emacs for 2 years the paredit on vim makes me want to jump off a cliff
13:57Cozeyhello. When I (use ) a clojure file from swank, and have a syntax error, i don't get the linue number information anywhere. How is it possible to fetch it?
14:06technomancywunki: just load config off the classpath with c.j.io/resource and configure your classpath to include secret files in production
14:08wunkitechnomancy: thank you, will do that!
14:15technomancywhat's the program?
14:15clojurebot"In practice, nothing works." -- Brad Fitzpatrick
14:18gigamonkeyHey, I recognize that quote! ;-)
14:26dnolenwhoa 349 peeps in here today?
14:29chouserJust sayin'
14:30jodaroi could be a leftover peep from three easters ago
14:30jodarothe peep of easters past
14:30jodaroor should that be easter's
14:32hugoddnolen: from what I see match 0.1.0 was never released, but went straight to 0.2.0-SNAPSHOT, correct? (you'll be getting bored of me asking for a release jar …)
14:33dnolenhugod: yeah probably not a cut a release until I get backtracking in. a bit swamped with other things (work and Dan Friedman's forthcoming constraint logic programming paper)
14:34dnolenmaybe next week or after Strange Loop.
14:35dnolenchouser: apologies, I meant people of course ;)
14:35hugoddnolen: sure, I've got several projects I would like to use it on :)
14:35chouserdnolen: just kidding around. Don't mind me.
14:35technomancyinc on requesting a stable match
14:38kephalewell, the only way to tell if you are a peep or not is the microwave test
14:40bhenrykephale: if that's the case then we're all peeps
14:55iceythere's not really a way to assign a css class to a form input using hiccup, is there?
14:56bhenryicey: put it in curly braces:
14:57bhenry[:div {:class "myclass"} "divcontent"]
14:57joegalloicey: are you talking about the form-to defelem, specifically?
14:57joegallohttps://github.com/weavejester/hiccup/blob/master/src/hiccup/form_helpers.clj#L115
14:58iceyjoegallo: no, i want to attach a class to a textarea
14:58bhenry[:textarea {:class "class"}]
14:58joegalloso are you using the text-area defelem?
14:58joegallohttps://github.com/weavejester/hiccup/blob/master/src/hiccup/form_helpers.clj#L88
14:59iceyjoegallo: yeah, so it looks like i'll have to move away from using the text-area defelem and use the regular syntax like bhenry mentioned. thanks.
15:00bhenry(assoc-in [1 :class] (text-area "name" "value") "my-class")
15:01joegalloicey: yup
15:02bhenryicey: see my last one if you are using the defelem. remember that the element is still a vector
15:04iceybhenry: I see how that would have worked, but using [:textarea ...] ended up looking a lot cleaner; thanks again :)
15:05bhenryicey: cool. i honestly didn't even know about defelem.
15:06iceyit's great that there are many ways to skin this cat. i'm glad i asked about it now
15:08arohnericey: you can also do [:textarea.class]
15:08arohner[:div#my-id] and [:div.my-class] are both supported
15:09arohnerand classes can be chained: [:div.foo.bar.baz]
15:09iceyarohner: yeah, moving away from using the form helpers makes it a lot more flexible
15:09iceyarohner: now i'm not sure why i was using the form helpers... they didn't really gain me much
15:21user317why do i get an error when i (use :reload)? that a function already refers to something
15:29raek_user317: it probably means that you defn'ed a name that already exists in clojure.core, e.g. (defn conj ...)
15:29user317no, i doubt it
15:29user317hist-data-conn
15:29raek_hrm, ok. then it sound less likely... :-)
15:30raek_you can remove the namespace with (ns-remove 'the.ns)
15:30raek_and then require it again
15:30user317whast the difference between use and require
15:30raek_also remove any other namespaces that has used or required that one
15:31raek_require only makes sure that the namespace has been loaded
15:31raek_after that you can acces a var x in namescape foo.bar with foo.bar/x
15:31user317i see, what about use?
15:31raek_use does what refer does but also "pulls in" all public vars of the namespace so you don't have to use the namespace prefix
15:32raek_a bit like import in java
15:32jfletcheris there a list of which structures are optimized for what? or a way I can just use lists/hashtables?
15:34raek_user317: this is a good reference: http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html
15:34user317raek_: thanks
15:35raek_it is recommended to only use 'use' with the :only option
15:36raek_(after trying to read code from someone who didn't, you will see what I mean)
15:54chouserjfletcher: http://www.innoq.com/blog/st/2010/04/clojure_performance_guarantees.html
16:01user317any reason why test would return :no-test when i have a test defined?
16:13jfletcherchouser: thanks, that's a much more helpful answer than I expected.
16:13chouserjfletcher: set your expectations low enough and you'll never be disappointed :-)
16:14Rayneschouser: You disappoint me all the time.
16:14chouserRaynes: your expectations need to be lower, then.
16:14RaynesBut what if I expect to be disappointed?
16:14RaynesThen I suppose my expectations are low enough.
16:15chouserjfletcher: I just noticed the header on that table is messed up -- shifted to the left one column.
16:15jfletcherchouser: Yeah noticed that after looking at the vector column
16:16jfletcherAnother question I'm a little hesitant to ask, am I the only person to find clojure's syntax more confusing than CL?
16:17jfletcherthe reason I liked CL in the first place was the fact it was the same every time, and no need to think about order or evaluation etc,
16:18jfletcherplus you could do like (let ([x 1] [y 2]) (+ x y)) if you really wanted
16:18chouserjfletcher: no, you're not the only one. But for me, those little differences between () and [] helped a *lot* in learning to read Clojure.
16:19jfletcherit's not a massive problem, the fact I've never written a line of java before is a bigger problem
16:19chouserClojure sits in an interesting spot, attracting Java, Lisp, and Unix-scripty programmers
16:20jfletcherwhich is also because of syntactic politics, in that I didn't like camelback notation 15 years ago.
16:20chouserEach of them already had some of Clojure's features but are attracted by something they were missing
16:20user317how do i construct a record?
16:20chouserBut that also means each of them finds some part of Clojure uncomfortable
16:21jfletchermm
16:22user317(apply HQ. '(1 2)) gives me a ClassNotFoundException HQ.
16:22chouserLispers tend to complain about too much syntax, cons acting differently, nil != (), core functions being named differently, lack of user-defined reader macros, and requiring functions be defined before use.
16:23chouseruser317: try (apply ->HQ [1 2]) or (HQ. 1 2)
16:23jfletcheryea, why isn't empty list null?
16:23chouserjfletcher: heh. see?
16:23user317java.lang.Exception: Unable to resolve symbol: ->HQ
16:23jfletcherpersonally I think it's great, not that () is (), but nil is nil and nothing else
16:24user317i have (defrecord HQ [foo bar])
16:24jfletcherbut yea, the rest I admit to.
16:24chouserjfletcher: Java people complain about parens everywhere, dynamic typing, lack of infix math
16:24jfletcherinfix suck
16:24jfletchers
16:24jfletcherthey should try being around when you had to load your arguments into stacks.
16:24jfletcherthat's how polish notation came about in the first place. :)
16:25user317chouser, this is the only thing that worked (apply #(HQ. %1 %2) [1 2])
16:25chouserUnix scripty people (that's me) complain about the JVM startup time, classpaths, lack of good access to underlying OS
16:25jfletchermm, they're valid points though
16:26jfletcherthough no lisp has brilliant access to OS, without 3rd party interface.
16:26user317chouser, any idea why? is -> something that i need to import/require?
16:26chouseruser317: HQ. isn't a function, that's why you can't pass it as an argument to apply. (HQ. x) is essentially a macro that expands to (new HQ x)
16:27chouseruser317: When you use defrecord in recent versions of Clojure, it also generates ->HQ and map->HQ functions. My guess would be your version of Clojure doesn't have that yet
16:27chouseruser317: or perhaps those functions are in a different namespace and you're importing the HQ class but not the functions.
16:28chouserjfletcher: there is probably some validity to all those arguments, but a lot of difficult engineering tradeoffs were made to design Clojure and I'm generally pleased with the results.
16:29chouserjfletcher: one reason for nil != () is that nil is Java's null and thus can't implement any interfaces, while () is a real object that implements ISeq, Counted, etc.
16:32chouserI'm taking off.
16:32jfletcherTake care, and thanks again.
16:40user317so i defined a record in one file, but i cant seem to use it from my test file when i call (RecordName. blah) it gives me a an error that it cant resovle calssname
16:49seancorfieldyou need to import it
16:49bhenryuser317: you have to import it.
16:49user317i have :use [namespace] in my namespace
16:50user317is there a maximum number of fields in a record?
16:50bhenry(:import [namespace.classname])
16:50dnolenuser317: no but at certain point you should probably just use plain maps.
16:54user317:14
16:58dnolenuser317: well, actually you're probably limited by the max number fields for Java classes.
17:09seancorfieldmight it be limited by the max number of args in a function call? (just curious)
17:09user317man, this is driving me nuts, so i have (:import [ibclj.defs.HQuote]) but i still get Unable to resolve classname: HQuote, when i reference Hquote.
17:09user317HQuote. that is
17:11jkkrameruser317: gist?
17:12hiredmanuser317: look at example :import usage, and some :import usage in some sample code
17:12user317whats gist
17:12jkkramergist.github.com
17:12hiredmanyou don't need to paste anything
17:12hiredmanthe problem is immediately obvious
17:13hiredmancompare that :import to a working :import
17:13dnolenseancorfield: if it's true it's only for the default type/record ctors I think, not actually syntax for constructing an type/record instance.
17:14dnolenuser317: requiring someone to use :import isn't very nice tho, better to provide ctor fn, then people can just use that to get an instance of your type.
17:17user317ctor function seems the way to go, thanks
17:18seancorfield(:import [ibclj.defs HQuote]) - is that right?
17:18seancorfieldhmm, i got it working in a repl and then it doesn't work via lein test
17:18seancorfieldignore me :)
17:19seancorfieldi haven't had to use records yet so i'm curious about the solution...
17:26user317do reify methods need to be the same order as they are declared in the class i am trying to implement?
17:27coopernursewhat's the right way to setup a local dependency when using lein? for example, I'm working on project X which depends on lib Y. I want to hack on Y and test those changes in X without having to deploy a jar to a maven repo.
17:28seancorfieldah, figured it out! you have to require or use the containing namespace _and_ import the record type, yes?
17:28technomancycoopernurse: check lein help readme for the section on checkout dependencies
17:29brehautseancorfield: yes
17:29seancorfieldso (:require ibclj.defs) (:import ibclj.defs.HQuote)
17:29seancorfieldnone of the clojure books are very clear about that
17:29user317seancorfield: i wrapped it with a ctor function
17:29seancorfieldi couldn't find a multi-namespace example with records in Clojure in Action
17:30seancorfieldClojure Programming kinda glosses over it too
17:30hiredmanseancorfield: it depends what the record does, if the record doesn't do anything with the namespace it is created in you don't need to load it
17:30seancorfieldJoy of Clojure gave me the hint...
17:30coopernursetechnomancy: thanks. so the "checkouts" bit is wwhat I'm after?
17:30user317seancorfield: which also lets me use it in apply, etc..., the use/import/require seems the ugliest part of clojure so far
17:30technomancycoopernurse: right
17:30coopernursecool, thanks
17:31seancorfieldhiredman: my test case just had (defrecord Test [first last]) in one ns and in the other ns I had to require and import
17:31hiredmanseems unlikely
17:31hiredmanwhat errors did you get?
17:31brehauthas anyone else run into problems around clj 1.2.0 and 1.2.1 where records in a namespace that contains a hyphen (eg necessary-evil.fault.Fault) run into hyphen munging problems?
17:31seancorfieldhiredman: ClassNotFoundException on the record name
17:32seancorfieldwent away when i required the containing ns
17:32hiredmanI would double check that, make sure you actually ran the import
17:34seancorfieldhttps://gist.github.com/1204829
17:34seancorfieldshows the two files
17:35seancorfieldwithout that (:require ...) i get this failure: Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: beta3.trial.TrialRecord
17:36hiredmanmust be a repl thing
17:38seancorfieldi was not running it in the repl
17:39seancorfieldwhen i ran it in the repl, i loaded both files and could import without require (if that's what you mean) - which makes sense
17:39seancorfield...since both files were loaded
17:39seancorfieldbut just running beta3.core (-main) via lein run doesn't load beta3.trial without the require
17:40hiredmanworks for me
17:40hiredman1.2 or 1.3?
17:40seancorfield1.3 beta3
17:40seancorfield(hence the beta3 in my namespaces - i have a lein project for each version of clojure so i can experiment easily :) )
17:41seancorfieldyou tried on 1.2 i assume?
17:41hiredmanboth
17:42hiredmanpastebin the exact exception?
17:43hiredmanyou are missing a :gen-class if you are expecting to generate a main method
17:47seancorfieldlein run doesn't need :gen-class
17:47hiredmancorrect
17:48hiredmanjust saying, missing :gen-class can show up as a classnotfound
17:48seancorfieldhttp://pastebin.com/ffJrkRV6
17:48seancorfielduncomment the (:require) and it works, comment it out and it fails
17:50hugodwithout the require there is no defined load order, so it could load beta3.core before beta3.trial
17:51hiredmanah, of course
17:51hiredmanbut if you aot the class will be available regardless
17:51hiredmanit never loads beta3.trial so the record is never defined
17:53hugodbrehaut: using records containing underscores is not source code compatible between 1.2.0 and 1.2.1
17:53brehauthugod: yes ive noticed
17:54brehauthugod: unfortunately i made the (apparently flawed) decision prior to 1.2.1
17:54brehauthugod: if theres a work around so i can fix my lib, that'd be handy
17:55hugodit has to work with both 1.2.1 and 1.2.0?
17:56brehauthugod: i have uses of my lib on both i believe
17:56brehauthugod: i guess i could put out a release that requires 1.2.1
17:56user317((memfn charAt i) "foo" 1), where does the `i' come from?
17:57hugodbrehaut: or wrap all references to the classname in functions, so library users don't use the class name directly
17:57user317oh, its the arg name
17:58brehauthugod: ah right
17:58brehauthugod: thanks
18:07dsantiagoIs there some way, if there's a function that is using map destructuring, to collect its arguments into a map and use that map to call the function recursively?
18:09brehaut,((fn [{a :a c :b :as m}] (prn a c m)) {:a 1 :b 2 :c 3})
18:09clojurebot1 2 {:a 1, :c 3, :b 2}
18:09brehautdsantiago: im not quite sure if thats what you are asking
18:09dsantiagobrehaut, Yeah, I think what I mean is actually the keyword args in the map destructuring after &.
18:10brehaut,((fn [& {a :a c :b :as m}] (prn a c m)) :a 1 :b 2 :c 3) ; more like that ?
18:10clojurebot1 2 {:a 1, :c 3, :b 2}
18:11dsantiagoWell, yes, but now I want to call that function with the actual map (m).
18:12brehaut,(apply prn (flatten (seq {:a 1}))) ; is a horrible way to achieve it ?
18:12clojurebot:a 1
18:12dsantiagoAh, OK, I had tried apply, but I didn't think of that.
18:13dsantiagoThanks.
18:14brehautdsantiago: perhaps a wrapper function with variadic args and a real function with a map arg would be nicer though
18:14dsantiagoYeah, that's where I was heading anyhow, it just felt like there should be a more direct way.
18:22jkkrameris (binding [*read-eval* false] (read-string input)) safe to use with untrusted input? like, is there any way for it to instantiate arbitrary classes or do nefarious things?
18:29jkkramerbased on available documentation/code, it appears the answer is yes. would be nice if read or read-string mentioned *read-eval* and safety
18:32seancorfieldhiredman: good point about aot and defrecord (sorry, stepped away for a bit)
18:38brehauthugod: hmm. it turns out that im implementing a protocol from one namespace on the record from another namespace internally
19:01patchworkhey all, I doing a "use" to import a library into my namespace
19:02patchworkbut when I import THAT namespace, none of the original symbols are bound
19:02patchworkdo I need to do another use in this namespace, or is there a way to transmit used symbols into the next namespace?
19:02patchworkJust curious what the idiomatic usage is here
19:12technomancypatchwork: calls to use are not transitive
19:13technomancypeople have experimented with transitive use, but the consensus was that it's undesirable
19:14patchworktechnomancy: Gotcha
19:14patchworkso just use the same use call
19:14patchworkif that is what I desire
19:14patchworkthanks!
19:14technomancyyep, sure
20:18jlihum, is there a nice way to convert from clojure maps to javascript objects? I thought .strobj was it, but doesn't seem to be working for me
20:23seancorfieldis there an idiomatic and/or performance preference for #(f a %) over (partial f a) - any compelling reasons / situations when one is better than the other?
20:25hiredman#() creates new classes all the time, (partial f a) doesn't
20:26hiredmanor, I should say evertime #() is compiled
20:26hiredman,(type #())
20:26clojurebotsandbox$eval5412$fn__5413
20:26hiredman,(type #())
20:26clojurebotsandbox$eval5440$fn__5441
20:26hiredman,(type (partial + 1))
20:26clojurebotclojure.core$partial$fn__3822
20:26hiredman,(type (partial + 1))
20:26clojurebotclojure.core$partial$fn__3822
20:26hiredmanand partial is just prettier
21:00hugodbrehaut: then a macro would be the only way to make it work across versions
21:00brehauthugod: thanks
21:38jliokay, I think I finally understand strobj
21:39jliwell, that's not true. I'm just less mistaken about it.
22:07jliis there any sugar for building a map like this? (let [x ... y ... val ...] {:x x, :y y, :val val})
22:07jliwell, not sugar, but idiomatic shorthand
22:08S11001001jli: don't do the wrapping let, just stick the computing exprs as the values in the literal map
22:08jliwell, the expressions can be big
22:08S11001001jli: indentation saves you here
22:09jlireally big.
22:09S11001001how would putting them as let vars be any clearer?
22:09jlior maybe it's (let [[x y] ... {val :val} ...] {:x x :y y :val val})
22:10S11001001if you want to compute the value collection separately from the key collection, zipmap is your friend
22:12jliI don't
22:19gfrlogwhat might I be doing wrong if I try to implement an interface with deftype and it complains that the method is not in the interface?
22:21seancorfieldhiredman: your argument about #() vs (partial) is persuasive - and since i was already moving that way in my code, i feel vindicated :)
22:21cemerickgfrlog: check the arity of your implementing method body, as well as a method name typo
22:23gfrlogcemerick: it's a java-ey interface, do I need to worry about the types of my arguments, or does the compiler take care of that?
22:25brehautseancorfield: as a bonus you can join the church of point free
22:25jliuse with comp for an even higher score
22:26jliI don't think it's possible to attain haskell-like pointlessness without flip though
22:27gfrlogdangit now I need to look up the irc logs to see what hiredman's argument was
22:27brehautgfrlog: #() generates a new class each time, where partial does not
22:27cemerickgfrlog: So it's an interface with overloaded method sigs? Yeah, you'll have to hint the args in that case, but then you would get an error like...
22:28cemerick"Must hint overloaded method: m"
22:28gfrlogcemerick: no, it's not overloaded
22:28gfrlogcemerick: so I assume it's supposed to just work
22:28jlihttp://www.haskell.org/haskellwiki/Pointfree#Combinator_discoveries
22:28gfrlogcemerick: oh I forgot the this arg
22:28cemerickgfrlog: Yeah; I'm guessing an arity issue
22:28cemerickAh, sure, explicit this :-)
22:29gfrlogcemerick: thanks for the help
22:29cemerickhah, FWIW
22:30gfrlogbrehaut: yeah I agree that's rather compelling
22:31gfrlogdoes anybody know/suspect a rationaled behind the clojure regex syntax? Every language I know of with a regex syntax uses //, so I'm surprised clojure doesn't use that or at least #//
22:31brehautgfrlog: its purely a reader macro that way?
22:32gfrlogbrehaut: I don't follow -- how does a syntax choice determine whether or not something is a reader macro?
22:32brehautand it can hook into the # dispatch thing
22:32gfrlogwhat about #/regex/
22:32brehaut# is a dispatch thing; it takes the next thing and gives it a different meaning
22:33brehauttheres no /something/ literal
22:33arohnerwait, how does #() create a new class each time, but partial does not? and what context does "each time" mean?
22:33gfrlogarohner: each time it's compiled
22:33gfrlogarohner: every function literal is a separate class
22:33gfrlogpartial is not a function literal
22:34brehautarohner: http://clojure-log.n01se.net/#20:25 for hiredmans examples
22:34arohneroh, I see. #() creates a new class, (partial) creates a new instance of the same class
22:34gfrlogbrehaut: does # operate at the parser(==? reader) level?
22:35arohnergfrlog: reader. Go check out LispReader.java
22:35arohnerI don't think there's really a separate parser in clojure
22:35brehautarohner: each macro or special form is its own parser?
22:36brehautalthough i guess parsers dont typically work on trees?
22:36arohnerbrehaut: each form calls read() as necessary
22:36arohnerso when the reader sees (, it calls readList(), which reads() until )
22:36gfrlogcan macros have preconditions?
22:39brehautarohner: i think ive managed to not articulate what i mean
22:41brehautarohner: typically a parser process a stream of symbols generated by the lexer; in clojure the reader creates a tree which is more complex than a lexer would create but less complex than what you'd get out of a parser?
22:42gfrlogThe reader returns a clojure data structure I believe
22:42brehautexactly
22:42gfrlogwith all the reader-macros having been processed
22:43brehautbut the meaning of that as a program is still unknown until its run through the evaluator / compiler
22:44gfrlogyeah, clojure/lisp trade less "syntax" for less meaningful parses
22:44brehautim beginning to think theres no point trying to draw an analogy to a more conventional language here
22:44gfrloghah
22:44brehautgfrlog: thats the thing though; the result of the read is more information rich than a lexer stream, but less so than an AST
22:45brehaut(lets ignore the argument about whether sexp's are ASTs)
22:45gfrlogAbstract Lysptax Trees
22:46gfrlog(that's where the alt key comes from)
22:46sridhas any deployed apps to heroku with scheduled tasks (cron)? i wonder how the pricing for cron (assuming you run 1-5 mins task per day) is determined on the Cedar stack.
22:49TheBusbyaccount list
22:49TheBusbywhoops, sorry wrong window
22:49gfrloglame password
22:50brehautgfrlog: how do you know? it just came through as ************ to me
22:51gfrlogbrehaut: because any password with fewer than 20 characters is lame
22:51brehauthaha
22:51gfrlog[org.clojure/clojure-contrib "1.2.1"]
22:51gfrloganybody know what's wrong about that?
22:51brehautit doesnt exist?
22:52gfrlogbrehaut: ah, good point, I'll go fix it then :P
22:52gfrlog"lein new" doesn't include contrib anymore so now I gotta go lookup the maven line
22:53brehautah yeah. i need to go find out where the contrib libs necessary-evil depends on now live
22:54gfrlogI switched it to 1.2.0 and that worked :/
23:03gfrlogwhen clojure starts throwing an arrayindexoutofboundsexception whenever you load your namespace, it's time to go to bed.
23:16lrenni just updated my emacs (emacs starter kit) config after what was probably a year and now I don't get a repl. slime work, clojure mode works, i can compile etc, but i don't get a repl buffer. do i have to turn on slime-fancy or something?
23:48lrennslime-repl is a separate package now. following the current documentation new users won't get a repl :( That's a bummer.