Function jscl::true-cons-p (location: src/types.lisp)
@davazp , mmm?
Stable version (2022-2025)
CL-USER>(jscl::true-cons-p (list 1 2))
NIL
CL-USER>(jscl::true-cons-p '(1 . 2))
T
CL-USER>
Last release
CL-USER> (jscl::true-cons-p '(1 2))
NIL
CL-USER> (jscl::true-cons-p (cons 1 2))
TYPE-ERROR: 2 is not a CONS.
....
... 61 more frames, increase JSCL::*BACKTRACE-LIMIT* to view more
T
CL-USER>
As far as I can see, the %js-try code hasn't changed. How can this behavior be explained - it prints the error type, but returns the correct return code?
The following code executes without error printing
(defun true-cons-p (form)
(handler-case
(progn
(list-length form)
(return-from true-cons-p nil))
(error (msg)
(return-from true-cons-p t) )))
but this solution is poor in terms of both JS code size and execution time
CL-USER> (time (dotimes (i 100000) (true-cons-p '(2 . 1))))
Execution took 12.351 seconds
jscl::true-cons-p stable version performance
CL-USER>(time (dotimes (i 100000) (jscl::true-cons-p '(1 . 2))))
Execution took 0.436 seconds.
Function
jscl::true-cons-p(location: src/types.lisp)@davazp , mmm?
Stable version (2022-2025)
Last release
As far as I can see, the
%js-trycode hasn't changed. How can this behavior be explained - it prints the error type, but returns the correct return code?The following code executes without error printing
but this solution is poor in terms of both JS code size and execution time
jscl::true-cons-p stable version performance