tricu

A lazy functional language based on Tree Calculus
Log | Files | Refs | README | LICENSE

functions.tri (481B)


      1 !import bd2c14d6db6b69308a5252a8e839705a55d30e815f012900b094315263e08d81 *
      2 !export *
      3 
      4 -- Give a calculation a name so we can reuse it with different inputs.
      5 double number = mul number 2
      6 
      7 -- number is a parameter: each call supplies its value.
      8 sixDoubled = double 6
      9 nineDoubled = double 9
     10 
     11 -- A function can take more than one input.
     12 rectangle width height = mul width height
     13 area = rectangle 4 7
     14 
     15 -- Try writing triple and using it in place of double.
     16 -- Next: Working with lists.