Exceptions

throw


(let throw (fun (_x) (...))) throw takes a value as its argument and return it to be used by try

Parameter

  • _x: the value to return

Author

@SuperFola

Example

(let error (throw "cannot divide by zero"))

return


(let return (fun (_y) (...))) return takes a value as its argument and return it to be used by try

Parameter

  • _x: the value to return

Author

@SuperFola

Example

(let value (return (/ 1 x)))

try


(let try (fun (_either _continue _handle) (...))) Takes a value either returned by throw or return and apply a given on it if it’s an error or not

Parameters

  • _either: the value to test
  • _continue: the success handler
  • _handle: the error handler

Author

@SuperFola

Example

(let invert (fun (x)
    (if (= x 0)
        (throw "cannot divide by zero")
        (return (/ 1 x)))))
(try (invert 0)
    (fun (inverted) (print inverted))
    (fun (err) (print err)))