imports and a data structure (any critique welcome)

Jonathan jdgall84 at gmail.com
Thu Dec 26 16:23:57 PST 2013


I come from Haskell, so please excuse any functional programming 
idiosyncracies I have :)

In Haskell, I have a datatype for representing so called terms 
which looks like:

     data Term = Var Char | Op Char [Term]

i.e. a Term is a variable (denoted by an Int) or an operation 
(whose name is also denoted by an int), applied to a list of its 
arguments.  For example,

     f(g(x,y),a(),x) is represented by Op 'f' [Op 'g' [Var 'x',Var 
'y'],Op 'a' [], Var 'x]

Now, the reason I am writing in D is twofold.  First, I want to 
learn the D language, and second I really need pointers to reduce 
certain complexities in the operations (Haskell does not have 
observable sharing).


More information about the Digitalmars-d-learn mailing list