On Sun, Jan 13, 2019 at 12:37 AM Hassan Shahin <hsha...@gmail.com> wrote:

> Thanks Jack and Mike!
>
> You are right. Arguments to procedures will be evaluated before the
> invocation of the procedure.
>

This is true, but it's not really the issue in your case. Even in #lang
lazy, which does not eagerly evaluate procedure arguments, your program
would still be an error, because the expression `John` has no meaning at
all unless you define it. Try the following in both #lang racket and #lang
lazy:

--- definitions window ---
#lang lazy ;; or racket

(define type-of (lambda (item other-message)
                  (cond
                    [(pair? item) 'pair]
                    [(null? item) 'empty-list]
                    [(number? item) 'number]
                    [(symbol? item) 'symbol]
                    [else
                     other-message
                     'some-other-type])))

--- interactions window ---
(type-of #\e (displayln "hello"))
(type-of (cons 2 3) (displayln "hello"))
(type-of John (displayln "hello"))

---

The `John` example will fail in both languages, but you'll observe the
difference with the other two examples.

- Jon

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to