[racket] Typed racket and keywords

From: Norman Gray (norman at astro.gla.ac.uk)
Date: Thu Feb 21 14:34:32 EST 2013

Vincent, hello.

On 2013 Feb 21, at 15:20, Vincent St-Amour <stamourv at ccs.neu.edu> wrote:

> I agree, the docs could be a lot clearer.
> 
> I'll add examples that use keyword arguments.

It might also be worth looking at the docs for 'lambda:', since I can't see any way of adding keywords to an anonymous function.  I tried:

(define t
  (λ: ((i : Integer)
       (#:inc (increment : Integer 1)))
    (+ i 1)))

...plus a couple of likely-looking variants like

(define t
  (local
    (define: (t* (i : Integer)) : Integer 
      (+ i 1))
    (t* 9)))

But without success (in 5.3.3).

To avoid cluttering up the lambda: form, might it be worth (instead?) making it possible to associate a function type form with an anonymous lambda?  Something like:

(lambda (i #inc (increment 1)) :: (Integer #inc Integer -> Integer)
  (+ i increment))

That looks more readable to me than the multiple nesting of the current lambda: form.

All the best,

Norman


-- 
Norman Gray  :  http://nxg.me.uk
SUPA School of Physics and Astronomy, University of Glasgow, UK



Posted on the users mailing list.