I am using Racket contract system, and I want to export a function of no arguments, which returns a lambda expression with no arguments, e. g.:
#lang racket
(define (foo)
(do-somthing)
(lambda ()
(do-other things)))
Does anyone know how to write contract for this kind of function?
I suspect it would look something along the lines of:
(-> (-> any/c))
is a contract that matches functions that returns another function, which, when evaluated, returns a single integer value.But if you'd like to relax return values of
foo
, you'd use justany
instead ofany/c
, which allows any number of return values, not just a single value. Consider:See Contracts on Higher-order Functions in Racket documentation.