CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2007
    Posts
    40

    Exclamation 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!

  2. #2
    Join Date
    Dec 2007
    Posts
    40

    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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured