Re: SRFI 284: define-typed
Dr. Arne Babenhauserheide 25 Sep 2026 23:43 UTC
"Dr. Arne Babenhauserheide" <xxxxxx@web.de> writes:
> An option to support rest arguments in define-typed (not only in
> define-typed*) would be to go back to the initial version which had the
> type in the first position instead of after ->
…
> (define-typed (count a) (integer? list?) (length a))
> (count '(1 2 3))
An option that would be pretty ugly but could work is:
(define-typed (count a . b) (a -> integer? . list?) (length a))
with multiple return values
(define-typed (count a . b) (a (-> all-integer?) . list?) (apply values a))
It could look OK for the case without return values:
(define-typed (count a . b) (a . list?) (length a))
I’ll have to try whether I can get it implemented.
It may be an ugly edge case, but it would complete the portable version
to be able to type all the flexibility that regular define offers.
Best wishes,
Arne
--
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
https://www.draketo.de