How to eval a "quoted" expression?



On Fri, Jul 18, 2003 at 10:45:51PM -0400, Stavros Macrakis wrote:
> A few more examples which may be useful:
> 
>   v: 'vv1;
>   vv1: 'vvv1;
>   vvv1: 'vvvv1;
> 
>   '( '(v) ) => 'v
>   '( v ) => v
>   '( ''v ) => vv1
>   ''v => vvv1
>   ''(''v) => vvvv1

Hmmm... These are much like LISP's QUOTE, with some exceptions.

'( '(v) )  --->  (QUOTE (QUOTE v))

'( v )     --->  (QUOTE v)

'( ''v )   --->  ... I can't give a counterpart in LISP, can you?
                 it means (QUOTE vv1). Maybe just v in LISP
                 is the counterpart.

''v        --->  (EVAL v)

''(''v)    --->  (EVAL (EVAL v))


Am I right? 

Here is my one-to-one corresponding test code in Scheme:

(define v 'vv1)
(define vv1 'vvv1)
(define vvv1 'vvvv1)

''v
;=> ''v

'v
;=> 'v

v
;=> 'vv1

(eval v (interaction-environment))
;=> 'vvv1

(eval (eval v (interaction-environment)) (interaction-environment))

'vvvv1


Can you give me some more information on the semantics of '
and ''? What evaluation order are they using?


> 
> My example of ev was flawed because I didn't re-set v.  This is better:
> 
>  v: 'vv1;
>  [v, ev(v), v: 'vv2, v, ev(v)] =>  [vv1, vvv1, vv2, vv2, vvv2]
> 
> 

-- 
Wang Yin
Deparment of Computer Science and Technology,
Tsinghua University,
100084
Beijing China