Paste number 332016: define-record-type* default value

Paste number 332016: define-record-type* default value
Pasted by: snape
When:3 years, 6 months ago
Share:Tweet this! | http://paste.lisp.org/+746O
Channel:None
Paste contents:
Raw Source | XML | Display As
(use-modules (guix records))

(define-record-type* <user>
  user make-user user?
  (country user-country
           (default "China")))

(define u (user))
(define v (user
           (country "Japan")))

(user-country u) ; -> China (using default value)
(user-country v) ; -> Japan (NOT using default value)

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.