[plt-scheme] for comprehensions in typed-scheme

From: Sam TH (samth at ccs.neu.edu)
Date: Mon Jun 8 08:45:35 EDT 2009

This works:

#lang typed-scheme

(: l (Listof Number))
(define l (list 1 2 3))

(for/lists (#{y : (Listof Number)})
           ([z (in-list l)])
           (* z z))

At the moment, you need to use a version of `for' where you can
specify the type of the accumulator, such as `for/lists', or one that
doesn't have an accumulator, such as `for' itself.  And you need to
specify the "type" of the values being iterated over, using something
like `in-list'.

I hope to remove both of these restrictions eventually.

sam th

On Mon, Jun 8, 2009 at 8:24 AM, Noel Welsh<noelwelsh at gmail.com> wrote:
> Hi,
>
> Does typed-scheme support for comprehensions? If so, how do I use
> them? (If not, bummer.)
>
> N.
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>



-- 
sam th
samth at ccs.neu.edu


Posted on the users mailing list.