-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
We could have a hyperbracketed operation which represents an expression that can be partially reversed, for use in set!.
Better yet, we could just reuse taffy-let for this.
In an expression context, these are already equivalent:
(taffy-let ([tail (hash-ref z 'key)])
`(cons ,x (cons ,(car y) ,tail)))
(let ([tail (hash-ref z 'key)] [temp1 x] [temp2 (car y)])
(cons temp1 (cons temp2 tail)))In a set! left-hand side context, these would be equivalent:
(set!
(taffy-let ([tail (hash-ref z 'key)])
`(cons ,x (cons ,(car y) ,tail)))
w)
(match w
[ (cons temp1 (cons temp2 tail))
(set! (hash-ref z 'key) tail)
(set! x temp1)
(set! (car y) temp2)])The match-let syntax would even make sense in a match expander context. These would be equivalent there:
(match w
[
(taffy-let ([tail (vector a b)])
`(cons ,x (cons ,(list y) ,tail)))
(make-result a b x y)])
(match w
[
(app
(match-lambda
[ (cons temp1 (cons temp2 tail))
(list tail temp1 temp2)]
[_ #f])
(list (vector a b) x (list y)))
(make-result a b x y)])Furthermore, when taffy-let is used as a set! transformer or a match expander, it might make sense to allow more than one clause in the taffy-let body.
Reactions are currently unavailable