http://axisofeval.blogspot.com/search?updated-max=2010-09-04T15%3A42%3A00%2B02%3A00&max-results=23
a question about the today existence of CAR and CDR functions on new lisp dialects. This have bring to me a consideration on my dialect. I try to expose to you my dilemma.
My system define structures like packages, funtions, structures, types in an anonymous way. A type can be created in this manner:
- Code: Select all
(define types:2d-point (type nil :x :y)) ---> #<type |2d-point| (x y)>
and create an object of type types:type. Then
- Code: Select all
(struct types:2d-point :x 0 :y 0) ---> #S(2d-point x 0 y 0)
will make an object of type types:2d-point with X and Y set to 0. Ok? Good!! The type object have the name "2d-point" because is registered into the package TYPES. Technically TYPES is a package that contain symbols whose values is a named type.
In the following instruction, the type have no name, because is not registered into TYPES:
- Code: Select all
(struct (type nil :x :y) :x 0 :y 0) ---> #S(#16:00E49E88 x 0 y 0)
In few words, this permit to use unnamed packages, unnamed types and so on. Package definitions work in the same manner.
Ok ?? GOOOOD!!!
So ... reading that link, where the author say to use structures for CONSES .. make me thinking that CAR and CDR can be fields of a structure, and so name and nicknames of types or packages can be fields of a structure too.
Then if I wanna know the name of a type I probably wanna write something like this:
- Code: Select all
(get :type X) ---> types:my-type
But, if "type" is a field defined by the user??
- Code: Select all
(define types:my-type (type nil :type :x :y))
(define x (struct types:my-type :type "XY" :x 0 :y 0))
(get :type x) --- ????
I wanna still have the possibility to get the type of x which is TYPES:MY-TYPE. Same problem on packages: the type of the object (types:package) or the value of the symbol "type" defined into the package?
The goal is to remove functions like
- name-of
nicknames-of
imaginary-of
real-of
sign
packages-of
car
cdr
set-car
set-cdr
size-of
type-of
and others, in favour of a generic Get/Set mechanism. This is a problem for me because TYPE is always a field .. even if you use "NAME" for the name of the package or a symbol "NAME".
How can I resolve this problem?
Thank you.
