Associating metadata with keywords

2008-10-07 Thread Matthew D. Swank
This seems strange: (with-meta :foo {:type 'id}) causes: java.lang.IncompatibleClassChangeError (NO_SOURCE_FILE:0) [Thrown class clojure.lang.Compiler$CompilerException] Restarts: 0: [ABORT] Return to SLIME's top level. 1: [CAUSE] Throw cause of this exception Backtrace: 0: clojure.lang.C

Re: Anonymous function syntax in R1053

2008-10-07 Thread Matthew D. Swank
On Oct 7, 12:32 am, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > On Oct 7, 2008, at 1:21 AM, Matthew D. Swank wrote: ... > Here's a similar question and answer from the list archive that   > includes a cool tip for seeing the effect of reader macros: > > > > > On Fri, Mar 14, 2008 at 11:58

Re: Associating metadata with keywords

2008-10-07 Thread Stephen C. Gilardi
On Oct 7, 2008, at 3:19 AM, Matthew D. Swank wrote: > This seems strange: > (with-meta :foo {:type 'id}) > [is an error] From http://clojure.org/metadata: Symbols and collections support metadata, a map of data about the symbol or collection Keywords are not symbols in Clojure and

equality and struct inheritance

2008-10-07 Thread Brian Doyle
I'm attempting to learn Clojure with a long history of OO and have some questions.I've created a defstruct for a place type object like: (defstruct place :id :name :street :city :state :zip) I want to write a function that would take a list of places and remove the duplicates. Duplicates ar

Re: equality and struct inheritance

2008-10-07 Thread Stuart Halloway
Hi Brian, (1) What does it mean to be equal on id and not equal on the other fields? If two fields claim the same id but a different name, how would you know which one to keep? (2) Given some answer to #1, why not store the structs in a map under id? (3) For the geocoded place struct, I w

followup on struct inheritance

2008-10-07 Thread Stuart Halloway
This is a tangent from Brian's question about struct inheritance: While I am not sure that I want struct inheritance, it seems unnecessarily hard to write the macro for it. Structs are not first class citizens, in that you cannot reflect against them. I want to ask: (defstruct person :fname

Re: Erlang vs Clojure

2008-10-07 Thread Rich Hickey
On Oct 5, 8:20 pm, Krzysztof Kliś <[EMAIL PROTECTED]> wrote: > Hello Rich, > I know this is an old post, but did you consider using Terracotta > (http://www.terracotta.org/) for clustering Clojure? It might fit the > Clojure concurrency model much better than MPI, and you wouldn't have > to mix

Re: equality and struct inheritance

2008-10-07 Thread Brian Doyle
On Tue, Oct 7, 2008 at 2:32 PM, Stuart Halloway <[EMAIL PROTECTED]>wrote: > > Hi Brian, > > (1) What does it mean to be equal on id and not equal on the other > fields? If two fields claim the same id but a different name, how > would you know which one to keep? I guess it could depend on the si

Re: equality and struct inheritance

2008-10-07 Thread Meikel Brandmeyer
Hello, Am 07.10.2008 um 23:32 schrieb Brian Doyle: Yes, I was just being somewhat lazy with this. If I define 10 attributes for a given struct and wanted to use all of those plus 3 more in a new struct I didn't want to have to write out those original 10 attributes again. I'm not sure, t

regex literal syntax

2008-10-07 Thread Chouser
Ok, I know we've been over this before, but nothing was actually done. For the record: http://groups.google.com/group/clojure/browse_thread/thread/81b361a4e82602b7/0313c224a480a161 So here is my attempt formalize a simple proposal. The reader should take the literal contents of #"..." and pass t

Re: regex literal syntax

2008-10-07 Thread Michael Beauregard
I love it! On Tue, Oct 7, 2008 at 4:37 PM, Chouser <[EMAIL PROTECTED]> wrote: > Ok, I know we've been over this before, but nothing was actually done. > > For the record: > > http://groups.google.com/group/clojure/browse_thread/thread/81b361a4e82602b7/0313c224a480a161 > > So here is my attempt fo

Re: equality and struct inheritance

2008-10-07 Thread Stephen Parker
On 7 Oct 2008, at 21:00, Brian Doyle wrote: > [...] I've created a defstruct for a place type object like: > > (defstruct place :id :name :street :city :state :zip) > > I want to write a function that would take a list of places and remove > the duplicates. Duplicates are defined by places havi

two dimensional arrays

2008-10-07 Thread Martin DeMello
How do you make a two-dimensional array of a given size? (e.g. (make- array '(i j)) in common lisp) I want to do stuff like, e.g., representing a chessboard, where I can index into cells and update them. martin --~--~-~--~~~---~--~~ You received this message beca

Destructuring bind question

2008-10-07 Thread Tom Hicks
This destructuring on sequences works: user=> (let [[:as m] [1 2]] m) [1 2] but this one on associations doesn't (and it seems like it should): user=> (let [{:as m} {:b 1 :c 2}] m) java.lang.NullPointerException clojure.lang.Compiler$CompilerException: NO_SOURCE_FILE:14: null .. Is there

Re: regex literal syntax

2008-10-07 Thread Chouser
Is it bad etiquette to reply to myself? I thought it might be useful to compare the proposed syntax with that of other languages with good regex support. I tried all the examples from my previous message in Perl, Python, Ruby, and JavaScript. All but Python have literal regex syntax, while Pyth

Re: two dimensional arrays

2008-10-07 Thread Chouser
On Tue, Oct 7, 2008 at 9:30 PM, Martin DeMello <[EMAIL PROTECTED]> wrote: > > How do you make a two-dimensional array of a given size? (e.g. (make- > array '(i j)) in common lisp) > > I want to do stuff like, e.g., representing a chessboard, where I can > index into cells and update them. For som

Bug in isa??

2008-10-07 Thread mb
Hello Rich, in the definition of isa? in boot.clj in the last line (no. 2879), there isa? recurs into the contents of the vectors. It uses implicitely the global-hierarchy instead of the provided one. Shouldn't it be (isa? h (child i) (parent i)) instead of (isa? (child i) (parent i)) Sinc