chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] can't get 'the' to work


From: Jörg F . Wittenberger
Subject: [Chicken-users] can't get 'the' to work
Date: 25 Mar 2013 13:38:49 +0100

I tried to fix my testcase using "the" as below.

Does't work:
Warning: in toplevel procedure `foo#bar':
expression returns a result of type `null', but is declared to return `(list-of number)', which is not a subtype

This alternative is not any better:

 (let ((foobar (the (or null (list-of number)) '())))

Warning: in toplevel procedure `foo#bar':
expression returns a result of type `null', but is declared to return `(list-of number)', which is not a subtype


Note that the compiler's compaint removed the (or null ...) part.
It does not so, if I try to use boolean instead of null; then
it at least complains including the bool.



(module
foo
(bar)
(import scheme chicken)

(define (bar . args)
  (let ((foobar (the (list-of number) '())))
    (do ((rest args (cddr rest)))
         ((null? rest)
          (if (null? foobar)
              'gaga
              foobar))
      (if (null? (cdr rest))
           (error (car rest)))
      (case (car rest)
         ((#:foobar)
          (set! foobar (cons (cadr rest) foobar)))))))

)

(import foo)

(display (bar #:foobar 42))
(newline)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]