Functional programming in ML
I have this datatype defined:
Code:
datatype 'a somedata = empty | data of string * string * 'a somedata list;
how could I write a function that would print this out? :(
I tried something like this :
Code:
fun print (empty) = [empty] | print (data(birka,vertiba,[somedata])) = print([somedata]); | printxml data(birka,vertiba,[empty]) = [empty];
thanks!
Re: Functional programming in ML
Another thing:
I hate to ask this, but is there a possibility to ASSIGN a value to a variable in a if-then construction? If-then is supposed to be an expression-operator, rather, than a statement. Does that make it like a function being able only to return values and not contain blocks of code?