[racket] contracts ->i optional keyword syntax

From: Kevin Forchione (lysseus at gmail.com)
Date: Sun Aug 24 01:03:58 EDT 2014

I’ve been trying to figure out the syntax for optional keywords in the ->i contract form. For example:

(->i ([lst list?])
       ([#:foo ….]) ; what does this look like? 
       (result list?))

The mandatory domain syntax seems straightforward, but I’ve tried various combinations for the optional keyword that don’t appear to be correct. 

(->i ([lst list?])
       ([#:foo (lst) (….etc)))
      (result list?))

doesn’t work for me, neither does sticking an id before or after … (lat) … 

Does anyone have an example of an optional keyword ->i contract? This would seem to be an extremely useful form, but the examples in the documentation do not appear to cover it. They do cover the ->* form, but not the ->i for that combination.



Posted on the users mailing list.