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. R?f. : [Haskell-beginners] a problem
([email protected])
2. R?f. : [Haskell-beginners] a problem
([email protected])
----------------------------------------------------------------------
Message: 1
Date: Wed, 23 Jun 2010 15:10:32 +0200
From: [email protected]
Subject: R?f. : [Haskell-beginners] a problem
To: Michael Mossey <[email protected]>
Cc: [email protected]
Message-ID:
<of1f0b6378.a50ab740-onc125774b.00482adb-c125774b.00486...@mpsa.com>
Content-Type: text/plain; charset=ISO-8859-1
Hello,
I've got (not that short):
conv :: Music_Data_ -> (Maybe Note, Maybe Direction, Maybe Sound)
conv (Music_Data_1 n) = (Just n, Nothing, Nothing)
conv (Music_Data_4 d) = (Nothing, Just d, Nothing)
conv (Music_Data_9 s) = (Nothing, Nothing, Just s)
sortOutMusicData :: [Music_Data_] -> ([Note],[Direction],[Sound])
sortOutMusicData d = catMaybes3 $ unzip3 $ map conv d
catMaybes3 (a,b,c) = (catMaybes a, catMaybes b, catMaybes c)
Cordialement,
Corentin DUPONT (SII)
CDL AL4/AT8 et Comelec
DTI/DPMO/CSEE/CLCO/LCTL
Tel: +33 (0) 1 56 47 65 38 / 47 65 38
[email protected]
Michael Mossey
<[email protected]
ech.edu> Pour
Envoyé par : [email protected]
beginners-bounce cc
[email protected]
Objet
[Haskell-beginners] a problem
23/06/2010 10:08
Can I get a suggestion for a concise way to write 'sortOutMusicData' as
described here? This is MusicXML-related.
data Music_Data_ = Music_Data_1 Note
| Music_Data_4 Direction
| Music_Data_9 Sound
...
sortOutMusicData :: [Music_Data_] -> ([Note],[Direction],[Sound])
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
Message: 2
Date: Fri, 25 Jun 2010 15:27:03 +0200
From: [email protected]
Subject: R?f. : [Haskell-beginners] a problem
To: Michael Mossey <[email protected]>
Cc: [email protected]
Message-ID:
<of4a4097cd.dde2a703-onc125774d.00494555-c125774d.0049e...@mpsa.com>
Content-Type: text/plain; charset=ISO-8859-1
Hello,
I would do (no that concise):
toMaybe :: Music_Data_ -> (Maybe Note, Maybe Direction, Maybe Sound)
toMaybe (Music_Data_1 n) = (Just n, Nothing, Nothing)
toMaybe (Music_Data_4 d) = (Nothing, Just d, Nothing)
toMaybe (Music_Data_9 s) = (Nothing, Nothing, Just s)
catMaybes3 (a,b,c) = (catMaybes a, catMaybes b, catMaybes c)
sortOutMusicData :: [Music_Data_] -> ([Note],[Direction],[Sound])
sortOutMusicData = catMaybes3 . unzip3 . map toMaybe
Corentin
Michael Mossey
<[email protected]
ech.edu> Pour
Envoyé par : [email protected]
beginners-bounce cc
[email protected]
Objet
[Haskell-beginners] a problem
23/06/2010 10:08
Can I get a suggestion for a concise way to write 'sortOutMusicData' as
described here? This is MusicXML-related.
data Music_Data_ = Music_Data_1 Note
| Music_Data_4 Direction
| Music_Data_9 Sound
...
sortOutMusicData :: [Music_Data_] -> ([Note],[Direction],[Sound])
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 24, Issue 36
*****************************************