imports and a data structure (any critique welcome)

TheFlyingFiddle kurtyan at student.chalmers.se
Fri Dec 27 08:29:53 PST 2013


On Friday, 27 December 2013 at 00:23:58 UTC, Jonathan wrote:
> 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).

Could you please clarify the question? I did not understand what 
you wanted to ask.


More information about the Digitalmars-d-learn mailing list