Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added if-rec-of-type syntax

  • Loading branch information...
commit 60e6e0f38cf9dc322643c4ec03267f0192fe7b5b 1 parent c01f23a
@vegashacker authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 repository.scm
View
9 repository.scm
@@ -20,6 +20,7 @@
load-one-where
fresh-rec-from-data
only-rec-of-type
+ if-rec-of-type
is-descendant?
find-parent
find-ancestor
@@ -45,6 +46,14 @@
(begin body ...)
(e "Unauthorized access."))))))
+(define-syntax if-rec-of-type
+ (syntax-rules ()
+ ((_ rec-id type (rec-iden) then-clause else-clause)
+ (let ((rec-iden (and (record-id-stored? rec-id) (load-rec rec-id))))
+ (if (and rec-iden (rec-type-is? rec-iden 'type))
+ then-clause
+ else-clause)))))
+
(define (store-rec! r)
(cache-store r)
(write-record! r)
Please sign in to comment.
Something went wrong with that request. Please try again.