-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
We could have a hyperbracketed operation with a single hole that performs a mutation. For instance, these could be equivalent:
(taffy-zap! `(+ 20 ,(car (retrieve-list))))
(set! (car (retrieve-list)) (+ 20 (car (retrieve-list))))Note that in this case, the (retrieve-list) expression is evaluated twice. Racket has a notion of set! transformer that processes whole expressions at a time, but it doesn't seem to have something like Arc's setforms where the subexpressions are factored out and only executed once. (The term zap here is also from Arc.)
We could actually address this shortcoming by combining taffy-zap! with taffy-let:
(taffy-let () `(taffy-zap! `(+ 20 ,(car ,(retrieve-list)))))This would basically desugar to:
(let ([temp (retrieve-list)])
(set! (car temp) (+ 20 (car temp))))Reactions are currently unavailable