Thanks Jon.

yes. I did, and you are right. I posted the same question a Google+ forum 
(https://plus.google.com/108613325307702875646/posts/1BaDJFoat4D), and I 
also got a reply that:
"John is being parsed as a variable, and thus, its binding is looked up in 
the local environment. Of course, there is none, hence the error."

- Hassan

On Sunday, January 13, 2019 at 7:52:53 AM UTC+2, Jon Zeppieri wrote:
>
>
>
> On Sun, Jan 13, 2019 at 12:37 AM Hassan Shahin <hsh...@gmail.com 
> <javascript:>> 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