gromit example pasted by andyjpb on Thu Jul 11 16:02:32 2019

(use gromit)


(define-property-type password 'prop_password
		      (set        integer required constant (key 0))
		      (algorithm  integer required constant)
		      (iterations integer required constant)
		      (salt       integer required constant)
		      (crypt      integer required constant))

(define-object-type account 'attrib_account
	       (onboarding  integer)
	       (pre-genesis integer)
	       (password    password))


better added by andyjpb on Thu Jul 11 16:03:30 2019

(use gromit)

(define-attribute-type integer 'INTEGER
		       serialiser:   identity
		       deserialiser: identity
		       initialiser:  (constantly 888) ; NULL) ; TODO: put NULL back
		       ; guard?
		       setter:       (lambda (i)
				       (cond
					 ((integer? i) i)
					 ((eq? #f i)   i)
					 (else
					   (assert #f (conc "integer field expected an integer or #f. We got " i "!")))))
		       getter:       identity)


(define-property-type password 'prop_password
		      (set        integer required constant (key 0))
		      (algorithm  integer required constant)
		      (iterations integer required constant)
		      (salt       integer required constant)
		      (crypt      integer required constant))

(define-object-type account 'attrib_account
	       (onboarding  integer)
	       (pre-genesis integer)
	       (password    password))