Apply-fn-if-known
Apply a function, expressed as a package and a name, if it exists.
General Form:
(apply-fn-if-known fn-pkg fn-name args state)
where fn-pkg and fn-name are strings.
This utility attempts to apply fn-pkg::fn-name to args, returning an
error triple as described below. Here is an example.
ACL2 !>(apply-fn-if-known "ACL2" "NTH" '(2 (a b c d)) state)
C
ACL2 !>
But fn-pkg might not exist! Even if it exists, fn-pkg::fn-name
might not be a known function symbol, or it might take a stobj
argument. In any of these cases, we return (value nil). Otherwise we
apply fn-pkg::fn-name to the given arguments, args, to obtain a
result val, returning (value val) — unless that application
causes an error, in which case we return an error triple (mv e v state)
where e is non-nil.