
Hi, Thanks for your prompt reply. Actually I am trying to convert the following transitive semantics to Haskell: (Memory maps I to Z) lookup m i = <current value of i> ( meaning lookup for I in memory m) evB b m = true/(while b do c od;m) -> (c; while b do c od;m) I have written the boolean expression and statement part but I am not able to write the memory representation in Haskell. Hope above explanation helps. Cheers! Akshay
Date: Mon, 7 Sep 2009 08:28:51 +0200 Subject: Re: [Haskell-beginners] Urgent: Defining Momory data Types in Haskell From: bugfact@gmail.com To: akshay.v.dave@hotmail.com CC: beginners@haskell.org
I don't think you provided enough information to give a full answer, at least not to me.
Briefly, if you want to use pointers as in C, then use IORef or STRef and the IO resp ST monad.
If you refer to the ability to define recursive structures in C using pointers like
struct IntNode { int value; IntNode* next; }
then you can just use Haskell's algebraic data types (ADTs), like
data IntNode = IntNodeTag Int IntNode
Of course this particular example is just a list of integers in Haskell, and on lists you have a multitude of premade functions to manipulate them.
But I guess this is not the answer you've been looking for? More about this can be found in any standard Haskell text book or the wikis
On Mon, Sep 7, 2009 at 7:28 AM, Akshay Dave
wrote: Hi All, I am stuck in converting the transition semantics in Haskell. Please let me know how to define memory data types in Haskell( like we define pointer in C). Prompt help would be greatly appreciated.
Sincerely, Akshay ________________________________ With Windows Live, you can organize, edit, and share your photos. Click here. _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_________________________________________________________________ Get back to school stuff for them and cashback for you. http://www.bing.com/cashback?form=MSHYCB&publ=WLHMTAG&crea=TEXT_MSHYCB_BackToSchool_Cashback_BTSCashback_1x1