[racket] Pass by value/name/reference
Be aware there is also a lazy racket (#lang lazy)
#lang racket ; call by value
(define (show x) (display x) (newline) x)
(define (plus x y z)
(display "now we are in the procedure\n")
(+ x y z))
"the procedure has been defined"
(plus (show 1) (show 2) (show 3) )
"the proceedure has been called"
gives
"the procedure has been defined"
1
2
3
now we are in the procedure
6
"the proceedure has been called"
>
BUT
#lang lazy ; call lazy
(define (show x) (display x) (newline) x)
(define (plus x y z)
(display "now we are in the procedure\n")
(+ x y z))
"the procedure has been defined"
(plus (show 1) (show 2) (show 3) )
"the proceedure has been called"
gives
"the procedure has been defined"
now we are in the procedure
1
2
3
6
"the proceedure has been called"
>
_____
From: users [mailto:users-bounces at racket-lang.org] On Behalf Of ????? ??????
Sent: domingo, 20 de julio de 2014 11:03
To: users at racket-lang.org
Subject: [racket] Pass by value/name/reference
Hey :)
How the arguments are passed in racket?
by value/ reference/name?
If u can add an example it will b good :)
Thank U !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140720/606ce08d/attachment.html>