On Jan 21, 11:48 pm, Mark Engelberg mark.engelb...@gmail.com wrote:
Thanks for the thread links. This is basically what I suspected -- if
you want to use structs in multimethods, you have to roll your own
constructor which adds some kind of type tag to either the hashmap
or the metadata.
On 22.01.2009, at 07:48, Mark Engelberg wrote:
Is there any way to determine whether something is a struct (versus
an ordinary hash map), and if so, determine which kind of struct it
was built from?
Not that I know. I have been searching for a while, and ended up
using my own tag attached
Finally started a GitHub repo just for this project.
http://github.com/swannodette/cljos/tree/master
The earlier version of course was very flawed/buggy. OK start, but the
macros in it were written with little/no understanding about how symbols are
resolved into their namespaces in Clojure (or
I am not entirely happy with this approach though. If everyone starts
to use metadata for various purposes, such type tags may well
disappear by some function replacing the metadata on an object
without preserving the tags that are already there. This is all the
more likely because there is
Konrad Hinsen a écrit :
there is nothing in the standard library to add a
tag to an existing metadata map. All there is is (with-meta ...),
which replaces the metadata map completely.
It itched me before and since there's already alter-meta! maybe there
should also be an alter-meta
On 22.01.2009, at 09:30, Konrad Hinsen wrote:
Not that I know. I have been searching for a while, and ended up
using my own tag attached to the struct as metadata. In clojure.zip
there is a similar use of metadata: methods are implemented as
functions passed in the metadata.
After a quick
On 22.01.2009, at 10:51, Konrad Hinsen wrote:
At the end of this message is a simple illustration of what can be
done with these changes. Any feedback is welcome of course!
Maybe I should reply immediately to some objections I expect to come:
1) Why create a secondary type system around
On Jan 22, 4:46 am, Christophe Grand christo...@cgrand.net wrote:
Konrad Hinsen a écrit : there is nothing in the standard library to add a
tag to an existing metadata map. All there is is (with-meta ...),
which replaces the metadata map completely.
It itched me before and since there's
On Jan 22, 2:48 am, Mark Engelberg mark.engelb...@gmail.com wrote:
Thanks for the thread links. This is basically what I suspected -- if
you want to use structs in multimethods, you have to roll your own
constructor which adds some kind of type tag to either the hashmap
or the metadata.
On 22.01.2009, at 15:26, Rich Hickey wrote:
It's pretty easy to write a trivial struct system, much harder to
address performance, interop, compilability, dynamicity etc
constraints.
Indeed.
As a simple case, if a defstruct is re-evaluated, will objects created
after that be of the same
http://lispnyc.org/soc2009.clp
Forget most of what I said, it seems the BDFL already has these things in
mind ;) Enough of types and structs for me, time for me dive into the less
familiar territory of Clojure.
On Thu, Jan 22, 2009 at 12:25 PM, David Nolen dnolen.li...@gmail.comwrote:
Can't
Hi,
Am 22.01.2009 um 18:25 schrieb David Nolen:
Can't some elements of the problem be solved with some form of
predicate dispatching as proposed by Meikel? Predicate dispatching
would allows us to use _anything_ as a type (i.e. structs
themselves), as well as allowing user defined
Is there any way to determine whether something is a struct (versus
an ordinary hash map), and if so, determine which kind of struct it
was built from?
For example, in Scheme, consider (define-struct circle (x y radius)),
you get a circle? predicate for free that knows how to distinguish
between
I feel like I've seen an answer to this before, but I can't find the
specific thread now. However, the following two threads seem to have
very closely related info (including a reply or two from Rich).
On Jan 21, 10:48 pm, Mark Engelberg mark.engelb...@gmail.com wrote:
Is there any way to determine whether something is a struct (versus
an ordinary hash map), and if so, determine which kind of struct it
was built from?
P.S., for the first part, you can use
(instance?
Thanks for the thread links. This is basically what I suspected -- if
you want to use structs in multimethods, you have to roll your own
constructor which adds some kind of type tag to either the hashmap
or the metadata.
It just seems like a common case, so I was hoping there was a more
16 matches
Mail list logo