I just pushed a generalization for the type of `curry'.
As Carl said, TR's type system can't fully describe the behavior of
`curry'. With its new type, `curry' works on n-ary functions, but the
returned function is limited to accepting its arguments in two steps,
the first one first, then all the
The type of curry is correct, but imprecise. It does not express all
possible uses of curry. The curry function can be used to split any
function application into an arbitrary number of stages, each with an
arbitrary number of arguments. There is no way to write down that type.
Typed Racket need
Greetings,
Is the type of 'curry' correct?
#lang typed/racket
(: f2 (Boolean Integer Integer -> Integer))
(define (f2 add? i1 i2)
(if add?
(+ i1 i2)
(- i1 i2)))
(define f1a (curry f2 #t)) ; fails to typecheck
(f2 #t 2 3)
(f2 #f 2 1)
;(f1a 10 20)
===>
Welcome to DrRacket, versi
3 matches
Mail list logo