[postmodern-devel] Get keys out of dao-class

Phil Marneweck zaries at global.co.za
Sat Feb 28 04:27:00 UTC 2009


Ok I figured it out, dao-keys "method" is a reader for effective-keys on
dao-class. I am still learning clos... *sigh*

On Fri, 2009-02-27 at 11:24 +0200, Phil Marneweck wrote:
> Thanx, I never thought about it being a method. I don't know how I
> missed it looking at the code. It works fine but I would like to
> understand how it works...
> 
> If I understand correctly there is two versions, the first returns a
> list of keys and the second returns a list of key values.
> 
> ;;first
> (defmethod dao-keys ((class-name symbol))
>   (dao-keys (find-class class-name)))
> 
> ;;second
> (defmethod dao-keys (dao)
>   (mapcar #'(lambda (slot)
>               (slot-value dao slot))
>           (dao-keys (class-of dao))))
> 
> Please explain to me how the first one works, to me it just looks like
> it calls itself?
> 
> Thanx
> 
> 
> 
>  ----- Original Message ------
>  From:Marijn Haverbeke
>  Sent:Friday, February 27, 2009 09:37
>  To: postmodern-devel at common-lisp.net; 
>  Subject:Re: [postmodern-devel] Get keys out of dao-class
> 
> 
> Doesn't dao-keys work? There's no defun for it since it's a method. 
> Call it on a class to get the slot names, on an instance to get the 
> slot values. 
> 
> Best, 
> Marijn 
> 
> _______________________________________________ 
> postmodern-devel mailing list 
> postmodern-devel at common-lisp.net 
> http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel
> 
> 
> 





More information about the postmodern-devel mailing list