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. How long is the pointer from a Vector valid (after it has
been extracted by unsafeWidth) (Nathan H?sken)
2. Re: How to convert a float or double number into a string?
(Kim-Ee Yeoh)
3. question about pattern guards (TP)
4. Re: How to convert a float or double number into a string?
(yi lu)
5. Inverse trig functions (Adrian May)
6. Re: Inverse trig functions (Martin Ruderer)
7. Re: Inverse trig functions (Adrian May)
8. Re: Inverse trig functions (Martin Ruderer)
----------------------------------------------------------------------
Message: 1
Date: Thu, 19 Sep 2013 14:26:57 +0200
From: Nathan H?sken <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] How long is the pointer from a Vector
valid (after it has been extracted by unsafeWidth)
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hey,
Background: I am making a wxhaskell backend for diagrams. Currently I am
attempting to implement dashing. The function
penSetDashes :: Pen a -> Int -> Ptr c -> IO ()
takes a bit muster, represented by an array of chars (second parameter
is the number of the used bits).
The problem is, that the underlying C++ function expects the pointer to
be valid even after the function has been executed (until the pen is
deleted or another dashing is set).
So I am creating a Vector Word8 with the desired bitmuster and I am
using Data.Vector.Storable.withUnsafe to pass its internal pointer to
penSetDashes.
But the pointer must point to something valid even after that!
So I was thinking, what if I define
data MyPen a = MyPen (Pen a) (Vector Word8)
and always keep the vector of dashes with the pen. Will the pointer stay
valid?
If there are other Ideas on how to this, I am open!
Regards,
Nathan
------------------------------
Message: 2
Date: Thu, 19 Sep 2013 23:39:41 +0700
From: Kim-Ee Yeoh <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] How to convert a float or double
number into a string?
Message-ID:
<capy+zdrds97btri4wrnlh_ko4lvu4hpvh3rsq0uvpemh5rx...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
On Wed, Sep 18, 2013 at 8:14 PM, yi lu <[email protected]>wrote:
> What I need is just as much number of digits as possible. If I can hold as
> many digits of pi, i.e. 3.1415926535... as possible and save it in a
> String, it will be perfect!
>
Perhaps you had some experience with a computer algebra system (Maple,
Mathematica, etc.) and was expecting similar behavior?
While it's certainly possible to build it on top of Haskell, these kind of
floating-point features aren't available out of the box. Haskell provides
only fixed-bitwidth floating point.
As Oscar recommended, you probably want a String -> String function, say
> toEnglish "1.239402874"
"one point two three nine four zero blah blah"
-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130919/92271c32/attachment-0001.html>
------------------------------
Message: 3
Date: Fri, 20 Sep 2013 00:20:45 +0200
From: TP <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] question about pattern guards
Message-ID: <[email protected]>
Content-Type: text/plain; charset="ISO-8859-1"
Hi,
I have a question related to pattern guards in the syntax of Haskell 2010.
Why is it not possible to combine them with a logical OR, instead of the
comma that stands for a logical AND?
http://www.haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#pattern-guards
Thanks,
TP
------------------------------
Message: 4
Date: Fri, 20 Sep 2013 08:44:50 +0800
From: yi lu <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] How to convert a float or double
number into a string?
Message-ID:
<cakcmqqxy1nz-+x7ezpnxejbpzumcq-ahqlpnivy7gk0a1x-...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Thank you all! I am considering defining a String -> String function now.
On Fri, Sep 20, 2013 at 12:39 AM, Kim-Ee Yeoh <[email protected]> wrote:
>
> On Wed, Sep 18, 2013 at 8:14 PM, yi lu <[email protected]>wrote:
>
>> What I need is just as much number of digits as possible. If I can hold
>> as many digits of pi, i.e. 3.1415926535... as possible and save it in a
>> String, it will be perfect!
>>
>
> Perhaps you had some experience with a computer algebra system (Maple,
> Mathematica, etc.) and was expecting similar behavior?
>
> While it's certainly possible to build it on top of Haskell, these kind of
> floating-point features aren't available out of the box. Haskell provides
> only fixed-bitwidth floating point.
>
> As Oscar recommended, you probably want a String -> String function, say
>
> > toEnglish "1.239402874"
> "one point two three nine four zero blah blah"
>
> -- Kim-Ee
>
> _______________________________________________
> 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/20130920/cd557eae/attachment-0001.html>
------------------------------
Message: 5
Date: Fri, 20 Sep 2013 18:11:42 +0800
From: Adrian May <[email protected]>
To: "[email protected]" <[email protected]>
Subject: [Haskell-beginners] Inverse trig functions
Message-ID:
<cad-ubzhk9xtm-mtvp_awkq+arp2knlek93tfrtyvbr0joxv...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hi All,
When Haskell says "inverse trig function", it seems to mean the inverse of
the return value of a trig function.
I want those functions that return an angle whose sine, cosine or whatever
equals the parameter I pass. Where are those?
TIA,
Adrian.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130920/b3fd6f4e/attachment-0001.html>
------------------------------
Message: 6
Date: Fri, 20 Sep 2013 13:40:00 +0200
From: Martin Ruderer <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Inverse trig functions
Message-ID:
<ca+t_wnajeuvvl9xytfrnd9yr6h9fhqw9xkvmitgkiy-wdu7...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Hello Adrian,
those would be called asin and acos.
Best regards,
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130920/a75a1e84/attachment-0001.html>
------------------------------
Message: 7
Date: Fri, 20 Sep 2013 19:52:34 +0800
From: Adrian May <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Inverse trig functions
Message-ID:
<cad-ubzgvv6b1kh+-okprlwqxwfo7ax1iv+y1vzfmdtyyrxa...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Apparently not. Those are 1/sin and 1/cos. I want to supply a ratio and get
an angle.
On 20 September 2013 19:40, Martin Ruderer <[email protected]> wrote:
> Hello Adrian,
>
> those would be called asin and acos.
>
> Best regards,
> Martin
>
>
> _______________________________________________
> 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/20130920/c7c0816a/attachment-0001.html>
------------------------------
Message: 8
Date: Fri, 20 Sep 2013 13:59:50 +0200
From: Martin Ruderer <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Inverse trig functions
Message-ID:
<CA+t_wNBjMZaoHpRsWBrgVUH8hoi+VYMra=qyjuc8m88wttw...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Are you sure?
Prelude> map (sin.asin) [0.1,0.3,0.5,0.7,0.9]
[0.1,0.3,0.5,0.7,0.9]
On Fri, Sep 20, 2013 at 1:52 PM, Adrian May
<[email protected]>wrote:
> Apparently not. Those are 1/sin and 1/cos. I want to supply a ratio and
> get an angle.
>
>
> On 20 September 2013 19:40, Martin Ruderer <[email protected]>wrote:
>
>> Hello Adrian,
>>
>> those would be called asin and acos.
>>
>> Best regards,
>> Martin
>>
>>
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
>>
>>
>
> _______________________________________________
> 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/20130920/a3b498fb/attachment.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 63, Issue 28
*****************************************