Re: Hooks library. (Is this clojure-y?)

2009-12-06 Thread Alex Osborne
Allen Rohner writes: > I started playing with the idea of a hooks library for Clojure, > similar to Emacs hooks. > > You can see the code at http://gist.github.com/250575 > > Does this library have the Tao of Clojure? > > If hooks aren't a clojure-y way of doing things, what is? Have you seen Ja

Re: Is it possible to define ordering functions for own type?

2009-12-06 Thread ataggart
On Dec 6, 8:50 pm, John Ky wrote: > Hi, > > Is it possible to define the functions >, <, >=, <=, ==, min, and max for my > own defstruct type? > > My type is: > > (defstruct deadline :value) > > where I initialise value with an object of type long. > > Thanks > > -John The functions >, <, >=, <=

Re: Hooks library. (Is this clojure-y?)

2009-12-06 Thread ataggart
On Dec 6, 9:22 pm, Allen Rohner wrote: > > What is it supposed to do?  What's the usage look like? > > Oh right, a description would be useful. The point is to build up the > functionality of a function from several places. You define a hook > function: > > (defhook foo [a b]) > > Initially, it

Re: Hooks library. (Is this clojure-y?)

2009-12-06 Thread Allen Rohner
> What is it supposed to do?  What's the usage look like? > Oh right, a description would be useful. The point is to build up the functionality of a function from several places. You define a hook function: (defhook foo [a b]) Initially, it does nothing. Then, other code can add hooks: (add-ho

Is it possible to define ordering functions for own type?

2009-12-06 Thread John Ky
Hi, Is it possible to define the functions >, <, >=, <=, ==, min, and max for my own defstruct type? My type is: (defstruct deadline :value) where I initialise value with an object of type long. Thanks -John -- You received this message because you are subscribed to the Google Groups "Cloju

Re: Hooks library. (Is this clojure-y?)

2009-12-06 Thread ataggart
On Dec 6, 7:33 pm, Allen Rohner wrote: > I started playing with the idea of a hooks library for Clojure, > similar to Emacs hooks. > > You can see the code athttp://gist.github.com/250575 > > Does this library have the Tao of Clojure? > > If hooks aren't a clojure-y way of doing things, what is?

Hooks library. (Is this clojure-y?)

2009-12-06 Thread Allen Rohner
I started playing with the idea of a hooks library for Clojure, similar to Emacs hooks. You can see the code at http://gist.github.com/250575 Does this library have the Tao of Clojure? If hooks aren't a clojure-y way of doing things, what is? -- You received this message because you are subscr

Re: The new deftype and multimethod dispatching

2009-12-06 Thread Bob Hutchison
On 6-Dec-09, at 3:46 PM, Meikel Brandmeyer wrote: > Hi, > > Am 06.12.2009 um 21:29 schrieb Bob Hutchison: > >> It turns out that dispatching on play.foo.Foo is the only way that >> works. I was hoping ::f/Foo or f/Foo would work too (maybe my alias >> is >> wrong??). Especially since, with alia

Re: Code improvement: Can this loop be expressed as higher-level function calls?

2009-12-06 Thread samppi
That's incredible: that my big loop could be collapsed into such little code. Thanks a lot; I'm still wrapping my brain around these functions, but they're so awesome. On Dec 6, 1:20 pm, ataggart wrote: > On Dec 6, 11:28 am, samppi wrote: > > > > > > > I've read that loop/recur is less preferabl

Re: The new deftype and multimethod dispatching

2009-12-06 Thread Meikel Brandmeyer
Hi again, I think my example should work. You have to dispatch on `type` not `class`. Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature

Re: The new deftype and multimethod dispatching

2009-12-06 Thread Meikel Brandmeyer
Hi, Am 06.12.2009 um 21:29 schrieb Bob Hutchison: > It turns out that dispatching on play.foo.Foo is the only way that > works. I was hoping ::f/Foo or f/Foo would work too (maybe my alias is > wrong??). Especially since, with aliasing in the user namespace, I can > create a play.foo.Foo us

Re: Is str supposed to be able to output lazy strings?

2009-12-06 Thread Meikel Brandmeyer
Hi, Am 06.12.2009 um 20:13 schrieb Dave M: >> (apply str (map identity [1 2 3])) >> "123" > > API docs for the arguments to apply - "([f args* argseq])"; so the > following is perhaps more straight-forward: Ad the "straight-forward": I think this was just an example to show the lazy-seq issue

Re: The new deftype and multimethod dispatching

2009-12-06 Thread Bob Hutchison
On 6-Dec-09, at 3:46 PM, ataggart wrote: > While there may be a way to work around it, if you're just dispatching > on the type of the first arg, you might want to use defprotocol > instead of defmulti. True, and I likely will for most situations. In what I hope to do, I've got a common situat

Re: The new deftype and multimethod dispatching

