#clojure logs

2010-09-30

00:00lambdalionWell, more and more I have been thinking about scheme as a sort of assembly language...
00:00lambdalionso I suppose you could ask "if you are going to translate to assembler why not just write assembler?"
00:03lambdalionAnd the answer would be "I find it more congenial to write in X, and it can be translated to Y without much loss."
00:06sproust`lambdalion: Scheme isn't as basic as you present it IMHO. Look at Racket, lots of nice libraries. Zero startup time either. Just my opinion though.
00:06lambdalionHmm- I think you might have misunderstood me a bit...
00:08lambdalionI was just saying that the core of scheme is a set of primitives that work well as a language to translate to...
00:09lambdalionbut people might still prefer to program in something not scheme...
00:11lambdalionanyway, I've been using drscheme to teach people things since long before someone decided that changing the name to racket would help. I like scheme tolerably well.
00:26amalloythey renamed drscheme to racket? i remember i dropped my AI class in college because all the parens in scheme scared me
00:26amalloyfunny how times change
00:27KirinDaveFeels so good to be doing clojure full time.
00:29hiredmanmmmm
01:04dmeadhi channel. can anyone point me to some tools that let you inspect clojure code?
01:04dmeadi want to look at clojure ASTs
01:04KirinDaveWhat do you mean?
01:04KirinDave(this (is an (AST)))
01:04KirinDave(for real, yo. It's sort of the point of sexprs) :)
01:04dmead;)
01:05dmeadstill, clojure has to have some sort of introspection tools?
01:05dmeadbesides macros?
01:05KirinDaveNot sure what you're trying to do.
01:08amalloyi think he might be looking for something like "i wonder what clojure does when i (let) something with destructuring?"
01:09amalloyeven if you expand all the macros there's a bit of magic going on at the java level that you can't see in clojure code, as far as i know
01:10andyfingerhutdmead: Do you want to see the Java byte codes produced? Or something before that point in time?
01:15dmeadi want to see the syntactic structure used right before bytecode generation
01:15dmeadandyfingerhut, ping, etc
01:15andyfingerhutYou can use (macroexpand '(defn [...] ...)) to see how macros are expanded, if there are any in a piece of code.
01:16dmeadeh. not really
01:16dmeadi really want to see how the compiler represents s-expressions
01:16dmeadhow it's stored, etc
01:16andyfingerhutIt represents them with Cons cells for lists and vector for things in []
01:16andyfingerhutI believe.
01:17dmeadlike in haskell, the language is defined in types that reflect the language spec
01:17dmeadah
01:17andyfingerhutThen some compiler code written in Java walks those data structures and emits Java byte code.
01:18lambdahelpya_You should just read the java bits of clojure then... but they are pretty arbitrary. They would be different on a different platform.
01:18KirinDaveHopefully in the next year we'll see the compiler get written almost fully in clojure.
01:18lambdahelpya_If clojure in clojure eventuates...
01:19andyfingerhutBut even when the compiler is written in Clojure, the source code, before and after macro expansion, will be represented as lists and vectors (and hashes, too, I suppose).
01:20hiredman,(type ())
01:20clojurebotclojure.lang.PersistentList$EmptyList
01:20hiredman,(type '(+ 1 2))
01:20clojurebotclojure.lang.PersistentList
01:22andyfingerhutThere are clojure.lang.Cons objects used to represent PersistentList's, which you can see a count of with a tool like jmap that inspects all objects in a JVM's memory
01:31yayitsweiis there a non-threaded version of clojure.contrib.http.agent?
02:33LauJensenGood morning all
03:01zmilare
03:20tobiasraederhi :)
03:30tobiasraederif there any way if i have an object representing the class (for an interface for example) to get the myinterface.class to pass it to a java function?
03:31raek,(class 1) ; like this?
03:31clojurebotjava.lang.Integer
03:31raek,(class (class 1))
03:31clojurebotjava.lang.Class
03:32tobiasraederif i call it on the symbol storing the interface i get java.lang.Class
03:32tobiasraederwhat i really need is the equivalent of myinterface.class
03:32raekcan you just use the class name?
03:32tobiasraederbut i dont know how for example:
03:33tobiasraeder,(definterface testinterface (^Void doStuff[]))
03:33clojurebotjava.lang.RuntimeException: java.lang.IllegalStateException: Var null/null is unbound.
03:33raekthen testinterface should return the class object, I think
03:33tobiasraederah alright
03:33tobiasraederill try that
03:34ashleywHi, I'm a newbie to clojure/lisp; could somebody help me with why this isn't working: (let [a (atom 1)] (swap! a 2)) — from what I can understand from the docs, swap! changes the value of the first atom arg to the second arg, but it doesn't seem to work that way?
03:34LauJensenashleyw: (swap! a inc) or (reset! a 2)
03:34LauJensenswap takes a fn, reset a value
03:36raekif two concurrent threads try to update the atom at the same time, one of them might have to try again, since the value that was passed to the function no longer is the current one
03:36amalloyashleyw: LauJensen's suggestions are great and are often right; i just want to mention you could also use (constantly):
03:36amalloy,(let [a (atom 1)] (swap! a (constantly 2)))
03:36clojurebot2
03:36ashleywLauJensen: Oh I see, thanks!
03:37raek...if one of them is done first
03:38raekthread A reads | thread B reads | both calculate next value | thread A writes | thread B wri... oops! already changed. thread B reads | thread B calculates next value | thread B writes
03:39raekreset! is, as the name suggests, mostly used when resetting someting to a known state, no matter what it was before
03:40LauJensenamalloy: Thats not idiomatic in my oppinion, if you have a value, use reset
03:40raekthe point is: don't read a value with @ and then reset! the atom to some new value based on it, because then all the atomic goodies will be gone
03:41ashleywSo what's the most conventional way, reset! or constantly?
03:41amalloyreset!, but really neither :P
03:41LauJensenashleyw: Lets say your atom is a counter, all you care about is getting the order right, then use swap! a inc
03:42amalloyashleyw: ie, if you absolutely must set it to some value x regardless of what is happening elsewhere in the program, you should use reset!...but in practice that rarely happens; you want to compute a new value based on the old one, which is what swap! does
03:48ashleywOkay thanks. Clojure/lisp is very weird, but I haven't had this much fun learning a new language in a loong time :)
03:49raek:-)
03:49LauJensenashleyw: If you're just starting out, you could check out project euler. The first 50 or so can really help show you the ropes of Clojure
03:52ashleywoh I forgot about project euler....I'll have a go now, thanks :)
04:23tobiasraederDoes anyone have a decent knowledge about clojure using swank, class loaders used in an imported jar and java.lang.relfect.Proxy?
04:23clojurebotadd-classpath is Fraught with Peril!
05:57joubertHi, what is the purpose/effect of {:rebind true} metadata on a defn?/
06:03joubertnm
06:04jjidoClojure has no letrec right?
06:05AWizzArdjjido: correct
06:08jjidoAWizzArd: thanks. I used let + assoc
06:09AWizzArdjjido: yes, this is good. If you happen to need a letrec you can just macro up your own.
06:21LauJensenAWizzArd: I've sent Das Keyboard back to Germany - I simply couldn't get used to it
06:30AWizzArdLauJensen: Ah okay. At least you tried it.
06:31LauJensenYea. And it made me appreciate my Edge a lot more than I did before, so not a bad experience
06:54jjidodo records have a "magical parent record" which accessors are applied to if they don't yield a result? eg. (:foo x) returns (:foo (:magical-field x))
06:54AWizzArdMost likely not, but I am not sure that I understand what you need.
06:58jjidoAWizzArd: my solution at the moment is to (merge) two records but I think that gets me a plain hash map, not a new record. If I had the magical parent record I could use that instead. It is to implement some kind of implementation inheritance.
06:59hoeckjjido: if the first arg to merge is a record, then it returns a record too
06:59jjidohoeck: really that is perfect then
06:59jjido:)
07:02esjLauJensen: I was tickled to discover you use a funny keyboard. In the manner of your extremist views on best tools, I learnt the Dvorak keyboard about 5 years back, and have been using it since.
07:03LauJensenesj: Still happy?
07:09esjoh yeah
07:12tobiasraederis there a way to add variables to proxied interface implementations?
08:22tobiasraederIs it possible to change the values of a type in the implemented protocol functions for deftype?
08:25raektobiasraeder: what do you mean by "value of a type"?
08:28jjido,System/out
08:28clojurebot#<PrintStream java.io.PrintStream@168b59a>
08:28tobiasraeder@raek if i deftype mytype that implements an interface which got getName and setName [name] and in the implementations i would like to the set :name "value" of the defined type
08:28tobiasraederwhich is a pretty oo approach i guess
08:30jjido,(do (defrecord foo [bar wombat]) (print-map (new foo 1 5)))
08:30clojurebotDENIED
08:30raekiirc, deftype defines immutable types
08:31jjidoRaek: not sure, the doc suggests you can write your mutators
08:31raekI think the docs mentions a way to call the construcor
08:32raekto create a new instance
08:32tobiasraedermhm
08:32raekhrm, defrecord is always immutable, at least
08:33tobiasraederi need this for some kinda weird interop stuff
08:33tobiasraederis there a way to define variables with proxy which can be set afterwards? (an atom, or something of that type, needs to be mutable i think)
08:34hoecktobiasraeder: (deftype Foo [^:unsynchronized-mutable a]) will create a type with a single private mutable field
08:34raeki recall reading something about mutable fields
08:34jjidocan you get the list of fields back from defrecord or from a record?
08:34raekyou can always use an atom
08:34hoecktobiasraeder: using an interface like you suggested lets you alter the field
08:35tobiasraeder@hoeck alright, that sounds like a good way for me to do that i guess
08:35hoeckor use a plain record and an atom/ref inside
08:35tobiasraederthe atom/ref is scoped inside the record then, right?
08:35hoecktobiasraeder: usually this is only useful if you are going to implement some low-level datastructure
08:36jjido(keys myrecord) doesn't work
08:36hoecktobiasraeder: yes, and accessible via (:key the-record) or the get/valAt methods
08:36tobiasraederi need an object that implements an interface of getters and setters and stores the state interally
08:36tobiasraeder@hoeck that sounds really like what i am looking for :)
08:37tobiasraederinternally*
08:37hoeckjust make shure you construct you record with the appropriate fields set to an atom
08:37hoeck(MyRecord. (atom 0))
08:38hoeckare you implementing the iface or do you want to provide sth to a java consumer??
08:38tobiasraederimplementing the interface so the java part can use the interface functions to set/get state
08:40hoeckso if you don't care that the record carries the state in a public field, use a record
08:41tobiasraederyeah i dont mind
08:41hoeckthats the easiest and threadsafe way to do it
08:42tobiasraederthat is the [^:unsynchronized-mutable a] version, right?
08:42hoeckusing :volatile-mutable or :unsynchronized-mutable requires more thinking about threading issues
08:42hoeckno, I meant the easiest being the defrecord + atom way
08:44tobiasraeder@hoeck so if i create the record with (MyRecord (atom 0) (atom 0) (atom 0)) howwould i set one of those values inside the implementation of the interface?
08:45jjido,(map (seq {:a 1 :b 3}) key)
08:45clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$key
08:46hoecktobiasraeder: http://gist.github.com/604507
08:46tobiasraeder@hoeck thank you very much.
08:46raektobiasraeder: with 'reset!' (also, not all irc clients highlight when there is a @ before the nick)
08:47jjido,(doseq (seq {:a 1 :b 3}) key)
08:47clojurebotjava.lang.IllegalArgumentException: doseq requires a vector for its binding
08:47sexpbot@Raynes
08:47RaynesMine does.
08:48RaynesI don't think I've ever used a client that doesn't highlight any sentence with my nickname or highlight key in it, despite it's prefix and postfix.
08:48raekjjido: use dorun or doall to force a seq
08:48hoecktobiasraeder: instead of having more than one methods I would rather use a hashmap in one single atom
08:49jjido,(doall (seq {:a 1 :b 3}) key)
08:49clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$key
08:49hoecktobiasraeder: and the IMutable must be declared with definterface or defprotocol but I guess you got that already
08:49raekah, misunderstood the intentions
08:49raekmap takrd thr fn first
08:51jjido,(map key (seq {:a 1 :b 3}))
08:51clojurebot(:a :b)
08:51jjidoRaek: does it work on a record?
08:51raekseq? yes
08:52raekseq is called my map automatically by map
08:52raekso you can leave it out
08:56jjidoI want to do (apply record-name. (map val myrecord)). It does not work obviously.
08:56raekconstructors are special syntax and not functions
08:56raekso
08:57jjidoI need a macro?
08:57cemerickno, a factory function will do just fine
08:57raek#(record-name. %)
08:57cemerickjjido: this might be of interest, though it's not exactly what you're after right now http://cemerick.com/2010/08/02/defrecord-slot-defaults/
08:58dnolenjjido: factory fns for records and types did not make it into 1.2. Just provide your own factory fn. It's also removes the need for users to have to import the class.
08:58raek#(record-name. %&) ; even
09:02chouserraek: that last one will pass in a seq, not multiple args
09:03chouserdnolen's advice is sound
09:09LauJensenMorning chouser
09:16chousergood morning
09:20fogus_good morning fine sir
09:25sproust`Good morning.
09:25sproust`What is the idiomatic way to join components of a path?
09:26sproust`(clojure.lang.java/file) "seems" to work file; grepping for path.separator yields something else.
09:26sproust`s/file/fine
09:37@rhickeyso, I'm failing to see how completely self-contained messages and responses can handle this:
09:37@rhickey(do (prn "what is your name?") (println "Hi " (read)))
09:37@rhickeyin the remote repl
09:38@rhickeyself-contained messages seem to be dominated by a desire to avoid side channels, but it seems to me that conversations between the IDE and the repl host are in fact side conversations
09:40@rhickeysince executing the above starts a multi-message conversation that can't be interleaved
09:41cemerickrhickey: exactly why I (mostly) punted on *in*
09:41@rhickeyah
09:42cemerick(read) in particular is tied to the notion of an attached terminal, at least conceptually
09:42@rhickeyI can also see difficulty for people sitting between some stream input and a whole-message interface in trying to delimit messages
09:42cemerickAlso why I (fully) punted on System/out and System/err, and *out* and *err* w.r.t. sends and such.
09:43cemerickThat's a client UI issue IMO.
09:44@rhickeyI think that makes it harder for some clients
09:44cemerickreally? Ctrl+enter for "send"...
09:44@rhickeyif they take input from a true stream, what are they going to have to do, call read?
09:45@rhickeycemerick: you are imagining a wholly owned client
09:45cemerick"wholly owned"?
09:45@rhickeyalso, if you forget a closing paren and push ctrl-enter?
09:45@rhickeycan you type another paren?
09:45cemerickImmediate failure, and an :error response msg back. *shrug*
09:46@rhickeycemerick: the repl client is the UI component
09:46@rhickey== wholly owned
09:46@rhickeybut might not be the case
09:46@rhickeysource-of-input -> repl-client -> ...
09:46@rhickeywhere source of input is a true stream
09:47cemerickI rejected streams entirely from the start.
09:47@rhickeyobviously a programmatic use of a message interface can send fully formed commands only
09:47@rhickeybut restricting the API to that seems limiting
09:47@rhickeyagain, I think to avoid side channels, is that it?
09:48cemerickthat, and one has to assume that there's more than one client connected to the same environment, so there's no way to properly distinguish *out*, *err*, System/out, System/err
09:49@rhickeycemerick: depends on how you define environment
09:49cemericksingle clojure process IMO
09:49@rhickeyso, again, could be multiple connections rather than multiplexed
09:49cemerickI think the terminal has to be considered the edge case, rather than the driving consideration.
09:49cemerick(as a concept, that is)
09:49@rhickeya single clojure process can have more than one *out* etc
09:49sproust`Am I missing something, or I can't find any function in core/contrib to get/strip file extensions?
09:50cemerickwell, every thread can have a different *out*, which is sorta my point
09:51@rhickeycemerick: I don't see it, that means you can properly distinguish
09:51cemerickbetween output generated by different client connections, you mean?
09:51@rhickeycemerick: yres
09:52@rhickeyyes
09:52@rhickeyhuman->environment, one connection, IDE->environment -> another connection
09:52cemerickPerhaps I'm just not clever enough. Output associated with arbitrary sends, futures, (.start (Thread. fooey)) can be traced back?
09:53@rhickeycemerick: bind *out* in the future
09:53@rhickeyto a separate pipe
09:53LauJensen,(last (re-find #"(.*)\.\w{3}" "test.xml"))
09:53clojurebot"test"
09:53LauJensensproust`: will that work?
09:55sproust`Lau: Sure, or using .lastIndexOf, just surprised there isn't a stdlib function to do that. Very common operation. Maybe I should submit one?
09:55cemerickCertainly, tooling would be working over a different connection than a human. The "bind *out* in the future" notion is something I hadn't considered, though that doesn't have anything to do with *in* of course.
09:55@rhickeycemerick: same thing with *in*
09:55cemerickrhickey: I guess I see (read) as a red herring.
09:55@rhickeyit seems the current design is dominated by multiplexing
09:55LauJensensproust`: Oh yea forget about lastIndexOf, thats much better
09:56LauJensensproust`: dunno where it would fit in contrib, but go have a look :)
09:56@rhickeycemerick: perhaps, but it's part of a family of things that are difficult as is
09:57@rhickeycertainly (do (prn "what is your name?") (println "Hi " (read))) works at the current repl, and won't in an atomic message transaction design
09:57sproust`,(defn split-ext [filename] (let [index (.lastIndexOf filename ".")] (map join (split-at index filename))))
09:57clojurebotDENIED
09:57cemerickwhich I've no problem with *shrug* I know others disagree.
09:58@rhickeycemerick: that's not to say that supporting both means losing the request response pairing, I think that is doable
09:58LauJensensproust`: more like (let [s "text.xml"] (.substring s 0 (.lastIndexOf s ".")))
09:58cemerickrhickey: my basis is the enclojure repl, where you've got *out* and *err* in a different panel entirely, piped from the console -- and when connected remotely, you just lose System/out and other threads' *out* entirely. Same with swank/SLIME afaik.
09:59@rhickeycemerick: I'm not disagreeing with that, and helped with the enclojure repl
09:59cemerickNot that that's an ideal or even a local maxima, BTW.
09:59@rhickeySystem/out can't be salvaged except as a global feed
10:00@rhickeyI'm focusing more on the message-transaction thing
10:01@rhickeyif conversations happened over different connections, *in*s and *out*s could be kept straight
10:01@rhickeyhuman + ide = 2 conversations
10:01cemericksure, that's a given
10:02sproust`LauJensen: this is what would be useful to me: http://gist.github.com/604609
10:02cemerickmy question is: is every send and future, etc going to keep the lineage of *out*?
10:02@rhickeycemerick: and 2 connections?
10:02cemerickand 2 connections what?
10:02@rhickeyand therefor 2 connections
10:02@rhickeyone for each
10:03sproust`Lau: feel free to paste into appropriate lib.
10:03LauJensensproust`: You should start by posting it on the ML
10:03drewrsproust`: I wrote this for joining paths together (c.j.io/file requires each component know whether its relative or absolute) http://gist.github.com/604610
10:03cemerickright, I mean on a per-connection basis -- the lineage of *out* would need to be threaded through every send, future, and (Thread.).
10:03@rhickeycemerick: I'm trying to understand the point you were making here, that you pointed to in your design doc:
10:03@rhickeyhttp://groups.google.com/group/enclojure/browse_frm/thread/dcea0e94d198f44e
10:04cemerickAnd if it is, would that only be in this environment, or in Clojure generally.
10:04sproust`drewr: thx. Shouldn't you use as-file instead of File. directly?
10:05@rhickeycemerick: I disagree about needing to thread it - if people are sending off futures etc without establishing *out* binding explicitly they get nopthing useful, same as now. If they are relying on the root binding their code is broken
10:05cemerickrhickey: That thread was about a particular design flaw in the enclojure repl, which was in any case entirely streams-based.
10:06cemerickrhickey: In that case re: threading of *out*, it seems we're in violent agreement. :-)
10:06@rhickeycemerick: I understand, but as I move away from the atomic message I don't want to reintroduce the flaw
10:06cemerick(barring the inevitable IRC misunderstandings)
10:07@rhickeyso, a connection gets its own *in* and *out*, and if it properly conveys them, that will work fine. That leaves me wondering about the need for atomic complete message
10:07cemerickrhickey: so by side channel, you mean establishing full-on streaming for *out* and friends per-connection?
10:07@rhickeycemerick: right
10:08@rhickeya single connection's ins and outs need only one physical connection
10:08cemerickTotally fine by me. My complaint in that thread was that I was having to pluck result values from *out*, which was being chunked separately from each send's response.
10:08cemericks/separately/off cadence
10:08drewrsproust`: no, that causes the problems I mentioned
10:09@rhickeycemerick: that can and still needs to happen, as someone can send a command that launches a thread that prints to *out* for another hour
10:09@rhickeysaying that a response includes all output associated with the command is impossible
10:10cemerickwell, result values have to be delineated in some reasonable fashion
10:10@rhickeyso, I think you need to distinguish writes to *out* by the repl engine itself
10:10@rhickeycemerick: results are the easiest thing
10:10cemerickRight, which was the :value slot in nrepl's response messages.
10:10@rhickeysince the repl is holding the return from eval
10:11@rhickeyyour talking about if the repl printed exception trace or something, not lining up?
10:11@rhickeyyou're
10:13cemerickno - the value provided to c.m/repl's :print
10:13@rhickeycemerick: what's the distinction between "result values" and "send's response" above?
10:14cemerickrepl-printed stack traces just get dumped to *err*
10:15avbrancoquit
10:16cemerickrhickey: in the enclojure regime, reads could not be paired with sends
10:17cemerick"result value" to me means, if I send "(println 5) 0", I get back readable values of "nil" and "0"
10:17@rhickeyok
10:17cemerickTooling would generally be sending only one expr at a time, but the above is necessary to get the highlighting chouser suggested
10:18cemericker, scratch "readable" above
10:18cemerickTooling obviously needs to be sending stuff that will result in something readable.
10:18cemerickinteractive users, no so much
10:18@rhickeyyou are saying enclojure gave you nil 5 0?
10:18sproust`drewr: your definition is a bit unusual; if I have an absolute path I would want the latest argument to take over the root again.
10:19cemerickrhickey: I'm saying that a single send of "(println 5) 1000" could result in enclojure-repl sending back multiple chunks, e.g. "5\n100" and "0\n"
10:20@rhickeyah
10:20cemerickthey were 1K chunks, but when tooling is getting a full accounting of all vars defined in the env, that's no good.
10:23drewrsproust`: I don't, but ymmv
10:23drewrym apparently does v :-)
10:24@rhickeycemerick: but you shouldn't care if *out* and *err* come back that way
10:24sproust`drewr: not so much my opinion, I think it's unusual re. other langs. To be verified.
10:24@rhickeycemerick: just need whole results
10:24cemerickrhickey: I don't with nREPL, because it returns values discretely. enclojure-repl was entirely stream-based, so that's what I was faced with.
10:25sproust`drewr: CPython's: >>> join("/foo", "///bar", "/baz///") ->>. '/baz///'
10:25sproust`
10:25cemerickrhickey: I encourage you to disregard that gg thread. enclojure-repl had a variety of design issues that I think are safely settled.
10:26cemerickas long as expression results are available discretely from *out* et al., all's good
10:26cemericks/from/separate from
10:26@rhickeyI am contending a design that respects the inherent streamy-ness of *out* and *err* needs to arbitrarily chunk their output into multiple messages, but need not do so with the eval result
10:26cemerickagain, entirely agree
10:27cemerickI never considered side channels for *out* et al. at all.
10:28sproust`It would be nice to have (re-quote) and (re-escape) for regexps (like Emacs).
10:28@rhickeythe nrepl design supports timeouts, but they can't really be made to work
10:28leafwrhickey: what IDE do you use? Or just a plain editor? I have always struggled to find an IDE without deep downsides.
10:29@rhickeyi.e. you spin off a future per request, but timing out on the future doesn't necessarily stop it, nr does interruption, for e.g. an infinite loop
10:29leafwI am just merely curious, as to in what way is clojure itself being developed.
10:30@rhickeyso, people may feel better seeing the prompt return, but could have left something churning forever
10:30cemerickrhickey: no, the timeout doesn't stop it, but an interrupt (which is automatically sent on a timeout now, I think) does stop infinite loops, e.g. (apply + (iterate inc)) was my testcase for that
10:32LauJensen$mail hugod I notified the Arch team about the bug in Tomcat and its already been fixed :P
10:32sexpbotMessage saved.
10:34jfieldsis there any easy way to convert {:a {:b {:c 1}}} to [[:a :b :c] 1] or {[:a :b :c] 1}
10:36@rhickeycemerick: I think if the code never enters an interruptable API call it will not be stopped
10:37cemerickrhickey: I'm starting to think you're right -- my interrupt of (loop [] (recur)) hasn't been respected yet :-(
10:37cemerickshit
10:37@rhickeyhttp://download.oracle.com/javase/1.5.0/docs/api/java/lang/Thread.html#interrupt()
10:40cemerickwell, I'm officially a dope
10:41@rhickeyno, it's a subtlety they don't call out, because the need is so great but it is not safely possible to do generally
10:41@rhickeythat's not to say that timeouts aren't interesting at the API level, but given what they can and can't do, the semantics need to be clear.
10:43@rhickeyhttp://download.oracle.com/javase/1.5.0/docs/guide/misc/threadPrimitiveDeprecation.html
10:44@rhickey"Unfortunately, there really isn't any technique that works in general. It should be noted that in all situations where a waiting thread doesn't respond to Thread.interrupt, it wouldn't respond to Thread.stop either. Such cases include deliberate denial-of-service attacks, and I/O operations for which thread.stop and thread.interrupt do not work properly."
10:45cemerickFunnily enough, I coded a Java REPL back ~2000 that used .stop for interrupts. Worked more than Future.cancel does, but obviously not advisable.
10:45cemerickCan't believe I forgot about that.
10:45LauJensencemerick: age...
10:45cemerickYup, I'm an old codger now.
10:45zoldarjfields, (map #(if (map? %) (first (keys %)) %) (tree-seq map? vals {:a {:b {:c 1}}})) that's the closest I could get...
10:51tobiasraedersomeone mentioned to me earlier that there was a IMutable interface and it could be used for defrecord. I can find any definition of IMutable tho. Anyone can help me on that? :/
10:52@rhickeytobiasraeder: records are immutable
10:52jfieldszoldar, thanks
10:53tobiasraeder@rhickey gave me that gist and said it should work http://gist.github.com/604507
10:53sproust`re. thread.interrupt() : this is a platform limitation IINM, same goes with C threads. You can't forcibly interrupt them; Java's thread cancellation is probably built as a cooperative mechanism, which includes interrupt points at choice system calls.
10:53@rhickeytobiasraeder: I don't know what that is
10:54tobiasraeder@rhickey alright :) thanks for the input on that
10:54tobiasraeder@rhickey is there any way to implement an interface (using proxy, defrecord, deftype etc) and store mutable data in/attached to that object?
10:54@rhickeytobiasraeder: someone else will have to help you with that
10:55tobiasraeder@rhickey alright :)
10:55cemericktobiasraeder: see the -mutable field metadata for deftype and defrecord http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/deftype
10:56cemericktobiasraeder: If you hose yourself b/c your records have mutable fields though, you're on your own :-P
10:56tobiasraeder@cemerick ill give it a try. thank you
11:01@rhickeycemerick: note that's only for deftype, not defrecord
11:02cemerickrhickey: Thanks for the clarification.
11:02cemericktobiasraeder: see ^^
11:03cemerickthat's what I get for relying upon dim memories of irc design discussions :-)
11:03tobiasraederhehe
11:03tobiasraederthanks for pointing it out.
11:04tobiasraederone more question if i use defrecord/type to implement functions they need atleast one parameter for "this"
11:04tobiasraederdoes the function in the java interface need atleast 1 parameter aswell?
11:05cemerick"to implement functions"?
11:05cemerick(fn [a] a) <-- a function
11:05cemerick;-)
11:12djpowellThread interruption in java is pretty nasty btw, cause catching InterruptedException resets the interrupted flag. So any code that does 'catch (Exception e)' unwittingly breaks interruption, and Java's checked exceptions make not using 'catch (Exception e)' very tedious
11:14@rhickeydjpowell: yeah :(
11:20djpowellI wanted to use it as a cancellation mechanism, but my jdbc driver was swallowing interrupted - there was a patch for that, but the thing is so fragile that I decided to backup interrupted with my own secondary flag, and switched to using .wait(timeout) in a loop, and checking my secondary flag in the loop.
11:21djpowellthe need to wrap checked exceptions into runtime exceptions makes it even harder to tell if someone has swallowed your interrupt. pesky checked exceptions...
11:48djpowellas people are talking about repls, i'll take the opportunity to advertise http://github.com/djpowell/liverepl - lets you hack a clojure repl into any running java or clojure process. quite handy to hack one or more repls into an existing clojure repl process, giving you a single process with multiple repls - handy for demoing concurrecy stuff
11:53AWizzArdrhickey: I discovered that (defrecord Foo [size]) can be problematic when you want to use the dot-accessor: (let [f (Foo. 100)] [(:size f) (.size f)]) ==> [100 1]
11:54cemerickyuck, I thought that was fixed a long while ago.
11:56@rhickeywhat is your expectation?
11:56@rhickeyyou have a class with a method and a field called size
11:56cemerickoh, nm, I transposed the results with the expressions
11:57cemerickthought (:size f) was returning 1
11:57@rhickeycemerick: right, that was fixed
11:57cemerickwhew :-)
11:57sempahgood evening
11:57sempahhow can I iterate over the seq? -> (defn addN [& x] (+ x x))
11:58AWizzArdIs there another syntax for accessing fields, other than (.myField x) or (:myField x)?
11:58sempahohh and first @ rhickey: thx for the language ;)
11:58AWizzArdsempah: in your case x is a list of the arguments. (addN 10 20 30) means that x = (10 20 30). You could say (defn addN [& x] (reduce + x))
11:59sempahgracias ;)
12:05AWizzArdrhickey: maybe there can be a warning when adding a field that has the same name as one of the methods?
12:07@rhickeyAWizzArd: if you are using records you should be using :x
12:09AWizzArdrhickey: in tight loops the dot-accessor + type-hint is 2.3 times faster.
12:10sproust`Hmmm, I have a question about dymamic variables. I have a (binding) clause in my main module, which binds 'emit to a function used for reporting progress. In another module, I use emit; when I evaluate from scratch, I get an error about emit not being available. I cannot import it from the main namespace, b/c that would created a circular dependency. I could simply shove a (declare emit) in another module... is there a better way out?
12:11AWizzArdWell, in most cases it is not a problem of course. Today it was the first time that I stumbled upon this, when benchmarking my Clojure serializer, which is not too far from Java speeds btw.
12:11sproust`s/created/create/
12:11AWizzArdsproust`: declare seems to be good here
12:12AWizzArdYou tell the compiler and other readers there there is indeed such a thing.
12:14sproust`AWizzard: thx. I thought there might be a better way.
12:15hiredmanAWizzArd: I believe :x uses a method cache with a type hint that hotspot should eventually inline away
12:23sproust`I'm invoking Clojure from the cmdline for my final program. Startup delay is insane (> 10 seconds). Is there a way to have clojure trace/report what it is doing (e.g. "loading library bla"), so I can view progress?
12:23@rhickeycemerick: all the tools guys bought into the command-server (i.e. no *in*) model?
12:28dnolensproust: did you AOT?
12:28sproust`dnolen: Nope. My point is not to bitch about startup time (sorry), but rather to find out if there is a way to trace loading.
12:29chousersproust`: interesting question, never tried.
12:29dnolensproust: ahead-of-time compile, that improves load time significantly. Clojure is launching, compiling your program, then running. I'd expect that to be slow.
12:29chousermight be able to instrument 'require' or something
12:30hiredmanyou can instrument load pretty easily
12:30sproust`hiredman: I see.
12:30sproust`Oh, Clojure doesn't have something like advice, does it?
12:30sproust`I meant, auxiliary methods.
12:31sproust`hiredman/dnolen: Thx.
12:31hiredmanhttp://github.com/technomancy/robert-hooke
12:33sproust`Awesome.
12:34chouserso did we again lose the ability to build contrib against a local clojure.jar?
12:34@rhickeychouser: I was wondering the same just yesterday
12:35chouserthe instructions in the README are certainly gone again
12:36chouserAre you physically near the Clojure/core team most days?
12:37@rhickeychouser: no
12:37chouserso no sticking your head out the office door and yelling, "Stu!!!"
12:37@rhickeythis question has been asked, but not yet answered
12:37cemerickrhickey: all but ninjudd, I think, but cake and lein are different beasts, I'd say
12:38chouserhave you tried the old instructions?
12:38@rhickeycemerick: what's cake?
12:38cemerickrhickey: swank and enclojure-repl having the same limitation, etc
12:38cemerickrhickey: a lein-compatible build tool that uses a persistent jvm for invocations, repls, etc
12:38cemerickhttp://github.com/ninjudd/cake
12:38chouserc.c.Condition isn't building for me from contrib master. bleh.
12:39AWizzArdhiredman: I see.
12:39@rhickeycemerick: hrm, I don't see why any such programmatic interface wouldn't be happy with messages
12:39@rhickeycemerick: inbound
12:40cemerickrhickey: `cake repl` aims to look and feel just like c.m/repl on a bare console, AFAIK
12:40hiredmanI think lein would more likely be a way to start a repl server than actually communicate with one
12:40@rhickeycemerick: ah
12:41svs`Hello. I managed to build a proper jar using lein following the advice here http://zef.me/2470/building-clojure-projects-with-leiningen but when I build my little non-trivial project I get Exception in thread "main" java.lang.NoClassDefFoundError: planet
12:41cemerickhiredman: no reason why the result of all this shouldn't allow you to say `somecmd --remote localhost:58943` or whatever
12:41cemerick(as well as start repl servers :-))
12:41cemerickthat's actually exactly what nrepl's main does, except it always defaults to a new server started on localhost
12:41technomancyyeah, I'm less interested in being in the client business with leiningen repls
12:43cemerickrhickey: ...which is why ninjudd and I have bumped heads. That should have made me think of having side-channels, but I'd been focused on only discrete msgs.
12:43cemerickninjudd: :-D
12:44chouserrhickey: oh, s.sierra added custom clojure.jar build instructions to the contrib readme last friday.
12:44chousertrying them now
12:46@rhickeychouser: they're awful, IMO. hoops and more hoops
12:47@rhickeywho could possibly think this is reasonable anymore?
12:47chouseronly 40% more complex than before, which was only 40% more complex than the original...
12:47technomancyit works OK for people who don't build contrib for themselves
12:48fogus_technomancy: Hooray! We've achieved OK-ness!
12:48technomancyit's nice to be able to say "I want error-kit" without pulling in the combinatorics, etc
12:49@rhickeytechnomancy: I'm only speaking to the custom clojure for people like me who change clojure often and want to make sure they don't break contrib
12:49@rhickeythey == me
12:50cemerick*cough* continuous integration *cough* ;-)
12:50@rhickeymore overhead
12:50@rhickeyused to be ant and ant
12:51@rhickeyI don't want to integrate until I'm ready
12:51chouserbut <x> is *everywhere*, it's only marginally more complex and takes care of so much for you. Custom <y> is bad.
12:52cemerickrhickey: if the ant build copies a clojure.jar snapshot to your local repo, then the new situation should be ant, mvn
12:52chouser(for [[x y] [:stomp :protocol, :maven :build-system, :tomcat :web-server] ...)
12:53@rhickeychouser: that analogy is broken, since there is much more to do here, much more complexity, apples and oranges, not standard apple vs custom apple
13:03@rhickey"2. Set a custom version number in src/clj/clojure/version.properties" - stunning
13:08Chousukethere could be a makefile that does all that for you ;P
13:08Chousukejust to bring yet another build tool into the mix!
13:11@rhickeyChousuke: will it remember not to check in the changed properties file for me?
13:11Chousukehmmh. .gitignore?
13:11Chousukeor can you do that?
13:11@rhickeyChousuke: it's part of the project!
13:11ChousukeThat's problematic :/
13:12cemerickgit add -f ignored-file overrides .gitignore IIRC *shrug*
13:12@rhickeyovercoming complexity rather than avoiding it - what have we come to?
13:12@rhickeyback in the tar pit
13:13cemerickAt the moment, there's no such thing as avoiding build complexity. One either deals with it, or redistributes it.
13:13LauJensenThat was a good essay/paper (out of the tar pit)
13:15@rhickeycemerick: not distinguishing inherent and incidental complexity is the problem
13:15cemerickrhickey: only if you can define a closed system
13:15cemerickUsually, incidental complexity is forced upon you by external, often social factors.
13:19arohnercemerick: it's not that clean. Maven is neither purely incidental, nor purely inherent complexity. And sometimes it increases complexity
13:20cemerickarohner: never said it was. All these systems are flawed.
13:20rlbWhat's the best way to generate a sequence of values like this: (for [x (range ...) y (range ...)] [x y]) [final-x final-y]?
13:21arohnercemerick: I'm not trying to rip on maven, I'm just pointing out that there's a third option, and the distinction isn't always clean between deal, redistribute and increase complexity :-)
13:21rlbi.e. I'd like all the values from the for, followed by the terminal values.
13:21arohnerrlb: concat
13:21dmiller2718rhickey: speaking of complexity of the build: Q1: okay to include DLR DLLs in a binary distribution of ClojureCLR? (binary distribution highly requested)
13:21arohneror just (for [x (range final-x + 1)]...)
13:22arohnererr (range (inc final-x))
13:22cemerickarohner: I know :-) Which is the third option?
13:22rlbarohner: ah, concat's exactly it, thanks
13:22arohnercemerick: increase complexity, without dealing or redistributing
13:22cemerickoh, I see what you mean
13:22arohnercemerick: "failure is always an option"
13:23cemerickha! :-D
13:23cemerickarohner: exactly my fundamental conclusion: http://cemerick.com/2010/09/22/wherein-i-feel-the-pain-of-being-a-generalist/
13:23cemerickMeanwhile, practical concerns continue to dominate.
13:25duncanmhola
13:26duncanm,(instance? clojure.lang.ISeq [])
13:26clojurebotfalse
13:26duncanmshouldn't that return true?
13:27raekno. :)
13:27duncanmif i want to write a method that catches vectors, what should i dispatch it on?
13:27raekcollections *are* not sequences, but they can produce sequential views of themselves
13:28duncanmi could use clojure.lang.PersistentVector, but would that be too specific?
13:28duncanm(my dispatch-fn is 'class')
13:28raek,(instance? clojure.lang.IPeristentVector [])
13:28clojurebotjava.lang.ClassNotFoundException: clojure.lang.IPeristentVector
13:28raek,(vector? [])
13:28clojurebottrue
13:29kjeldahl,(instance? clojure.lang.IPersistentVector [])
13:29clojurebottrue
13:29raekif you do it with protocols, I you can extend the protocol for IPersistentVector (i.e. any vector type)
13:29chouserok, I give up. what if I *want* all of contrib (and its examples) on my classpath in a clojure repl?
13:30chouserI had hoped mvn clojure:repl in contrib would do it, but that fails.
13:30raekhrm, wait. multimethods can do that too
13:30raekthey use isa? for the matching, right?
13:30raek(isa? clojure.lang.IpersistentVector [])
13:30raek,(isa? clojure.lang.IpersistentVector [])
13:30clojurebotjava.lang.ClassNotFoundException: clojure.lang.IpersistentVector
13:30raek,(isa? clojure.lang.IPersistentVector [])
13:30clojurebotfalse
13:31raek,(isa? (class []) clojure.lang.IPersistentVector)
13:31clojurebottrue
13:33duncanmraek: isa? and instance? are different, right?
13:33raekconclusion: with dispatch fn 'class', you can have an implementation for IPersistentVector
13:34raekisa? uses instance? for class hierarchies
13:34duncanm,(instance? {} clojure.lang.IPersistentVector)
13:34clojurebotjava.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.lang.Class
13:34raekyou can define other kinds of hierarhies too
13:34duncanmright
13:34duncanmokay
13:35raekisa? is a generalized instance?, one could say. it is not structly type-based
13:35chouseradding clojure-maven-plugin to contrib's pom.xml doesn't seem to help.
13:35duncanmraek: but when i only care about classes, i can use the more specialized 'instance?' fine
13:37raekyes, but multimethods use isa? to find a matching dispatch value
13:38raekbut if you do some comparison yourself, then instance? is fine
13:38@rhickeydmiller2718: no binaries in git, but iff the MS license allows, ok in .zip in downloads section
13:40raek(defmulti foo class) (defmethod foo clojure.lang.IPersistentVector [...] ...) ; should work fine, since (isa? (class []) clojure.lang.IPersistentVector) => true
13:41LauJensenThere's a license which states you can put certain binaries in git?
13:41@rhickeycemerick: that rationale could be pulled out at any time in any domain to excuse things sucking - doesn't make them suck less
13:41chouseraaargh
13:42@rhickeymaven seems to feel at basic principles like - pay for what you use
13:42dmiller2718rhickey: Okay, that also answers Q2 regarding putting libs in dev version.
13:43dmiller2718rhickey: MS license for DLR okay with distribution of binaries as long as basic license text is included, which I will do. Thx.
13:43@rhickeyseems to fail
13:44@rhickeymaven == everyone pays for what anyone might ever do
13:44AWizzArd(:
13:44dysinger:)
13:44chouseraaaargh
13:45lypanovany slimv users around?
13:46lypanovdysinger: y slimv vs vimclojure? happy?
13:48dysingerlypanov: oh I thought that was a type for "slime" (the real deal)
13:48lypanovheh.
13:48cemerickrhickey: I don't think open platforms/communities are structurally capable of sucking less in this department, as I alluded to in the post
13:48@rhickeycemerick: heh
13:49arohnercemerick: sane versioning, sane package format would help significantly
13:49arohnerof course, replacing .jar isn't really an option
13:50cemerickrhickey: The fact that clojure's build.xml contains a bug-ridden slow implementation of half of maven would seem to indicate that you're already needing at least that much of it. ;-)
13:50@rhickeyarohner: replacing jar is coming, in fact
13:51@rhickeycemerick: I seriously doubt it. People had a hammer and started swinging
13:52cemerickrhickey: Insofar as you're interested in having users on the JVM, you have to have artifacts going out in a maven-compatible way. There's those social factors again.
13:52slyrus__ cemerick: but that build.xml doesn't require that you download 3 dozen random apache projects I've never heard of (nor want to hear of)
13:52cemerickslyrus__: wha?
13:52TeXnomancymight be nice to have access to "Maven: The Good Parts"
13:53slyrus__cemerick: just responding to your comment about clojure's build.xml having half of maven in it
13:53cemerickslyrus__: I'm saying, what are the 3 dozen random apache projects?
13:54slyrus__all of the random stuff in .m2, plexus-*, commons-*, etc...
13:54slyrus__perhaps I exaggerate the number
13:55cemerickslyrus__: do you care, if it's automated?
13:55slyrus__I'm annoyed by it. Perhaps I shouldn't be.
13:55cemerickslyrus__: If you are, you probably should be annoyed by how many files an OS update process touches or something, too. *shrug*
13:56chousercemerick: I'm caring right now because the automation and/or my attempts to get help failed
13:57cemerickchouser: this is the 'use a custom build of clojure with contrib' issue?
13:57slyrus__cemerick: yes, we should drop this, but my point was that at least the slow, buggy half-of-maven that's in build.xml is relatively self-contained and one can easily go in and fix/improve it. fixing a whole bunch of random apache projects doesn't sound like fun.
13:57solussdSo I've been reading The Joy of Clojure and read through the lazy quicksort algorithm- it says it is tail recursive, but cons everything together in the 'else' position of the if containing the recur- is this still tail recursion?
13:58cemerickslyrus__: quite certain I've never touched any part of maven or its plugins *shrug*
13:58chousercemerick: no I gave up on running a repl in that context. I just want a clojure repl with all of contrib (including examples) on the classpath
13:58LauJensencemerick: Im also not sure why its always you who have to take a beating for Maven? :)
13:58chouserhaving tried, asked here, googled, tried, and failed, I have given up on the automation
13:58chouserI'm now building the classpath by hand
13:58chouserI'll paste it when done
13:58@rhickeyyay, classpath!
13:59@rhickey:)
13:59cemerick:-(
14:00chouserok, to allow 'require' of any of the examples that will soon be checked (back) into contrib, simply start clojure so:
14:00chouserjava -cp ../clojure/clojure.jar:modules/accumulators/src/examples/clojure/:modules/condition/src/examples/clojure:modules/datalog/src/examples/clojure:modules/miglayout/src/examples/clojure:modules/monads/src/examples/clojure:modules/probabilities/src/examples/clojure/:modules/types/src/examples/clojure/:modules/accumulators/src/main/clojure/:modules/condition/src/main/clojure/:modules/datalog/src/main/clojure/:modules/miglayout/src/main/clojure/:modules/monads/src/main/clojure/:modules/probabilities/src/main/clojure/:modules/types/src/main/clojure/:modules/def/src/main/clojure/:modules/generic/src/main/clojure/:modules/condition/target/classes:modules/except/src/main/clojure/:modules/graph/src/main/clojure/:modules/core/src/main/clojure/:modules/fcase/src/main/clojure/:modules/swing-utils/src/main/clojure/:modules/macro-utils/src/main/clojure/:modules/stream-utils/src/main/clojure/:modules/macros/src/main/clojure/ clojure.main
14:00cemerickchouser: I've not looked at the contrib modularization at all yet -- but if it works as I'd expect, running whatever invocation will cause a local deployment of clojure.jar followed by 'mvn' in contrib will do the trick
14:01chousermvn install; mvn clojure:repl failed -- couldn't find clojure-maven-plugin
14:01cemerickchouser: well, that sounds like a bug
14:02chouserfollowing instrustions I found on the web, I added a snippet to the contrib pom to depend on clojure-maven-plugin. after several false starts I was able to get a repl
14:02chouser...but examples were not included on the classpath
14:02chouserSince I have email here that says "Note that the "examples" source paths are only included on the classpath in test mode, which includes clojure:repl and clojure:swank." I assumed that should have worked and had no idea what to pursue next
14:03chouserasking here gained me nothing.
14:03cemerickI'm shocked to hear there's a bug somewhere ;-)
14:03chouserso I built that classpath, one item at a time, adding more things as deps failed until it all worked.
14:03cemerickI'm sure SS would pick up a thread on clojure-dev
14:06cemerickLauJensen: Yeah, I keep on sticking my neck out there. Masochist, I am he.
14:06chouserall this to restore files that were lost during a directory reorganization required by ... buh-buh-bum... maven.
14:06cemerickchouser: just wait until all of contrib is sharded into individual repos :-P
14:09chousercemerick: can't wait
14:12LauJensenchouser: Why dont you just move contrib over to another build system ?
14:12chouserI hate build systems.
14:13Raynes He doesn't use build systems.
14:13chousernever met one that didn't drive me crazy
14:14LauJensenchouser: thats amazing - knowing your threshhold for crazy
14:15chouserit's barely the same domain, but ebuild is probably the least painful I've known well -- gentoo's build and dep tool.
14:16cemericksarcasm runs thickly
14:16cemerickthrongs plead for sweet relief soon
14:16cemerickin death, maven waits
14:16Chousukeebuild is more like a build tool tool :P
14:17chouseryeah, barely the same domain. but it did involve custom commands for particular situations, user customization, dependency graph resolution, dep downloading, etc.
14:19cemerickman, no haiku fans? Tough crowd.
14:20wdouglasSorry, it was brilliant
14:21cemerickshoover: well played :-)
14:21shooveranyone know how to set emacs clojure-mode to left-align single-semicolon comments?
14:21shoovercemerick: I like it now. I was too busy to count syllables
14:23cemerickShould've made it a cinquain.
14:23rlbis sequential? effectively #(instance? clojure.lang.Sequential %)?
14:24MayDanielrlb: Yes.
14:24amalloyrlb: (source sequential?) makes it pretty clear :)
14:25rlboh, right.
14:25amalloycemerick: is sarcasm really two syllables? it feels like sar-ca-sm to me
14:25cemerickamalloy: according to OS X's dictionary... *shrug*
14:26amalloyoh funny, cause after asking i just looked it up on M-W, which thinks it's three
14:26cemerickI would have said sar•cas•m myself, but...
14:26cemerickreally!
14:26amalloyhttp://www.merriam-webster.com/dictionary/sarcasm
14:26cemerickamalloy: no, just two there too
14:28amalloyoh, i see. i was looking at the part on the right
14:28amalloynow i have to look up what kind of crazy notation that is. IPA or something
14:28cemerickexactly right
14:30raekhrm, that is not IPA...
14:32amalloyyeah, i can't tell what it is either, or what they hyphens are supposed to represent if not syllable breaks
14:35amalloycemerick: their pronuncuation guide says that - is used to separate syllables, and doesn't mention the little dot symbol in the thing on the left. i interpret that to mean that the thing on the left isn't a pronunciation guide, though i dunno what it actually is in that case
14:40anonymouse89when declaring a namespace like (ns hello (:use foo.bar)) how do I specify the refer-like :exclude :only ... ?
14:41chouser(:use [foo.bar :only [a b]])
14:41anonymouse89chouser: ah, thanks
14:42anonymouse89chouser: I'm using your command-line stuff btw, very helpful
14:42chouseranonymouse89: pretty minimal, but I'm glad it's helping
14:43chouserinteresting that I don't think I'd be inclined add something like that to contrib today. Seems to underdeveloped for the seriousness that is contrib now.
14:43chousertoo
14:45anonymouse89chouser: maybe have a look at contrib.complex-numbers :)
14:47chouserbleh. deftype means something else now...
14:50alexyklancepantz: thanks for rolling back *env* name
14:51alexykdnolen: thx for flowing in sync :)
14:51lancepantzalexyk: *grrrr*
14:51lancepantz:)
14:51alexyklancepantz: is it a purr or a growl? :)
14:51lancepantzi unhappily gave in
14:52alexyklancepantz: well, no pain, no gain :)
14:52lancepantznow the other thing is *context*
14:52alexyklancepantz: what is /usr/bin/jps which cake is trying to call? My Linux setup lacks it
14:52lancepantzchose your battles i suppose
14:52ninjuddi'm thinking of renaming it *alexy-context*
14:52lancepantza ps that only list java processes
14:53alexyklancepantz: *context* came to me too while phishing... or fishing, I forgot what it was... :)
14:53lancepantzalexyk: are you using the jre instead of the jdk?
14:53lancepantzalexyk: do you have have jar on your path?
14:54alexyklancepantz: I use prefix gentoo. I know many of you didn't ever hear about it, but ut installs sun0jdk, I have jar. Just upgraded to 1.6.0_21
14:54alexyk]
14:54alexykperhaps I need to reveal it somehow
14:55alexykI'll see...
14:55lancepantzyeah, it should be there
14:55alexyk:)
14:55alexykor page dnolen out of bed
14:56alexykon his cozy east coast from teh cake's west one
14:56lancepantzalexyk: i will happily accept any pull requests containing tests
14:57alexykdnolen: YES! An epiphany: textcake! no more textmate-clojure or vice-versa agony!
14:57alexykor, cakemate
14:57dnolenorg.textcake.bundle.clojure.mode.main/*alexy-context-shell-env-persistent-hash-map*
14:57lancepantzlol
14:58alexykorg.textcake.bundle.clojure.mode.main/*ninjudd-lancepantz-dnolen-alexy-all-agreed-context-shell-env-persistent-hash-map*
14:58abrenkalexyk: /usr/bin/jps -> run-java-tool
14:58alexykabrenk: is it a symlink?
14:59abrenkalexyk: yep
15:00alexykabrenk: thx!
15:01abrenkalexyk: "ls -l /usr/bin/ | grep run-java-tool | wc -l" is 43 on my system
15:01alexykabrenk: you mean it has 43 symlinks??
15:01abrenkalexyk: if you don't have all those jps, jstack, jconsole etc. symlinks our system are different somehow
15:02alexykabrenk: I run *prefix* gentoo
15:02alexykon a CentOS :)
15:02alexykwho installed your jps (which package)?
15:03abrenkalexyk: "equery belongs /usr/bin/jps" -> dev-java/java-config-2.1.10
15:03alexykabrenk: ah ok
15:03abrenkwhat is *prefix* gentoo?
15:04alexykhttp://www.gentoo.org/proj/en/gentoo-alt/prefix/
15:04hiredmanhow do you turn off validation for clojure.xml/parse
15:04alexykif you're ever stuck on a box without root and can't rpm/yum, or just want portage, that's what you get. May be useful for folks, sorry if too off-topic.
15:10lypanovalexyk: or if you're on a mac. or windows.
15:10alexyklypanov: on mac, macports rules, but yeah. I have a Portage drive image on a Mac, which is case-sensitive...
15:11lypanov:/
15:11lypanovdea
15:11lypanovdeath to macports
15:12alexyklypanov: let a thousand flowers bloom :)
15:12lypanovbut gentoo prefix did the job for a while.
15:12alexyklypanov: brew is amateurish, lots of loose ends
15:12xkbwhat's brew?
15:13lypanovdoesn't take 24 hours to install a basic pkg tho. so makes me happy.
15:13alexykxkb: http://github.com/mxcl/homebrew
15:13xkbthnks
15:19alexyklypanov: seeing you come from NL, I think it got to be strong enough :)
15:22nickikwhere can I find good CL documentation (like clojuredocs) with examples of all the functions and stuff
15:24chousernickik: maybe http://www.lispworks.com/documentation/HyperSpec/Front/X_AllSym.htm
15:27nickik@chouser thats was what im looking for
15:27nickik@chouser thx
15:29LauJensenAmazing service we give here in #clojure :)
15:36alexykLauJensen: the only missing thing is Belgian, um, Danish history :)
15:37LauJensenClojure is also Lisp
15:38alexykLauJensen: I meant Common one
15:38nickikim working threw PAIP and I implement everything in Clojure so I have to understand the CL version and find functions that are the same or implement them myself
15:39LauJensenalexyk: I've often wondered why you'd want a common lisp, when you can have an extraordinary one like Clojure
15:39alexykLauJensen: exactly. I can't even look at CL not having [] {} and : teh right way!
15:40nickiki'm having a discusion about that on reddit :)
15:40alexykuncommon lisp
15:40ChousukeClojure has sexy expressions ;P
15:40alexyknickik: are you stirring the passions of old bearded lisp types then?
15:43nickik@alexyk not that far in the book only working on the first real exampels
15:45nickikis there something like the CL member function or do I have to write it myself?
15:46alexykninjudd: are the clojars versions of protobuf and jiraph up-to-date or should I just git them?
15:46amalloynickik: (some)
15:47jjidois it possible to create a recursive structure? Like a double-linked list
15:47ninjuddalexyk: protobuf, yes. jiraph, no. i am working on the 1.2 version in the deftype branch, but it isn't quite done
15:47amalloy,(some #{10} [2 4 8])
15:47clojurebotnil
15:47amalloy,(some #{10} [2 4 8 10])
15:47clojurebot10
15:47amalloynickik: ^^
15:48nickikno member returns the rest (member 2 '(1 2 3 4)) => '(2 3 4)
15:50shooverdo any emacs users care about indenting single-semicolon comments like the other IDEs?
15:50shooverhere's what I had to do: http://gist.github.com/cd2f5a888aaab4f33fe9
15:51amalloy,(drop-while (complement #{2}) [1 2 3 4])
15:51clojurebot(2 3 4)
15:51amalloynickik: good enough?
15:51alexykninjudd: I'm using the jiraph.tc in clojure 1.1, and have that built, now fails to work with 1.1. Is there an existing jiraph build for 1.2 at all?
15:52alexykfails with 1.2 from a jar, obviously
15:52amalloyshoover: i haven't been using emacs for long, but the way it indents ; comments drives me nuts
15:52jjidowhat is an atom for?
15:53shooveramalloy: Me too. I don't mind typing ;;, myself, but if you reindent code anyone else writes, it gets all messed up.
15:53alexykshoover: github added star gist! yay! starred :) Used to fork before just to remember...
15:53nickik@amalloy nice better then the one I wrote
15:53jjidocan I use an atom for a variable that I just want to link back to
15:54amalloynickik: if you want to avoid writing the drop-while/complement/#{} boilerplate you could do something like (defn some [list & search] (drop-while (complement (set args)) list)
15:56ninjuddalexy: in the deftype branch. feel free to play around with it
15:56ninjuddalexyk ^^^
15:56nickik@amally that ok i try to keep the functions as the are because in the book he uses CL and if I have functions with the same name i can use without think about it
15:57nickik@jjido what do you mean by "link back to"
15:57callenwhat's the name of that emacs bundle somebody put together for clojure?
15:57amalloycallen: emacs starter kit?
15:57jjidonickik: I am trying to write a double-linked list kind of structure
15:57nickikEmacs starter kit
15:57callenBwaha.
15:57callenShanks. Getting going on a new machine.
15:57callenwho here is going to the clojure conj?
15:58nickiki would but its on the other side of the planet :) i hope there will be good videos
15:59jjidonickik: so I need to both set "next item" on my object and create an item with a back reference to it
15:59alexykninjudd: thx, will check it out (of git :))
15:59nickik@jjido im not an expert but could you just do a datatype that is like a concell but with 3 slots?
16:00callennickik: I'm thinking about going (I'm in NYC).
16:00amalloynickik: the problem is that with immutable data there's a chicken/egg situation if you want two objects to link to each other
16:00raekjjido: this is hard to do with immutable data structures, since they can only contain references to already constructed values
16:01raekthe reference loops causes the problem
16:02nickik@callen i think fogus sad something about that there will be official videos made
16:02jjidoraek: I know... if I could have a assoc+construct operator it would be nice
16:02nickikaudio and the slides would be ok too
16:02amalloyjjido: it's pretty ugly, but you could get similar functionality a different way. have a seq of nodes, none connected to each other, and a "global" hash-map that maps node=>next/prev pair
16:03raekjjido: I think it would be possible to do something like (deftype [prev-atom value next-atom] ...)
16:03raek(deftype DoublyLinkedList ...
16:04jjidoraek: and after that? Mutate it?
16:04raekthe atoms can be used as mutable cells
16:04jjidoraek: that was my question
16:05raekjjido: have you seen this? http://pepijndevos.nl/how-reify-works-and-how-to-write-a-custom-typ
16:06raekthe resulting data structure wouldn't be very clojure-y, but it would work
16:09jjidoraek: that is fun, but it uses "inc" and "dec"
16:09jjidoso the fwd node and the bwd node can be calculated from current node
16:20@rhickeyso, I'm finding this distributed repl really turns into 2 pretty distinct scenarios:
16:20@rhickeyrepl
16:20@rhickey input is stream, can (read) from *in*
16:20@rhickey outputs streams *out*/*err* are interesting to clients
16:20@rhickeycommand server
16:20@rhickey each message single readable object
16:20@rhickey eval it, generate single return
16:20@rhickey no in or out streams
16:21LauJensenrhickey: cemerick left, dont know if what you wrote was mostly for him?
16:22chousercommand server flags and returns exceptions?
16:22@rhickeychouser: yes
16:23@rhickeyrepl would also have distinct eval returns
16:23jjidoLOL using atom for double-linked list works, and one should not print out its value.
16:24@rhickeynothing would preclude someone using repl mode from sending complete messages of course
16:25ninjuddrhickey: in my thinking about this, i came to the conclusion that if you build a command server that handles in and out streams correctly, it can serve both purposes
16:25TeXnomancyshoover: using double semicolons for full-line comments is a pretty long lisp tradition
16:25chouserthe difference being repl mode doesn't try to link specific input exprs with their return values?
16:26@rhickeychouser: no, even that is possible
16:26chouserjjido: finger trees allow for a double-headed list that can do a lot of what doubly-linked-lists do, and yet is persistent.
16:27duncanmraek: ping? i don't know how to write a multimethod that has 2 arguments
16:27raekthat dispatches on two things?
16:27@rhickeyninjudd: not quite, as the semantics of the input to the command server are different
16:27jjido(let [self (new Bilink nil (new End) (atom nil))] (swap! (:prev (:succ self)) (fn [_] self)) self)
16:28duncanmraek: i want to write (distance Point Point) and (distance Vector Vector)
16:28jjidothis is my code
16:28chouserrhickey: so if you can send whole exprs to repl mode, and link to the return value, is the only difference whether an incomplete input expr is an error vs. queued up text?
16:28ninjuddrhickey: i suppose that was based on my plan to have separate input and command queues
16:29@rhickeyninjudd: also, command servers allow for significantly more indirection - multiple servers servicing same input queue, results going to various dynamically supplied output queues, etc
16:29raek,(isa? [clojure.lang.PersistentVector clojure.lang.PersistentHashMap] [clojure.lang.IPersistentVector clojure.lang.IPersistentMap])
16:29clojurebottrue
16:29raekisa? does isa? recursively on the components of data structures
16:29@rhickeyninjudd: you can't do that and deal with (do (prn "what is your name?") (println "Hi " (read))) properly
16:29raekso the dispatch function could return a 2-vector
16:30duncanmoh
16:30@rhickeychouser: no, see ^
16:30ninjuddrhickey: incidentally, i think a timeout in the client before switching from command mode to input mode can solve the paste problem with separate command and input streams
16:30@rhickeyninjudd: nope
16:31raekduncanm: there are some related examples on http://clojure.org/multimethods
16:31@rhickeychouser: above re: semantics and indirection
16:31AWizzArdrhickey: any chance that with the patch for the updated def (which accepts a doc string) we also can get a def- ?
16:31ninjuddrhickey: explain
16:31@rhickeyto correctly handle repl-mode input you have to streamify the input message queue
16:32ninjuddrhickey: that's more of a reiteration than an explanation ;)
16:32duncanmraek: i've been looking at that - http://gist.github.com/605263 -- this is my latest attempt, but it doesn't work
16:33duncanmraek: oops, there's a typo there
16:33chouserinteresting. who uses *in* other than the repl? I'm always a bit startled when I see it.
16:34@rhickeychouser: any interactive console app might
16:34ninjuddchouser: cake uses it for running bare clj scripts and also for it's piped unix filter task
16:35@rhickeyshutdown server (y/n)? ...
16:35chouseryeah, I know it's supported by the normal terminal repl, but mixing with (read) ...
16:35chouserok ok, I'll drop that line.
16:35ninjuddrhickey: the way we currently unify the command server and repl server in cake is that 'repl' is a command
16:36@rhickeyninjudd: I can't spend any more time on that command and in take turns idea
16:36brianstamandDoes anyone know how to add my own java packages to leiningen? The code works if I manually put them in classes but when i build with lein it "cleans up" by deleting them
16:36brianstamandby "classes" i mean classes/ sorry
16:36_rata_hi clojurians
16:37ninjuddrhickey: fine, i'll drop it unless i can come up with a working prototype
16:38defn<Raynes> I've probably used and more than I've used or, but used if more than I've used and and or.
16:38Raynesdefn: Ohai!
16:39raekduncanm: are you sure that you don't have the old defmulti lying around? defmulti has defonce semantics nowadays...
16:39defnhey buddy, long time no see
16:39@rhickeyso we were talking yesterday about trying to get down to 2 queues, one for in and one for out. But given this dichotomy, I think it's 3 - in (with 2 modes), results and out-streams
16:39ninjuddrhickey: my point is just this: whether you unify the command and repl server by having separate command and in streams or by making 'repl' a command, it can be done.
16:40@rhickeyninjudd: aargh
16:40raekduncanm: couly you try (ns-unmap 'your.ns 'distance)?
16:40raek...and then revealuate the definitions
16:41@rhickeycommand server runs input in atomic message mode, doesn't offer out-streams, repl runs input in stream mode, offers out-streams
16:41defnso today is my last day to get the early bird special for clojure-conj, eh?
16:41Raynesdefn: I'm going to cry if you're not there when I arrive.
16:41RaynesI was looking forward to bear hugs and such.
16:42defnhahaha -- not all of us can get such a sweet deal raynes!
16:42@rhickeyrepl server needs a stronger notion of a session than does command server
16:42RaynesAin't that the truth.
16:43TeXnomancybrianstamand: you mean java code you've written yourself?
16:43defni wonder if i can convince the community to give an out of 25-year-old a break...
16:43defnout of work*
16:43ninjuddrhickey: can you support running non-repl command-line scripts with stdin support using the two-mode approach?
16:45esjdefn: could be worse, you could be stuck on the other side of the pond...
16:45@rhickeyninjudd: I don't know what you mean by that. It's an execution server, you send it stuff to execute. Command line is out of scope (i.e. something you wrap around this if it makes sense)
16:46Raynesdefn: You're welcome to sleep at the foot of my bed if necessary.
16:46TeXnomancybrianstamand: you might want to try the javac plugin, which is on the verge of getting merged into mainline; there's a thread on the lein mailing list about it
16:46defnesj: you've got me there -- i think i might just sell some stuff to make it happen, i figure i could unload a guitar (but that would break my heart)
16:46defnRaynes: careful, i might take you up on that!
16:47ninjuddrhickey: i guess what i'm asking is: can you support stdin for commands sent to the command server? or are you saying that isn't important?
16:47chouserninjudd: would repl mode not work for that?
16:47@rhickeyninjudd: It doesn't care where input comes from on the client side
16:47chouserninjudd: how do you decide when to disconnect currently?
16:48@rhickeybut repl mode makes it easy to stick streaming input into the client, as you don't need to partition by 'command'
16:48ninjuddchouser: it may, but then your code is interspersed with your data.
16:48amalloywhen is the conj, anyway?
16:48defnLate Oct.
16:48defn22,23rd
16:48Raynes22nd - 23rd.
16:49ninjuddchouser: eof on stdin or the socket read stream
16:49amalloyactually is there just a website i can look at? i'm a 25-y/o, not out of work but not interested in spending loads of money either; might arrange to go halfsies with defn if it's convenient?
16:49chouserninjudd: oh, the server doesn't disconnect when the command is done?
16:50defnamalloy: yeah im definitely interested
16:50defnhardest part for me is going to be /getting there/
16:50nickik@rhickey are there going to be videos (or audio) available?
16:50nickikof the conj
16:50ninjuddchouser: the server closes the socket which causes an eof in the client
16:50amalloydefn: from where?
16:50@rhickeynickik: dunno yet, someone is looking into it
16:50defni have class on thursday and my car is going to be angry at me if i put too many miles on it
16:50brianstamandTeXnomancy - Thanks. And yes, that's what I meant :)
16:50defnamalloy: Wisconsin
16:50chouserninjudd: when does the server decide to close the socket?
16:50esjnickik: I was just talking to relevance about that yesterday. They're trying to arrange it, and looks like it may be possible.
16:51chouseramalloy: http://clojure-conj.org/
16:51defnty chouser
16:51amalloydefn: heh. can't help you much with getting there; i'm coming from san francisco
16:51defnamalloy: flying i assume?
16:51amalloyi was planning to walk, but i guess your idea is better
16:52defnhaha
16:52nickikthe titels of the presentations alone make me dribble but there is know way I can fly to america
16:52lancepantzthat's like 1 5-6 day drive
16:52jolyesj: nickik: video or audio/slides would be awesome
16:52ninjuddchouser: when the code is done executing, in the case of the 'repl' command, that happens when there is an eof on the client's stdin (which causes the client to close the socket write stream).
16:52nickik@esj cool would be great
16:53defnlancepantz: haha ive done Wisconsin to New York, and Wisconsin to Alaska -- you can do it in less, but it requires an intense sense of purpose
16:53esjnickik: its apparently mucho expensive. I said I'd be willing to put cash towards it, and that I'm probably not the only one. Getting the videos would be a major win. rhickey's videos were a large part of what drew me into clj, and I doubt I'm alone.
16:53nickikaudio and slides are sufficien
16:54nickik@esj i wanted to pick up scala when I discoverd the videos :)
16:54ChousukeI hope the questions will be audible too :P
16:54esjChousuke: always somebody wants the impossible :)
16:54defnI just want to see what all of the Clojurians are wearing! Will there be a red carpet?
16:54nickik@esj just audio should be expensive, would it?
16:55ChousukeIn most presentation recordings I watch/hear the QA session goes like "... yes ... "oh good question <blah blah>" ... "no" ..."
16:55defnChousuke: good presenters restate the question
16:55ChousukeIt's easy to forget though.
16:55defn*nod*
16:55esjnickik: i have no idea, relevence say so, and they strike me as not being in the habit of being incorrect.
16:55defnamalloy: let me know what you decide, will you?
16:56defnwe could split a room -- that'd cut costs a bit
16:56nickikthey could open a pool to raise money for it. I would pay for them and I think a lot of people from europ would
16:56amalloydefn: yeah, that was the main thing i was thinking. but jeez flights to NC are a lot longer and more expensive than flights to denver :P
16:57nickik*too
16:57anonymouse89I'm running into a lack of understanding of namespaces. For my purposes I have a namespace foo.core which contains -main. I need main to take stuff defn'd in an external file, put it into foo.a namespace.
16:57esjnickik: that's what I expressed, and I think they'll do that if they can't arrange it on their own bat. Can't hurt to let them know you'd be keen, though...
16:58amalloydefn: yeah, sorry, i don't think i want to spend $1000 and two work days on the conj
16:58anonymouse89right now I'm trying to load-file and then intern the function into foo.a, but this is not working (java.lang.Exception: Can't create defs outside of current ns)
16:59nickik@esj lets hope for the best. thx
16:59Raynesamalloy: Sneak in in ninjudd's luggage.
16:59ninjuddcarry on
17:00amalloyoh, ninjudd lives near sf?
17:01nickik@anonymouse89 you want to define something in a other namespace? You should do that. Whats the usecase?
17:01ninjuddamalloy: no. encino
17:01amalloydamn. i was hoping i could just stalk you when i want more cake features
17:03lpetitrhickey: just for knowing, would you accept a patch to clojure to add to clojure's META-INF/MANIFEST.MF the relevant OSGi meta-data (static parts such as Export-Package, Symbolic name, etc. ; and dynamic part for the bundle version) ?
17:03anonymouse89nickik: it's a genetic programming system. The user is defining an error-function in an external file and then passing the path to that file as an argument.
17:03clojurebotnamespaces 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:03lpetitnothing's ready yet, just asking to know how you would feel with such a patch
17:08nickik@annonymouse89 the new file should become a new namespace?
17:10anonymouse89nickik: the user is giving me a fn written in clojure in its own file without a namespace declaration. I need that to be put into a specific namespace where it will be accessible by other functions that use it.
17:11@rhickeylpetit: are they completely generic (i.e. not per app)?
17:12lpetitGood point.
17:12lpetitThey would be generic, or not be, indeed.
17:12chouseranonymouse89: try (binding [*ns* (the-ns 'users-ns)] (load-file ...))
17:13chouseranonymouse89: you'll need to set up that namespace first, perferrably with the ns macro
17:14nickik@chouser the version i was thinking about wouldn't have been that clean :)
17:25AWizzArddefinlined functions can be used first-class values yes and go into function positions yes? This is the difference to macros.
17:26KirinDave Hum
17:26KirinDaveWhen writing a macro for a def form
17:26KirinDaveWhat's the idiom for inserting metadata on the defined symbol?
17:26KirinDave^{...} doesn't seem to work
17:26AWizzArdKirinDave: with-meta
17:26KirinDaveAh
17:26AWizzArdhttp://github.com/clojure/clojure-contrib/blob/maven/src/main/clojure/clojure/contrib/def.clj#L39
17:27nickikhttp://99-bottles-of-beer.net/language-dylan-225.html <- can I do something like this (the <integer> / 1 multimethod part) in clojure without making a specific dispatch value for that case?
17:31raekKirinDave: ' ^{...} foo ; this also works
17:31KirinDaveraek: In a macro?
17:31KirinDaveIt is not working...
17:31raekah
17:31raeksorry
17:32raekwhen you have the symbol as a value, the with-meta is the way to go
17:32raekmy example was for symbol literals with metadata
17:32anonymouse89chouser: thanks, not sure if that's exactly what I need but it's given me ideas
17:33AWizzArdfor literal symbols it should work, yes
17:34raek^{...} ' foo ; puts metadata on the (quote foo) list
17:34duncanmraek: ah, ns-unmap fixed it
17:35AWizzArdIs it the compiler which expands definlines?
17:37amalloynickik: i don't think so
17:38lancepantzif i (use 'foo) in user, then running (ns-refers 'user) should contain mappings for the fns in foo, correct?
17:42nickik@amalloy would be a cool.
17:43nickikIn dylan you don't have to say (defmulti ....) every time you can just wirte (defmethod ...) and if there is no multimethod it creats one
17:43erikcw1was gen-and-load-class removed from 1.2?
17:46amalloynickik: but (defmulti) is more flexible; you specify a dispatch function, which could be simple equality like in this case, or could be based on class (more common), or on...size of the input collection, or whatever
17:49nickikamalloy: yes but would it just be handy if there was a standerd function provieded (if a stupid on like class or a complicaded one could be decided later)
17:53amalloynickik: what if the defmethod were parsed and compiled before the defmulti were ever created? it's easy to imagine that causing problems
17:55amalloyie the compiler defaults to a defmulti on class, then assigns your method to it; then someone defines a multi with a similar name; i don't think it's reasonable to expect the compiler to dive into code belonging to another class/file and undo some bindings
17:55Nathan2Hey, I'm trying to define a function that gives a nested iteration like the for-macro. I can't use for because I don't know ahead of time how many sequences I'm looping over. I solved it with recursion, and I wonder if that's the best/most idiomatic way.
17:56Nathan2My attempt: http://paste.lisp.org/+2GSI
18:00amalloynathan: my guess is no, there must be a better way to do this, but i'm not sure what it is. with so many nice language constructs having to do recursion by hand is a warning sign
18:01AWizzArd,(instance? Long)
18:01clojurebotfalse
18:03amalloynot very helpful, i know; i'll have a go at fixing it up to make your current solution more idiomatic, at least
18:06Nathan2That's what I felt as well! But I couldn't think of a way without resorting to a macro that leveraged 'for'
18:07jjido,(list "a")
18:07clojurebot("a")
18:07jjido(conj "a" nil)
18:07jjido,(conj "a" nil)
18:07clojurebotjava.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IPersistentCollection
18:07jjido,(cons "a" nil)
18:07clojurebot("a")
18:09joly,(conj nil "a")
18:09clojurebot("a")
18:09jjidojoly: ok I got it backwards ;)
18:09jolyjjiddo: :)
18:10amalloyNathan2: the first/rest thing is way un-idiomatic, particularly. that looks a lot better with desctructuring
18:12Nathan2amalloy: That's true.
18:15amalloyhm, i seem to have broken emacs's automatic gisting
18:15Nathan2I was trying to think of a way to use reduce, but I still feel that it would require something recursive-esque... like reduce returing functions that further reduce... or something like that.
18:16amalloyhttp://gist.github.com/605420 is a (horribly-indented) version that uses destructuring
18:16amalloyit's not tested, either; i just tried to quickly add in destructuring
18:17alexykninjudd: can you run cake client on one box and jvm on another?
18:18alexyke/g/ eval'ling from TextMate on a puny mac in a monster JVM on a gigaserver
18:18ninjuddcurrently, no. but you can implement it if you want :)
18:19ninjuddalexyk: the hard part will be stopping and starting the jvm remotely
18:19alexykninjudd: yeah
18:20alexykhow about li'l popups "tell servant to restart jvm"
18:20Chousukenet send ... :P
18:20alexykI meant "tell intern"
18:21alexykover their tidy ssh tunnels
18:22lancepantzalexyk: so are you using textmate for clojure dev now?
18:23alexykninjudd: now that I have a monolithic jiraph jar, how can I import jiraph.tc as tc? *rusty*
18:23alexyklancepantz: yep, I always prefer TextMate these days
18:24alexykalthough I used Emacs since 1994... "When facts change, my opinion changes; and yours, sir?"
18:24ninjuddalexyk: you mean? (require '[jiraph.tc :as tc])
18:24Nathan2amalloy: That version does look a lot neater.
18:24alexykninjudd: I used to have that and it fails for some reason now... let me see
18:26amalloyNathan2: but does it work?
18:28ssiderishello, does anyone know if leiningen supports "source" dependencies?
18:28ssiderisas in non-jarred clojure files that are not in the procject's dir structure
18:28alexykninjudd: looks like no jiraph__init.class or jiraph.clj in jiraph-0.5.0-SNAPSHOT.jar built by cake install?
18:30ninjuddalexyk: are you in the deftype branch?
18:30alexykyep
18:30ninjuddthere is no jiraph or jiraph.tc in that branch
18:30Nathan2amalloy: Yep, it looks to work the same: (take 4 (nested2 (range) [:a :b])) ----> ([0 :a] [0 :b] [1 :a] [1 :b])
18:31ninjuddif you want the old jiraph.tc ns, use master
18:31ninjuddotherwise, the interface has changed quite a bit
18:31alexykninjudd: that explains it :) So: I actually use tokyo cabinet part of jiraph. How do I do that now?
18:32Nathan2I tried looking at the source of the 'for' macro... it's pretty hairy.
18:32ninjuddalexyk: jiraph.tokyo-database, but like i said, it has changed quite a bit
18:32alexykninjudd: ok...
18:33ninjuddalexyk: uses protocols. the protocol for tokyo-database is in jiraph.byte-database
18:33alexykninjudd: should master cake install under clojure 1.2?
18:33alexykmeaning master of jiraph cake-install...
18:34ninjuddalexyk: it is on clojars, if that's what you mean
18:35alexykninjudd: and playing nicely with clojure 1.2?
18:35ninjuddalexyk: not sure. i haven't tried
18:35alexykok
18:38nickikWhy is this not working when i pass a string? http://paste.lisp.org/display/115075
18:42nickikdamn! that should work!
18:46brianstamandWhy does lein try to run my jar after it jars it?
18:47brianstamandOr I should say before. Since it isn't creating the jars :p
18:48brianstamandWhenever I include a :main it does it
18:51raeknickik: try (ns-unmap 'the-ns 'the-var)
18:52raekand then reavluate the defmulti
18:53raekdefmulti now has defonce semantics...
18:56nickik@reak I see i tought its something like this the function is now called foo :)
18:56nickikwhy was that added=
19:00nickik@raek this is the final version but know the bunny stuff doesn't work http://paste.lisp.org/display/115078
19:00nickikthe type stoff works
19:08amalloynickik: the nested ifs there are weird. i don't know much about multimethods, but surely this should be a cond
19:08amalloy(cond (seq rest) (...) xspec xpec :else (class x))
19:11nickikbut that should matter that just a other way of coding it (the better one)
19:13amalloyyes
19:13amalloylike i said, not exactly a multimethod pro here
19:26amalloynickik: http://gist.github.com/605491 should also be identical but even shorter and clearer, but for some reason the :as thing is failing to compile. anyone know why?
19:26alexykninjudd: interesting setup difference, on mac cake proto instaleld protoc fine, on linux says: [install-protoc] sudo: sorry, you must have a tty to run sudo
19:26alexykI do have sudo, but it thinks it's not in a tty
19:27alexykI can run sudo cake proto from command line, but cake still wants sudo
19:27ninjuddalexyk: mind opening an github issue on clojure-protobuf with details?
19:28alexykninjudd: sure if it's not my setup
19:28nickik@amalloy can you use :as after &? Somebody was faster then me (and better) look at it here http://stackoverflow.com/questions/3834263/is-clojures-multi-method-dispatch-truly-superior-say-to-what-i-can-do-in-pytho
19:28ninjuddalexyk: sounds like a real bug
19:29alexykninjudd: my sudo is also weird on that system, not remembering my password for a few minutes
19:29ninjuddhmm
19:29alexykwell it does in fact
19:29alexykso it's cake
19:30ninjuddalexyk: just install protoc manually for now. it will probably be a few weeks before i'll find time to figure out a workaround
19:30amalloynickik: you can use :as after &; the same binding works when i evaluate it in a let[], but fails in a defn[]
19:31nickikcan't say why
19:32JorejiHey guys, what do I have to do in order to have a record be a clojure.lang.Sequential?
19:32amalloynickik: i see why; one of the comments in the link you gave me shows the right way to do it
19:32alexykninjudd: did manual install, it still wants to sudo... how does it check for protoc? simply in path?
19:33JorejiIs there some way to provide Sequential-like behavior (which is... according to repl-utils/show... no behavior at all...) to a record?
19:33ninjuddalexyk: yes
19:33alexykninjudd: taking path from current shell or login?
19:34ninjuddshell
19:34amalloynickik: http://gist.github.com/605501 shows the right way to use :as
19:37nickikah ok good to know
19:37amalloyJoreji: just (seq myrec), right?
19:37nickikso im going to bed
19:37nickiknight
19:37amalloythat gives you a seq of key/value pairs
19:38Jorejiamalloy: but: (sequential? myrec) => false
19:39Jorejiamalloy: I would like to be able to use flatten on a record which has children. But flatten filters out everything which is not a sequantial.
19:40ohpauleezwhat's the correct way to do (not (nil?))
19:41ohpauleezI feel like there's a more idiomatic way to do it, but I'm drawing a blank
19:43cemerickrhickey: ping
19:43@rhickeycemerick: hey
19:44cemerickrhickey: Evening :-) Do you have a sense for what your time horizon is on mqREPL?
19:45@rhickeycemerick: I babbled a bit earlier
19:45@rhickey...
19:45cemerickI can go check the logs
19:45@rhickeyit's a bit more refined now, essentially I see two pretty distinct use cases
19:45lancepantzso is nREPL now mqREPL or are you continuing work on nREPL as well cemerick ?
19:45@rhickeycommand server and repl server
19:46@rhickeynrepl as it stands is kind of a hybrid
19:46@rhickeyrepl
19:46@rhickey input is stream, can (read) from *in*
19:46@rhickey outputs streams *out*/*err* are interesting to clients
19:46@rhickey needs a stronger notion of session (for *in*/*out* association)
19:46@rhickey context survives from one call to next
19:46@rhickey e.g. (def x 42), *e *1 *2. *ns*
19:46@rhickey set!s of bindings, *ns*
19:46@rhickeycommand server
19:46@rhickey each message single readable object
19:46@rhickey eval it, generate single return
19:46@rhickey eval in what ns?
19:46@rhickey no in or out streams
19:46@rhickey or per server, not per session?
19:46@rhickey or capture output only during command execution?
19:46@rhickey flush and drain
19:46@rhickey no session notion
19:46@rhickey no enduring context
19:46@rhickey except changes to global namespaces
19:47cemericklancepantz: things are up in the air at the moment
19:47@rhickeyI think what you've got could be repl server if it handled *in* better. Maybe I'll just let tool users force you into that :)
19:47@rhickeybut a command server really should have no context
19:48@rhickeycemerick: I think all you need to do is get away from command is in a single message
19:49@rhickeystick a little streamifier on input that tracks message ids
19:49cemerickHaving the side channels for the streaming bits is a fine enhancement to make to what's there now.
19:49cemerickBut it absolutely must retain discrete return values.
19:49@rhickeywhen repl erad returns, it can grab the last id from the special instream, then bind it to *in* and eval
19:49@rhickeyread
19:50@rhickeycemerick: yes, discrete results
19:50@rhickeycould interleave *err* and *out* fragments
19:50@rhickeyfor async output
19:50cemerickrhickey: that's what I was implementing yesterday morning
19:50@rhickeyI think *err* and *out* should be separate
19:51cemerickagreed
19:51@rhickeyin any case, as I think more about command server, I think it would probably like to leverage more of the mqs
19:51@rhickeyfor instance there's nothing precluding multiple command servers consuming same queue, and dynamic reply-to queues for results
19:52cemerickThat's decidedly out of scope for me, at least right now.
19:52@rhickeyso, I think you should proceed with nrepl and I'll play around with command server on stomp/mq
19:52@rhickeythey are different, and a command server will never be a suitable repl given the lack of context
19:52cemerickrhickey: your positions on protocols and such notwithstanding?
19:53@rhickeywhether you switch to stomp for your API is a separate question, but I think the stomp for retargeting over mqs is not as important as stomp for transport independence and free clients
19:54@rhickeyin any case, something that wanted to be both a repl server and command server would have to have two distinct modes for the input queue, and separate queues for results and outstreams
19:54@rhickeyhalf of which wouldn't be used for each use case
19:55@rhickeyso repl server and command server
19:56@rhickeybut I think you should evaluate stomp strictly with the repl server use case in mind, and see if it makes sense to you
19:56cemerickIt seems that "command server" is a context-free repl server, suitable for use over MQs.
19:56@rhickeycontext free and different input semantics
19:57@rhickeyand session-free
19:57@rhickeyand proper destination notion, for reply-to
19:57cemerickI'd group all the issues around streams and connection state/session under "context", but sure.
19:57@rhickeyso, connection-free really
19:58JorejiCommon guys, there must be some way to have (sequential? my-rec) return true?
19:58@rhickeyit's quite different when you put it all together
19:58cemerickIndeed.
19:58cemerickFunny how we start and finish this thing in roughly the same positions where we started, at least from where I sit. :-)
19:59@rhickeyas you your current wire protocol, I have to admit to really not liking it. I don't think you serve non-Clojure clients by making it newline terminated drivel
19:59@rhickeyI wouldn't be afraid to pass/return Clojure data literals, they aren't hard to construct in any language that has strings
20:00cemericksheesh
20:00@rhickeythe nthe question is do you put that payload in a standard protocol like stomp
20:00@rhickeysorry, dribble
20:00@rhickeynot drivel
20:00@rhickey:)
20:01cemerickironically enough, stomp is newline- and NUL-terminated
20:02@rhickeyafter all, that is what you are going to get back, right?
20:02cemerickwhat, clojure data literals?
20:02@rhickeycemerick: but don't get confused about the headers (for the server) and the body (for us)
20:02@rhickeycemerick: yes
20:03cemerickanyway
20:04@rhickeyhttp://gist.github.com/605527
20:06@rhickeyi.e. structured messages, the stomp frames are for stomp
20:06cemerickso all clients would need to have a clojure reader impl?
20:06@rhickeycemerick: that's what I asked before, isn't that what they are going to get back anyway?
20:06@rhickeyclojure data?
20:07cemerickno, they're getting strings back
20:07@rhickeystrings with what in them?
20:07cemerickresults from *out*, *err*, and (pr-str last-value)
20:07cemericknone of which are guaranteed-readable
20:08@rhickeycemerick: I guess if all they are doing is client-side printing, still thinking about programmatic use...
20:09@rhickeyanyway, I'll get my use case out of your hair, and trust you and the tools guys to agree on something great
20:09cemerickrhickey: no, tools would be sending expressions that they expect to return readable forms
20:09cemerickThat's a client issue, though.
20:10@rhickeyyou don't need a full reader to read {:result "string" :out "string"}
20:11@rhickeybut why not make it easiest for Clojure devs?
20:11cemerickClojure devs I'm not worried about at all -- they'll be using the provided client anyways.
20:12@rhickeycemerick: ok
20:13@rhickeywell, the important think is that nrepl should proceed, and focus on repl, not leaving out any human needs
20:14@rhickeyI've gotten far enough in the design to see that command server is a different beast, mqrepl is likely to fall by the wayside unless it falls out of your work
20:15@rhickeysorry for the distraction
20:33defnDoes anyone know if clojure-conj registration is refundable?
20:35defnAlso I remember seeing discounted room rates for conference-goers -- do those rates still exist or have they all been sold?
20:35Raynesdefn: They exist through October 8th, I believe.
20:36defnAh I was missing the link -- found it
20:36defnThanks Raynes
20:37defnI think I'll get 2 doubles just in case there are any smoking hot femme-Clojurians
20:38defnThinking about that though, why would I want 2 doubles?
20:38amalloydefn: to lull them
20:38defnamalloy: haha
20:39defn"No it's cool! There's /two/ beds! Not creepy!"
20:39amalloybecause they wouldn't worry at ALL about sleeping on your other bed...
20:39RaynesAlan told me he booked a room with two 'Queen' beds. I think he was overtired that night. I'm fairly certainly they don't have double queens.
20:39RaynesLike double double isn't good enough for me.
20:39defnRaynes: I know lol -- I sleep on a full with my current girlfriend because we're poor and have no space
20:40RaynesI sleep on a horrid twin sized bed with bent bars underneath. My cousin spent time in Iraq and pointed out that the bed feels exactly the same as what he slept on during that time.
20:40defnI can't imagine being like: "I'm sorry, but queen is not large enough"
20:40defnRaynes: haha, ouch
20:41RaynesI'd put the mattress on the floor and sleep there if I wasn't terrified of spiders and mice.
20:41defnI've flipped my mattress to try and get back that "new mattress feel"
20:41defnno dice.
20:41RaynesNot really scared of either of them, but they're much more intimidating when you're asleep.
20:41RaynesRoll over on a mouse and wake up with rabies.
20:42defnI once was in Belize on a little Caye out in the middle of the ocean
20:42defnI had a cockroach half the size of my mind put a couple legs in my mouth
20:42defns/ming/hand
20:42defngrr, mind*
20:42Raynes._.
20:42RaynesI was about to comment on your excruciatingly tiny mind.
20:42defnI was about to challenge you to a duel.
20:43Raynes"[
20:43Raynes:p*
20:43dnolenso what was the verdict on an inclusive take-while again?, speaking of which, keep is really cool.
20:45defndnolen: care to explain keep?
20:46dnolen,(first (keep [nil nil nil 1 nil]))
20:46clojurebotjava.lang.IllegalArgumentException: Wrong number of args (1) passed to: core$keep
20:46defn(doc keep)
20:46clojurebot"([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."
20:46dnolen(first (keep identity [nil nil nil 1 nil]))
20:46dnolen,(first (keep identity [nil nil nil 1 nil]))
20:46clojurebot1
20:46defn(map keep [nil nil nil 1 nil])
20:47defn(keep true? [nil 1 true nil])
20:47defn,(keep true? [nil 1 true nil])
20:47clojurebot(false false true false)
20:47defncool.
20:47amalloy,(map #(keep identity %) [nil 1 nil nil 2] [3 nil])
20:47clojurebotjava.lang.IllegalArgumentException: Wrong number of args (2) passed to: sandbox$eval8265$fn
20:48amalloy,(map #(keep identity %) [[nil 1 nil nil 2] [3 nil]])
20:48clojurebot((1 2) (3))
20:48defnthat's just magix
20:48defnmagic
20:49RaynesThat's awesome.
20:49defnit'd be neat for optional args, i think
20:51dnolen,((fn [& [x & rest :as all]] [x rest all]) [1 2 3])
20:51clojurebot[[1 2 3] nil ([1 2 3])]
20:52dnolenoops
20:52dnolen,((fn [& [x & rest :as all]] [x rest all]) 1 2 3)
20:52clojurebot[1 (2 3) (1 2 3)]
20:52dnolenalso awesome
20:52defn,(let [args [nil 1 "foo" "sometimes" nil nil 100]] (keep identity args))
20:52clojurebot(1 "foo" "sometimes" 100)
20:53defn,(class "foo")
20:53clojurebotjava.lang.String
20:53chouser,(class (class "foo"))
20:53clojurebotjava.lang.Class
20:53defn,(class (class (class "foo")))
20:53clojurebotjava.lang.Class
20:54defnif you do anymore of those the world explodes.
20:54defnor something...
20:54defnchouser: are you going to check out hillary mason's talk at strangeloop?
20:54defni think that looks like my highlight next to seeing Guy Steele
20:56defnand of course ill be going to your talk :)
20:59amalloy,(nth (iterate class 1) 1000)
20:59clojurebotjava.lang.Class
21:00amalloydefn: no explosions!
21:00defnI don't believe it.
21:00amalloytruly a miracle of nature
21:00defnNow verbalize what's going on there in your head. That will give you schizophrenia at least I think.
21:01amalloyanyway goin home now. ta ta
21:01defnamalloy: you get your ticket for clojure-conj?
21:01defnamalloy: im about to book a room, wondering if you want to split a room for a couple nights...
21:02amalloydefn: afraid not; i mentioned earlier that i decided not to go, but i guess you missed it
21:02defnah yeah, i had a kernel panic :X
21:02amalloyhaha
21:02amalloybye
21:02defnamalloy: if you change your mind let me know, im getting 2 doubles regardless
21:02defnciao
21:06JorejiWhat's the difference between clojure.lang.ASeq and clojure.lang.ISeq?
21:10defnJoreji: someone is probably going to correct me but I think it has to do with rest, vs next
21:11JorejiAh okay. I was hoping for ASeq to be a protocol. Too bad.
21:13cais2002(good morning)
21:13defn=> true
21:13cais2002is there an existing function that could do (index-of [1 2 3 6 5] 6) => 3
21:14defn,(get [1 2 3] 2)
21:14clojurebot3
21:15Joreji,(.indexOf [1 2 3 6 5] 6)
21:15clojurebot3
21:16Jorejicais2002: Found that using auto-complete-mode, in case you are using emacs.
21:21cais2002joreji: thanks. using vim
21:22defncais2002: sorry i misunderstood
21:22cais2002aikes, I thought defn is a robot ...
21:23defnclojurebot: skynet?
21:23clojurebotI will become skynet. Mark my words.
21:23Raynes-> (first (keep-indexed #(when (= 6 %2) %) [1 2 3 6 5]))
21:23sexpbotjava.lang.SecurityException: Code did not pass sandbox guidelines: (#'clojure.core/keep-indexed)
21:23RaynesBleh
21:24Raynes,(first (keep-indexed #(when (= 6 %2) %) [1 2 3 6 5]))
21:24clojurebot3
21:24defnwhat breaks the sandbox there?
21:24Rayneskeep-indexed.
21:24RaynesIt's just not whitelisted.
21:24defnah
21:26chouserdefn: yeah, Hillary's talk looks interesting
21:28defnher tweets are really interesting all the time
21:28defnso i figure it'll be cool
21:29defnfor instance, she took a few days of tweets and showed the distribution of possible spellings for "fuck" :D
21:29defn"FuuucuuuuuuuCCCKKKKK" 5, "FUCK" 10000, etc. heh
21:31chouserhm, edifying
21:31defnobviously she's doing God's work
21:51brianstamand.
21:52ossarehchouser: you'll be loving everyone in that case, http://www.skynetlovesyou.com/
22:03pjb3trying to install clojure-contrib from master
22:03pjb3FAIL in (writing-attributes) (test_jmx.clj:79)
22:04chouserossareh: I don't get it.
22:19jk_does this code create a new set every time i call it? (defn jar? [file-name]
22:19jk_ (let [jar-types #{"jar" "zip" "rar" "war" "ear"}]
22:19jk_ (boolean (jar-types (extension file-name)))))
22:20_rata__hi
22:31ossarehchouser: it was lame :)
22:35chouserjk_: let's find out!
22:36chouser,(let [f (fn [] #{"one" "two" "three"})] (identical? (f) (f)))
22:36clojurebotfalse
22:36jk_bummer
22:36jk_:)
22:36chouserhm, I'm mildly surprised
22:36jk_chouser: nice way to test it though
22:37chouserwell, it means the root node is different
22:37chouserit doesn't prove there's no internal sharing
22:37clojurebotsharing is caring
22:37jk_i see :)
22:38jk_chouser: but if i plan to do something like that, i should def the set ahead of time?
22:38chouserhmmm
22:39jk_.1
22:39jk_.(1)
22:39jk_waht triggers the clojurebot?
22:39hiredmanchouser: why would they not be the same?
22:39hiredmaner
22:40hiredmanwhy would they be?
22:40hiredmanthe read in set is the same, but it has to be evaluated/created each time the function is called
22:40chouseronce read, why wouldn't it just return the thing that was read
22:40TheBusbyjk_: ,(printfln "comma's trigger the bot I think")
22:40TheBusbyjk_: ,(println "comma's trigger the bot I think")
22:41TheBusbynmind...
22:41jk_lol
22:41hiredmanbecause if it did it like that functions like (fn [x] #{x}) would return a set with the symbol x in it
22:46jk_hiredman: doesn't it actually do that though? doesn't the function argument simply shadow any def from the outer scope? just askng...
22:46hiredmanah
22:46hiredmanno
22:47hiredmanI mean it would return literally the symbol x inside a set
22:47hiredmanpassing it through from the reader like chouser is suggesting is what quote does
22:48chouser,(let [f (fn [] '#{"one" "two" "three"})] (identical? (f) (f)))
22:48clojurebottrue
22:48chouserha! fascinating
22:48hiredmanall the collection types have a static create method that takes an array
22:48jk_.(true)
22:50hiredmanso I imagine the emmited byte code pushing the functions args on to the stack, makes an array, and then calls the static method
22:50hiredmanand the static method doesn't know it's recreating the same thing again
22:52jk_hiredman: umm you mean it's making an array of the stuff in the set literal that from from the function body? and then calling the method. there is no arg
22:53jk_wow that was seriously mangled
22:53hiredmanoh, the jvm is a stack machine so args are most implicit
22:53hiredmanmostly
22:53jk_ok, i see what you're saying
22:54hiredmanyou build up stuff on the stack then invokestatci Some.method some-arg-types some-return-type
22:54hiredmanwhich is really weird
22:54hiredmanthe types are arguments but the values are implicit
22:54hiredmanbut the types aren't really arguments for the method, they are for linking the correct method
22:56chouserI guess it would have to detect at compile time that the contents are all constants
22:56chousera lot of work to just save the user from a '
23:01amalloychouser: plus it would make it impossible to get the opposite behavior. the way things are now, you can either quote it, or close around the value you want to be constant, right?
23:05jk_so the answer to my original question is yes, it's creating a new set every time unless i quote it in the let so the reader doesn't evaluate it. is that correct?
23:07amalloyjk_: it seems that way, but i wouldn't be surprised to learn that that's an implementation detail you shouldn't rely on
23:08jk_amalloy: but i have to rely on it if i need to understand the program behavior. why would i want to create potentially millions of objects when it's completely unnecessary?
23:09amalloy,(let [c #{1 2 3}, f (fn [] c)] (identical? (f) (f)))
23:09clojurebottrue
23:09amalloy*that* you can rely on for sure
23:09amalloyi wouldn't be 100% confident about the quoting trick unless i read docs that said it works
23:10jk_,(1)
23:10clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
23:10amalloy,1
23:10clojurebot1
23:10jk_aha! it's the comma :)
23:10amalloyyes
23:10amalloy->(inc 10)
23:10sexpbot⟹ 11
23:11jk_or arrow :)
23:11amalloyif you want to double-check, you can pit the bots against each other :)
23:12jk_amalloy: so your second formulation works because you closed over the set that was created without the quote. i really don't see anything different there than what hiredman was saying
23:12jk_passing it through the reader does actually create the set
23:13jk_amalloy: that is to say, your demo doesn't really address the quote question at all
23:13amalloyno, it doesn't. the quote question seems to work now, but i have no reason to think it's guaranteed
23:13amalloyunless i can find that in some docs
23:14jk_amalloy: i should add... according to my interpretation as a clojure newbie! not trying to pass myself off as very knowledgeable :)
23:15laurusWhy is a floating point number rounded in operations rather than a java.math.BigDecimal number?
23:15laurusEr, when a java.math.BigDecimal number is not?
23:15amalloyjk: i'm just saying that the language definitions guarantee that if you close around a reference, that reference will stay the same; i don't know the language well enough to know if they specify that this works for constructing quoted values also
23:15ninjuddchouser: ping
23:16amalloylaurus: because floating-point numbers followw the IEEE floating-point spec, which says they only get to use N bits of precision
23:16amalloyBigDecimal is a class for when you want more than that
23:16laurusamalloy, what determines that N?
23:16amalloylaurus: http://en.wikipedia.org/wiki/IEEE_754-2008
23:18amalloyif floating-point numbers never got rounded, you couldn't divide 1 by 3; defining a standard point at which they round improves portability and consistency
23:18laurusamalloy, only if you demand that 1/3 become a decimal, right?
23:19amalloyand that's what floating-point numbers demans
23:19amalloyif you want something else, use ratios:
23:19amalloy,(/ 1 3)
23:19clojurebot1/3
23:19laurusSo why isn't everything just BigDecimal then?
23:20hiredmanbds are slower than primitives
23:21laurusI'm kind of not sure when to use each one
23:21jk_,(:a '{:a "aaa" :b "bbb"})
23:21clojurebot"aaa"
23:21hiredmanfloating point is icky so never
23:21laurushiredman, so instead of 1.25 I should always write 1.25M?
23:21jk_that just doesn't seem right. :\
23:21laurusFor example
23:22amalloylaurus: it depends on what you want. why is 1+1=2 instead of 11? either one is an operation that can be useful
23:22hiredmanlaurus: are youwriting a lot of floating point literals?
23:22amalloyif you want precision, use BDs or ratios
23:23laurusamalloy, right, that makes sense
23:23laurushiredman, no, I'm reading _Practical Clojure_ and looking over my question marks :P
23:23amalloylaurus: but yeah, as hiredman implies, if you're using a lot of floating-point numbers then you'll probably know already what kind you want. if not, it usually won't matter
23:24jk_can someone explain why that works? (:a '{:a "aaa"}) how can that work when the quote should keep there from even being a map to work against?
23:24amalloyjk_: the quote just prevents anything inside it from being treated as a function
23:24laurusThanks for the explanation of something so basic to programming :)
23:25amalloy(or as a variable)
23:25amalloy,(let [a 10] ['{:val a} {:val a}])
23:25clojurebot[{:val a} {:val 10}]
23:25laurus,(re-matches #"[a-zA-Z]* " "test123")
23:25clojurebotnil
23:25abedrais there another way to read metadata on a multimethod that I am missin
23:25abedramissing
23:25jk_amalloy: oh, ok. i see. it still gets evaluated
23:25laurusI don't understand why that doesn't match the string "test".
23:25amalloylaurus: you left a space after the *
23:26abedraother than (meta (var foo))
23:26laurusamalloy, yeah, I think that's a typo in the book
23:26amalloy,(re-matches #"[a-zA-Z]*" "test123")
23:26clojurebotnil
23:26amalloyhm. i guess i've never used re-matches
23:27laurusamalloy, "Returns the match, if any, of string to pattern, using java.util.regex.Matcher.matches()"
23:27laurusSo that's a standard Java regex matcher apparently
23:28amalloyyeah, but it's been like five years since i used java for regexes :P
23:28laurusMe too ;)
23:28laurusWell, in my case, never :P
23:28laurusI'm so used to the Python regexs, which I think are basically the same as Perl and JavaScript
23:28amalloyhttp://download.oracle.com/javase/1.4.2/docs/api/java/util/regex/Matcher.html#matches%28%29
23:29amalloymatches() tests whether the whole thing matches
23:29laurusAh, "the entire input sequence"
23:29laurusI mean, it's kind of obvious from the behavior it just showed, it's just hard to believe for someone steeped in the Perl-style regexes
23:29amalloyuse find() instead
23:30amalloy,(re-find #"[a-z]+" "12test123")
23:30clojurebot"test"
23:31amalloylaurus: java uses PCRE. you won't find any surprises in how the regexes behave, just in the API to get at them
23:32laurusamalloy, oh, I see, thank you for that clarification
23:32amalloy(and since you're doing it from clojure, the APIs were going to be a surprise anyway!)
23:33laurus:)
23:33amalloyheh, there is something comically broken about lein repl when i boot into cygwin
23:34amalloyit works fine, and then when i C-d to get out of the repl, the prompt appears but refuses to accept input
23:35laurusHeh. I had a similar problem with a shell in Emacs I think
23:36amalloyi could boot into ubuntu but i'm already using windows...and for some reason the unix server at work isn't accepting ssh, so i'm stuck with cygwin
23:36laurus:|
23:38laurus,(re-groups (re-matcher #"[a-zA-Z]*" "test"))
23:38clojurebotjava.lang.IllegalStateException: No match found
23:38laurusWhat's up with that?
23:40amalloyyou need to ask the matcher to match something first
23:40laurusAh, thanks.
23:41laurusI'm probably too tired to be doing this :P
23:41laurus"returns the groups from the most recent find/match" went right over my head :|
23:41amalloy,(let [m (re-matcher #"a" "a")] (.lookingAt m) (re-groups m))
23:41clojurebot"a"
23:41TeXnomancyz_
23:41amalloyTeXnomancy: is that so
23:42TeXnomancywups; baby on the keyboard
23:45amalloywhere's the doc for clojurebot? i see people making him do cute tricks, but all i know is the ,expr syntax
23:45amalloyclojurebot: clojurebot?
23:45clojurebotclojurebot is not a benchmarking platform
23:46amalloyclojurebot: help?
23:46clojurebothelp is http://clojure.org
23:46laurus,(re-groups (re-matcher #"(a)b" "ab"))
23:46clojurebotjava.lang.IllegalStateException: No match found
23:46laurus,(re-groups (re-find (re-matcher #"(a)b" "ab")))
23:46clojurebotjava.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.util.regex.Matcher
23:46laurusamalloy, what am I doing wrong?
23:47amalloyre-find is returning a vector of matches; re-groups expects a matcher
23:47laurusRight, but in the second-to-last thing I tried, I passed it a matcher
23:47TeXnomancyclojurebot: source?
23:47clojurebotsource is http://github.com/hiredman/clojurebot/tree/master
23:47amalloy,(doto (re-matcher #"(a)b" "ab) (re-find) (re-groups))
23:47clojurebotEOF while reading string
23:47TeXnomancyif you squint from the right angle, it looks like documentation
23:49amalloylaurus: the second-last thing you tried, you passed it a matcher but hadn't asked it to match yet
23:49amalloythe last thing, you asked it to match and then passed it a vector
23:49laurusUgh, okay.
23:50amalloyTeXnomancy: these commit messages are so helpful. i could probably learn how to use him without even opening a source file
23:53laurusamalloy, it's quite strange, re-matches requires a pattern and a string, but re-find can take those or a matcher.
23:53laurusIs that an inconsistency?
23:54amalloywell, by definition yes. but it's not a bad one
23:54laurusWhy? :)
23:54amalloyre-matches only matches the whole string, so there's no point keeping the matcher around
23:54amalloyre-find will keep getting new matches if you pass it the same matcher, until it runs out
23:54laurusOh, because it'll always return nil for the next one
23:55laurusRight.
23:55laurusThanks. I think I'd better go to sleep.
23:55laurusSomething tells me I would have realized a lot more of this if I'd done it a few hours ago :P
23:55hiredmanmy sarcasm hilight went off for this channel
23:56laurusGood night everyone!
23:56laurusAnd thanks again amalloy :)
23:57amalloyhaha
23:57amalloyhow do i set one of those up, hiredman
23:59hiredmanwith great fortitude and endurance