[racket] contracts ->i optional keyword syntax

From: dfeltey at ccs.neu.edu (dfeltey at ccs.neu.edu)
Date: Sun Aug 24 01:24:15 EDT 2014

Keywords should be followed by an id+ctc as described in the documentation, so something like the following should work

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

Hope this helps

----- Original Message -----
From: "Kevin Forchione" <lysseus at gmail.com>
To: "Racket Users" <users at racket-lang.org>
Sent: Sunday, August 24, 2014 1:03:58 AM GMT -05:00 US/Canada Eastern
Subject: [racket]  contracts ->i optional keyword syntax

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.


  Racket Users list:

Posted on the users mailing list.