Put 'none back as a result for ~global-and with no matches.
This commit is contained in:
parent
8ac38f4a3a
commit
8c1b7dcf13
|
@ -44,11 +44,13 @@
|
||||||
(make-~global #'aggregate-global-or #'#t))
|
(make-~global #'aggregate-global-or #'#t))
|
||||||
|
|
||||||
(define (aggregate-global-and . bs)
|
(define (aggregate-global-and . bs)
|
||||||
(true? ;; force the result to be a boolean, the order of terms is unimportant
|
(let ([matches (filter identity ;; remove failed bindings
|
||||||
|
(flatten bs))])
|
||||||
|
(if (null? matches)
|
||||||
|
'none ;; no matches occurred
|
||||||
|
(true? ;; coerce to boolean, so that the order of terms is unimportant
|
||||||
(andmap unbox ;; remove the layer of protection
|
(andmap unbox ;; remove the layer of protection
|
||||||
(cons (box-immutable 'none) ;; default value when no bindings matched
|
matches))))) ;; don't care about ellipsis nesting
|
||||||
(filter identity ;; remove failed bindings
|
|
||||||
(flatten bs)))))) ;; don't care about ellipsis nesting
|
|
||||||
(define-eh-mixin-expander ~global-and
|
(define-eh-mixin-expander ~global-and
|
||||||
(make-~global #'aggregate-global-and))
|
(make-~global #'aggregate-global-and))
|
||||||
|
|
||||||
|
|
|
@ -262,8 +262,13 @@ the notion of order irrelevant.
|
||||||
matches of a global pattern using the same @racket[#,tribute-name]. See above
|
matches of a global pattern using the same @racket[#,tribute-name]. See above
|
||||||
for a description of how global operations work.
|
for a description of how global operations work.
|
||||||
|
|
||||||
The result is always transformed into a boolean, so @racket[_attribute-name] is
|
If there is at least one occurrence of @racket[~global-and] for that
|
||||||
always bound to either @racket[#t] or @racket[#f].}
|
@racket[_attribute-name] which successfully matches, the result of the
|
||||||
|
@racket[(and valueᵢ ...)] is always coerced to a boolean, so
|
||||||
|
@racket[_attribute-name] is always bound to either @racket[#t] or @racket[#f].
|
||||||
|
|
||||||
|
If there are no matches at all, the special value @racket['none] is used
|
||||||
|
instead of @racket[#t] as would be produced by @racket[(and)].}
|
||||||
|
|
||||||
@defform[(~global-counter attribute-name+value #,ntax-pattern ...)
|
@defform[(~global-counter attribute-name+value #,ntax-pattern ...)
|
||||||
#:grammar
|
#:grammar
|
||||||
|
|
Loading…
Reference in New Issue
Block a user