title: I want to make function maptree with standard ML
body: <p>I want to make function maptree with standard ML.
  If function f(x) = x + 1;
  then</p>
  
  <pre><code>maptree(f, NODE(NODE(LEAF 1,LEAF 2),LEAF 3));
  </code></pre>
  
  <p>should make result</p>
  
  <pre><code>NODE(NODE(LEAF 2,LEAF 3),LEAF 4))
  </code></pre>
  
  <p>I write the code like below.</p>
  
  <pre><code>datatype 'a tree = LEAF of 'a | NODE of 'a tree * 'a tree;
  fun f(x) = x + 1;
  fun maptree(f, NODE(X, Y)) = NODE(maptree(f, X), maptree(f, Y))
  | maptree(f, LEAF(X)) = LEAF(f X);
  </code></pre>
  
  <p>but when I execute this code like this</p>
  
  <pre><code>maptree(f, (NODE(NODE(LEAF 1,LEAF 2),LEAF 3)));
  </code></pre>
  
  <p>result is not I want to
  (NODE(NODE(LEAF 2,LEAF 3),LEAF 4)))
  but
  NODE(NODE(LEAF #,LEAF #),LEAF 4)).
  Why this happened(not a number but #)?</p>