2009-12-06 Thread ataggart
On Dec 6, 12:29 pm, Bob Hutchison wrote: > Hi, > > I'm new to Clojure, not new to lisp (CL and scheme), and having a   > thoroughly good time. I've been having a go at the new deftype stuff   > and using a clone of the new branch from the git repository (up-to- > date as of this message being post

The new deftype and multimethod dispatching

2009-12-06 Thread Bob Hutchison
Hi, I'm new to Clojure, not new to lisp (CL and scheme), and having a thoroughly good time. I've been having a go at the new deftype stuff and using a clone of the new branch from the git repository (up-to- date as of this message being posted). So far everything I've tried has worked very

Re: Code improvement: Can this loop be expressed as higher-level function calls?

2009-12-06 Thread ataggart
On Dec 6, 11:28 am, samppi wrote: > I've read that loop/recur is less preferable to using higher-level > function calls like reduce and for and map, especially when chunked > seqs are implemented. But is can the loop below be rewritten to use > those functions instead? It's a loop that iterates

Code improvement: Can this loop be expressed as higher-level function calls?

2009-12-06 Thread samppi
I've read that loop/recur is less preferable to using higher-level function calls like reduce and for and map, especially when chunked seqs are implemented. But is can the loop below be rewritten to use those functions instead? It's a loop that iterates over one vector and changes both the vector a

Re: Clojure development environments

2009-12-06 Thread Phil Hagelberg
Richard Newman writes: > I actually see this in the git log: > > commit 7feddfd95afd6d1af3b3cbd380b4625ec8bdb186 > Author: Phil Hagelberg > Date: Sat Nov 28 20:48:16 2009 -0800 > > swank-clojure-slime-mode-hook must be autoloaded for M-x slime- > connect. > > Thanks to romanroe for

Re: Is str supposed to be able to output lazy strings?

2009-12-06 Thread Dave M
On Dec 6, 1:20 pm, CuppoJava wrote: > This is expected behavior. > > eg. (str (map identity [1 2 3])) > returns "clojure.lang.lazy...@7861" > > The way to think about it is, (str) asks for the string representation > of an object. The string representation of a lazy sequence in this > case is "cl

Re: Clojure development environments

2009-12-06 Thread Richard Newman
> Was that the only function you saw missing? You use the plural, but > that's the only one I've heard problem reports about. There might have been others, but I don't remember any. I hit that one every time I visited a buffer, of course :) That's where it errored, so I imagine any other undefi

Re: create java class instance from type selected at runtime

2009-12-06 Thread ataggart
On Dec 5, 11:48 am, Christopher Wicklein wrote: > Greetings! > > I'd like to create an instance of a Java class like this: > > let [foo (Bar.)] > > but, I'd like the type specified by Bar to not be static, e.g. something like > this: > > let [foo (:type params).] > > but, I can't seem to get this

Re: Is str supposed to be able to output lazy strings?

2009-12-06 Thread samppi
Also, you should also consider simply using the seq function, which is what you should use when you want just to evaluate a lazy sequence: (str (seq (map identity [1 2 3]))) "(1 2 3)" On Dec 6, 11:20 am, CuppoJava wrote: > This is expected behavior. > > eg. (str (map identity [1 2 3])) > returns

Re: Clojure development environments

2009-12-06 Thread Phil Hagelberg
Richard Newman writes: > I'm sure that's how it's supposed to work, but just this afternoon I > had a lot of trouble using a _fresh install_ of Carbon Emacs to > install swank-clojure through ELPA; kept hitting undefined functions*, > and that was after a few failed attempts to install. >

Re: Is str supposed to be able to output lazy strings?

2009-12-06 Thread CuppoJava
This is expected behavior. eg. (str (map identity [1 2 3])) returns "clojure.lang.lazy...@7861" The way to think about it is, (str) asks for the string representation of an object. The string representation of a lazy sequence in this case is "clojure.lang.lazy...@7861". If you want the string re

Is str supposed to be able to output lazy strings?

2009-12-06 Thread Folcon
I just called str on a function and it outputted: "SELECT * FROM QUERY WHERE TYPE='query' clojure.lang.lazy...@a600e679" if this is expected behavior how do you force it to evaluate the sequence before turning it into a string? Regards, Folcon -- You received this message because you are subsc

Possible change to launch script in homebrew

2009-12-06 Thread Christian Vest Hansen
I want to change the clojure launch script in homebrew (a package manager for Mac OS X), but before sending a pull request I want to bounce it off of you guys. The existing script was pretty minimal, and I wanted to at least have it check if rlwrap was available. These are the changes I've made:

Re: Clojure development environments

2009-12-06 Thread Bill Allen
Using the standard snu emacs on ubuntu 8.04 and on windows xp (no jocks about my up-to-dateness), it really was that easy. One difference is that I installed the emacs starter kit which installs elpa and other generally nice packages. Don't let the name put you off. I've been an emacs user for > 2