[racket] higher-order-primitive

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Dec 29 16:01:01 EST 2010

At Wed, 29 Dec 2010 09:43:56 -0500, Stephen Bloch wrote:
> Is there a way to define/provide a higher-order primitive (i.e. a
> higher-order function that can be used in Beginning Student) with
> variable arity?

I think you have to define a macro that expands to use
`first-order->higher-order' around the arguments that should be allowed
as procedures.

For example, if you want a primitive `P', then define `P' as

 (define-syntax-rule (P e ...)
   (real-P (first-order->higher-order e) ...))

and implement the function as `real-P'.

Posted on the users mailing list.