[plt-scheme] A couple "Lazy Scheme" questions
On Jul 7, Psy-Kosh wrote:
> > There are plenty of examples for defining and using these types.
> > The only two constructs you need to know about are `define-type'
> > and `cases' -- the first defines a type, and the second destructs
> > an instance (through pattern matching). Alternatively, you can
> > see PLAI or EoPL -- and consider `define-type' and `cases' as
> > variations with slightly different syntax than used in those
> > books.
>
> And again, thank you, I see now how to use it. Just to make sure I
> understood properly, the subtypes
There are no subtypes -- only variants. It's very ML-like.
> can't have variable numbers of fields (ie, you can't define two
> subtypes of the same name with different numbers of fields)
I'm lost here. Each variant has its own number of arguments.
> nor can you create a subtype with "rest" arguments, correct?
No -- use a list field for that.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://www.barzilay.org/ Maze is Life!