-4

In the program listed below, I'm getting the error message:

let*: bad syntax (not an identifier and expression for a binding) in: pokemon1inPokedex

I'm not sure why, any advice would be appreciated!

my code

(define (in-order? pokemon1name pokemon2name)
  (let*
    [pokemon1inPokedex (inPokedex? pokemon1name)]
    [pokemon2inPokedex (inPokedex? pokemon2name)])
  (cond [(and pokemon1inPokedex pokemon2inPokedex) (greater pokemon1name pokemon2name)]
        [(true? pokemon1inPokedex) #t]
        [(true? pokemon2inPokedex) #f]
        [else #f]))     
Leif Andersen
  • 21,580
  • 20
  • 67
  • 100

1 Answers1

2

The problem is that you have incorrect syntax with let*.

From the racket guide, the syntax for let* is

(let* ([id val-expr] ...) body ...+)

Note the missing ( and ) parens for the identifiers you are binding, as well as your moved closing ).

Modifying your example to use the the let* form correctly will result in code that looks something like:

(define (in-order? pokemon1name pokemon2name)
  (let* ([pokemon1inPokedex ...]
         [pokemon2inPokedex ...])
    (cond [(and pokemon1inPokedex) ...]
          [pokemon1inPokedex ...]
          [pokemon2inPokedex ...]
          [else ...]))

Obviously I've left the ... for you to fill in.

As a side note, pokemon1inPokedex doesn't really follow any normal Racket naming convention that I am aware of. Following standard naming conventions in Racket would give you pokemon1-in-pokedex?

Leif Andersen
  • 21,580
  • 20
  • 67
  • 100