-
Notifications
You must be signed in to change notification settings - Fork 1
Tutorial: Types: ERR TRY
molarmanful edited this page Nov 25, 2023
·
7 revisions
ERR
is sclin's error type. It encapsulate 2 strings: one denoting type and
another denoting message.
All ERR
s are falsy.
"TYPE""error message">E
TRY
represents a computation that may succeed or fail.
Failed TRY
s are falsy; successful TRY
s are truthy.
"success">!?
"FAIL""failed">E >!?
"success">!+
"failed">!-
( 2 1/ )!
( 1 0/ )!
You can use functions like map
, mapf
, fltr
, each
to manipulate the
contents of the TRY
.
"try"@# [.
() ( "success"n>o ) ,.
() ( "fail"n>o ) ,.
]: ??#
#try.
( "1">N )! ( =$a. ) mapf
( "0">N )! ( =$b. ) mapf
( $a $b / )!
Made with ❤️ by Ben Pang (@molarmanful).