[racket] arrow contract with unrestricted keywords?

4 views
Skip to first unread message

Ryan Culpepper

unread,
Aug 27, 2010, 4:32:36 AM8/27/10
to racket list
I have an apply-like procedure (actually, it's a kind of curry) that
takes at least one positional argument and accepts arbitrary keyword
arguments. That is,

(procedure-arity p) = (arity-at-least 1)
(procedure-keywords p) = (values '() #f)

I want an arrow contract that applies a contract to the first positional
argument and leaves everything else unconstrained. In particular, I want
the contracted procedure to still accept arbitrary keyword arguments. Is
there a way to do that?

Ryan
_________________________________________________
For list-related administrative tasks:
http://lists.racket-lang.org/listinfo/users

Robby Findler

unread,
Aug 27, 2010, 7:55:34 AM8/27/10
to Ryan Culpepper, racket list
Unfortunately, there is not. The simplest thing is probably to roll
you own checks, but if you wanted to make a new contract combinator,
I'd be happy to help.

Robby

Ryan Culpepper

unread,
Aug 27, 2010, 9:53:18 PM8/27/10
to Robby Findler, racket list
Robby Findler wrote:
> Unfortunately, there is not. The simplest thing is probably to roll
> you own checks, but if you wanted to make a new contract combinator,
> I'd be happy to help.

I figured it out from the "Building New Contract Combinators" section of
the docs. The resulting code is a bit verbose, but not difficult. The
examples for 'make-contract' helped a lot.

Thanks,
Ryan

Reply all
Reply to author
Forward
0 new messages