Open Kinnardian opened 2 years ago
Hi, It's meant to transform a 2 arguments operator into a "whatever number you want" arguments operator
For instance, +bytes takes only 2 arguments, and compile to "A B OP_CAT" (A being the compilation of a, same for B) So, +bytes, defined as \l -> (apply-all l '+bytes) will be used as (+bytes a b c) and will be compiled to "A B OP_CAT C OP_CAT" (maybe it's (+bytes* (list a b c)), can't remember)
+bytes* is defined here: https://github.com/frenchfrog42/Baguette/blob/c088b1827ab87f6447d9ad2592776219e3c37986/util.rkt#L9 And used here over the next 5lines: https://github.com/frenchfrog42/Baguette/blob/c088b1827ab87f6447d9ad2592776219e3c37986/compilation.rkt#L701
In the code I use actually a lot 'cons*, which is the same for the concatenation of instructions
The
(apply all function)
and its usage are a bit opaque.https://github.com/frenchfrog42/Baguette/blob/c088b1827ab87f6447d9ad2592776219e3c37986/util.rkt#L3 (Sorry I am new to functional programming.)
Can you provide some exposition @frenchfrog42 ?