Skip to content

Instantly share code, notes, and snippets.

@danking
Created October 20, 2011 17:59
Show Gist options
  • Select an option

  • Save danking/1301809 to your computer and use it in GitHub Desktop.

Select an option

Save danking/1301809 to your computer and use it in GitHub Desktop.
(define (datum-equal? x y)
(let-values (((x y) (if (and (syntax? x) (syntax? y))
(values (syntax->datum x) (syntax->datum y))
(values x y))))
(let-values (((x y) (if (and (struct? x) (struct? y))
(values (struct->vector x) (struct->vector y))
(values x y))))
(if (and (sequence? x) (sequence? y))
(for/and ([x-element x]
[y-element y])
(datum-equal? x-element y-element))
(equal? x y)))))
(define-binary-check (check-datum-equal? datum-equal? actual expected))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment