Hi all,

what is the best way to write the cls macro in the following example?

Also, why is intern needed in those places?  Could/should not these be
transient symbols which I guess are not interned and still be used as
variables?

# based on 
http://enfranchisedmind.com/blog/2008/04/14/useful-things-about-static-typing/

(de cls L
  (let (@C (car L)
        @F (cdr L)
        @A (mapcar '((F) (intern (uppc (car F)))) @F)
        @D (mapcan '((F) (list (intern (uppc (car F))) (cadr F))) @F)
        @S (mapcar '((F) (list '=: (car F) (intern (uppc (car F))))) @F)
        @I (mapcar '((F) (list 'inc (list ':: (car F))
                                    (intern (uppc (car F))))) @F)
        @Pa (list ': (caar @F))
        @Pd (mapcan '((F) (list "," (list ': (car F)))) (cdr @F)))
    (macro
      (class @C)
      (dm T @A (default . @D) . @S)
      (dm move> @A . @I)
      (dm pput> () (prin "(" @Pa . @Pd) (prin ")")))))

(cls +TwoDeePoint (x 1) (y 2))
(cls +ThreeDeePoint (x 3) (y 4) (z 5))

(de nudge (pt) (move> pt 1 1))

(class +Whatever)
(dm pput> () (prinl "Whatever..."))

(de doPut (obj) (pput> obj) (prinl))

(let (two_d (new '(+TwoDeePoint))
      three_d (new '(+ThreeDeePoint))
      whatev (new '(+Whatever)))
   (doPut two_d) (doPut three_d) (doPut whatev)
   (nudge two_d) (pput> two_d)
   (nudge three_d) (pput> three_d)
   (prinl))

I am used to common lisp ` and , notation which builds list templates
by the reader but I am not sure how to do it with similar ease in
picolisp.  I found that functions macro or make deal with this or I
could just build a list and call eval.  However, this does not seem
elegant enough to me.  What is the reason picolist does not have
similar backquote and comma?

Is there a better way of writing the third line (without eval) of the
following?

(de eList (Plural Dlg)
   (<h3> NIL Plural)
   (eval (list 'form 'dialog Dlg)))

(eList "Users" '(choDlg T ,"Users" (nm +User)))

I struggle with calling form the right way as it does not evaluate
its rest/cdr argument which I want to pass in as a "quoted" list.

Thank you,

Tomas
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

Reply via email to