Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.haskell.org/cgi-bin/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. Bounded number types? (stuebinm)
2. Creating a Triple List from a List (A. Mc.)
3. Re: Creating a Triple List from a List (Francesco Ariis)
----------------------------------------------------------------------
Message: 1
Date: Sat, 27 Feb 2021 19:00:27 +0100
From: stuebinm <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] Bounded number types?
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Hi all,
I'm wondering: is there any type that represents e.g. a floating point
value that is guaranteed to be within some interval (e.g. [0,1]?).
My practical use-case would be that I'm reading in input data from json,
which may be ill-behaved — obviously I could just manually check, and
then keep track of which numbers in which record fields are within which
intervals, but coming from less strongly typed programming languages I
wonder if there would be a "typed" way to do this, too.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x695C841098BECF1D.asc
Type: application/pgp-keys
Size: 3131 bytes
Desc: not available
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20210227/d108a61f/attachment-0001.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20210227/d108a61f/attachment-0001.sig>
------------------------------
Message: 2
Date: Sat, 27 Feb 2021 18:07:21 -0800
From: "A. Mc." <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Creating a Triple List from a List
Message-ID:
<CAOsti3=ittf0pl4txtwljvvkfj2trwd-kaxdf9hmjc78qze...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hello,
What is the best way to take:
[1, 2, 3, 4 ]
And convert it to:
[ [ [ 1 ], [ 2 ] ], [ [3]. [4] ] ]
so that each member pair is:
[ [1], [2] ]
roughly analogous to a 1x2 vector?
Thanks in advance and thank you for your time.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20210227/3a966693/attachment-0001.html>
------------------------------
Message: 3
Date: Sun, 28 Feb 2021 03:29:27 +0100
From: Francesco Ariis <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Creating a Triple List from a List
Message-ID: <20210228022927.GA30216@extensa>
Content-Type: text/plain; charset=utf-8
Il 27 febbraio 2021 alle 18:07 A. Mc. ha scritto:
> Hello,
>
> What is the best way to take:
> [1, 2, 3, 4 ]
>
> And convert it to:
>
> [ [ [ 1 ], [ 2 ] ], [ [3]. [4] ] ]
>
> so that each member pair is:
>
> [ [1], [2] ]
>
> roughly analogous to a 1x2 vector?
A 1×2 vector would be
> [[1 2], [3, 4]]
am I wrong? If so, a quick and dirty solution could be
d2 :: [a] -> [[a]]
d2 [] = []
d2 [a] = error "odd element"
d2 as = let (is, es) = splitAt 2 as
in is : d2 es
-- λ> d2 [1..6]
-- [[1,2],[3,4],[5,6]]
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 151, Issue 14
******************************************