Lists in haskell

iliali16 iliali16 at gmail.com
Sat Mar 25 11:10:15 EST 2006


people pls help me i have this weekend to finish my assignment on
haskell.thats questuion1 of my assignment if somebody can help pls do so 10x
in advance 

The aim of this assignment is to build a simulator of a programming
language. The programming language contains variables (referred to by
their name, given as a string), which can store an integer value:
type Data = Integer
type Variable = String
The variable values are to be stored in a lookup table relating variable
names and values, using the data synonym Store:
type Store = [(Variable, Data)]
(a) Define the empty Store, which contains no information about variables.
(b) Define a function getVal, which takes a Store and a variable name,
and returns its value. You may assume that the variable is defined
in the Store.
getVal :: Store -> Variable -> Data
(c) Define a function setVar, which takes a Store, a variable name and a
value, and returns an updated Store with the variable value updated.
setVal :: Store -> (Variable, Data) -> Store

--
View this message in context: http://www.nabble.com/Lists-in-haskell-t1341747.html#a3588096
Sent from the Haskell - Libraries forum at Nabble.com.



More information about the Libraries mailing list