try

From The K Language Wiki
Revision as of 06:42, 9 July 2022 by Promovicz (talk | contribs) ("Better category ordering, add redirects to categories, fix pseudo-adverb categories")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Try
.[f;y;g]

This article is limited to ngn/k. There is scope for addition of the functionality of other major K implementations, if there are any differences.

Try is a primitive which allows executing functions which would otherwise error.

  • f is the function to be tried.
  • y is the list of arguments to be given to the function(like in dot).
  • g is the function to be applied the the error message(given as a string), in case f.y errors.
 .[+;1 2;"E:",]
3
 .[+;1,`2;"E:",]
"E:lmt"