packages feed

funcons-simple-0.1.0.3: tests/Advanced/Advanced2.fct

initialise-binding initialise-storing initialise-giving finalise-failing finalise-throwing scope
  (collateral (bind
    ("main",
     allocate-variable (functions
       (tuples ((values)*),
        values))),
  bind
    ("fib",
     allocate-variable (functions
       (tuples ((values)*),
        values)))),
   sequential (assign
     (bound ("main"),
      function closure (scope
        (match
          (given,
           tuple ()),
         handle-return (print (apply
           (assigned (bound ("fib")),
            tuple (decimal-natural ("6")))))))),
   assign
     (bound ("fib"),
      function closure (scope
        (match
          (given,
           tuple (pattern closure (bind
             ("n",
              allocate-initialised-variable
                (values,
                 given))))),
         handle-return (if-else
           (is-equal
             (assigned (bound ("n")),
              decimal-natural ("0")),
            return (decimal-natural ("0")),
            if-else
              (is-equal
                (assigned (bound ("n")),
                 decimal-natural ("1")),
               return (decimal-natural ("1")),
               return (integer-add
                 (apply
                   (assigned (bound ("fib")),
                    tuple (integer-subtract
                      (assigned (bound ("n")),
                       decimal-natural ("1")))),
                  apply
                    (assigned (bound ("fib")),
                     tuple (integer-subtract
                       (assigned (bound ("n")),
                        decimal-natural ("2")))))))))))),
   apply
     (assigned (bound ("main")),
      tuple ())))