Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: How would you write... (John M. Dlugosz)
2. Re: How would you write... (Daniel Fischer)
3. Re: How would you write... (Frerich Raabe)
4. Re: How would you write... (Norbert Melzer)
5. Re: How would you write... (Frerich Raabe)
6. Re: How would you write... (Norbert Melzer)
----------------------------------------------------------------------
Message: 1
Date: Tue, 22 Apr 2014 03:37:20 -0500
From: "John M. Dlugosz" <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] How would you write...
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
On 4/22/2014 3:17 AM, Norbert Melzer wrote:
> What Is the the type of your pappus function?
I've not specified a type sig, so it figures out some particular subdomain of
numeric
types. Whatever that is, it takes two numbers and returns a tuple of three
floating-point
numbers
pappus r n = (x-0.5,y,rn)
where
blah= n**2*(1-r)**2+r
x = (r*(1+r)) / (2*blah)
y = (n*r*(1-r)) / blah
rn = ((1-r)*r)/(2*blah)
------------------------------
Message: 2
Date: Tue, 22 Apr 2014 10:39:05 +0200
From: Daniel Fischer <[email protected]>
To: [email protected]
Cc: "John M. Dlugosz" <[email protected]>
Subject: Re: [Haskell-beginners] How would you write...
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"
On Tuesday 22 April 2014, 03:00:20, John M. Dlugosz wrote:
> 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,
If I guess your intentions right:
chain1 = [ translate x y $ color red $ Circle r | (x,y,z) <- map (pappus 100)
[1 .. 10]]
------------------------------
Message: 3
Date: Tue, 22 Apr 2014 10:47:30 +0200
From: Frerich Raabe <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] How would you write...
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8; format=flowed
On 2014-04-22 10:00, John M. Dlugosz wrote:
> 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.
[..]
> (1) how can the list comprehension syntax manage it,
I suspect
chain1 = [ translate x y $ color red $ Circle r | i <- [1..10], (x,y,r) <-
pappus 100 i ]
would be one way to do what you want.
--
Frerich Raabe - [email protected]
www.froglogic.com - Multi-Platform GUI Testing
------------------------------
Message: 4
Date: Tue, 22 Apr 2014 10:49:15 +0200
From: Norbert Melzer <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] How would you write...
Message-ID:
<CA+bCVsv=UQ-7NMoUks-0XqMjv7af=q68hqqhhcqx9iax5t1...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
This one doesn't work, since pappus doesn't return a list
Am 22.04.2014 10:47 schrieb "Frerich Raabe" <[email protected]>:
> On 2014-04-22 10:00, John M. Dlugosz wrote:
>
>> 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.
>>
>
> [..]
>
> (1) how can the list comprehension syntax manage it,
>>
>
> I suspect
>
> chain1 = [ translate x y $ color red $ Circle r | i <- [1..10], (x,y,r)
> <- pappus 100 i ]
>
> would be one way to do what you want.
>
> --
> Frerich Raabe - [email protected]
> www.froglogic.com - Multi-Platform GUI Testing
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140422/234803e1/attachment-0001.html>
------------------------------
Message: 5
Date: Tue, 22 Apr 2014 10:59:20 +0200
From: Frerich Raabe <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] How would you write...
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8; format=flowed
On 2014-04-22 10:49, Norbert Melzer wrote:
> This one doesn't work, since pappus doesn't return a list
Ah, right, I forgot to adjust that part. How about
chain1 = [ translate x y $ color red $ Circle r | i <- [1..10], let
(x,y,r) = pappus 100 i ]
...though I'm not too fond of 'let' declarations in list comprehensions.
--
Frerich Raabe - [email protected]
www.froglogic.com - Multi-Platform GUI Testing
------------------------------
Message: 6
Date: Tue, 22 Apr 2014 11:08:02 +0200
From: Norbert Melzer <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] How would you write...
Message-ID:
<ca+bcvsvxp8bfqoesnsh65t5wtraanuhsj9yjysgbadledjg...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
That's why I think Daniel Fischers solution is the one.
Am 22.04.2014 10:59 schrieb "Frerich Raabe" <[email protected]>:
> On 2014-04-22 10:49, Norbert Melzer wrote:
>
>> This one doesn't work, since pappus doesn't return a list
>>
>
> Ah, right, I forgot to adjust that part. How about
>
> chain1 = [ translate x y $ color red $ Circle r | i <- [1..10], let
> (x,y,r) = pappus 100 i ]
>
> ...though I'm not too fond of 'let' declarations in list comprehensions.
>
> --
> Frerich Raabe - [email protected]
> www.froglogic.com - Multi-Platform GUI Testing
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140422/8560e917/attachment-0001.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 70, Issue 43
*****************************************