$apply

arg-count fun


Warning

This function is declared internal, so there are no guarantees whatsoever regarding its existence or functionality.

Have fun playing around with the internals but please try not to use any of these in any library or application.

Summary

arguments -> (result) --- Read arg-count arguments from the stack, apply the to fun and push the result on the stack

Bytecode

Probably only interesting to you if you want to understand more about the Nujel VM or care very much about performance.

(    0 ($get/val 'arg-count))
(    2 ($push/val 255))
(    4 ($>))
(    5 ($jf* 24))
(    8 ($get/val 'throw))
(   10 ($get/val 'list))
(   12 ($push/val :arity-error))
(   14 ($push/val Functions can only take up to 255 arguments directly, try to pass a list/array/map instead))
(   16 ($get/val 'arg-count))
(   18 ($get/val 'current-lambda))
(   20 ($apply 0))
(   22 ($apply 4))
(   24 ($apply 1))
(   26 ($jmp* 4))
(   29 ($push/nil))
(   30 ($drop))
(   31 ($get/val 'list))
(   33 ($push/val #$4))
(   35 ($get/val 'int->bytecode-op))
(   37 ($get/val 'arg-count))
(   39 ($apply 1))
(   41 ($apply 2))
(   43 ($ret))