Replace a parameter in wich occours in a other parameter pasted by x1n4u on Thu Sep 3 23:01:19 2015
;; I wanna write a function wich sets a specific variable with itself in a ;;function ;; e.g (defien a 4) ; a=> 4 (set! a (+ 4 a)) ;a=> 8 ;;wanna function / macro (set!-self a (+ 4 a)) => 8 ;; My horrible attempts (define-syntax set!-self (syntax-rules () ((_ self f) (eval `f)))) (define (set-self self f) (eval `(set! self ,f)))
like this? added by DerGuteMoritz on Thu Sep 3 23:23:21 2015
(define-syntax update! (syntax-rules () ((_ var proc) (set! var (proc var))))) (define a 4) (update! a add1) a ; => 5