packages feed

funcons-simple-0.1.0.3: tests/Kexceptions/Kexceptions09.fct

initialise-binding initialise-storing initialise-giving finalise-failing finalise-throwing scope
  (collateral (bind
    ("x",
     allocate-variable (values)),
  bind
    ("y",
     allocate-variable (values)),
  bind
    ("z",
     allocate-variable (values)),
  bind
    ("g",
     allocate-variable (functions
       (tuples ((values)*),
        values))),
  bind
    ("f",
     allocate-variable (functions
       (tuples ((values)*),
        values))),
  bind
    ("main",
     allocate-variable (functions
       (tuples ((values)*),
        values)))),
   sequential (null,
   null,
   null,
   assign
     (bound ("g"),
      function closure (scope
        (match
          (given,
           tuple ()),
         handle-return (throw (decimal-natural ("15")))))),
   assign
     (bound ("f"),
      function closure (scope
        (match
          (given,
           tuple ()),
         handle-return (effect (apply
           (assigned (bound ("g")),
            tuple ())))))),
   assign
     (bound ("main"),
      function closure (scope
        (match
          (given,
           tuple ()),
         handle-return (sequential
           (effect (give
             (decimal-natural ("5"),
              sequential
                (assign
                  (bound ("x"),
                   given),
                 given))),
            effect (give
              (decimal-natural ("10"),
               sequential
                 (assign
                   (bound ("y"),
                    given),
                  given))),
            handle-thrown
              (effect (apply
                (assigned (bound ("f")),
                 tuple ())),
               scope
                 (bind
                   ("y",
                    allocate-initialised-variable
                      (values,
                       given)),
                  print (assigned (bound ("y")),
                  " "))),
            print (assigned (bound ("x")),
            " "),
            print (assigned (bound ("y")),
            "\n")))))),
   apply
     (assigned (bound ("main")),
      tuple ())))