[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] advice needed on type-checking of vectors
From: |
John Cowan |
Subject: |
Re: [Chicken-hackers] advice needed on type-checking of vectors |
Date: |
Sun, 28 Oct 2012 14:04:56 -0400 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Felix scripsit:
> (check-type (vector-of number) some-variable)
>
> Should this form check each [element of the] argument for being
> a number?
I think so, yes. After all, testing something for being a (proper)
list is even more expensive. In any case, once you have done that,
you can assume that everything of the form (vector-ref some-variable
foo) returns a number (until a vector-set! is done, anyway). Print a
"may be expensive" warning if you like.
Sometimes check-type will have to return an error, of course, as when the
first argument means "function of integer returning integer", since there
is no way to verify that unless it can be done at compile time.
--
No saves, Antonio, loke es morirse en su lingua. Es komo John Cowan
kedarse soliko en el silensyo kada dya ke Dyo da, komo address@hidden
ser sikileoso sin saver porke. http://www.ccil.org/~cowan
--Marcel Cohen, 1985