views:

277

answers:

1

Hello:

I'm using drscheme from: http://www.archlinux.org/packages/extra/x86_64/drscheme/

I'm trying to work with the sample code in my textbook, but I keep getting getting "unbound identifier" errors. Is it because the scheme interpreter is not configured correctly? or is the code just plain wrong?

Here are a few examples:

Input:

#lang scheme
(define (equalimp lis1 lis2)
        (COND
         ((NULL? lis1) (NULL? lis2))
         ((NULL? lis2) '())
         ((EQ? (CAR lis1) (CAR lis2)) (equalimp (CDR lis1) (CDR lis2)))
         (ELSE '())
))

Output:

Welcome to DrScheme, version 4.2.5 [3m]. Language: scheme; memory limit: 128 MB.

expand: unbound identifier in module in: COND

Input:

#lang scheme
(define (quadratic_roots a b c)
  (LET (
        (root_part_over_2a
         (/ (SQRT (- (* b b) (* 4 a c))) (* 2 a)))
        (minus_b_over_2a (/ (- 0 b) (* 2 a)))
       )
  (DISPLAY (+ minus_b_over_2a root_part_over_2a))
  (NEWLINE)
  (DISPLAY (- minus_b_over_2a root_part_over_2a))
  ))

Output:

expand: unbound identifier in module in: LET

Note: I tried using LET* because I read this: stackoverflow.com/ questions/946050/using-let-in-scheme but it produces the same error.

Thanks !

+3  A: 

It looks like a case sensitivity issue for that language setting. I know Scheme is supposed to be case-insensitive, but when I tried

(define (equalimp lis1 lis2)
        (cond
         ((null lis1) (null? lis2))
         ((null? lis2) '())
         ((eq? (car lis1) (car lis2)) (equalimp (cdr lis1) (cdr lis2)))
         (else '())
))

it worked just fine.

Bill the Lizard
Actually, I just checked the R6RS and it is now case sensitive! Since PLT were a big proponent of R6RS I guess this is the source of the problem.
Nathan Sanders
It works! Thank you!