Commit c243caa 1 parent e719e64 commit c243caa Copy full SHA for c243caa
File tree 4 files changed +204
-1618
lines changed
test/Feersum.Tests/_snapshots
4 files changed +204
-1618
lines changed Original file line number Diff line number Diff line change 18
18
" world"
19
19
-2))
20
20
21
- (define-syntax my-cond
22
- (syntax-rules (else)
23
- ((cond (else e ...)) (begin e ...))
24
- ((cond (test e e1 ...))
25
- (if test
26
- (begin e e1 ...)))
27
- ((cond (test e e1 ...) c ...)
28
- (if test
29
- (begin e e1 ...)
30
- (my-cond c ...)))))
31
21
(display
32
- (my- cond
22
+ (cond
33
23
(#f 'false )
34
24
(#t 'true )
35
25
(else 'fail )))
36
26
(display
37
- (my- cond
27
+ (cond
38
28
(#f 'false )
39
29
(#t 'true )))
40
30
(display
41
- (my- cond
31
+ (cond
42
32
(else 'ok )))
43
33
(display
44
- (my- cond
34
+ (cond
45
35
(#f 'fail )))
Original file line number Diff line number Diff line change @@ -627,8 +627,6 @@ and private bindForm ctx (form: AstNode list) node =
627
627
|> Result.map ( BinderCtx.importLibrary ctx >> BoundExpr.Import)
628
628
|> ResultEx.okOr BoundExpr.Error)
629
629
|> BoundExpr.Seq
630
- | { Kind = AstNodeKind.Ident( " cond" ) }:: body ->
631
- unimpl " Condition expressions not yet implemented"
632
630
| { Kind = AstNodeKind.Ident( " case" ) }:: body ->
633
631
unimpl " Case expressions not yet implemented"
634
632
| head:: rest ->
Original file line number Diff line number Diff line change @@ -210,6 +210,7 @@ module private BuiltinMacros =
210
210
211
211
/// Builtin `or` Macro
212
212
let private macroOr =
213
+ // TODO: re-write this when proper hygene is supported.
213
214
" (syntax-rules ()
214
215
((or) #f)
215
216
((or test) test)
@@ -238,11 +239,26 @@ module private BuiltinMacros =
238
239
expr1 ...))))"
239
240
|> parseBuiltinMacro " unless"
240
241
242
+ let private macroCond =
243
+ // TODO: This `cond` implementation doesn't support the `=>` 'pipe' form
244
+ // of the macro yet. This is because we're waiting for hygene
245
+ // support like `or`.
246
+ " (syntax-rules (else)
247
+ ((cond (else e ...)) (begin e ...))
248
+ ((cond (test e e1 ...))
249
+ (if test
250
+ (begin e e1 ...)))
251
+ ((cond (test e e1 ...) c ...)
252
+ (if test
253
+ (begin e e1 ...)
254
+ (cond c ...))))"
255
+ |> parseBuiltinMacro " cond"
256
+
241
257
/// The list of builtin macros
242
258
let coreMacros =
243
259
{ LibraryName = [ " scheme" ; " base" ]
244
260
; Exports =
245
- [ macroAnd ; macroOr; macroWhen; macroUnless ]
261
+ [ macroAnd ; macroOr; macroWhen; macroUnless; macroCond ]
246
262
|> List.map ( fun m -> ( m.Name, StorageRef.Macro( m))) }
247
263
248
264
// ------------------------ Public Builtins API --------------------------------
You can’t perform that action at this time.
0 commit comments