#clojure logs

2009-03-14

00:38Mecis there a not equal?
00:40RaynesMec: not=
00:41Meclol how did i miss that, thanks
00:43danlarkinor (not (=
00:43danlarkinor (compliment =
00:43cp2just use not=
00:43cp2:)
00:43danlarkinagreed :)
00:44Mecits so obvious i never considered it, im used to != or <> or ~= or ^=
00:45cp2yeah Mec
00:45cp2i didnt notice it at first etiehr
00:45cp2infact i think i did a few (not (=
00:45cp2not that thats wrong, just looks...idunno
00:47Mecnot= is like one logical idea and there's a parenthesis cutting our idea in half in (not (= .. it hurts the mind
00:53slashcomAnyone use JNA with clojure at all? I'm having trouble with it
00:55cp2well, i havent used it
00:55cp2but maybe i can help
00:55slashcomokay well I started with this mailing list posting: http://groups.google.com/group/clojure/browse_thread/thread/77e626c5440bf1a0
00:55slashcombut gen-and-load-interface isn't around anymore, as far as I can tell
00:56cp2iirc it was removed
00:56slashcomhttp://gist.github.com/78949 so I have this test file
00:57cp2ok
00:58slashcomhttp://gist.github.com/78950 and here's my repl
01:00slashcomI ran my compiled JnaTest through jad too: http://gist.github.com/78951
01:00slashcombut using _28_quote_20_getpid_29_ as my method doesn't help either
01:01cp2hm
01:02slashcomi haven't tried doing it in java yet. maybe i should do that
01:02cp2to be honest i dont really know much about proxies in clojure, you might want to see if someone more experienced is around
01:02cp2like Chouser, or hiredman
01:02cp2:)
01:02cp2danlarkin was just here too
01:02danlarkinpong
01:02slashcomhi dan :)
01:02slashcommind looking at the problem above?
01:03danlarkindepends on where on your body it is
01:03danlarkinI'm above the waist only
01:03danlarkinoh jeez
01:03danlarkinit's late
01:03danlarkinthat doesn't even make sense does it
01:03slashcom:)
01:04danlarkinI'm sorry... it's been a long day
01:04slashcomyeah, well, it's pi day now, right?
01:04danlarkinhey! true
01:05danlarkinHm, I haven't don any JNA
01:06slashcomis there a way to ask clojure what methods an object has?
01:06slashcomkind of like python's dir()?
01:06danlarkinthere's a nice function called show in clojure-contrib
01:07slashcom[ 9] (quote getpid) : Integer ()
01:07slashcom[10] (quote getppid) : Integer ()
01:07slashcom[11] (quote sleep) : Void (Integer)
01:07danlarkinoh
01:07danlarkinwell there ya go
01:07danlarkinremove the quotes from your interface definition
01:08Mecis there a way to keep track of only the last 10 digits of a number while performing calculations on it? greater than 10 is fine but not less
01:09slashcomcp2: danlarkin: yay it worked! thanks guys
01:09cp2i didnt help much, but ok :)
01:11slashcommy goal is to use OSX's fsevents or linux's inotify to notice when .clj files change and automagically reload them
01:14danlarkinslashcom: I have code doing that, but not as nicely as you plan
01:14danlarkinmine has a thread that loops with a 1 second sleep checking mtimes
01:16slashcomyeah, I saw a lot of that on the interwebz. Unfortunately I've never done anything with fsevents or jna
02:10cadshey, has anyone here heard of this clojure meeting in atlanta? : http://leafhopper.github.com/clojure.html
02:12PuzzlerHi. Anyone here using the IntelliJ plugin?
02:24Lau_of_DKGood morning gents
02:25durka42good night Lau
02:26Lau_of_DKNight night
02:26durka42~ Lau wandered into #clojure, and suddenly saw a release to play with
02:26clojurebotclojure is cheating
02:26durka42~ Lau was wandering around, and suddenly saw a release to play with
02:26clojurebotCLABANGO!
02:27Lau_of_DK:)
02:27durka42it's on github somewhere
04:59javuchihello
04:59javuchii need some support with swan-clojure
04:59javuchianyone here?
05:18maacljavuchi: yeah
05:20maacljavuchi: what's the prob
05:41javuchianyone can help with this:
05:41javuchihttp://groups.google.com/group/clojure/browse_thread/thread/34a93067a525e176#
05:43maacljavuchi: looks like a swank / clojure mismatch - you could use clojure-modes clojure-install
05:44javuchimaacl: i don't understand what you say
05:44maacljavuchi: download clojure-mode from git
05:45maaclgithub
05:45maacljavuchi: are you familiar with git ?
05:46javuchimaacl: i followed the guide
06:20AWizzArdclojurebot: max people
06:20clojurebotmax people is 162
09:36leafwis there any built-in way to export a map as xml ?
09:37leafwi.e. outputting <map> <entry key="%" value="%" /> </map> or similar
09:37leafwit's trivial to write a fn to do it, but I wonder if it's there already
09:47Lau_of_DKleafw, I think zip-filter can get you there quite quickly
09:47mecolinhi
09:47Lau_of_DKhi :)
09:48Lau_of_DKleafw, I remember using emit to do something like that a while ago
09:52mecolinI can't figure out how to alter a root binding of var: (def x 1) (def y) (alter-root-var (var y) (constantly x)) gives "var user/y is unbound.
09:56cgrandmecolin: alter-root-var works only on vars that are already, you can symply do (def y x) to set/overwrite the current root binding
09:56leafwthanks Lau_of_DK , will check
09:57Lau_of_DKHey cgrand
09:57cgrandHey Lau_of_DK!
10:00mecolincgrand: what if y is in different namespace ?
10:01cgrandmecolin: java interop (.setRoot or something like that)
10:02cgrand(.bindRoot #'my/var new-value)
10:02cgrandLau_of_DK: did you look at Madison?
10:03Lau_of_DKYea, Im helping dan a little, getting it ready for Github/alpha
10:03cgrandhmmm... then what is already up is pre alpha?
10:04cgrandI was looking for cookie and session mngment. Is there such a thing?
10:04Lau_of_DKHe uped it last night?
10:04Lau_of_DKupped
10:04cgrandhttp://github.com/danlarkin/madison/tree/master
10:04Lau_of_DKOh so it is
10:05Lau_of_DKI havent come across session/cookie handling. So far Ive gone through the tests, basic setup, and the automated project creation tool
10:06cgrandok, in my ring's fork there's some cookie handling stuff
10:06Lau_of_DKWhich all works great
10:06Lau_of_DKCool
10:07cgrandand I'd like to provide HttpCore as another backen to ring (not servlet-based and smaller than Jetty)
10:09eevarcgrand, what's wrong with servlets?
10:12cgrandeevar: they do too much
10:16Lau_of_DKLike what?
10:16Lau_of_DKAnd cgrand, how does your HttpCore work ?
10:17eevarthe ruby world has spent ages coming up with a unified request+response interface (rack), Java already has that, and I doubt fragmentation would help anyone
10:18Lau_of_DKeevar, you'll have to learn sooner or later: If cgrand says its a good idea, it is a good idea
10:20cgrandLau_of_DK: it's not mine it's Apache's http://hc.apache.org/httpcomponents-core/
10:20Lau_of_DKah ok
10:20Lau_of_DKBut whats gained specifically from switching away from servlets? cgrand
10:21leafwwhat is the proper way to add documentation to a defmulti?
10:21Chouser(alter-var-root #'clojure.core/*print-length* (constantly 99))
10:22kotarakleafw: (defmulti foo "docstring" ....)
10:22leafwthanks kotarak
10:23leafwby the way, kotarak: you've got mail
10:23kotarakI've got mail? Just a sec.
10:23leafw(IIRC you wrote vimclojure)
10:24mattrepljust came across this statement on (ab)use of overloaded keywords in Java: "You can tell a language is mature when each keyword has multiple uses."
10:30kotarakleafw: you are albert?
10:30leafwkotarak: yes
10:30kotarakleafw: yes. I'm Meikel.
10:31leafwyour nick matches one of the class namespace levels. Could guess that much :)
10:31kotarakleafw: kotarak means tomcat in bulgarian, kotka is cat. :)
10:32leafwI gabariu pa ruski nemnoga, pa ne pa bulgarski :(
10:33AWizzArdJa nje ponamaju po russki
10:34leafwAWizzArd: said in perfect russian, ole
10:34AWizzArdna logen ;)
10:35AWizzArd,(for [a (range 5) :let [x (* a a)]] x)
10:35clojurebot(0 1 4 9 16)
10:35AWizzArdDoes this work for you in svn r1327?
10:36Lau_of_DK,(for [a (range (Math/pow 2 12))] (map println (range 0 a)))
10:36clojurebotExecution Timed Out
10:36Lau_of_DK:(
10:37Lau_of_DK,(doseq [spam (range 100)] (Thread/sleep 50) (println spam))
10:37clojurebot0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
10:39kotarakleafw: jena mi e belgarka. kak e kotka na ruski? Come si dice "cat" in russo?
10:40cgrandLau_of_DK: ring is an abstraction (similar to Rack) of the http protocol as is HttpCore, everything that Servlets provide can be modularly added
10:40leafwkotarak: katioshka
10:40Lau_of_DKI get that - I was just poking at which particular features of servlets you're looking to remove
10:42cgrandLau_of_DK: auth + some encoding issues + web.xml hell
10:44kotarakleafw: to answer the easy question: The repl checks for the Clojure=> prompt. When you delete it by accident (as you described in the email) the repl can get confused. This is only text.... the limits of Vim.
10:45kotarakleafw: There needs to be more error checking. At the moment I'm actually happy, that it works at all.
10:47kotarakleafw: The Heisenbugs you describe are a bit puzzling. Can you try to get hold of them and find a way to repreduce them?
10:47leafwkotarak: yeah, I am happy too. I wish I knew more vim internals (I'm just a power user) to be able to help there
10:47leafwkotarak: I have been trying to reproduce them. I need to test smaller sets of files -- I'm editing a large project right now
10:48leafwwill do today.
10:50kotarakleafw: haha. Lucky you! The vim internals are a horror cabinet of inconsistencies and hacks. ;)
10:51mattreplcgrand: what's the plan for handling multipart/form-data in ring? there's the FileUpload lib from Apache to decode it, but it needs the servlet request object
10:51mattrepls/handling/exposing
10:53cgrandmattrepl: haven't thought about this yet
10:54mattreplit may be ugly, but adding the original servlet req object to ring's req map might be the pragmatic choice to leverage existing libs that expect the servlet interface
10:54mattreplthat way multipart/form-data support becomes middleware
10:55kotarakleafw: May I ask a stupid question? How do you switch between buffers? Simply switching shouldn't cause VimClojure to do anything.
10:56leafwcontrol+w j to go to the buffer below-- split windows
10:57kotarakleafw: you may also check the bleeding-edge branch in the repo. There I added a better error reporting. (Not in a buffer, yet, but with more information what went wrong). Maybe it can help you to track down the problem. http://bitbucket.org/kotarak/vimclojure
10:57leafwthanks!
10:58cgrandmattrepl: I think that FileUpload provides some classes (eg MultipartStream) that will help without requesting the Servlet interface
10:58cgrandbbl
10:59leafwkotarak: another error: when pushing return after (defn [] ..), the cursor doesn't return all the way to under the ( of (defn, but rather two spaces to its right.
10:59kotarakleafw: works for me
11:01leafwkotarak: would be nice if you could deliver a minimal .vimrc that does all. I have lots of vars and functions defined in there that may interfere.
11:04kotarakleafw: you mean as a complete example of all settings necessary?
11:05leafwthat would be a minimal one -- but I am sure you have other settings enabled, which do not interfere. Like incremental search and what not.
11:05kotaraksure
11:05leafwI'd like to see what do I have to trim down, or at least, from where should I start.
11:06kotarakOk. I can send you my .vimrc, if you want.
11:07leafwthat' be nice :)
11:12kotarakleafw: email is away :)
11:12leafwthanks :)
11:16lisppaste8leafw pasted "untitled" at http://paste.lisp.org/display/77018
11:17leafwdo the (.width r) and (.height r) get multiplied as Number or as primitive int?
11:19Lau_of_DKI would be surprised if it wasnt primitive
11:19leafwLau_of_DK: point is, don't know how to check
11:19leafwbecause * is a fn, so it takes Object args
11:20leafwI don't know what magic has been added there to circumvent that.
11:20Lau_of_DKBut if you (class x) , both number and primitive would return Integer wouldnt they ?
11:20leafwI think so
11:20leafw,(class (int 0))
11:20clojurebotjava.lang.Integer
11:21kotarak(doc unchecked-mult)
11:21clojurebotI don't understand.
11:21kotarakHmm...
11:21kotarakI think there were this unchecked math things.
11:21leafw(doc unchecked-*)
11:21clojurebotTitim gan �ir� ort.
11:21Lau_of_DK(defn *
11:21Lau_of_DK "Returns the product of nums. (*) returns 1."
11:21Lau_of_DK {:inline (fn [x y] `(. clojure.lang.Numbers (multiply ~x ~y)))
11:21Lau_of_DK :inline-arities #{2}}
11:21Lau_of_DK ([] 1)
11:21Lau_of_DK ([x] (cast Number x))
11:21Lau_of_DK ([x y] (. clojure.lang.Numbers (multiply x y)))
11:21Lau_of_DK ([x y & more]
11:21Lau_of_DK (reduce * (* x y) more)))
11:22leafw,(doc unchecked-multiply)
11:22clojurebot"([x y]); Returns the product of x and y, both int or long. Note - uses a primitive operator subject to overflow."
11:23leafwbut I recall rhickey saying that math operators do boundary checks with primitives unless they overflow, in which occasion they'd use BigInteger and such
11:24kotarakleafw: I think this :inline magic above makes primitives possible when (.width) etc. return such.
11:32leafwhow can one define a function that takes a named argument, i.e. like :else in cond, or does it have to be a macro?
11:32leafwI think it has to be a macro ... but I may be wrong
11:32leafwand can one define a macro with different arities?
11:34kotarakleafw: sure. (defmacro foo ([x] ...) ([x y] ...)) Macros are in the end only functions.
11:35leafwok
11:35kotarakleafw: for the named parameter: (defn foo [x y & named-args] (let [{keys [name1 name2] :or {name1 :abc name2 :fgh}} (apply hash-map named-args)] ....))
11:36kotarakleafw: then (foo some-x some-y :name2 :xyz)
11:37leafwaha you deconstruct the named-args
11:37kotarakleafw: yes, inclusive default values, of course only if you want those.
11:37leafwI noticed the default values, that :or
11:38leafwvery nice
11:38Chouser:else is just a keyword, so there's no problem passing that to a function.
11:39leafwits just so simple I thought it had to be more complicated.
11:40kotarakleafw: this is Rich's version http://paste.lisp.org/display/69347 (haven't tried it myself, though)
11:44leafwI can barely read it. Half the functions I've never used them yet.
11:44leafwmapcat, complement, array-map, split-with.
11:46kotarakI think you use it like this: (defnk foo [x y :name1 abc :name2 fgh] ...) and don't need the boilerplate I showed above.
11:47leafwnice
11:48kotarakmaybe this should go to clojure.contrib.def *hints at Chouser* :)
11:50leafw\me seconds that
12:15tashafa,(doc dup)
12:15clojurebotjava.lang.Exception: Unable to resolve var: dup in this context
12:15tashafa,(doc duplicate)
12:15clojurebotjava.lang.Exception: Unable to resolve var: duplicate in this context
12:16tashafa,(repeat 2 "r")
12:16clojurebot("r" "r")
12:16tashafaha
12:17tashafa,(repeat "r")
12:17clojurebotExecution Timed Out
12:17tashafa,(repeat "r")
12:17tashafahmm
12:17clojurebotExecution Timed Out
12:18tashafais that the epected behaviour?
12:18tashafaexpected*
12:18eevaryou asked for an infite sequence of 'r's
12:19eevar,(doc repeat)
12:19clojurebot"([x] [n x]); Returns a lazy (infinite!, or length n if supplied) sequence of xs."
12:30Hunseems clojurebot is eager
12:31tashafaah
12:31tashafathanks
12:34eevar,(set! *print-length* 10)
12:34clojurebotjava.lang.IllegalStateException: Can't change/establish root binding of: *print-length* with set
12:49Chouser,(,(alter-var-root #'clojure.core/*print-length* (constantly 20))
12:49clojurebotEOF while reading
12:49Chouser,(alter-var-root #'clojure.core/*print-length* (constantly 20))
12:49clojurebot20
12:49Chouser,(repeat "r")
12:49clojurebotExecution Timed Out
12:50Chouserhmph
12:50Chouser,(do (alter-var-root #'clojure.core/*print-length* (constantly 20)) (repeat "r"))
12:50clojurebotExecution Timed Out
13:04slashus2,(binding [*print-length* 5] (repeat 6 "r"))
13:04clojurebot("r" "r" "r" "r" "r" "r")
13:06slashus2,(binding [*print-length* 5] (println (repeat 6 "r")))
13:06clojurebot(r r r r r ...)
13:06ChouserI was hoping to find a way to make it stick.
13:06Chouserbut I guess clojurebot runs each expression in a new thread, so fresh thread-local bindings.
13:07slashus2,(alter-var-root #'clojure.core/*print-length* 5)
13:07clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
13:11slashus2,(alter-var-root *print-length* constantly 20)
13:11clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.Var
13:28leafwkotarak: when the compiler throws an exception, *e in the Repl doesn
13:28leafw't print it
13:28leafwwhere is that exception? Can one see a bit more into it?
13:28leafwit tells me the right clojure line, but makes no sense
13:28leafwoh nm
13:28leafwxD
13:29leafwuser problem as usual
13:30leafwalso: can macros be :use 'd in a ns declaration? i.e. (ns this.that (:use (t2.util some-macro-name)))
13:30leafwfor some reason, that fails.
13:33leafw(doc ns) says that's the right way to use :use in a ns declaration.
13:33clojurebotHuh?
13:33leafwno for you, clojurebot
13:33leafwxD
13:37durka42leafw: i think you use :only to get specific fns/macros by name
13:37leafwclojure-contrib contains half a dozen ways to use :use
13:38leafwhum
13:38leafwlike this: (:use [clojure.contrib.test-is :only (deftest- is)]))
13:38leafwwhich is not documented in (doc ns)
13:39durka42well, yes but i think in (doc ns) my.lib.this and my.lib.that are namespaces
13:40durka42it is kind of documented in (doc use)
13:41leafwthanks, even a bit better in (doc refer)
13:42kotarakyeah, namespace docs are bit difficult (was away till now)
13:42PuzzlerIt's also confusing how sometimes you need to quote the name of the library, and sometimes you don't.
13:43Puzzler(e.g., (use 'permutations) but (in-ns permutations)
13:43kotarakPuzzler: (ns ....) no quote, (use ..), (require ...) quotes
13:43kotarakin-ns should also need a quote, no?
13:43PuzzlerI don't think so, but then again, I'm the one who keeps getting confused :) ...
13:43durka42in-ns does but ns doesn't
13:44PuzzlerMaybe I'm thinking of the :use inside of an in-ns?
13:44PuzzlerI'm pretty sure that doesn't need a quote.
13:44durka42you're thinking of ns when you say in-ns
13:45PuzzlerYeah, you're right.
13:45PuzzlerSo why all the differences?
13:46durka42hmm
13:46durka42seems like everything is quoted except inside ns, because it's a macro
13:47leafwnamespaces need a cleanup--it's overly confusing.
13:48PuzzlerSpeaking of cleanup, is there any difference between the find function and the get function (except that get takes an extra optional argument)?
13:48PuzzlerCouldn't we ditch find?
13:48leafwon a different topic: would be nice if if-let would allow multiple bindings, and 'and' all of them as for the test.
13:48PuzzlerI think the contrib library has a cond-let which is a similar idea.
13:49PuzzlerBut yes, I like that idea. I frequently end up with a bunch of nested if-lets, and it gets ugly fast.
13:50leafwPuzzler: yes.
13:50PuzzlerYesterday, I wrote my longest bit of Clojure code so far.
13:51PuzzlerOpinion: It's easy to write, a bit tricky to debug with the crazy error messages, and somewhat hard to read when you're done with the whole thing.
13:51leafwI find it easy to read
13:51leafwbut I create very short functions that call other named functions.
13:52leafwi.e. reads like prose, or I'd like to.
13:52leafwdebugging is tricky, but environments like vimclojure make it easier
13:53kotarakPuzzler: that will change after wrote more clojure. Especially the readability thing.
13:53PuzzlerI create relatively short functions also; it's more a function of how much you can fit on one line. When writing, it's natural to use long chains of map/filter/whatever, but when reading back, it's totally unclear what it does.
13:53Chousukedon't put so much on one line then :)
13:53PuzzlerYes, but once you wrap around more than one line, it's even less clear.
13:53Puzzler:)
13:54PuzzlerAlso, I have similar problems with drilling down into maps via keys and such.
13:54PuzzlerEasy to write (because maps work like functions), but hard to read back, because it looks just like everything else.
13:54PuzzlerThere's something to be said for good old dot syntax to deal with deeply nested structures.
13:55Chousukethen perhaps your map is misnamed :/
13:55Chousukeyou might also want to take a look at the -> macro
13:55kotaraktogether with update-in, get-in, assoc-in...
13:57leafwso -> looks for a key in a map and into any submaps nested in there, recursively?
13:57Chousukeno
13:57Chousukeits more generic.
13:57PuzzlerBy the way, I've probably written as much Scheme code as C/C++/Java/Python code in my life, and I've always felt this way. My feeling about Clojure being easier to write than read is no different than my feeling about Scheme, which I've used for many years.
13:57kotarakIt uses that keywords are functions of maps.
13:58leafwthe (doc ->) is a piece of art, and would benefit from an example.
13:58PuzzlerPython is my favorite language *to read*. But for much of my work, I can really get much more done with immutable data structures.
13:58Chousuke(-> foo (bar barend) zonk) expands into (-> (bar foo barend) zonk) and that becomes (zonk (bar foo barend))
13:58PuzzlerSo I use Scheme/Clojure/etc.
13:59kotarak(-> thing a b (c d) (e)) <=> (e (c (b (a thing)) d))
13:59Chousukeso (-> map :key :key2) eventually becomes (:key2 (:key map))
14:00kotarak,(-> {:a {:b {: c 5}}} :a :b :c)
14:00clojurebotInvalid token: :
14:00kotarak,(-> {:a {:b {:c 5}}} :a :b :c)
14:00clojurebot5
14:02durka42maybe i'll write one
14:02Chousukeheh
14:02kotarakdurka42: I think konrad hinsen did that, you should check the list archive
14:03Lau_of_DKdurka durka
14:04Lau_of_DKkotarak, RE your commercial Im like "whoa!" - Vim can actually calculate line numbers now? Man thats progress :)
14:05kotarakLau_of_DK: SLIME obviously is not able to do it. :P
14:05p_lkotarak: cause Lisp doesn't have lines...
14:05kotarakp_l: so then why do people complain? ;)
14:06p_lkotarak: I guess they don't grasp there's no lines...
14:06durka42what's the difference between coll? and seq??
14:06durka42http://groups.google.com/group/clojure/msg/28837d55525306d8
14:06kotarakcoll? tests for collections (IPersistentCollection), seq? for seqs (ISeq), I guess.
14:07kotarakOk. So it was not Konrad, then...
14:08durka42Clojure=> (macroexpand-r '(-> thing a b (c d) (e)))
14:08durka42(e (c (b (a thing)) d))
14:14Drakesondo you know of any `shell' ns written for clojure?
14:15leafwDrakeson: what do you mean?
14:15kotarakDrakeson: there is clojure.contrib.shell-out or something like that
14:15Drakesonin the spirit of eshell in emacs
14:16Drakesonor even more lispy
14:16kotarakI don't know eshell, maybe something like scsh?
14:19leafwkotarak: does vimclojure have a binding for \rf all .clj buffers?
14:20kotarakleafw: yes. The bindings are set for all buffers. For buffers w/o a ns or in-ns at the top it doesn't make much sense, though.
14:20leafwwould be also nice if \rf of a file also \rf any .clj cited on the :use of its namespace.
14:20Drakesonkotarak: shell-out is also interesting, for slightly different purposes. eshell provides a bash-like shell with a many commands written in elisp. you can also define eshell/foo-command in lisp, and run foo-command in the shell.
14:20leafwkotarak: I mean load all buffers, in one shot.
14:21kotarakleafw: ah, no. That's not implemented, yet.
14:22leafwkotarak: I wouldn't mind bufdo \rf if it could be done in the right order of dependencies.
14:22p_ljust make a clojure machine....
14:22kotarakDrakeson: sounds like scsh for scheme. Although that is not intended for interactive use. I don't think, that something like that is available for Clojure, yet.
14:23kotarakleafw: well, \rf figures this out itself. I can change the :reload to :reload-all.
14:23DrakesonI am still thinking of doing scripting in clojure. Instead of #!/path/to/clj-wrapper, I want to experiment with a clojure.lang.Repl, or something like clojure.contrib.shell-repl (to be created) as the main shell.
14:23leafwkotarak: or just one more binding for reload-all.
14:23kotarakleafw: currently \rf means: (require :reload :verbose '<contents of b:vimclojure_namespace>)
14:23kotarakleafw: or that. \rF
14:24leafwthe problem with reload all is: does order matter?
14:24kotarakleafw: no. That's what require is for. But some things might be reloaded several times.
14:24kotarakwhen you do bufdo ....
14:25leafwkotarak: that's ok, would be great. So \rF is not yet there, is it
14:25kotarakhahahahahrahrarhaharhar }:-)
14:25kotarakleafw: not, but is to add. Will be up on the repo this evening.
14:26leafwthanks !
14:26kotarakis easy to add
14:26leafw:)
14:26leafwfinally, proper incremental programming .. for java! MWAHAHA
14:26kotarak\o/
14:27kotarakleafw: wait till you get the snippet completion I'm working on. ;) Who needs IDEs?
14:27leafwI hate eclipse and netbeans, if that's what you meant.
14:27leafwI considered eclim for a while, but one needs to know eclipse too well.
14:27kotarakI'm also not a particular fan of them.
14:28leafwthey lack an editor ;)
14:28kotarakAnd it was kind of unstable for me....
14:28kotarakeclim I mean
14:28Drakesoncan you do debugging in vimclojure or slime+clojure, yet?
14:28leafwalthough there is a jvi plugin for them.
14:28leafwDrakeson: vimclojure gives you back the line number with the error
14:28kotarakDrakeson: not in vimclojure and probably not any time soon
14:28leafwit's something :)
14:29kotarakYes, such basic things. :) But no integrated debugger.
14:29Drakesonnot just the location of the error. I want to step over a function and see what happens ...
14:29leafwand is always right, so far.
14:29kotarakEven when re-evaling code VC tries hard to get the line numbers right. Also they might diverge slowly for code below the change.
14:30kotarakAnd it seems that it does a better job than SLIME in that respect. :)
14:38Drakesonhow can I see a list of public symbols of a namespace?
14:38kotarak(keys (ns-interns (the-ns 'some.ns)))
14:39hiredmanDrakeson: clojure.org/namespaces has a list of useful namespace related functions
14:39kotarak,(keys (ns-interns (the-ns 'clojure.set)))
14:39clojurebot(rename-keys union select project join intersection bubble-max-key map-invert difference rename index)
14:40Drakesongreat, thanks
14:42leafwgood night everybody
14:44kotarakleafw: still here?
14:44kotarakleafw: \rf is actually \rF :)
14:45kotarakBut will change it now.
14:47dnolenanyone tried connecting to a remote Clojure REPL with SLIME using clojure.contrib.server-socket?
14:58Drakesondnolen: I am run swank on the remote machine, make an ssh tunnel (ssh -L ...) to it, and use slime-connect to connect. not so perfect but works.
14:58Drakesons/am//
15:00Jedi_Stanniskotarak: C-up and C-down are not working for me in the vimclojure repl
15:05dnolenDrakeson: cool! so how does the swank bit the remote machine work? and what's lacking?
15:06dnolenthe swank bit _on_ the remote machine work i mean.
15:07dnolenDrakeson: do you just load up swank.clj?
15:11mecolinis there any way to call a private function from a different namespace (for debug purposes) ?
15:12Chouser as cgrand says, yell at it until it obeys
15:12Chouser(@#'other.namespace/foo 1 2 3)
15:14mecolinChouser: thanks
15:15Lau_of_DK@#' ?
15:15Lau_of_DKYou guys are getting worse and worse at these secret Rich Hickey disciple black belts tricks
15:16Lau_of_DK"Gen-class doesnt work" "oh, you just have to (gen-class #@$$.---!!your.class.foo (:use (@foobiedoopie_@))) where foobiedoopie is hardcoded into core"
15:18Drakesondnolen: swank.clj is a bunch of defn's. I put (:require [swank.swank]) in the remote ns, and do (swank.swank/start-server ".slime-socket" :port 4005 :encoding "utf-8") in the remote code.
15:18danlarkinLau did you see, madison has been published!
15:18Lau_of_DKI saw my friend - Good work :)
15:19danlarkinnow the real work begins
15:19Lau_of_DKup until now its been fake work ?
15:21danlarkinhaha
15:21danlarkinwell now people can see it
15:24Lau_of_DKEverybody got that? danlarkin is making a full port of Django to Clojure - Its on Github named 'Madison' - Please have a look and submit quality code snippits asap plz
15:25danlarkin:-o
15:27dnolenDrakeson: hmm, I'm getting a "error in process filter: No inferior lisp process" when testing out connecting to the remote repl on the server itself.
15:27dnolenDrakeson: that's the error from slime-connect 127.0.0.1 port 9998 in my case.
15:28Drakesondnolen: did you do ssh -L 9988:localhost:9988 user@remotehost ?
15:32dnolenDrakeson: just trying test from the server itself, do I need to setup a tunnel? I'm starting up a REPL on the server, starting up swank, then I launch emacs and trying to connect with slime-connect. Is there something wrong with that setup. Thanks much for the help on this.
15:32dnolenlaunch emacs from the server (not my local machine)
15:32Drakesondnolen: no, you don't need the tunnel
15:33dnolenany thoughts about the No inferior lisp process error then?
15:33Drakesondid you put that line in the code on the server?
15:33dnolenslime-connect? yes
15:34DrakesonI mean: (swank.swank/start-server ".slime-socket" :port 4005 :encoding "utf-8")
15:34dnolenyes I did that on the server when I launched the REPL from the command line
15:37DrakesonI just did a vanilla test: on the command line: clj RET, (require 'swank.swank)(swank.swank/start-server "/dev/null" :port 4006 :encoding "utf-8") RET. Now I can M-x slime-connect to this port.
15:38Drakeson(in other words, works for me)
15:38Drakesondo you have recent versions of slime and swank-clojure?
15:38dnolenthanks for verifying checking.
15:39Lau_of_DKclojurebot, seen technomancy?
15:39Drakeson(for instance, I had a fairly old slime (about 1-2 months old, I guess), and I was getting a similar error as what you got)
15:41dnolenare you using the slime mirror from github or somewhere else?
15:45Drakesonslime: git://git.boinkor.net/slime.git, swank-clojure: git://github.com/jochu/swank-clojure.git
15:48Lau_of_DKhiredman, didnt you implement that 'seen' functionality ?
15:48Lau_of_DK~seen technomancy?
15:48clojurebotno, I have not seen technomancy
15:48Lau_of_DK~why not?
15:48clojurebotwhy not?
15:49Lau_of_DK~yes, why havent you seen him? He's been here quite a few times... when suddenly...
15:49clojurebotno, I have not seen him? He's been here quite a few times... when suddenly...
15:49cmvkk_heh
15:51Drakesoncan you make clojurebot say something that then he himself says CLABANGO? :D
15:51hiredmanclojurebot doesn't persist its seen information
15:52Drakeson~yes ~ ... when suddenly ...
15:52clojurebotCLABANGO!
16:00Raynes~yes, the sky turned dark. The ground opened up and the demons came... When suddenly...
16:00clojurebotCLABANGO!
16:06Drakeson(println "~ ...when suddenly ...")
16:06Drakeson,(println "~ ...when suddenly ...")
16:06clojurebot~ ...when suddenly ...
16:06Drakeson,(println "~ ... when suddenly ...")
16:07clojurebot~ ... when suddenly ...
16:07Drakeson,(println "~ I was bot abusing... when suddenly ...")
16:07clojurebot~ I was bot abusing... when suddenly ...
16:07Drakeson~ I was bot abusing... when suddenly ...
16:07clojurebotCLABANGO!
16:07Drakesond'oh!
16:09Chouserlisppaste8: url
16:09lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
16:09Chouserah, that's not addressed to clojurebot, so no looping ability there.
16:10Chouser~paste
16:10clojurebotlisppaste8, url
16:10lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
16:11Drakesonhow can I remove a namespace from the repl?
16:12arohnerDrakeson: the whole namespace, or an individual var?
16:12Chousernamespace functions are at: http://clojure.org/namespaces
16:12hiredman^-
16:12Chouserthere's a section named "Removing things"
16:13Drakesonsilly me
16:13Drakesonthanks
16:13arohner,(doc remove-ns)
16:13clojurebot"([sym]); Removes the namespace named by the symbol. Use with caution. Cannot be used to remove the clojure namespace."
16:13Chouserskillsmatter must have a different definition of "soon" than I do.
16:14hiredmanstill not up?
16:14Chousernope
16:26arohnercan I do a ref-set followed by an alter in the same transaction?
16:26arohneron the same ref
16:28arohnerit appears that after the ref-set, @my-obj is nil
16:34Lau_of_DKCan somebody explain this fnparse for me? What is it?
16:40kotarakLau_of_DK: is a parser library. I understand (roughly) like this: (fnparse EBNF) => parser-for-the-grammar)
16:42arohnerisn't there a var that limits how much of a struct a repl will print?
16:43arohnerI accidentally printed a big struct, and it's been going for a few minutes now...
16:43kotarak*print-length*, IIRC
16:44arohnerthanks. is that doc'd anywhere? I couldn't find it
16:46hiredman,(doc *print-length*)
16:46clojurebot"; *print-length* controls how many items of each collection the printer will print. If it is bound to logical false, there is no limit. Otherwise, it must be bound to an integer indicating the maximum number of items of each collection to print. If a collection contains more items, the printer will print items up to the limit followed by '...' to represent the remaining items. The root binding is nil indicating no limit.
16:47gnuvince_I downloaded jsr166y.jar and started my REPL with -cp /path/to/jsr166y.jar, but I still can't require clojure.parallel
16:47gnuvince_Any ideas?
16:47durka42i think the classes have been moved into the jsr166-extra.jar or something like that
16:48gnuvince_ok
16:48lisppaste8durka42 pasted "clojure.parallel" at http://paste.lisp.org/display/77047
16:48durka42when i was playing with clojure.parallel i had to do that in parallel.clj
16:48durka42i don't know if that is still relevant
16:50arohnerhiredman: when asking if that was doc'd, I meant on clojure.org. I expected to find it in "main and repl"
16:51Lau_of_DKkotarak, its greek to me
16:54kotarakLau_of_DK: EBNF => Enhanced(?) Backus-Naur-Form, I didn't look into fnparse, though. So don't ask me about its details.
16:55Lau_of_DKOk I wont :)
16:56hiredmanI started playing with fnparse and tried to translate a wiki-markup ebnf
16:56hiredmanbut I think I lacked a grasp on some of the key concepts
16:58hiredmanso I eagerly wait someone writing a fnparse for dummies blog post
16:58Lau_of_DKk - I should look up a pdf on google-tech-docs on functional parsing
16:58hiredmanlast I tried the pdf it 404'ed
17:02danlarkinLau_of_DK: fnparse is really cool :-o
17:03dnolenDrakeson: thx for the help earlier, turns out it was working the whole time, but I need to call slime-repl directly from emacs.
17:07danlarkinthe idea behind a functional parser (aka parser combinator) is that you get a lexer and a parser in one step
17:07hiredmanall well and good
17:07hiredmanbut how do you use it?
17:08danlarkinhttp://github.com/danlarkin/madison/blob/59dd04cd3723e9fbcb83ca40724e18312106bc9d/src/madison/template/parser.clj
17:08hiredmannot helping
17:09danlarkinit's bottom up style
17:10hiredmanstill not helping
17:10danlarkinso you write a little function that matches "<" for instance
17:10danlarkinand then one that matches ">"
17:10danlarkinand then one that matches stuff that's valid to have inside a < and >
17:10danlarkinand then you're on your way to an xml parser
17:10hiredmanthen combine them
17:10danlarkin..kinda
17:10hiredmanhmmm
17:15danlarkinand the nice thing about the parser combinator is that it combines the lexing and parsing, so you can have semantics assigned to "<element>" and in one pass turn it into whatever, instead of first tokenizing it and then parsing the tokens
17:16hiredmanmmm
17:17kotarakand you can make parser on the fly. you parse a <element> and then create on the fly a parser for </element>. Matching the exact element.
17:19hiredmanI guess I'll just have to get back on the horse and try again
17:20leafwkotarak: the problem I was seeing earlier on, related to the heisenbug, is gone once all namespace declarations of all involved files are properly set.
17:20leafwkotarak: looks like vimclojure is very sensitive to proper ns declaration (which as we said earlier lacks documented examples of all its possibilities)
17:20kotarakleafw: :) good to hear.
17:21kotarakleafw: yeah the namespace are difficult to grasp in the beginning..
17:22hiredman~namespace
17:22clojurebotnamespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it
17:22kotarakWell. I have to rely on correct code. The mind_reader.vim plugin doesn't work in my MacVim, yet. ;)
17:22leafwxD
17:23leafwhiredman: (doc ns) leads to (doc use) which leads to (doc refer). The whole thing could take a nice dedicated page with its variety of possibilities.
17:23hiredmanI supose clojure.org/namespace might be the place too put it
17:24leafwlike combining several (:use [this.that :only (one two)] [other.there :only (three)]), combined with full :use of libs, and :import ...
17:25kotarak(:use (common.prefix [this :only (that)] [an :exclude (other)]))
17:26leafwwoah
17:26leafwdidn't know that one.
17:26kotarakThat's basically all features in one form
17:26kotarakrequire has :as but the syntax is the same
18:58Lau_of_DKHail Sohail
19:01sohailyes, hail me
19:15arohnerI'm really starting to get addicted to using if statements as expressions
20:20Guest66367there are no "statements"
20:23danlei,(find-doc
20:23clojurebotEOF while reading
20:23danlei,(find-doc #"[Ss]tatement")
20:24clojurebot------------------------- clojure.core/ns ([name & references]) Macro Sets *ns* to the namespace named by name (unevaluated), creating it if needed. references can be zero or more of: (:refer-clojure ...) (:require ...) (:use ...) (:import ...) (:load ...) (:gen-class) with the syntax of refer-clojure/require/use/import/load/gen-class respectively, except the arguments are unevaluated and need not be quoted.
20:39hiredmandanlei: (?i) turns the regex into a case insensitive regex
20:40hiredmanclojubreot may need its own version of find-doc
21:49keithbIf I have a long Clojure file, is it a good or bad idea to create a main() function and then call it, a la http://is.gd/ndTV (see bottom)?
22:08Chouserkeithb: I don't think it matters much yet.
22:08Chouserhaving a main function would help if you plan to compile to a stand-alone .jar
22:10ChouserBut I'm sure you'll get more complete answers from your posting to the group. :-)
22:57AWizzArdIs there something like (join ..) instead of the common pattern (apply str ..)?
23:11Chouserin contrib.str-utils
23:15AWizzArdalready found it, thanks :)
23:15hiredmanI think having a main function is a good idea
23:16hiredmanyou don't even have to call it at the end of the file, jsut clojure.main -i somefile.clj -e "(main)"
23:29replaca_hiredman: what does the -i do there?
23:33hiredmanreplaca_: it evals that file
23:33hiredmanincludes it
23:33hiredmanI think it is -i
23:33replaca_hiredman: ahh, ok, thx
23:59hiredmanhah!