Welcome to the CHICKEN Scheme pasting service

chicken 4 vs 5, records and matchable / match added by jjhoo on Mon Feb 3 21:42:42 2020

(module asdf
    (test)

  (import scheme)
  (cond-expand
    (chicken-4
     (import chicken)
     (import (only extras sprintf))
     (require-library matchable))
    (else
     (import chicken.base)
     (import chicken.format)
     (import (only chicken.memory.representation
                   record-instance-slot record-instance?))))

  (import matchable)

  (define-record foorec a b)
  (define-record barrec foo c)

  (define (test r)
    (match r
      [($ barrec foo c)
       (match foo
         [($ foorec a b)
          (print (sprintf "chicken-4 matched ~s ~s ~s" a b c))])]
      [($ asdf#barrec foo c)
       (match foo
         [($ asdf#foorec a b)
          (print (sprintf "chicken-5 matched ~s ~s ~s" a b c))])]
      [other (print "Other match " r)]))

  (test (make-barrec (make-foorec "cat" "dog") "parrot")))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which module provides `define-foreign-type'?
Visually impaired? Let me spell it for you (wav file) download WAV