#clojure logs

2011-10-18

00:17RaynesStrange how they made everything useful about 'doc' private.
00:17RaynesKind of blows away the whole 'implement with functions and then write a thin layer of macro to make it more convenient'.
00:19ibdknoxRaynes: what do you want to do?
00:21RaynesI guess I mostly just wish special-doc wasn't private.
00:24Raynes,(doc .)
00:24clojurebotI don't understand.
00:24RaynesDidn't figure you would.
00:25amalloy~source doc
00:26Raynesamalloy: Why aren't you on AIM?
00:26RaynesOh. Guess it's me that isn't.
00:29amalloyibdknox: IMO it's hideous that there's all this great logic for encoding information about special forms: which ones are related, what kinds of expressions you can use them in, and where to find more info on clojure.org - but the only "public" way to get at that information is by converting it all into one computer-indigestible string
00:30RaynesIndeed.
00:30ibdknoxamalloy: I certainly don't disagree
00:30ibdknoxI was just curious what he was up to :)
00:30Raynesibdknox: Lazybot reimplement's doc in a prettier way for IRC.
00:31amalloyworse, i think, is that you have to have a symbol at macro time - it won't even look anything up for you if you have a var
00:31RaynesNot sure if that apostrophe belonged there.
00:32spoon16i've got a simple question about (map)
00:32ibdknoxspoon16: shoot
00:32amalloyRaynes: Apostrophes don't mean, "WHOA, watch out! HERE COMES AN 'S'!"
00:32Raynesamalloy: I'm aware.
00:32spoon16I want to (map process-line-func (io/read-lines "file_path"))
00:32spoon16but I want the resulting vector to exclude nil values
00:32spoon16my process-line-func is outputting nil if the line is empty
00:32amalloy&(doc keep)
00:32lazybot⇒ "([f coll]); Returns a lazy sequence of the non-nil results of (f item). Note, this means false return values will be included. f must be free of side-effects."
00:33amalloyand also ##(doc filter)
00:33lazybot⇒ "([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns true. pred must be free of side-effects."
00:34spoon16link to docs page for that? should I just be looking for keep?
00:34Rayneshttp://clojure.github.com/clojure/clojure.core-api.html#clojure.core/keep
00:34RaynesThe docs are the same.
00:35Raynes&(map identity [nil nil nil])
00:35lazybot⇒ (nil nil nil)
00:35Raynes&(keep identity [nil nil nil])
00:35lazybot⇒ ()
00:35RaynesIt's essentially the same thing. Just doesn't bother with nil.
00:35spoon16I see
00:35spoon16thanks for the example
00:36RaynesClojuredocs is good for examples.
00:36Raynes$example keep
00:36RaynesI guess I've forgotten how to use that.
00:36Raynes$examples clojure.core keep
00:36RaynesPerhaps?
00:36RaynesBah, he hates me.
00:36ibdknoxwho doesn't?
00:36amalloyRaynes: this is what you get for not writing better docs
00:36ibdknox~rimshot
00:36clojurebotBadum, *ching*
00:37amalloyif only $examples had an example usage...
00:37ibdknoxohh the irony :p
00:39RaynesSlightly broken at the moment.
00:43archaicI should have been using seesaw waaaaaaaaay earlier. 1000 lines of tangled gui swing -> 400 with real nice modularity
00:44Raynesarchaic: I could have told you that!
00:47archaiccould you tell me an easy way to integrate with cron? :]
01:03spoon16how to sort-by a complex key #( ( ( % :value ), ( ( % :child ) :value ) )
01:03spoon16output of function in this case would be (5, 2) as an example
01:06wiseenis there a function that will partition the input seq as pair of top two values like : [1 2 3 4 5 6] -> [[1 2] [3 4] [5 6]] - I suspect this should be common since many macros take paired arguments
01:06amalloyspoon16: i assume from your words that you're looking for juxt, but your code is nonsense
01:06amalloy&(doc partition)
01:06lazybot⇒ "([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to compl... https://gist.github.com/1294645
01:07wiseenamalloy, lol
01:07wiseentnx
01:07amalloy$findfn 2 [1 2 3 4] [[1 2] [3 4]]
01:07lazybot[clojure.core/split-at clojure.core/partition-all clojure.core/partition]
01:09hiredman,((juxt (juxt first second) (juxt (comp first rest rest) (comp second rest rest)) [1 2 3 4])
01:10clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
01:10spoon16amalloy: sorry about the code… still learning so very likely it's completely wrong :) I think you have pointed me in the right direction
01:10spoon16thanks
01:10hiredmanclojurebot: jerl
01:10clojurebotI don't understand.
01:10hiredman,((juxt (juxt first second) (juxt (comp first rest rest) (comp second rest rest))) (range 1 5))
01:10clojurebot[[1 2] [3 4]]
01:10amalloyhiredman: haha very classy
01:11amalloyyou just need to work a sort-by in there so your code answers both of their questions entirely
01:13hiredman,((comp (juxt (juxt first second) (juxt (comp first rest rest) (comp second rest rest))) (partial sort-by identity)) (range 1 5))
01:13clojurebot[[1 2] [3 4]]
01:29MGThi
01:31novitkHi, I have some really wicked bahaviour with clojure.java.shell
01:31novitknovitk@max:~/tmp$ cat shprob.clj (use '[clojure.java.shell :as shell]) (println (:out (shell/sh "ls" "-l"))) novitk@max:~/tmp$ time java -jar ../clojure-1.3.0/clojure-1.3.0.jar shprob.clj total 20 -rw-r--r-- 1 novitk novitk 18 2011-10-18 01:16 hello.clj drwxr-xr-x 2 novitk novitk 4096 2011-10-02 12:05 sdd1 -rw-r--r-- 1 novitk novitk 76 2011-10-18 01:17 shprob.clj -rw-r--r-- 1 novitk novitk 75 2011-10-18 01:07 shprob.clj~ d
01:32novitkbasically if I use it the jvm waits for over a minute to shutdown
01:32amalloynovitk: futures and the agent threadpool
01:32novitkthis is on both ubuntu and win
01:33novitkshell is using agents?
01:33amalloysh spins up some threads to support piped io
01:33amalloyand futures use a threadpool, which doesn't get automatically shut down
01:35novitkthx amalloy, will research
01:36ibdknoxman, I should write my doc strings as I go instead of waiting until the end
01:37amalloyibdknox: (defn munge "Does some kind of string manipulation, honestly I don't remember what kind and the code is a mess." [x] ...)?
01:37ibdknoxhaha
01:37ibdknoxmore that writing 180 lines of docs all at once is incredibly boring
01:38ibdknoxhttps://github.com/ibdknox/Korma/commit/0b9193fc26f05d758eed7349e3791eac02f4dcee
01:41tolstoyIs it possible to have multiple namespaces in a single file (when running as leon run, for instance)?
01:42amalloyibdknox: https://github.com/ibdknox/Korma/commit/0b9193fc26f05d758eed7349e3791eac02f4dcee#L1L155 - you were too weak to do doc-only
01:43tolstoy(ns util) (some-forms) (ns my-app.core) (defn -main [& args] (util/foo))
01:43tolstoySeems like that was possible back in the Clojure 1.1ish days (last time I used it).
01:43ibdknoxamalloy: it's true... don't tell anyone :p
01:44ibdknoxtolstoy: you can have multiple ns's in a single file, but require won't do the right thing
01:44tolstoyHow about use?
01:44ibdknoxtolstoy: use is basically just require + refer
01:45tolstoyibdknox: So, basically, no? (I don't mind, just don't want to rathole on this.)
01:45ibdknoxtolstoy: yeah, it's not idiomatic and generally not a good idea in the first place, so no one went out of their way to make it easy :)
01:45tolstoyI only really want to do it just for initial dev.
01:46amalloytolstoy: it's certainly possible. you just can't require a namespace unless it's in the file it "should" be
01:48tolstoyAh! I got it to work. amalloy: Okay, I got you on that "require" part of it. I'm just using it as a way to keep bunches of functions sectioned off while I figure out what I'm doing.
01:48amalloytolstoy: if your OS was built after 1950, you have an even better way, though: put them in separate files :P
01:49ibdknoxmine was built in 1949.
01:49tolstoyamalloy: Heh. Next you'll be suggesting I can just flip from buffer to buffer in this editor-type-thing.
01:50ibdknoxstill runs like the day I bought her.
01:50amalloyibdknox: don't make me oil up the old Analytical Engine. let's not make this a contest
01:50ibdknoxlol
01:51spoon16how can I combine a list of vectors ([] [] []) into a single vector… or list?
01:52ibdknox,(doc concat)
01:52clojurebot"([] [x] [x y] [x y & zs]); Returns a lazy seq representing the concatenation of the elements in the supplied colls."
01:52ibdknox,(doc reduce)
01:52clojurebot"([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val i...
01:54archaic,(source filter)
01:54clojurebotSource not found
01:54tolstoyGoogled in "wabbitmq" and google won't believe me, insists I mean RabbitMQ. (Alas, wabbitmq seems abandoned.)
02:54archaictrying to get command-line interface working, I can compile cmd_line_test fine, I can run it using lein run, but java -cp . cmd_line_test gives a NoClassDefFoundError from the projects root directory .. (the 4 .class files main,init,etc are in the /classes folder) any ideas?
02:55tolstoyHm. That happened to me today (new to Clojure after a couple of years away from it).
02:55tolstoyI solved it by adding (:gen-class) to the ns declaration where my main method was.
02:55tolstoyThat was so that my uberjar would be executable.
02:56archaicits there ;|
02:56tolstoy(java -jar myapp.jar)
02:56tolstoyDrat!
02:58tolstoywhich class is not found? is clojure.jar on the class path?
03:00archaiccmd_line_test is not found, clojure-1.3.0.jar is in lib/
03:32Blktgood morning everyone :D
03:43spoon16how do I debug this?
03:43spoon16user=> lines
03:43spoon16("43 70 27" "3 18 24" "65 99 45" "20 39 26" "45 74 26" "10 28 20" "78 97 23" "0 9 22" "")
03:43spoon16user=> (map #( (println %) ) lines)
03:43spoon16(43 70 27
03:43spoon16java.lang.NullPointerException
03:43spoon16sorry, didn't mean to paste that many lines
03:45Fossi,(map #( println % ) ("43 70 27" "3 18 24" "65 99 45" "20 39 26" "45 74 26" "10 28 20" "78 97 23" "0 9 22" "") )
03:45tolstoyspoon16: Not sure. But does (map println lines) work?
03:45clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn>
03:45scottjspoon16: #(println %) instead of #((println %))
03:45scottjprintln returns nil and you can't call nil as a function. so you have (println %) returns nil and then #(nil) calls it
03:46spoon16i see
03:46spoon16thanks
03:46scottjand normally you don't use map for side effects, but doseq
03:46spoon16yeah, I'm trying to debug some other issue
03:47spoon16not actually wanting to print
03:47scottjbut if you like map, realize it's lazy and you might need to dorun or doall it
03:47spoon16it's the extra ()
03:47Fossi,(map #( println % ) '("43 70 27" "3 18 24" "65 99 45" "20 39 26" "45 74 26" "10 28 20" "78 97 23" "0 9 22" "") )
03:47clojurebot(43 70 27
03:47clojurebot3 18 24
03:47clojurebotnil 65 99 45
03:47clojurebotnil 20 39 26
03:47clojurebotnil 45 74 26
03:47clojurebotnil 10 28 20
03:47clojurebotnil 78 97 23
03:47clojurebot...)
03:48Fossiups :>
03:48scottjspoon16: btw you can (map println lines), no need to wrap in function
03:48Fossi,(map println '("43 70 27" "3 18 24" "65 99 45") )
03:48clojurebot(43 70 27
03:48clojurebot3 18 24
03:48clojurebotnil 65 99 45
03:48clojurebotnil nil)
03:48Fossilots of nils in there as well ;)
03:49scottjI think the return value and output get interleaved
03:49scottjI think the result is just (nil nil nil)
03:50tolstoy,(doseq [x '("43 70 27" "3 18 24" "65 99 45" "20 39 26" "45 74 26" "10 28 20" "78 97 23" "0 9 22" "")] (println x))
03:50clojurebot43 70 27
03:50clojurebot3 18 24
03:50clojurebot65 99 45
03:50clojurebot20 39 26
03:50clojurebot45 74 26
03:50clojurebot10 28 20
03:50clojurebot78 97 23
03:50clojurebot0 9 22
03:50tolstoyscottj: ftw
04:02ejacksonmorning all
04:03scottjRaynes: maybe put weather in the ororo description so it shows up in searches on clojars
04:39Raynesscottj: Good idea. Done.
04:39spoon16best way to iterate over a vector of structs and (assoc struct-instance :index i)?
04:40RaynesStep one is stop using structs. They've been deprecated for a long time.
04:41Rayneshttp://clojure.org/datatypes you probably want to use defrecord instead.
04:41spoon16what should I use instead… I was just playing with ants.clj and they are used there because (I guess) the underlying map keys are not reqused
04:41Raynesants.clj was written in Clojure 1.0, IIRC.
04:41spoon16yeah, I'm sure you are right
04:41spoon16it's just what I was looking at
04:42RaynesNot criticizing you. Just making sure you know. :)
04:42spoon16I have a vector where isntances in the vector point to arbitrary other instances in the same vector. When I encounter an instance in the vector that has a pointer to an arbitrary instance I need to navigate that reference and identify the index in the vector that reference owns
04:43spoon16so how can I iterate over the vector and add an :index property to every instance in the vector?
04:47scottjRaynes: also at least single example api fn call in the readme would have been niced
04:49clgvspoon16: like &(vec (map-indexed (hash-map :value %2 :index %1) [10 11 12]))
04:49clgv,(vec (map-indexed (hash-map :value %2 :index %1) [10 11 12]))
04:49clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: %2 in this context, compiling:(NO_SOURCE_PATH:0)>
04:49clgv,(vec (map-indexed #(hash-map :value %2 :index %1) [10 11 12]))
04:49clojurebot[{:index 0, :value 10} {:index 1, :value 11} {:index 2, :value 12}]
04:50spoon16nice
04:50spoon16thanks
04:50clgvit's not really "adding" but creating a new vector with those maps. but it does what you described.
04:52Raynesscottj: I thought the documentation was pretty clear. It is extremely simple. Everything take two arguments except for history.
04:52spoon16yeah, I get it
04:52spoon16thats what I wanted
04:52Raynesscottj: But if you think it'd be helpful, I'll add an example call.
04:52scottjRaynes: having an example code means you don't have to read the documentation :)
04:53RaynesEvil.
04:53clgv+1 raynes. skipping reading the docu sounds like a straight way to hell^^
04:54Raynesclgv: In this case, not really. Like I said, all of the API methods (except for that damn history one) are exactly the same. One example actually does the trick here.
04:54scottj(conditions api-key "22206") or something
04:54RaynesPrecisely.
04:54scottjthree words instead of three paragraphs :)
04:55clgvRaynes: what lib are you talking about?
04:55Raynesclgv: http://github.com/Raynes/ororo
04:57clgvRaynes: hmm interesting. they have weather data for my city as well :)
04:59Raynesscottj: Added a couple of examples.
05:00RaynesI'll extend that to allow for all sorts of things to be passed. Maps, sequential collections, and strings of various lovely formats.
05:00RaynesYou can pass a string like "state/city" right now.
05:01scottjit is interesting that the state position can also be country
05:01RaynesThat API can do all kinds of fun things. lazybot will get a bunch of weather features as soon as I get around to writing a plugin.
05:01RaynesYeah, that's useful.
05:03scottjwhere does the name come from?
05:04Raynesscottj: The first name of Storm from XMen.
05:05scottjahh, I'm clueless about xmen, I think I was the only one in the theater of this last movie that didn't know magneto was going to be bad
05:06RaynesHeh. amalloy_ actually led me to the name. I didn't actually think to use it until he mentioned Storm.
08:00lnostdal_does a print function that does not add spaces exist?
08:16clgvlnostdal_: spaces left and right of characters or also spaces in-between characters
08:27fdaoudraek, gfredericks: remember our little conversation yesterday..
08:28fdaoudI found the missing piece of my puzzle: resolve
08:28fdaoud,((resolve (first '(+ 3 4))) 38 4)
08:28clojurebot42
08:30tordmor,(doc resolve)
08:30clojurebot"([sym] [env sym]); same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)"
08:32fdaoud4clojure doesn't allow resolve either! bah!
08:59antares_hey guys. I am seeing this exception coming from Leiningen (or so I think): https://gist.github.com/12ee8a548a46431674e9 — is it a known problem?
09:04kij
10:16clgvantares: afaik it is a problem with AOT compiled code under clojure 1.2 that you now want to use when building a clojure 1.3 project
10:54semperostrying to learn pallet by using a local "stub" provider with jclouds; anyone know of any good resources/examples I could use as a reference to get things working?
10:55semperosor perhaps node-list is the appropriate one for local playing...
11:01jcromartieI propose that any embedded Lisp s-expression-based query language be called "SexQL"
11:18SLiLooking to buy Joy of Clojure book without killing trees, since I'd rather read it on my Kindle anyway... And the situation seems quite confusing. Apparently there's a Kindle version, but not in Amazon? Also Manning website says "No matter where you buy the pBook—whether from the Manning website, another online store, or in a regular bookshop—you can now get the eBook at no extra charge. To register your pBook, you will need information from the book's inse
11:19SLiOf course I could just order the paper version, get the ebook version and sell the paper version... Still would rather save the hassle. :)
11:40scgilardiyou can buy the ebook in kindle format from this page: http://www.manning.com/fogus/ . what's confusing?
11:47joegallotechnomancy: i'm trying to find the source for http://clojars.org/server-socket, but google is denying me -- link?
11:49cemerickJeez, RSVPs are full for ClojureNYC tomorrow.
11:57dnolencemerick: nice! I strangely sense that the interest Clojure in NYC is starting to heat up.
11:58cemerickNow if Boston can get a little warmer. Decidedly chilly over there, surprisingly.
11:58dnolenwill be giving a presentation tonight at Gilt Groupe, and then another before the Conj at Hacker School - a fun thing hosted at Spotify's offices.
11:58cemerickdnolen: good luck at the Gilt Group thing tomorrow, btw :-)
11:59babilenAnybody knows what "Houser EK" references in Joy of Clojure (10.7)? It is about exception handling in Clojure and the Text is "..and it might be better to explore other possibilities (Houser EK)"
11:59dnolencemerick: thanks, unfortunate they're happening at the same time! But I'll catch it at the Conj :)
11:59babilen10.7.4 to be precise
11:59cemerickdnolen: it'll be much better by then, for sure
12:00cemerickI got behind on the underlying project a bit; having this dry run is forcing me to get back to it
12:00zerokarmaleftbabilen: clojure.contrib.error-kit, i believe
12:02zerokarmaleftbabilen: http://richhickey.github.com/clojure-contrib/error-kit-api.html
12:02lazybotNooooo, that's so out of date! Please see instead http://clojure.github.com/clojure-contrib/error-kit-api.html and try to stop linking to rich's repo.
12:02zerokarmaleftbargle
12:02babilenzerokarmaleft: Ah, ok. Thank you -- I just wanted to explore those "other possibilities" -- What else are good ones to take a look at?
12:03babilenzerokarmaleft: That reference was completely lost on me
12:03mrsipanis there a way to declare custom exceptions for error handling?
12:04mrsipanI have heard about conditions, but have no idea what is its relation with exceptions
12:04babilenmrsipan: Yes, either use gen-class or "explore other possibilities" such as http://clojure.github.com/clojure-contrib/error-kit-api.html
12:05babilen;)
12:05mrsipanbabilen, thanks
12:05raekbabilen: check out "Slingshot"
12:06raekbabilen: https://github.com/scgilardi/slingshot
12:06babilenraek: I'll take a look. And while we are in the "take a look" phase ... midje or lazytest or something else?
12:06seancorfieldthe consensus seems to be that none of the exception handling contrib namespaces will be migrated to new contrib so the "official" recommendation for now is to look at slingshot...
12:07babilenseancorfield: Thank you
12:07raekI think slingshot has informally taken the place of error-kit and condition
12:07raekah, what seancorfield said... :-)
12:08seancorfieldsee http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go for more detail on old contrib and new contrib (and what's effectively going away for want of an active maintainer)
12:24TeXnomancyjoegallo: oh no, I forgot to push the source
12:42duck1123babilen: re Midje vs Lazytest, I've used both, and both are very nice, but lazytest was limited in the types of "fixtures" that could be applied
12:42duck1123I found myself needing 'around' and couldn't pull it off easily in lazytest
12:50technomancyjoegallo: https://github.com/technomancy/server-socket
12:50joegallorock out, thanks man
12:51technomancynp
12:51technomancyI emailed Craig McDaniel; he misses working in Clojure =(
12:51technomancy(original author of server-socket)
12:51ejacksoneep, I still use good ole' clojure.test. I feel old
12:52technomancyleiningen teaches clojure.test some new tricks =)
12:54pjstadigi sooo want to say "real men don't write tests", but maybe i shouldn't :)
12:55pjstadigwhich of course would be a joke, so don't get worked up about it
12:58S11001001scgilardi: I'm thinking about this % thing again; mightn't it be safer to wrap in `(let [~'% (:object ~'&throw-context)] ...) instead of doing the prewalk-replace?
12:58S11001001ls
12:58S11001001(benefits of erc)
13:18andrewcleggok, stupid moment. how do you define a global that maps to a particular instance of a java enum?
13:18andrewcleggI tried like this: (def track ResourceType/TRACK)
13:18andrewcleggResourceType cannot be cast to clojure.lang.IFn :-(
13:19andrewcleggcould make them into 0-arg functions but that seems like missing the point
13:20aaelonyWhat is the best way to write a large lazyseq to a file? I am experimenting with spit, but not sure for to force it to output to file http://pastie.org/2718820
13:22raekaaelony: (with-open [out (io/writer "filename.txt")] (binding [*out* out] (doseq [line lines] (println line))))
13:22raekwhere io is clojure.java.io
13:22aaelonyraek: thanks very much :)
13:23raekandrewclegg: that should work
13:23raekandrewclegg: (def green java.awt.Color/GREEN) works in my repl
13:24raekI think the problem is elsewhere
13:24andrewcleggprobably pilot error, hang on
13:25raek"ResourceType cannot be cast to clojure.lang.IFn" seems to indicate that you try to use the value as a 0-arg function, though
13:25andrewcleggyeah, sorry, I had some stray parens around it where I was using it
13:31timvisheri'm trying to turn a zipfile into a seq of byte[] using util.zip. A) is there an easier library to work with? and B) how do i work with `while` idioms in clojure?
13:32timvisherB being only relevant if there isn't a better library
13:36joegallo,(doc while)
13:36clojurebot"([test & body]); Repeatedly executes body while test expression is true. Presumes some side-effect will cause test to become false/nil. Returns nil"
13:37timvisherjoegallo: /me smacks foreheak. RTFM! ;)
13:37joegallonp, it's an easy one to miss
13:37timvishergod, this api is atrocious
13:38timvisherit doesn't even implement Iterable
13:58spoon16I'm playing around in the REPL and am getting 'java.lang.NullPointerException (NO_SOURCE_FILE:0)'
13:58spoon16is there some way to get a more meaningful stack trace?
13:58hiredman(.printStackTrace *e)
13:58hiredman*e is the last uncaught exception thrown
13:59spoon16thanks
13:59bhenrywhere is show?
14:00bhenryi.e. what namespace
14:00hiredmanclojure.repl maybe
14:00hiredman,(require 'clojure.repl)
14:00clojurebotnil
14:00hiredman,(get (ns-publics (create-ns 'clojure.repl)) 'show)
14:00clojurebotnil
14:01bhenryit's not there. i thought it would be.
14:01hiredman,(ns-publics (create-ns 'clojure.repl))
14:01clojurebot{source #'clojure.repl/source, stack-element-str #'clojure.repl/stack-element-str, set-break-handler! #'clojure.repl/set-break-handler!, find-doc #'clojure.repl/find-doc, thread-stopper #'clojure.repl/thread-stopper, ...}
14:01hiredman:/
14:01hiredmanpossibly some clojure.tools.*
14:02drewrbhenry: it's still only in clojure.contrib.repl-utils
14:02bhenrycool drewr thanks
14:02drewrI have to keep [org.clojure.contrib/repl-utils "1.3.0-alpha4"] around *just* for that
14:02drewrwhich prints earmuff warnings every time I compile the code :'(
14:04hiredmanmaybe the plan is to rewrite it on top of clojure.reflect.java
14:05hiredmanclojure.reflect/reflect maybe similar to show
14:10hiredmanwould be interesting to have a library that takes in something like reflect returns and generates classes
14:12timvisheris there any way to represent this idiom in clojure? `while((entry = zis.getNextEntry()) != null) {`
14:12timvisheri'm aware of `while` but I can't figure out how to mash this in there
14:13nickmbaileysounds kind of like you just want 'map'
14:13Bronsatimvisher: usually to cicly through all the elements of a sequence in clojure doseq is used
14:13Bronsa*cicle
14:13timvisheryes, but the problem is that i'm not dealing with a seqable api
14:13timvisherhttp://java.sun.com/developer/technicalArticles/Programming/compression/
14:15timvisherand ZipFile. doesn't allow for a URI
14:15timvisherso I need to use their ZipInputStream. but that requires that `while` idiom
14:15timvisheri'm trying to avoid setting a var or something but i'm guessing i'm going to have to
14:16S11001001timvisher: you need loop, not while
14:16timvishermaybe store the result of .getNextEntry in an atom and swap at the end of the function?
14:17timvisherwith a `(recur (.getNextEntry zis))`?
14:21timvisherwell, i suppose that none of these zip files will _ever_ be big enough to blow the stack. ;)
14:23nickmbaileyloop/recur doesn't consume stack space
14:24timvishertrue true
14:27jkkramertimvisher: http://stackoverflow.com/questions/5419125/using-java-api-from-clojure-reading-zip-file
14:33amalloytimvisher: you can (take-while identity (repeatedly #(.getNextEntry zis)))
14:33amalloyand then you have a seq and can stop messing with this mutability stuff
14:36timvisherjkkramer, amalloy: thanks for the pointers!
14:36timvisherunfortunately, this api seems to be particularly functionally resistant
14:36timvisherjust having a seq of zipentries won't do it, because I can't then turn those into byte arrays
14:37timvisheri'm essentially trying to coerce the zipfile into a seq of input-streamables
14:37timvisherbut a ZipEntry doesn't expose anything that lets me do that
14:38amalloy$javadoc java.util.zip.ZipEntry
14:38lazybothttp://download.oracle.com/javase/6/docs/api/java/util/zip/ZipEntry.html
14:40amalloytimvisher: so you have to call .getCompressedSize on each entry, and then read that large a byte[] from the input stream? j.u.zip is even worse than i remember
14:41timvisherit's crazy bad. :)
14:41timvisheri'd expect that to be the case (.getCompressedSize), but it returns zero for a directory entry
14:42timvisherwhich is incorrect, IRRC
14:42amalloytimvisher: i think it's probably right?
14:43timvisherah
14:43timvisherwell, this is my first forray into zips so i'm probably the wrong one here
14:46timvisheras a side question, :use doesn't expose the namespace's functions as native functions to others who :require the ns. Is there a way to do that?
14:47timvisheri.e. I have a ns that builds on the functionality of another library, but I'd like all of the functions of the other library to be exposed to anyone using mine
14:47timvisherso far, i've been duplicating defns and requiring the other ns
14:47timvisherwhich, ahem, is terrible
14:49amalloytimvisher: that's a frowned-on activity
14:51timvisherwhich part?
14:52timvisheramalloy:
14:52amalloytimvisher: re-exposing other functions as if they were yours
14:52timvisherah
14:53timvisherso, being that it's frowned upon, i suppose clojure provides no way to do it?
14:53amalloythere are macros to do that in contrib, like defalias and immigrate (or maybe that's in a third-party lib?), but there's definitely nothing in core
14:53timvisheroh well, i'll have to figure a different model then. :)
14:54amalloytimvisher: it's probably simplest to just have your users (:use [highlevel :only [foo bar]]) (:require [lowlevel :as hack]) or something
14:55timvisherultimately, I was attempting to have a little sandbox for improving the library before contributing back, but that was before I understod lein a little better. I could be hacking on it and just publishing locally
14:55timvisherthat's probably the way I want to go
14:59RaynesDid somebody say… SANDBOX!?!?!
15:00Rayneshttp://github.com/flatland/clojail
15:00RaynesAw, not that kind of sandbox.
15:00timvisher:)
15:01timvisheryou're enthusiasm is duly noted, though.
15:48spoon16I know that I am doing it wrong… but I'm having a bit of a hard time identifying the right way to solve this
15:48spoon16,(map-indexed #(assoc %2 :index %1) (let [b { :p 19 } a { :p 8 :s b }] [a b]))
15:48clojurebot({:index 0, :p 8, :s {:p 19}} {:index 1, :p 19})
15:48spoon16I want :s on the the first item in the vector to have :index 1
15:49spoon16do I need to use refs/vars or some means of indirection when building the map?
15:49spoon16s/vector/list
15:52llasram`spoon16: What's the larger problem you're trying to solve?
15:54spoon16just messing around… I have a list of objects and any object may reference any other object… but I want to be able to identify the index of the item that I land on when I navigate one of those relationships
15:55spoon16I can use map-indexed to rebuild the list with each object having a :index property… but that doesn't update the random reference… that random reference still points at the version of the object with no :index annotation
15:56technomancyI would argue that defalias is actually quite useful in deprecation scenarios.
15:58spoon16here is a slightly compact version
15:58spoon16,(map-indexed #(assoc %2 :index %1) (let [b { } a {:s b}] [a b]))
15:58clojurebot({:index 0, :s {}} {:index 1})
16:01wwmorganI have some Thai strings that show up in my lein repl as ??? ?????. I've installed rlwrap but I still just get the question marks. How can I make the right characters appear?
16:01dnolenhttp://stackoverflow.com/questions/7812635/how-do-i-effectively-manage-a-clojure-code-base
16:03llasram`spoon16: how about:
16:03spoon16I want (= (-> (first t) :s :index) (-> (second t) :index)) to be true
16:03llasram`,(let [b { }, a {:s b}, items [a b], index-of (reduce (fn [m [x i]] (assoc m i x)) {} (map-indexed vector items))] [(index-of a) (index-of b)])
16:03clojurebot[0 1]
16:03technomancywwmorgan: probably a locale issue; could it be stuck on macroman?
16:03spoon16llasram`: let me play with it
16:04llasram`spoon16: Otherwise... Well, I don't that what you're trying to do is possible with immutable data structures
16:04spoon16llasram`: it is definately possible that I'm doing it completely wrong :)
16:04fliebeldnolen: hmm
16:05todunis there a simple way to test for numbers in clojure? thanks.
16:06dnolen,(number? 1)
16:06clojurebottrue
16:06dnolen,(number? 1.5)
16:06clojurebottrue
16:06todundnolen: simple. elegant. thanks :)
16:07wwmorgantechnomancy: actually I just tried a Thai string literal and it worked. I think the bug is somewhere in the file IO that I'm doing (slurp?). Thanks!
16:07todunis there a way to filter out the elements of a seq without removing the opening and closing braces?
16:07raekwwmorgan: which encoding is the file in?
16:07raekslurp uses UTF-8 by default
16:08llasram`todun: ex?
16:08todunllasram: (1 2 3) becomes ()
16:09dnolen,(empty '(1 2 3))
16:09clojurebot()
16:09dnolen,(empty '{1 2 3 4})
16:09clojurebot{}
16:09wwmorganraek: it is UTF-8. Hmm
16:09todundnolen: woah! clojure can do that? thanks. I googled for stuff like that and turned up empty.
16:09todundnolen: thanks again.
16:09bhenryhow can i convert some java like this to clojure https://gist.github.com/777d5bbe558a77fef033
16:09llasram`Right, that's what dnolen said (*rimshot*)
16:11fliebelbhenry: There is a JDBC i new contrib. Maybe that helps?
16:11raekwwmorgan: can you try to evaluate (seq "åäö") in your repl to test that it's set up correctly?
16:11bhenryfliebel: solid. i'll head that way.
16:11raekwwmorgan: it should evaluate to (\å \ä \ö)
16:11gtrak,(seq "åäö")
16:11clojurebot(\� \� \�)
16:11wwmorganraek: yep. I get the ?s
16:11fliebel&(seq "åäö")
16:11lazybot⇒ (\å \ä \ö)
16:12fliebellazybot wins
16:12raekwwmorgan: what letters did you see from me? latin letters with diacritics or questionmarks?
16:12wwmorganraek: from you I see the latin letters with diacritics
16:13raekyou should see the same thee letters in the result in the repl
16:13raek*three
16:13raekwwmorgan: did you see letters or questionmarks in the repl output?
16:15wwmorganraek: I got question marks. But if I do (apply str (seq "åäö")) then I get the right thing again
16:15raekwwmorgan: then your terminal is not configured right.
16:16raekwhat OS do you use?
16:16llasram`i stick to a subset of english which can be represented in five bits
16:16wwmorganraek: mac os x
16:18raekwwmorgan: ok, there is a problem with java in os x. it's incorrectly configured to use MacRoman as the default encoding (but the encoding really used is actually UTF-8)
16:19technomancyheh; macroman
16:19fliebelWow, my input is even more exotic: (\? \? \? \? \? \?)
16:19raeknow, there should be a way to set a certain java property to override that
16:19wwmorganraek: aha. So I want to tell leiningen to use a JVM opt to use UTF-8 instead
16:20fliebel-XXDoNotUseExoticEncoing
16:20raektechnomancy: what is the preferred way to set a java property globally in lein?
16:20technomancyraek: export JVM_OPTS if you want it to apply across all projects.
16:21wwmorganyep. Invoking java with -Dfile.encoding=UTF-8 seems to do it
16:21raeksomething like this? --> export JVM_OPTS=-Dfile.encoding=UTF-8
16:22raekwwmorgan: hopefully there should be a way to set that environment variable globally in os x
16:22technomancyraek: sure
16:22raekwwmorgan: did the thai text work too after this?
16:22wwmorganraek, technomancy: thanks! Everything looks good now
16:22technomancyunfortunately OS X makes it a pain to set environment variables that apply globallye.
16:23jriddyis there a more obvious way to coerce to a bool than #(if % true false) ?
16:23raekjriddy: 'boolean'
16:23jriddy,(boolean 1)
16:23taliostechnomancy: did michael neale from cloudbees get a hold of you?
16:23clojurebottrue
16:23jriddythx
16:26antares_technomancy: hi! what's the right place for leiningen questions?
16:26Raynesantares_: Here is fine.
16:27antares_I am getting the following exception with 1.6.1.1: https://gist.github.com/12ee8a548a46431674e9
16:27Rayneshttp://groups.google.com/group/leiningen There is also the mailing list.
16:27talioswb splitters
16:27RaynesIf nobody answers you here, go ahead and post to the mailing list.
16:27antares_if I remove lib/dev, things work fine until lein deps downloads dependencies again
16:28antares_I managed to build 1.6.2-SNAPSHOT and replace my ~/.lein/self-installs/* jar with it, now it works fine
16:28technomancytalios: I don't think so. was that over email or what?
16:29technomancyantares_: probably a bad dev-dependency ruining it for everyone
16:29taliostechnomancy: irc, I pointed him here - he's has a lein-cloudbees plugin he was wanting some assist with ( not sure what exactly off hand tho )
16:29antares_technomancy: I have clj-time 0.3.1 and clojure.data.json 0.1.1 in my dev dependencies, running on Clojure 1.3.0
16:29talioswill sling him your email when I speak to him next tho
16:30antares_technomancy: also, with lein 1.6.2-SNAPSHOT the issue disappears :/
16:30technomancyantares_: dev-dependencies must work with the same version of clojure that leiningen uses
16:30technomancyso libraries that require 1.3 are right out
16:30cemerickdata.json is clean, so I'd suspect clj-time
16:31taliosreally? do you have a lein13 release at all?
16:31technomancyantares_: it shouldn't work with 1.6.2-SNAPSHOT either; that's quite strange
16:31antares_technomancy: the stack trace suggest something is wrong in the leiningen.utils.paths$legacy_native_path which I cannot find on 1.6.x branch
16:31talios'lo cemerick
16:31technomancytalios: I can't make a breaking change like that in the 1.x version series
16:31cemericktalios: :-)
16:31taliostechnomancy: fair enough. "but if its good enough for Rich..." :)
16:32antares_technomancy: so dev dependencies cannot be used with 1.3.0, did I understand you correctly? will leiningen be 1.3.0-compatible any time soon? I see self-install still uses 1.2.1
16:32cemericktalios: BTW, feel free to keep bashing netbeans :-P
16:32technomancyantares_: it's a long way out; maybe six months
16:32talioscemerick: willdo :)
16:33antares_technomancy: so it (1.3.0-compatible version) is out already, correct?
16:33technomancyantares_: no, it won't be out for a long time
16:33antares_hm, ok
16:33antares_what are reasons for not being 1.3.0-compatible?
16:34technomancyantares_: it would break the majority of existing leiningen plugins
16:34technomancyrather than waiting it'd be much better to just add backwards-compatibility to the libraries you are considering that currently require 1.3.0
16:34antares_ok, I see
16:42tolstoyI have core.clj, and a util.clj, and I want to use util.clj as in util/foo. But (:use my-app.util :as util) isn't working. What am I missing?
16:43tolstoyOh, wait. Different part of my code is breaking.
16:43cemericktolstoy: In any case, it's: (:use [my-all.util :as util])
16:44hiredmanhttp://groups.google.com/group/clojure/browse_thread/thread/59f0ef691311fad5?hl=en is like some kind of dark sad comedy of errors
16:44hiredmanns is really rather terrible
16:46tolstoyNow I get a class not found error. Oy!
16:46hiredmantolstoy: you want require :as
16:48tolstoyHm. Still not working. Is there a good project I can look at with an example?
16:49hiredmanwhat error?
16:50bhenryi need help using a java method on an object with clojure. https://gist.github.com/1296675
16:50hiredmanit's a static method
16:50bhenryhiredman, does that mean it's unusable? or that there is a different way to use it?
16:50hiredman~google clojure java static methods
16:51clojurebotFirst, out of 7540 results is:
16:51clojurebotJava Interop - Clojure
16:51clojurebothttp://clojure.org/java_interop
16:52tolstoyAh! Parenthesis problem. Phew.
16:52dnolenbhenry: ns is not particularly newbie friendly, and use, require fns complicate the issue.
16:53spoon16,(Class/forName "mystringhere")
16:53clojurebot#<RuntimeException java.lang.RuntimeException: java.lang.ClassNotFoundException: mystringhere>
16:53spoon16bhenry: is that what you were looking for?
16:54bhenryspoon16: no it was (. Class forName "mystringhere")
16:54bhenryinstead of (.forName Class "mystringhere")
16:54jcromartiebhenry: did you check that page?
16:54hiredman,(macroexpand `(Class/forName "foo"))
16:54clojurebot(. java.lang.Class forName "foo")
16:54jcromartiehttp://clojure.org/java_interop says (Classname/staticMethod args*)
16:55bhenryi saw a different part of the page...
16:55jcromartie(excellent illustration, hiredman)
16:56spoon16jcromartie: do we need parens around english now? ;)
16:57jcromartie(assoc (:illustration hiredman) :excellent true)
16:59amalloyjcromartie: laaaame. you want an update-in
16:59amalloyor assoc-in is enough here, i guess
16:59bhenryit could be assoc if he made a map instead
17:00jcromartieamalloy: true :P
17:02jcromartieoff-topic: my friend insists that Java is complicated and obfucsated
17:02spoon16,(assoc { :illustration hiredman } :excellent true)
17:02clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: hiredman in this context, compiling:(NO_SOURCE_PATH:0)>
17:03spoon16what is he comparing it to?
17:03jcromartiecompared to C#
17:03jcromartieor Perl
17:03jcromartieand he's not trolling
17:03spoon16I agree (vs C#)
17:03amalloynor is he really wrong? i'm an old java dev, but c# is cleaner
17:04jcromartiespoon16: C# lets you write simpler code than Java, but C# is not a simpler language
17:04jcromartiewell, more concise code
17:05brehautdepends if xml counts as java code :P
17:05spoon16jcromartie: you are right, but one benefit of the MSFT ecosystem is that a significant portion of what you use while building a useful application is delivered by MSFT (with great documentation and consistency) that makes it super easy to open VS and build something. The languages are comparable but the effort to organize all the libs you need to build something useful with Java is significantly more complicated than if you were to use C#. IMO
17:06jcromartiespoon16: but at the same time, the JVM is a much simpler platform
17:06bhenryi can't get clojure to connect to an AdvantageDatabaseServer. if someone knows how to do this, please help me.
17:06jcromartiethe classpath is so simple compared to .NET's various GACs and whatnot
17:06spoon16I'm not a C# champion, I don't use it anymore for work… but I did use it for 5 years and I miss some things about how unified the experience was
17:06jcromartieyes :)
17:08jcromartieand compare Clojure language version management to something like RVM
17:08jcromartiehaving the whole language and your project's dependencies bundled up in a lib/ directory is great
17:08jcromartieand as far as I know, the JVM is the easiest place to do that
17:09amalloyi don't know what a GAC is but the classpath is a huge source of error for projects
17:09brehautGlobal Assembly Cache: its where jit'd assemblies of clr code live in .net
17:10jcromartieamalloy: the Global Assembly Cache... you have to muck around with registering libraries and things are hidden behind user-friendly fake folders, etc.
17:10amalloyjcromartie: you're talking about the jvm ecosystem here, not java. java projects don't get their whole language in a library
17:10jcromartieright
17:10jcromartieyes, I think I can say the JVM ecosystem is pretty simple
17:11jcromartieat least, the JVM is like a 5-speed manual transmission, and the CLR is like an electronically-controlled dual-clutch multiple-shaft DSG
17:12jcromartiesure, you can get it wrong in the JVM
17:12jcromartiebut not as spectacularly wrong as it can get in the CLR
17:12jcromartielike, pulling your hair out trying to solve some assembly version conflict in a machine's hidden global library cache :)
17:13jcromartieclasspath problems are solved by looking at your classpath and fixing it
17:13jcromartieeasy
17:14jrabbitis there a way to make slurp and text tools not barf on large files?
17:14jrabbitit loads it all into memory and then the jvm breaks with an OOM error
17:15hiredmandon't use slurp
17:15jrabbitwhats the better tool :)
17:17jcromartiejrabbit: it depends on what you are reading
17:18jcromartiebut basically you want to use a BufferedReader
17:18jcromartie(or am I way off here...?)
17:18jrabbiti think so
17:19jrabbitits ~50mb of irc logs they're just being read inefficently
17:19jcromartieactually, BufferedReader is what you want
17:19jrabbitclojure.java.io/reader seems good too
17:19jcromartiewhich returns a BufferedReader :)
17:20ibdknoxwhy are we talking about the GAC?
17:20jrabbitis there a reason to ah.
17:20jcromartie(line-seq (clojure.java.io/reader "your/irc.logs"))
17:20jrabbitheh
17:20jcromartieibdknox: arguing wether Java/JVM is simple compared to CLR
17:20jrabbitI guess I can try and rewrite my filter/map stuff
17:20amalloyjcromartie: not very good resource management there - you never close the reader
17:20ibdknoxhrm
17:21ibdknoxjcromartie, either can be equally complex I would say
17:21jcromartiehah, sorry amalloy... I thought line-seq closed the reader
17:21jcromartieer, sorry jrabbit
17:22jrabbithmm
17:23jrabbitamalloy: what does close it? :P
17:23jcromartie(.close rdr)
17:23amalloy&(doc with-open)
17:23lazybot⇒ "Macro ([bindings & body]); bindings => [name init ...] Evaluates body in a try expression with names bound to the values of the inits, and a finally clause that calls (.close name) on each name in reverse order."
17:23jcromartieoh that's handy :)
17:24jrabbitthats writen so opaquely >_>
17:25jrabbitI understand what it is because I've been looking at other functions but urgh if I was looking for it..
17:25jcromartieclojure docs mince no words
17:26ibdknoxClojure docs need some love.
17:26technomancythat one's not so bad
17:27technomancyit's the ns docs that are inscrutable
17:27ibdknoxugh
17:27jrabbit (:require clojure.contrib.io))..
17:27jrabbit#<CompilerException java.lang.Exception: Unable to resolve symbol: read-lines in this context (NO_SOURCE_FILE:15)>
17:27jrabbitLovely.
17:27ibdknoxjrabbit, use clojure.java.io
17:27jrabbitI was before... :\
17:27jrabbitconfusing
17:28jcromartieyou can use :only
17:28jcromartieor require :as
17:28jrabbithttp://richhickey.github.com/clojure-contrib/io-api.html#clojure.contrib.io/read-lines is there a useful similar function?
17:28lazybotNooooo, that's so out of date! Please see instead http://clojure.github.com/clojure-contrib/io-api.html#clojure.contrib.io/read-lines and try to stop linking to rich's repo.
17:28jcromartieoh wait, read-lines
17:28technomancyheh; that's ironic
17:28jrabbitoh the link isn't 1.3 :D
17:29technomancy"Please see this slightly less out-of-date link instead"
17:29ibdknoxamalloy, stop misleading people ^^
17:29jrabbitwhy isn't htere a clojure.java.io doc then?
17:29ibdknoxor Raynes, whichever one of you wrote that one
17:29jrabbitwell atleast I'm doing this now and not with something important
17:30amalloytechnomancy: yeah, alas. it just swaps rich's repo for the canonical one; it doesn't know anything about contrib
17:30Raynesibdknox: I had nothing to do with that.
17:30technomancyjrabbit: http://copperthoughts.com/p/clojure-io-p1/ is the best documentatino I've found on c.j.io
17:33jrabbitooh it worked
17:33jrabbitline-seq is exactly what I want lets see if it works
17:33jrabbitoh clojure you lazily defined that
17:34jrabbitwoo it works without crashing the jvm. lovely.
17:35jrabbittechnomancy: ibdknox thanks
17:35jrabbitjcromartie: you too
17:35spoon16I have a let variable that i would like to replace with a different reference
17:35spoon16,(let [im {}] (map-indexed #(let [i %1 p %2] (assoc im p i)) [:x :y :z]) im)
17:35clojurebot{}
17:35spoon16I know that is not how let works
17:35spoon16but what would be the right solution?
17:36spoon16how can I append the result of (assoc) to im
17:36amalloyreduce
17:42Raynestechnomancy: If you were going to write a library to interface with a bunch of url shorteners, what would you name it?
17:42jcromartieshortyplexer
17:42jcromartieoh wait
17:43jcromartiequestion was not for me :)
17:43amalloyRaynes: he'd name it after a literary midget
17:44ibdknoxlol
17:44Raynesamalloy: I figured as much.
17:44technoma-I was just thinking that "zeugma" would be a great project name
17:44technoma-but you might want to save it for something involving polymorphism
17:45ibdknoxfor anyone else who didn't know: http://en.wikipedia.org/wiki/Zeugma
17:45ibdknox:)
17:46RaynesI should name it ibdknox
17:46ibdknoxlol
17:46ibdknoxI am relatively short I guess
17:46brehautdoes the company of dwarves in the hobbit have a name?
17:47RaynesI'd hate to give the impression that I've already read The Hobbit.
17:47technomancywow, I didn't know there were that many kinds of zeugmas
17:47RaynesIt's bad enough that I named my weather library Ororo, implying that I even remotely care about xmen.
17:47technomancyI had always taken it to just mean a syllepsis
17:47ibdknoxhaha
17:47technomancy"time flies like an arrow; fruit flies like a banana"
17:47technomancyetc
17:48RaynesThat said, I do have experience with The Lord of the Rings, and thus 'hobbit' is a possible name.
17:48RaynesSince they're awfully short.
18:02tolstoyurl-shrtnr
18:03tolstoyurl.shrtnr
18:08amalloyhuh. i was surprised to find that (let [f (fn ...)] (def foo f)) doesn't behave quite the same as (def foo (fn ...))
18:11dnolenamalloy: what's different
18:11amalloydnolen: classname of generated function
18:12amalloyin the former case it's core$eval23421$fn_23422, and in the latter it's core$foo
18:12amalloyit looks like the compiler has special logic when it parses def, explicitly checking to see if the value is a function expression, and telling it to use a different name if so
18:13dnolenibdknox: giving a lightning talk tomorrow on ClojureScript, anything you think I should point out as being particularly cool?
18:14amalloyi guess i thought that defn got the function to have a nice name because it uses (fn foo ...), but it turns out that just changes the fn__ to foo__, not replace the whole name
18:16amalloyand apparently if you wrap the def in a let, you no longer get a pretty name
18:17amalloy(let [] (defn foo [])) ;; core$eval12548$foo__12549
18:17ibdknoxdnolen, the idea of transparent client/server interaction is pretty neat
18:17dnolenyup, will definitely mention that.
18:18ibdknoxdnolen, pinot remotes serve as an example if you need one
18:18ibdknoxdnolen, macros and repl are the only other "wow" things I can think of
18:18dnolenibdknox: I still need to give the pinot/noir pairing a try. Noone's done a blog post or video of that right?
18:19duck1123pinot works without noir, right?
18:19ibdknoxit does
18:19ibdknoxdnolen, nope, I haven't been focusing a ton on that yet
18:19dnolenibdknox: yeah, I think the rest of the wow stuff comes after much larger investment of time ...
18:20ibdknoxdnolen, either at the conj or shortly thereafter I should have some cool stuff for folks
18:20ibdknoxin terms of pinot
18:20brehautcljs has non-shitty collections right?
18:20ibdknoxbrehaut, yep
18:21brehautthats marquee bloody feature for the browser right there
18:21dnolenbrehaut: haha, true I mention that.
18:22brehautnot that im bitter about javascript completely crap collections
18:22amalloyhuh. slime has slime-macroexpand-all-inplace. why would you ever want that? "replace my macro-using source code the expanded version"?
18:23dnolenamalloy: that pretty useful when debugging macros, I often copy and paste crap around when doing serious debugging.
18:23amalloydnolen: slime-macroexpand-all is useful, but not inplace surely
18:24dnolenamalloy: I don't think you can run C-x C-e in the macroexpand buffer right? (maybe totally wrong here). but often you want to expand inside some other form w/ locals or something.
18:25amalloyi think i see what you mean. C-x C-e does work in the macroexpand buffer, but i can imagine there being something that doesn't
18:29duck1123with git, it's not that bad
18:45crazyFoxhi. i am proxying a JPanel and I would like to add it as a ComponentListener of itself. I am doing this in a doto form (http://pastebin.com/YWsgJPAK). I figured I should use the Java 'this' reference - which the compiler doesnt like. Suggestions?
18:47amalloy...really, pastebin? you want me to enter a captcha to *read* crazyFox's paste?
18:47crazyFox^^ didnt know - wait...
18:47ibdknoxsame here
18:48sritchiehey all -- I'm migrating over to 1.3, and am running into this error: java.lang.NoSuchMethodError: clojure.lang.Numbers.lt(II)Z
18:48amalloycrazyFox: `this` doesn't mean anything special in clojure
18:48sritchieit's on a line with a doseq
18:48crazyFoxre: captcha: try now
18:49amalloysritchie: Raynes had that issue the other day - maybe he figured out what was going on
18:49RaynesYes, I did. And then I forgot...
18:49sritchiehaha, oh no
18:49Raynessritchie: Could you show me your project.clj file?
18:49RaynesMight ring a bell or two.
18:49amalloycrazyFox: if you want to use the "implicit" value of a doto twice, you're mostly out of luck and need to do the let yourself
18:49ibdknoxsritchie, when was the last time you did lein clean?
18:50ibdknoxsritchie, or the cake equivalent
18:50sritchieI've been cleaning away each time I try this
18:50sritchielet me paste the function that's causing the error function
18:50sritchies/error function/error
18:50lazybot<sritchie> let me paste the function that's causing the error
18:51technomancy_for what it's worth, lein clean in most cases is the equivalent of taking out the cartridge and blowing on it in an NES.
18:51amalloycrazyFox: (let [p (proxy ...)] (doto p (.setPreferredSize ...) (.addComponentListener p)))
18:51ibdknoxtechnomancy_, that totally worked for me...
18:51crazyFoxamalloy: ah! i was just typing sth like that to you - thx ill try it
18:51sritchieRaynes: https://gist.github.com/1296982
18:51technomancy_ibdknox: it's all psychological
18:51sritchieone of the classes defined in line 33 tosses this error
18:52ibdknoxtechnomancy, I'll just stay over here, happy with my placebos :p
18:52technomancyplacebos are way underrated
18:52RaynesI can't believe that I can't remember what was causing that error...
18:52ibdknoxtechnomancy, actually there have been a few times when lein clean did exactly what I needed it to
18:52amalloysritchie: fwiw, (list* a b c) == (cons a (cons b c))
18:53technomancyibdknox: the only time I can think of is when you change dependencies
18:53technomancyibdknox: is there something else?
18:53sritchiednolen: yeah, I've been nuking the dirs in ~/.m2 as well
18:53dnolenClojure Voodoo Practices 2nd Ed
18:53ibdknoxtechnomancy, nope, it was always when I switched versions of things
18:53technomancyibdknox: thanks for reminding me though; I need to make deps run an implicit clean =)
18:54ibdknoxtechnomancy, :)
18:56sritchieRaynes: false alarm, I think lein clean fixed me up
18:56ibdknoxHAH
18:56sritchie:)
18:56ibdknoxtold you.
18:56technomancywhat
18:56sritchieit's the cure-all!
18:56sritchieI'm going to robert hooke lein clean onto everything
18:56ibdknoxI remember that error too, and it had something to do with a .class file hanging around that was compiled with some older version of a dep
18:57technomancyok, implementing it now
18:57sritchieibdknox: loving noir, by the way
18:57ibdknoxsritchie, sweet :)
18:57sritchieI'm working on a webapp now using noir and enlive
18:57ibdknoxand it's going well?
18:57cemericksritchie: fold a call to rm -rf ~/.m2/repository too — repeatable builds FTW :-P
18:58sritchieyup, very well, I had started working in rails some time ago, and jumped ship completely for noir
18:58sritchieI'll write up a post soon on some of the code I've been writing for forms, etc
18:59technomancyibdknox: is noir going to have authentication built-in, or is that best delegated to something like sandbar?
18:59technomancyit looks like you provide some of the building blocks for auth/login, but there's still a fair amount to stitch together
19:00technomancymaybe that's intentional due to no one-size-fits-all?
19:00ibdknoxtechnomancy, yeah, I don't think there is a truly general solution that works
19:00ibdknoxtechnomancy, one thing I hope to see moving forward are a set of small components built on noir for common things like that though
19:01ibdknoxtechnomancy, for example, most auth libs assume you're using a SQL database... for many projects I do now, I don't have one
19:01technomancyyeah, you need a pluggable storage mechanism of some type
19:01cemerickbuilding a Clojure wrapper around spring-security is item #86 on my TODO list
19:01ibdknoxtechnomancy, it's on my todo list
19:01technomancyI assume you're refering to sandbar?
19:01technomancycemerick: can you tame the beast?
19:02technomancyI've never used spring, but from what I've heard it sounds a bit scary.
19:02cemerickspring is scary
19:02ibdknoxvery, very scary
19:02cemerickspring-security is derived from a framework that was folded into spring proper long after it matured
19:02cemerickit's just a ton of authentication/authorization mechanisms + a servlet filter
19:03amalloyclojurebot: spring is scary. very, very scary
19:03clojurebotYou don't have to tell me twice.
19:05ibdknoxtechnomancy, I should point out, that writing authentication specific to you app should be really lightweight... If you find that's not true, you should let me know
19:05ibdknoxyour*
19:05ibdknoxtechnomancy, pre-routes should do most of the work for you
19:06ibdknoxtechnomancy, or do you mean the user storage aspects?
19:06sritchieauthentication with noir alone was fine;
19:06sritchieI ended up using sandbar for validations
19:07chewbranca/msg technomancy weird emacs got pegged at 100% cpu and locked up
19:07chewbranca on me until I smashed C-C on the keyboard lol
19:07ibdknoxsritchie, what was missing? Or did you just like the form generation stuff?
19:08technomancyibdknox: I haven't gotten to it yet... been putting it off =)
19:08technomancybut you're probably right
19:08sritchieibdknox: let me take a look at my code to see what I ended up doing, one sec
19:10ibdknoxI have a general aversion to things that generate HTML structure for me, since it's very rare that the generated HTML would hold up to the requirements of the design
19:11technomancywhat pisses me off is that browsers still don't offer a way to style HTTP basic auth
19:11ibdknoxhaha
19:11ibdknoxand probably never will
19:11sritchieibdknox: I don't know that the noir validators wouldn't do this for me, but I liked the way sandbar allows for composition of validators
19:11sritchiehttps://gist.github.com/1297027
19:11technomancyit's 2011 or whatever year it happens to be and we are still coding HTML forms to perform login; wtf.
19:12sritchieibdknox: I ended up with a defform macro that generates the form and a corresponding defpage, to accept the action; https://gist.github.com/1297033
19:13ibdknoxsritchie, cool :)
19:14sritchieit redirects back to the sending action on failure, using noir's method of registering errors
19:16ibdknoxtechnomancy, you could steal most of the work from the noir-blog example
19:17technomancyibdknox: thanks for the tip
19:18tolstoyIf you have a defrecord inside a namespace for use only inside that namespace, is there a way to make it private (like defn- type of thing)?
19:18ibdknoxtolstoy, why do you want to?
19:18tolstoyIt's only meant to be useful inside that namespace.
19:19pandeirohow are people including their clojurescript dependencies? just manually copying over? is it a bad idea to stick my libs into $CLOJURESCRIPT_HOME so I can always find them if I need to automate project creation?
19:19tolstoyIf nothing else, marking it "hidden" would indicate that to readers.
19:19ibdknoxyou can set :private true in the metadata
19:19ibdknoxI'm not actually sure what the implications of that are though
19:20ibdknoxpandeiro, I jar pinot
19:20ibdknoxpandeiro, and stick it on clojars
19:20tolstoyI'll give it a try and see what happens. Thanks! I couldn't remember what that particular metadata tag was (and can't find any associated docs).
19:21pandeiroibdknox: that would mean you use lein for cljs projects too? just for the dep mgmt?
19:21ibdknoxpandeiro, more or less. Though all of my projects also have a server for them :)
19:22ibdknoxpandeiro, what you suggested is fine too though. I actually drop macros into my CLOJURESCRIPT_HOME/lib folder all the time
19:22pandeiroibdknox: i see, cool... since i'm not using a clojure backend i think that works better for my flow
19:22technomancyibdknox, sritchie: https://github.com/technomancy/leiningen/commit/13fb2bd80f1ef64a01cb383263e470bdc12470ea
19:23ibdknoxwooohoo :)
19:23sritchienice!
19:23amalloytolstoy, ibdknox: marking a record as :private has no effect
19:23ibdknoxamalloy, well it seems he wants to do it more as a marker than anything
19:24ibdknoxamalloy, what does *it* work on though?
19:24amalloyibdknox: helpfully, you can read my comment either as "don't waste your time, it does nothing" or "it does nothing, so knock yourself out"
19:24amalloyibdknox: i don't understand the question? it works on vars
19:25ibdknoxerr rather, what does it do? Will it then except if I try to use it elsewhere?
19:25spoon16best way to get last item in a vector?
19:25amalloy&(doc peek)
19:25lazybot⇒ "([coll]); For a list or queue, same as first, for a vector, same as, but much more efficient than, last. If the collection is empty, returns nil."
19:25spoon16peek
19:25amalloyibdknox: on a var, or a record?
19:25ibdknoxon a var
19:26amalloyit doesn't get referred in use/refer clauses
19:26ibdknoxah
19:26amalloyand i think there's no entry into your symbol table for require, either, now that i think of it
19:26amalloyyou can still reach in and grab it by its varname
19:26tolstoyamalloy, ibdknox: I can't seem to get at the defrecord outside its namespace anyway, so…..
19:26amalloytolstoy: that's because you're trying to use/require instead of import
19:27tolstoyamalloy: Ah, okay. defrecord gens a class, so you have to use import?
19:27amalloyyeah
19:28tolstoyOkay. I think I'm just not going to worry about it. I mean, what am I doing, OO? ;)
19:29tolstoyI get the impression that defrecord (new to me since my last clojure dabble) is a bit excessive as a local data structure. A map would work just as well.
19:29ibdknoxtolstoy, correct
19:30ibdknoxIn my experience records are rarely the "right" solution
19:30tolstoyBetter used as (sort of) value objects transmitted from layer to layer in an app?
19:30tolstoyFor instance, a web request takes form data, stuffs it in a defrecord, hands it off to a persistence layer? That type of thing?
19:31ibdknoxmaps work wonderfully for that
19:32tolstoyWhat's the use case for defrecord, then? Java interop?
19:32amalloytolstoy: java interop, protocol implementations, and high-performance special-case-only maps
19:33amalloyand they're not that useful for java interop a lot of the time
19:34ibdknoxusing them with protocols is the interesting case
19:34todunis there a way/test to determine if a seq or collection has nested seqs or collection?
19:34ibdknox,(doc some)
19:34clojurebot"([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"
19:34ibdknox,(some coll? [1 2 3])
19:34clojurebotnil
19:35ibdknox,(some coll? [[] 1 2])
19:35clojurebottrue
19:35ibdknoxtodun, ^
19:35todun,^
19:35clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
19:36todunibdknox: how do I use that command?
19:37ibdknoxtodun, I was pointing up
19:37todun,(^ '(1 2 '(1 2)))
19:37clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Metadata must be Symbol,Keyword,String or Map>
19:37ibdknoxtodun, the answer was some
19:37todunibdknox: oh. oops. sorry. thanks.
19:48jodaroi seem to be falling into a trap of having a bunch of stuff in a let
19:48jodaroand then like hardly anything in the rest of the function
19:48ibdknoxchances are you should have multiple functions
19:49ibdknoxto clean out the let a bit, if it's getting really long
19:49jodaroyeah
19:49jodaroi'll split this up
19:54amalloyi don't think there's anything wrong with having most of your function body in a let-binding
19:57jodaroi'm new enough that i can't decide if its right or not
19:57jodarothere is no doubt that this function can/should be split up a bit, though
19:59dnolenI think the thing to watch out for is this, http://stackoverflow.com/questions/7812635/how-do-i-effectively-manage-a-clojure-code-base
19:59dnolenit's easy to get carried away and make lots of small fns - even if they're interdependent
20:00dnolenif you can't put something and get something sensible out w/o involving a lot of other stuff, it might be doing too little.
20:00dnolenI'm a fan of letfn.
20:02jodarothis particular function is part of a rest/web api client
20:03jodarofor simplicity
20:03jodarothe first round took all the args
20:03jodarodid some processing on them (with the help of a separate function for one thing, at least)
20:03jodaroprepped the request
20:03jodaroexecuted the request
20:03jodaroand parsed the response
20:03jodaroso its too much for one function for sure
20:04jodaroi think it would be reasonable to go with a prepare, an execute, and a parse
20:30tolstoyIf I want to "subclass" an exception (say) so I can store some state in it for when the exception gets thrown, can I use "reify"? Should I use proxy?
20:31tolstoygen-and-load-class?
20:35dnolentolstoy: Throwable has to be subclassed, you can't use reify (I think)
20:35tolstoyHow do you subclass?
20:36tolstoyLooks like Proxy is it.
20:40brehauttolstoy: http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/
20:40technomancywait wait
20:40technomancydon't subclass exceptions
20:40technomancyclojurebot: slingshot?
20:40clojurebotslingshot is the successor to clojure.contrib.condition: https://github.com/scgilardi/slingshot
20:41technomancy^ use that instead
20:48tolstoyAh, okay.
20:48tolstoyReally, I just need to store some stuff in a "thread" so that when the thread dies, I can reconstruct another one.
20:49tolstoy(All of which is much easier with actors and trap-exit.)
20:49ZolrathI've been refreshing infoq.com constantly over the past two days, I thought Rich's Strange Loop Talk and the Storm talk were supposed to go up yesterday
20:54tolstoyAh, I can use a closure: (let [state (whtever
20:55tolstoyAh, I can use a closure: (let [state (whtever)] (reify …….. use state.))
21:19trptcolinmy brain is melting: what could make @#'foo different from foo? (same thread; one line after the next; order doesn't matter)
21:20todunI'm looking for a list of clojure predicates. anyone know of any? thanks.
21:21amalloy&(and true false)
21:21lazybot⇒ false
21:21amalloy&(@#'and true false)
21:21lazybot⇒ true
21:21amalloytrptcolin: ^
21:21todunsorry. I meant sequence predicates..like some
21:22todunI tried any but it didn't work and thus wondered if there was a list somewhere of these things.
21:22todunjust read up the term thus my correcting my previous message late.
21:22trptcolinamalloy: bu-wha? why?
21:22amalloytrptcolin: it's my favorite parlor trick
21:23amalloy@#'foo throws away the metadata that says foo is a macro
21:23amalloy(because that's stored on the var, which you tossed)
21:23trptcolintodun: searching for ? here will give you some stuff: http://clojure.github.com/clojure/
21:23amalloyso instead the underlying function gets called, which takes two extra ignored args...
21:23toduntrptcolin: thanks. will check it out.
21:24amalloyit's easier to see if you extend it: ##(@#'and true false 'x 'y)
21:24lazybot⇒ (clojure.core/let [and__3468__auto__ x] (if and__3468__auto__ (clojure.core/and y) and__3468__auto__))
21:24trptcolinamalloy: craazy. ok, so metadata gets tossed when deref'ing a var. anything else come to mind?
21:25amalloyno, but another implication of the same fact
21:25amalloyyou "get around" the :private metadata on vars
21:25trptcolinin particular, i get an Unbound when trying to eval the symbol, and the thing that we're trying to bind when deref'ing
21:26trptcolinmore interestingly, it's a behavior difference in 1.3 from 1.2.1
21:27trptcolinhaving a hard time trimming it down to a small repro case, unfortunately
21:28amalloytrptcolin: not my area, alas
21:31trptcolinbummer :) thanks for thinking about it!
21:50todunI'm writing two separate routines that use recursion. The first removes all the elements from from a collection and returns the structure: so '(1 2 '(1 2)) returns '( '() ). The second performs nested reversals. So [1 2 [ 3 4] ] returns [ [ 4 3] 2 1]. I think I'm making a mistake using recur & loop. But I'm not sure what is wrong: http://pastebin.com/GKznMTHR . Any help is appreciated. thanks.
21:52brehauttodun dont def inside a defn
21:52brehauttodun: if you want local functions use let or letfn
21:52amalloyyeah, every time you do that a kitten dies
21:52todunbrehaut: is it un-idiomatic or just plain wrong to do so?
21:53todunbrehaut: ok. let me quickly read up on that..
21:53amalloytodun: it is wrong
21:53amalloyit makes your code no longer threadsafe or functional, and also way slower
21:53todunamalloy: sad. I shall endeavor to stop.
21:54todunamalloy: I see. multi-threading is my next interest so that will not be good.
21:54clojurebotAlles klar
21:54amalloyclojurebot: forget amalloy: I see. multi-threading |is| my next interest so that will not be good.
21:54clojurebotI forgot that amalloy: I see. multi-threading is my next interest so that will not be good.
21:55brehaut((fn structure [s] (mapcat (fn [x] (if (coll? x) (conj (empty x) (structure x)) ()))) s)) [1 2 '(3 4)])
21:55brehaut,((fn structure [s] (mapcat (fn [x] (if (coll? x) (conj (empty x) (structure x)) ()))) s)) [1 2 '(3 4)])
21:55clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox$eval27$structure>
21:55todun?
21:57amalloy,((fn structure [s] (mapcat (fn [x] (if (coll? x) (conj (empty x) (structure x)) ())) s)) [1 2 '(3 4)])
21:57clojurebot(())
21:57brehautamalloy: thanks
21:58brehauttodun: structure returns the structure without the content
21:58amalloy,((fn structure [s] (mapcat (fn [x] (if (coll? x) (conj (empty x) (structure x)) ())) s)) '[1 2 (3 4) (5 (6 7))])
21:58clojurebot(() (()))
21:58amalloybrehaut: possibly a more-instructive sample input ^
21:58brehautaha yes
21:59todunamalloy: brehaut that does look way smaller than I had.
21:59amalloyfwiw i'm not sure the (empty x) does you much good here, and might in fact be wrong on some inputs
21:59todunallot of new functions here. so was my approach hopeless?
21:59brehautamalloy: in hindsight i agree
21:59todunmy use of recur-loop?
22:00amalloytodun: i don't think it's hopeless, but it's needlessly complicated and not actually any more performant - loop/recur means you avoid using stack, but you use more heap instead
22:01amalloyand certainly hard to debug because of the complication
22:01brehaut,((fn nested-reverse [s] (map #(if (coll? %) (nested-reverse %) %) (reverse s))) [1 2 [3 4]])
22:01clojurebot((4 3) 2 1)
22:01brehautthats your other function right
22:01brehaut?
22:01todunamalloy: so if I changed everything to use letfn, will it work better?
22:01todunbrehaut: yes it is. thanks.
22:01amalloytodun: hell if i know. i can't read your code at all; see above :P
22:02brehautthis is an example of 'know your standard library' :)
22:02brehaut(everyone on 4clj is kicking my arse due to my poor stdlib knowledge)
22:02todunbrehaut: amalloy ha. ok. I will try to improve it. my loop/recur really is not good.
22:03amalloybrehaut: who needs the standard library when you have reduce
22:03amalloyand juxt
22:03brehautamalloy: who needs reduce when you have point free
22:04amalloymy client was so offended by point-free it kicked me out of the room to protect my innocent ears
22:04amalloyeyes? it's never clear which you're using to "listen" to someone talk on irc
22:06brehauti blame the haskell for all my bad clojure idioms
22:06archaici have never had to use load-file once when would you ever use it?
22:07brehautwhen you write clojure 3 years ago, or if you are splitting a NS across multiple files?
22:08amalloysounds about right
22:09brehautarchaic: eg http://stackoverflow.com/questions/4690758/splitting-a-clojure-namespace-over-multiple-files
22:28todunis there like an in-range? sort of predicate in clojure? thanks.
22:31brehaut,(let [x 10] [(< 0 x 10) (< 0 x 20) (< 10 x 20) (<= 0 x 10)])
22:31clojurebot[false true false true]
22:32todunthanks. that is interesting.
22:33brehauttodun: be sure to read the doc strigns for < and friends; they probably dont mean what you think they mean
22:33todunbrehaut: yes. I can see that now. so different. thanks.
22:33archaicdon't even think of them as gte/lte, rather ascending/descending .. makes it somewhat easier
22:34brehautarchaic: exactly right
22:34brehaut,(< 10)
22:34clojurebottrue
22:34todunarchaic: ok. uhm..
22:35todun,(10 <)
22:35clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
22:35todun,(> 10)
22:35clojurebottrue
22:35brehautfrom memory < is strictly increasing, <= is monotonically increasing
22:36todunbut why does it work when it compares just a single element?
22:36brehautbecause one item is a sequence where every value is strictly greater than the previous
22:37brehautinductively its the n case, rather than the n+1
22:37brehautif you think about it as less than, then its going to be confusing.
22:38todunI'll have to somehow wrap my head about this one. pretty strange I say.
22:38brehautalso useful to know is that = and not= are not binary ops
22:39brehauttodun: start by discarding the name you knew < by and start calling it 'increasing series'
22:40brehautput it another way, if you had (def increasing? (partial apply <)) in your program, and you called (increasing? [10]) ; => true, it wouldnt be surprising
22:40todunbrehaut: uhm...ok. that certainly helps.
22:41brehauttodun: sorry, (defn increasing? [s] (apply < s)) for the non-point free definition
22:41todunnon-profit free?
22:41todunoh yes, so the name can work out.
22:42brehautim sorry, im a recovering haskell dabbler
22:43todunhaha. if I can understand clojure, that might be my next stop.
22:44todunI know this is not the jedit room, but I was wondering if any users of jedit with clojure run into the situation whereby int turns into the integral sign.
22:46amalloyhah. emacs users more often have the problem that (fn ...) turns into a curly f
22:47brehautmakes for great copy and paste fun
22:51todun:)
23:16ThreeCupsIs it possible to take an argument list and automagically turn it into a map? something like (defn [id name] ...) and inside the function have access to a map equivalent to {:id id :name name}?
23:17amalloyThreeCups: i have a util that is close to that
23:17ThreeCupsamalloy: cool. Is it a macro?
23:18amalloyhttps://github.com/flatland/useful/blob/develop/src/useful/map.clj#L8
23:18ThreeCupshaving a look now. Thanks!
23:20amalloyso you'd have to write (let [the-map (keyed [id name])] ...), but you can wrap another macro around that, to do that as part of defn
23:21ThreeCupsGreat. I'm just learning Clojure/Lisp, so it's good just to look at other people's code and learn
23:22amalloyThreeCups: you might enjoy looking at useful, then. it contains a lot of stuff that ninjudd and i have found common enough to shove into a library
23:25ThreeCupsOkay, I'll have a look. Is it on github?
23:26ThreeCupsOh... it's what I'm looking at :)
23:28archaicis there an easier way to have a shared util library between my projects than hosting it on git/clojars? do I need to learn maven for that?
23:30amalloyarchaic: hosting on clojars is super-easy
23:31amalloythat's not *technically* an answer to your question, i guess
23:33archaicmight go with that then, seems like overkill tho :)
23:35ThreeCupsIs there no way to do this locally? E.g. include a local jar in a build with leiningen?
23:36taliosif its in your local maven repo then you should be able to just declare it as a dependency. i assume lein installs to the maven repo since it uses it underneath? ( i'd hope so )
23:36amalloylein can install to your local repo, but technomancy frowns on builds that only work on one machine
23:37taliostrue. with good reason actually.
23:37amalloyand if you've put in the effort to get something maven-deployable, it's only like ten extra seconds to put it on github instead
23:37amalloyer, clojars
23:37taliosI was just thinking -NOT- installing to local woul be a good idea.
23:38taliosgithub bad imho - git repos are NOT for binaries. that seems like the wrong solution to me
23:40amalloytalios: see my correction
23:40taliosaha :)
23:40tomojis the github maven trick really putting jars in a git repo?
23:40amalloytomoj: is there a github maven trick?
23:41taliostomoj: if its the one I'm thinking of then yeh, abuses the github wiki space i -think-
23:41taliosi could be wrong tho
23:41tomojhttp://cemerick.com/2010/08/24/hosting-maven-repos-on-github/
23:41alandipertcemerick's approach is a repo
23:42tomojyeah
23:42alandiperti think i've seen it done with pages as well
23:42tomojI never read past the title I think
23:42taliospages is just a git repo as well isn't it?
23:43tomojhmm
23:43tomojgit will provide a zip that would work as a jar, wouldn't it?
23:43tomojoh, can't control the paths though..
23:43brehauttalios: its a branch of a repo with a magic name isnt it?
23:43taliosthat sounds right
23:46brehauttalios: your in auckland right?
23:46taliosbrehaut: yep. where abouts are you?
23:46brehauts/bad grammer/correct grammer/
23:47brehauttalios: the tron
23:47taliosyour name is familar, and for some reason I think we've met - maybe. or not.
23:47brehauti dont think we've met
23:47brehautpossible the twitter
23:47taliostrue. I blur between the JUG, twitter, irc, the podcast etc. these days
23:48brehautare their many clojure people in auckland?
23:48talios3 in this office :) a few others. there was/is a lisp group here but its kinda idle, arbscht runs it
23:49brehautnice :)
23:49taliosaltho I confess to not having touched clojure in a LONG time. not even the maven plugin :( time time - where are thou?
23:50brehauti dont get to do as much clj as id like either
23:51spoon16does clj support #! /usr/bin/clj …. for command line execution of clojure scripts?
23:52amalloyspoon16: technically, yes: #! is a comment, so you can do that
23:52amalloybut (a) a system-wide clj is not very popular, and (b) as i understand it there's a limit on the size of shebang lines which means you can't get all your classpath info in for anything non-trivial
23:52amalloyalso (c) the jvm starts up really slowly :P
23:54brehautyou might be better off with a shell script that wraps #! … lein run
23:54spoon16I've got a bunch of little algorithms that I have implemented in different languages
23:54brehautor cljs + nodejs
23:54spoon16and I like being able to just run them with an input argument from bash
23:54spoon16but maybe that is not the best way to go with my clojure implementations
23:54archaici was wondering about the jvm startup issue with scripting.. can't you do what cake does with a second jvm in the background to get around it?
23:54amalloy$google clojure jark
23:54lazybot[jark -] http://icylisper.in/jark/scripting.html
23:57spoon16that seems like a big hammer for what I want
23:57spoon16easy enough to just run the repl