[Haskell-beginners] How would you write...

Norbert Melzer timmelzer at gmail.com
Tue Apr 22 08:17:48 UTC 2014


What Is the the type of your pappus function?
Am 22.04.2014 10:01 schrieb "John M. Dlugosz" <ngnr63q02 at sneakemail.com>:

> chain1 = [ translate x y $ color red $ Circle r | (x,y,r) <- pappus 100
> [1..10] ]
>
> The above is not right, as the comprehension syntax doesn't see the input
> range buried in an argument.
>
> What's the right way to express
>
> pap1 = translate x y $ color red $ Circle r
>  where (x,y,r) = pappus 100 1
>
> where 1 is [1..10] and I get a list of results?
> (pap1 does work as expected)
>
> (1) how can the list comprehension syntax manage it,
> (2) what's the recommended way to express that (not necessarily via list
> comprehension syntax) ?
>
> —John
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140422/099b6ab7/attachment-0001.html>


More information about the Beginners mailing list