This commit is contained in:
Justin Ethier 2018-01-29 13:09:52 -05:00
parent 6aca207641
commit d64040043f

View file

@ -152,20 +152,18 @@ must be present.
(match (make-employee "Bob" "Doctor") (match (make-employee "Bob" "Doctor")
(($ employee n t) (list t n)))) (($ employee n t) (list t n))))
;;> For records with more fields it can be helpful to match them by For records with more fields it can be helpful to match them by
;;> name rather than position. For this you can use the \scheme{@} name rather than position. For this you can use the `@`
;;> operator, originally a Gauche extension: operator, originally a Gauche extension:
;;> \example{ (let ()
;;> (let () (define-record-type employee
;;> (define-record-type employee (make-employee name title)
;;> (make-employee name title) employee?
;;> employee? (name get-name)
;;> (name get-name) (title get-title))
;;> (title get-title)) (match (make-employee "Bob" "Doctor")
;;> (match (make-employee "Bob" "Doctor") ((@ employee (title t) (name n)) (list t n))))
;;> ((@ employee (title t) (name n)) (list t n))))
;;> }
;;> The \scheme{set!} and \scheme{get!} operators are used to bind an ;;> The \scheme{set!} and \scheme{get!} operators are used to bind an
;;> identifier to the setter and getter of a field, respectively. The ;;> identifier to the setter and getter of a field, respectively. The
@ -211,9 +209,6 @@ must be present.
;; It's just 80 lines for the core MATCH, and an extra 40 lines for ;; It's just 80 lines for the core MATCH, and an extra 40 lines for
;; MATCH-LET, MATCH-LAMBDA and other syntactic sugar. ;; MATCH-LET, MATCH-LAMBDA and other syntactic sugar.
;; ;;
;; A variant of this file which uses COND-EXPAND in a few places for
;; performance can be found at
;; http://synthcode.com/scheme/match-cond-expand.scm
- [`match`](#match) - [`match`](#match)
- [`match-lambda`](#match-lambda) - [`match-lambda`](#match-lambda)