Thread overview | |||||
---|---|---|---|---|---|
|
December 27, 2013 imports and a data structure (any critique welcome) | ||||
---|---|---|---|---|
| ||||
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). |
December 27, 2013 Re: imports and a data structure (any critique welcome) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan | 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.
|
December 27, 2013 Re: imports and a data structure (any critique welcome) | ||||
---|---|---|---|---|
| ||||
Posted in reply to TheFlyingFiddle | Found your other post nwm. |
Copyright © 1999-2021 by the D Language Foundation