[MLton-user] Extended Basis Library: iterating thunks
Geoffrey Alan Washburn
geoffw at cis.upenn.edu
Thu Apr 19 10:43:36 PDT 2007
Vesa Karvonen wrote:
> OTOH, the type of repeatWith makes me think of tabulate.
> Hmm... A simpler alternative could be Effect.tabulate
>
> val tabulate : Int.t -> Int.t Effect.t
>
> So, given
>
> ef : 'a Effect.t
> i2a : Int.t -> 'a
>
> for some 'a, one could say
>
> tabulate n (ef o i2a)
>
> instead of
>
> repeatWith ef n i2a
Okay, I decided to go with just tabulate for now. However, shouldn't
its type be
val tabulate : Int.t -> Int.t Effect.t Effect.t
or
val tabulate : Int.t Effect.t -> Int.t Effect.t
?
I went with the former because it ought to be more useful for partial
applications.
> Also note the existing function Basic.repeat:
>
> val repeat : 'a UnOp.t -> Int.t -> 'a UnOp.t
I had seen that but it didn't seem like the best solution at the time.
--
[Geoff Washburn|geoffw at cis.upenn.edu|http://www.cis.upenn.edu/~geoffw/]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mlton.org/pipermail/mlton-user/attachments/20070419/dbe3a797/attachment.htm
More information about the MLton-user
mailing list