On 02.03.2009, at 01:50, Rich Hickey wrote:
I was wondering if you considered using maps or struct-maps for this.
One of my pet peeves with algebraic data types is the unnamed,
positional nature of the components/fields. It always bothers me you
have to rename the fields in every pattern
On Feb 26, 4:06 pm, Konrad Hinsen konrad.hin...@laposte.net wrote:
On 26.02.2009, at 10:00, Konrad Hinsen wrote:
I know, but as I said, my current implementation is just a proof of
concept. It is not viable for production use for a variety of
reasons. I was planning to replace it by
On 26.02.2009, at 08:47, Jeff Valk wrote:
String representation obviously uses :type now in a very particular
way. I'm not sure where this happens though. Can anyone shed some
light on the details?
print-method now dispatches on type, rather than class as it did
before. There is no
On 26.02.2009, at 01:51, Rich Hickey wrote:
You raise interesting issues and I'd like to explore them further. I'm
not sure the issues you have with type-tag-or-class dispatch are all
that prohibitive. In any case, I've added a type function that returns
the :type metadata or the class if
2009/2/26 Konrad Hinsen konrad.hin...@laposte.net
On 26.02.2009, at 01:51, Rich Hickey wrote:
You raise interesting issues and I'd like to explore them further. I'm
not sure the issues you have with type-tag-or-class dispatch are all
that prohibitive. In any case, I've added a type
On Feb 26, 2009, at 1:51, Rich Hickey wrote:
You raise interesting issues and I'd like to explore them further. I'm
not sure the issues you have with type-tag-or-class dispatch are all
that prohibitive. In any case, I've added a type function that returns
the :type metadata or the class if
On Feb 26, 4:00 am, Konrad Hinsen konrad.hin...@laposte.net wrote:
On 26.02.2009, at 01:51, Rich Hickey wrote:
You raise interesting issues and I'd like to explore them further. I'm
not sure the issues you have with type-tag-or-class dispatch are all
that prohibitive. In any case, I've
On Feb 26, 4:17 am, Laurent PETIT laurent.pe...@gmail.com wrote:
2009/2/26 Konrad Hinsen konrad.hin...@laposte.net
On 26.02.2009, at 01:51, Rich Hickey wrote:
You raise interesting issues and I'd like to explore them further. I'm
not sure the issues you have with
On Feb 26, 6:19 am, Konrad Hinsen konrad.hin...@laposte.net wrote:
On Feb 26, 2009, at 1:51, Rich Hickey wrote:
You raise interesting issues and I'd like to explore them further. I'm
not sure the issues you have with type-tag-or-class dispatch are all
that prohibitive. In any case, I've
2009/2/26 Rich Hickey richhic...@gmail.com
On Feb 26, 4:17 am, Laurent PETIT laurent.pe...@gmail.com wrote:
2009/2/26 Konrad Hinsen konrad.hin...@laposte.net
On 26.02.2009, at 01:51, Rich Hickey wrote:
You raise interesting issues and I'd like to explore them further.
Would it make sense to make instance?/type-instance?/type .. multimethods
themselves ?
2009/2/26 Konrad Hinsen konrad.hin...@laposte.net
On 26.02.2009, at 01:51, Rich Hickey wrote:
You raise interesting issues and I'd like to explore them further. I'm
not sure the issues you have with
On Feb 26, 8:30 am, Laurent PETIT laurent.pe...@gmail.com wrote:
2009/2/26 Rich Hickey richhic...@gmail.com
On Feb 26, 4:17 am, Laurent PETIT laurent.pe...@gmail.com wrote:
2009/2/26 Konrad Hinsen konrad.hin...@laposte.net
On 26.02.2009, at 01:51, Rich Hickey wrote:
You
2009/2/26 Rich Hickey richhic...@gmail.com
On Feb 26, 8:30 am, Laurent PETIT laurent.pe...@gmail.com wrote:
2009/2/26 Rich Hickey richhic...@gmail.com
On Feb 26, 4:17 am, Laurent PETIT laurent.pe...@gmail.com wrote:
2009/2/26 Konrad Hinsen konrad.hin...@laposte.net
On Feb 25, 6:51 pm, Rich Hickey richhic...@gmail.com wrote:
user= (type #^{:type ::Fred} [1 2 3])
:user/Fred
This is extremely appealing, as David said, for those of us building
type systems for our application data.
There's one wart for my particular use:
(binding [*print-dup* true]
Thanks for the insight, Konrad. I know this is a sideshow to the larger
discussion on types, but it does present an unexpected usability issue.
On 26 February 2009 at 02:44, Konrad Hinsen wrote:
The fix is to provide a default implementation for print-method. Try
executing this:
On 26.02.2009, at 10:00, Konrad Hinsen wrote:
I know, but as I said, my current implementation is just a proof of
concept. It is not viable for production use for a variety of
reasons. I was planning to replace it by something based on gen-class
and proxy, but I will first try to get away
Is there any reason they cannot be implemented as structs with some sort of
type tag?
On Wed, Feb 25, 2009 at 10:26 AM, Konrad Hinsen
konrad.hin...@laposte.netwrote:
I have just added a new library to clojure.contrib. It provides a
proof-of-concept implementation of algebraic data types. An
On Feb 25, 2009, at 16:32, Jeffrey Straszheim wrote:
Is there any reason they cannot be implemented as structs with some
sort of type tag?
I suspect that could be done, but some nice features would be lost:
1) User-friendly printing.
I implement the multimethods print-method and print-dup
1) User-friendly printing.
I implement the multimethods print-method and print-dup for my
classes, which allows me to specify how objects are printed. print-
method and print-dup dispatch on class, so my types need to be
classes or at least derive from a class that is distinct from the
On Feb 25, 2009, at 17:40, David Nolen wrote:
Should print and println be multimethods? It seems the ability to
custom print a data structure would be generally useful.
It's already there, just not documented as far as I know. All the
printing routines end up calling
On Feb 25, 12:19 pm, Konrad Hinsen konrad.hin...@laposte.net wrote:
On Feb 25, 2009, at 17:40, David Nolen wrote:
Should print and println be multimethods? It seems the ability to
custom print a data structure would be generally useful.
It's already there, just not documented as far as
This is nothing short of amazing for those who want to build ad-hoc type
systems.
(defstruct #^{:type ::my-struct} my-struct :a :b)
(type #'my-struct) ; - :user/my-struct!
I have a lot of code fixing to do now :)
Also Konrad's point that using multimethods for dispatch-fns would be ugly,
but
On Wed, Feb 25, 2009 at 10:09 PM, David Nolen dnolen.li...@gmail.com wrote:
This is nothing short of amazing for those who want to build ad-hoc type
systems.
Plus custom printing.
(defmethod print-method ::Foo [o w]
(doto w
(.write #Foo: )
(.write (:x o))
(.write )))
(defn
How about appending type metadata automagically...
(defstruct stuff :a :b)
(defmacro make
Creates a new instance of struct t and appends 'type' t as metadata
[t vs]
`(with-meta
(struct ~t ~...@vs)
{:type (keyword (str *ns*) (name '~t))}))
user (make stuff 1 2)
{:a 1, :b 2}
user
Hmm, I get a stack overflow when trying that make macro.
After using macroexpand-1...
(with-meta (struct stuff 1 2) {:type (keyword (str *ns*) (name (quote stuff)))})
I still get the stack overflow.
I'm on svn 1307, jdk 1.5 mac osx.
Any ideas?
Regards, Adrian.
On Thu, Feb 26, 2009 at 7:08 AM,
On 25 February 2009, Adrian Cuthbertson wrote:
Hmm, I get a stack overflow when trying that make macro.
After using macroexpand-1...
(with-meta (struct stuff 1 2) {:type (keyword (str *ns*) (name (quote
stuff)))})
I still get the stack overflow.
I'm on svn 1307, jdk 1.5 mac osx.
Any
26 matches
Mail list logo