Artifact
53f39546058c40e8c06f7997f5779c8c4d6e21bf:
- File
srfi/s31/rec.sls
— part of check-in
[80c8c83034]
at
2016-07-07 18:11:39
on branch trunk
— initial import
(user:
ovenpasta@pizzahack.eu
size: 632)
0000: 3b 3b 20 43 6f 70 79 72 69 67 68 74 20 28 63 29 ;; Copyright (c)
0010: 20 32 30 30 39 20 44 65 72 69 63 6b 20 45 64 64 2009 Derick Edd
0020: 69 6e 67 74 6f 6e 2e 20 20 41 6c 6c 20 72 69 67 ington. All rig
0030: 68 74 73 20 72 65 73 65 72 76 65 64 2e 0a 3b 3b hts reserved..;;
0040: 20 4c 69 63 65 6e 73 65 64 20 75 6e 64 65 72 20 Licensed under
0050: 61 6e 20 4d 49 54 2d 73 74 79 6c 65 20 6c 69 63 an MIT-style lic
0060: 65 6e 73 65 2e 20 20 4d 79 20 6c 69 63 65 6e 73 ense. My licens
0070: 65 20 69 73 20 69 6e 20 74 68 65 20 66 69 6c 65 e is in the file
0080: 0a 3b 3b 20 6e 61 6d 65 64 20 4c 49 43 45 4e 53 .;; named LICENS
0090: 45 20 66 72 6f 6d 20 74 68 65 20 6f 72 69 67 69 E from the origi
00a0: 6e 61 6c 20 63 6f 6c 6c 65 63 74 69 6f 6e 20 74 nal collection t
00b0: 68 69 73 20 66 69 6c 65 20 69 73 20 64 69 73 74 his file is dist
00c0: 72 69 62 75 74 65 64 0a 3b 3b 20 77 69 74 68 2e ributed.;; with.
00d0: 20 20 49 66 20 74 68 69 73 20 66 69 6c 65 20 69 If this file i
00e0: 73 20 72 65 64 69 73 74 72 69 62 75 74 65 64 20 s redistributed
00f0: 77 69 74 68 20 73 6f 6d 65 20 6f 74 68 65 72 20 with some other
0100: 63 6f 6c 6c 65 63 74 69 6f 6e 2c 20 6d 79 0a 3b collection, my.;
0110: 3b 20 6c 69 63 65 6e 73 65 20 6d 75 73 74 20 61 ; license must a
0120: 6c 73 6f 20 62 65 20 69 6e 63 6c 75 64 65 64 2e lso be included.
0130: 0a 0a 23 21 72 36 72 73 0a 28 6c 69 62 72 61 72 ..#!r6rs.(librar
0140: 79 20 28 73 72 66 69 20 73 33 31 20 72 65 63 29 y (srfi s31 rec)
0150: 0a 20 20 28 65 78 70 6f 72 74 20 72 65 63 29 0a . (export rec).
0160: 20 20 28 69 6d 70 6f 72 74 20 28 72 6e 72 73 29 (import (rnrs)
0170: 29 0a 20 20 0a 20 20 3b 3b 20 54 61 6b 65 6e 20 ). . ;; Taken
0180: 64 69 72 65 63 74 6c 79 20 66 72 6f 6d 20 74 68 directly from th
0190: 65 20 53 52 46 49 2d 33 31 0a 20 20 28 64 65 66 e SRFI-31. (def
01a0: 69 6e 65 2d 73 79 6e 74 61 78 20 72 65 63 0a 20 ine-syntax rec.
01b0: 20 20 20 28 73 79 6e 74 61 78 2d 72 75 6c 65 73 (syntax-rules
01c0: 20 28 29 0a 20 20 20 20 20 20 5b 28 72 65 63 20 (). [(rec
01d0: 28 4e 41 4d 45 20 2e 20 56 41 52 49 41 42 4c 45 (NAME . VARIABLE
01e0: 53 29 20 2e 20 42 4f 44 59 29 0a 20 20 20 20 20 S) . BODY).
01f0: 20 20 28 6c 65 74 72 65 63 20 28 20 28 4e 41 4d (letrec ( (NAM
0200: 45 20 28 6c 61 6d 62 64 61 20 56 41 52 49 41 42 E (lambda VARIAB
0210: 4c 45 53 20 2e 20 42 4f 44 59 29 29 20 29 20 4e LES . BODY)) ) N
0220: 41 4d 45 29 5d 0a 20 20 20 20 20 20 5b 28 72 65 AME)]. [(re
0230: 63 20 4e 41 4d 45 20 45 58 50 52 45 53 53 49 4f c NAME EXPRESSIO
0240: 4e 29 0a 20 20 20 20 20 20 20 28 6c 65 74 72 65 N). (letre
0250: 63 20 28 20 28 4e 41 4d 45 20 45 58 50 52 45 53 c ( (NAME EXPRES
0260: 53 49 4f 4e 29 20 29 20 4e 41 4d 45 29 5d 29 29 SION) ) NAME)]))
0270: 20 20 0a 20 20 0a 29 0a . .).