Title here
Summary here
(let throw (fun (_x) (...)))
throw takes a value as its argument and return it to be used by try
_x
: the value to return(let error (throw "cannot divide by zero"))
(let return (fun (_y) (...)))
return takes a value as its argument and return it to be used by try
_x
: the value to return(let value (return (/ 1 x)))
(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
_either
: the value to test_continue
: the success handler_handle
: the error handler(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)))