From 86689171d9bd95b31ac8f39cb6ebd58e892984dc Mon Sep 17 00:00:00 2001 From: AlexKnauth Date: Fri, 21 Aug 2015 14:49:45 -0400 Subject: [PATCH] =?UTF-8?q?add=20examples=20of=20set-filterer-lens=20on=20?= =?UTF-8?q?lists=20and=20set=3D=3F?= --- unstable/lens/set-filterer.scrbl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/unstable/lens/set-filterer.scrbl b/unstable/lens/set-filterer.scrbl index 3d7a4d0..c19cb49 100644 --- a/unstable/lens/set-filterer.scrbl +++ b/unstable/lens/set-filterer.scrbl @@ -15,4 +15,11 @@ Creates a lens that filters a set by the predicate @racket[pred]. Lists are also sets, so @racket[set-filterer-lens] works for lists too, but it does not preserve ordering. It follows the lens laws only if you compare using @racket[set=?], not @racket[equal?]. -} +@lenses-unstable-examples[ + (lens-view (set-filterer-lens number?) '(a 1 2 3)) ; will be '(1 2 3) + (lens-set (set-filterer-lens number?) '(a 1 2 3) '(1 2 3)) ; will be '(3 2 1 a) + (code:comment "this breaks the lens laws according to equal?") + (equal? '(a 1 2 3) '(3 2 1 a)) + (code:comment "but not according to set=?") + (set=? '(a 1 2 3) '(3 2 1 a)) +]}