[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Error not indicated
From: |
Carl Sorensen |
Subject: |
Re: Error not indicated |
Date: |
Wed, 7 Oct 2009 06:30:18 -0600 |
On 10/6/09 3:30 PM, "Nick Payne" <address@hidden> wrote:
> If I accidentally omit the spaces in the scheme pair for the tweak
> offset, no error is indicated in the console output but the tweak
> doesn't take effect.
If either (or both) of the spaces surrounding the . in the pair are missing,
then the data structure you are creating is no longer a cons cell of two
numbers.
'(0 . 1) is a cons cell with 0 as the car and 1 as the cdr
'(0. 1) is a list; a cons cell with 0 as the car , and a cons cell with 1 as
the car and '() as the cdr as the cdr. i.e. car is 0, caar is 1 cadr is '()
'(0 .1) is a list; car is 0, caar is 0.1, cadr is '()
'(0.1) is a list, car is 0.1, cdr is '()
Perhaps the type checking code in scheme should be a bit stronger.
You can avoid this problem by using cons to define your offsets. Instead of
'(0 . 1) use (cons 0 1) (note that there is no ' before the opening
parenthesis).
HTH,
Carl