Skip to content

Commit

Permalink
Merge c90f023 into 39171b6
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKnauth committed Aug 19, 2015
2 parents 39171b6 + c90f023 commit 6577a4a
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions unstable/lens/list.rkt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#lang racket/base

(require racket/contract/base)
(provide (contract-out
[reverse-lens
(lens/c list? list?)]
[last-lens
(lens/c list? any/c)]
))

(require lens/base/main
lens/list/main
lens/compound/main
"isomorphism/base.rkt"
)

(module+ test
(require rackunit fancy-app))

(define reverse-lens
(isomorphism-lens reverse reverse))

(define last-lens
(lens-thrush reverse-lens first-lens))

(module+ test
(check-equal? (lens-view reverse-lens '(1 2 3)) '(3 2 1))
(check-equal? (lens-transform reverse-lens '(1 2 3) (cons 4 _)) '(1 2 3 4))
(check-equal? (lens-view last-lens '(1 2 3)) 3)
(check-equal? (lens-set last-lens '(1 2 3) 'a) '(1 2 a))
)

0 comments on commit 6577a4a

Please sign in to comment.