functional-style datatypes in Python
Posted
by Danny Roberts
on Stack Overflow
See other posts from Stack Overflow
or by Danny Roberts
Published on 2010-04-09T01:58:44Z
Indexed on
2010/04/09
2:03 UTC
Read the original article
Hit count: 513
For anyone who's spent some time with sml, ocaml, haskell, etc. when you go back to using C, Python, Java, etc. you start to notice things you never knew were missing. I'm doing some stuff in Python and I realized what I really want is a functional-style datatype like (for example)
datatype phoneme = Vowel of string | Consonant of voice * place * manner
datatype voice = Voiced | Voiceless
datatype place = Labial | Dental | Retroflex | Palatal | Velar | Glottal
datatype manner = Stop | Affricate | Fricative | Nasal | Lateral
type syllable = phoneme list
Does anyone have a particular way that they like to simulate this in Python?
© Stack Overflow or respective owner