Hostname: page-component-76fb5796d-skm99 Total loading time: 0 Render date: 2024-04-26T05:22:05.923Z Has data issue: false hasContentIssue false

FUNCTIONAL PEARLS: Probabilistic functional programming in Haskell

Published online by Cambridge University Press:  12 September 2005

MARTIN ERWIG
Affiliation:
School of Electrical Engineering and Computer Science, Oregon State University, Corvallis, OR 97331, USA (e-mail: erwig@eecs.oregonstate.edu, kollmast@eecs.oregonstate.edu)
STEVE KOLLMANSBERGER
Affiliation:
School of Electrical Engineering and Computer Science, Oregon State University, Corvallis, OR 97331, USA (e-mail: erwig@eecs.oregonstate.edu, kollmast@eecs.oregonstate.edu)
Rights & Permissions [Opens in a new window]

Extract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

At the heart of functional programming rests the principle of referential transparency, which in particular means that a function f applied to a value x always yields one and the same value y=f(x). This principle seems to be violated when contemplating the use of functions to describe probabilistic events, such as rolling a die: It is not clear at all what exactly the outcome will be, and neither is it guaranteed that the same value will be produced repeatedly. However, these two seemingly incompatible notions can be reconciled if probabilistic values are encapsulated in a data type.

Type
Functional Pearls
Copyright
© 2005 Cambridge University Press
Submit a response

Discussions

No Discussions have been published for this article.