primitive? is only defined on values.

thunk, let, lambda, etc are not values.

They are syntactic forms and thus, for example, the expression

(primitive? let)

represents an ill-formed let expression (indeed, so does 'let')

because the syntax of let must always be:

(let ([id expr] ...) body ...)

That's why when you write

(primitive? let)

it says

let: bad syntax in: let

The first 'let' is the name of the place the error is thrown.

The second 'let' is the entire erroneous expression, in this case, the
whole let expression.

You'll see the same error for:

(+ let let)
(procedure? let)

etc.

Jay

On Sat, May 12, 2012 at 10:20 PM, Harry Spier <[email protected]> wrote:
> When I try primitive? I get the following results:
>
>> (primitive? +)
> #t
>> (primitive? (thunk +))
> #f
>> (primitive? cons)
> #t
>> (primitive? values)
> #t
>> (primitive? thunk)
> . thunk: bad syntax in: thunk
>> (primitive? let)
> . let: bad syntax in: let
>> (primitive? lambda)
> . lambda: bad syntax in: lambda
>> (primitive? +)
> #t
>> (primitive? cons)
> #t
>> (primitive? let)
>  let: bad syntax in: let
>> (primitive? thunk)
> . thunk: bad syntax in: thunk
>> (primitive? (thunk (+ 1 2)))
> #f
>
> Where I get the "bad syntax " error messages instead of #f  is this a
> bug or is this the desired behavior?
>
> Thanks,
> Harry
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users



-- 
Jay McCarthy <[email protected]>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93

____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to