4 ms·
This code can look a lot better by replacing the compute function with this: https://pastebin.com/fMtc8Git https://pastebin.com/fMtc8Git
by adjkant 8y ago
This code can look a lot better by replacing the compute function with this:
https://pastebin.com/fMtc8Git https://pastebin.com/fMtc8Git
- mastro35 8y agoYep! Good call! ;)
- abecedarius 8y agoIt looks like that reverses the arguments? You could do args = self.stack[-n:] del self.stack[-n:] self.push(function_requested(*args)) or maybe self.stack[-n:] = [function_requested(*args)]
- adjkant 8y agoYeah oops coded that up quick. Either way you fix it, it’s far better than a function for calling each number of args and keeps the code readable.
- adjkant 8y agoFor fun, an updated version that cleans up other things as well as the ordering, not relying on signatures of lambdas, etc. https://pastebin.com/HF41J8KQ https://pastebin.com/HF41J8KQ