Environment model

  • Follow


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I am a beginner in Scheme. I'm given the following example:

==
((lambda (x) (* x x))
 ((lambda (a b) (a (* b b)))
  (lambda (a) (* a a))
  (* 2 2)))
==
and the computed value is 65536. Could someone explain me step by step
why the value is this one?

Thanks.
- -- 
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
- -- 

Failure is not falling down, you fail when you don't get back up.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iEYEARECAAYFAk838XEACgkQM0LLzLt8MhzoFwCglHm+XJFob2rWXIvLlOx70tz9
nn0AnArY+xWvFtb5xK0FnKeJ7KlLE27T
=aK1Z
-----END PGP SIGNATURE-----
0
Reply Luca.Merciadri (232) 2/12/2012 5:05:53 PM

Merciadri Luca wrote:
> ((lambda (x) (* x x))
>  ((lambda (a b) (a (* b b)))
>   (lambda (a) (* a a))
>   (* 2 2)))

> and the computed value  is 65536. Could someone explain me
> step by step why the value is this one?

It is not difficult.  This (* 2 2) evaluates to 4, and after
that what is it that you do not understand?

  Which   Scheme  implementation  are   you  using?    If  I
understand  correctly, Racket  has a  step-by-step evaluator
that could help you.

-- 
Marco Maggi
0
Reply marco9664 (30) 2/12/2012 7:46:08 PM


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've now understood. Thanks.

- -- 
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
- -- 

It is better to die on one's feet than live on one's knees.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iEYEARECAAYFAk84NzoACgkQM0LLzLt8Mhzk/ACbBfMDj2CX+VW5/9aeRnOUudzp
3DMAnRl1XjWCGIqhWuL3JseMvdOQ6aWe
=C4np
-----END PGP SIGNATURE-----
0
Reply Luca.Merciadri (232) 2/12/2012 10:03:38 PM

2 Replies
66 Views

(page loaded in 0.067 seconds)

Similiar Articles:













7/23/2012 10:41:01 AM


Reply: