abcl
abcl copied to clipboard
Problems with `alexandria:curry` and `alexandria:rcurry`
Eval this in REPL:
(ql:quickload :alexandria)
(compile
(defun next (predicate generator)
(multiple-value-bind (value present-p) (funcall generator)
(loop :until (funcall predicate value)
:do (setf (values value present-p) (funcall generator)))
(values value present-p))))
(next (alexandria:rcurry #'>= 3) (let ((i 0))
(lambda ()
(if (<= (incf i) 5)
(values i t)
(values nil nil)))))
which is expected to output 3, T
, but on ABCL it will cause:
The value T is not of type REAL.
[Condition of type TYPE-ERROR]
Restarts:
0: [RETRY] Retry SLY interactive evaluation request.
1: [*ABORT] Return to SLY's top level.
2: [ABORT] Abort thread.
Backtrace:
0: (INVOKE-DEBUGGER #<TYPE-ERROR {24998C06}>)
1: org.armedbear.lisp.Lisp.error(Lisp.java:383)
2: org.armedbear.lisp.Lisp.type_error(Lisp.java:457)
3: (#<LOCAL-FUNCTION IN RCURRY {2A5E76E5}> 2)
4: (NEXT #<LOCAL-FUNCTION IN RCURRY {2A5E76E5}> #<ANONYMOUS-INTERPRETED-FUNCTION {2E61E776}>)
5: (SYSTEM::%EVAL (NEXT (ALEXANDRIA:RCURRY #'>= 3) ..))
6: (EVAL (NEXT (ALEXANDRIA:RCURRY #'>= 3) ..))
7: (#<LOCAL-FUNCTION IN INTERACTIVE-EVAL {6B637CDE}>)
This error will not occur if:
- Call the
next
function without compiling it. - Or substitute
(alexandria:rcurry #'>= 3)
with(lambda (x) (>= x 3))
.
Hi! Yes, the issue here is the same as with Defold: if the Android OS recognizes a device as a gamepad, the apps should receive its input as properly named buttons ("BUTTON_A", "BUTTON_X", and so on). In your case, the Android OS does not seem to recognize the gamepad layout, and so it sends generic numbers instead ("188", "197", etc.). This is the "Unhandled key code" message.
On Android, Pegasus uses the Qt libraries for detecting gamepad input. The Qt libraries use the layout detected by the Android OS, but if Android itself does not recognize the gamepad layout, then it won't work properly in Pegasus either.
In the future, it would be nice to replace the Qt code with something more up to date, but that will take some time.