mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-17 01:37:34 +02:00
WIP
This commit is contained in:
parent
6aca207641
commit
d64040043f
1 changed files with 11 additions and 16 deletions
|
@ -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)
|
||||||
|
|
Loading…
Add table
Reference in a new issue