Posts

Showing posts with the label racket

arguments.callee in Racket (Scheme)?

Image
Clash Royale CLAN TAG #URR8PPP arguments.callee in Racket (Scheme)? I need the feature arguments.callee of JavaScript in Racket (Scheme). Do you know how? arguments.callee Here, an example in JavaScript function makeFactorialFunc() { return function(x) { if (x <= 1) return 1; return x * arguments.callee(x - 1); }; } 1 Answer 1 You cannot get the currently executing function in a dynamic way in Racket, but you can certainly still implement the function in your question in Racket, just by giving the function a name: (define (make-factorial-func) (define (func x) (if (<= x 1) 1 (* x (func (- x 1))))) func) It’s possible that you feel like you need the dynamic-ness of arguments.callee for some reason, and it might be possible to achieve that goal through some other mechanism, but seeing as you don’t provide any context for why you think it’s necessary in you...