"Unrelated identifier" errors in the schema

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

I try to work with sample code in my tutorial, but I keep getting "unbound identifier" errors. Is this because the schema interpreter is not configured correctly? or just the wrong code?

Here are some 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 '()) )) 

Conclusion:

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 abc) (LET ( (root_part_over_2a (/ (SQRT (- (* bb) (* 4 ac))) (* 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)) )) 

Conclusion:

expand: unbound identifier in module in: LET

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

Thanks!

+4
source share
1 answer

This seems to be a case sensitivity problem for this language. I know that the circuit should 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 fine.

+5
source

Source: https://habr.com/ru/post/1308309/


All Articles