Title :
A functional approach to simulation programming
Author_Institution :
Dept. of Comput. Sci., Virginia Polytech. Inst. & State Univ., Blacksburg, VA, USA
Abstract :
The author explores simulation programming in Haskell, a purely functional language. It is shown how a simple simulation problem can be modeled in Haskell, and the result is compared to those obtained with four traditional approaches. It is demonstrated that infinite lists, or streams, provide a natural way of modeling queues, and that the properties of a simple queuing problem can be expressed declaratively by specifying the interrelationships between queues. Lazy evaluation allows the functional solution to avoid the time-flow mechanism used in most simulation frameworks, and it is argued that the resulting solution is simpler and more intuitive. As a result, it is believed that functional languages are preferable to traditional high-level languages for modeling some classes of simulation problems. The problem used to illustrate simulation programming in Haskell is taken from Balci´s (1988) paper. It describes the behavior of a multiple virtual storage batch computer system with two CPUs and a printer, and with jobs entering from four different sources
Keywords :
digital simulation; functional programming; performance evaluation; queueing theory; functional language; infinite lists; interrelationships between queues; lazy evaluation; multiple virtual storage batch computer system; queues; simulation programming; streams; Application software; Computational modeling; Computer science; Computer simulation; Functional programming; Logic programming; Programming profession; Simultaneous localization and mapping;
Conference_Titel :
Simulation Conference, 1990. Proceedings., Winter
Conference_Location :
New Orleans, LA
Print_ISBN :
0-911801-72-3
DOI :
10.1109/WSC.1990.129517