add struct example

This commit is contained in:
Jon Rafkind 2010-07-14 11:34:57 -06:00
parent 9a984fcc2b
commit a3fefc1c35
3 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,5 @@
#lang honu
provide structField;
pattern structField (name_result) [name:identifier];

View File

@ -0,0 +1,12 @@
#lang honu
require "struct.honu";
struct foo {a b c};
z = foo(1, 2, 3);
y = 3;
y = 9;
// x = foo(1, 2, 3);
display(z.a);

View File

@ -0,0 +1,10 @@
#lang honu
require (forSyntax "struct-patterns.honu");
provide struct;
macro struct () {
_ name {field:structField ...} ;
} {
schemeSyntax#sx(honu-struct name (field_name_result ...))
}