[plt-scheme] Enumeration types

From: Paul Graunke (ptg at ccs.neu.edu)
Date: Wed Jul 10 15:32:17 EDT 2002

Search for hash-table in help-desk.

Paul

At 09 Jul 2002 17:25:00 +0100, Paulo J. Matos wrote:
> [Please handle PLT Scheme list administrative tasks through the Web:
>    http://list.cs.brown.edu/mailman/listinfo/plt-scheme]
> 
> 
> > 
> > It would greatly depend on what you were doing. If you're using the 
> > enumerated symbols to stand for some properties as they are very
> > commonly used, then all you need are symbols in scheme. If you are
> > using them another way, then I'm affraid I'd need more context as
> > scheme is very different from C and often there are no equivalents
> >
> 
> I just wish to associate a number to a symbol. So that each
> symbol that is part of a enum has a given number associated with
> it. This is part of a protocol. The protocol says that it send 1
> for error, 2 for acknowledge, etc. I would like to treat these by
> the name acknowledge and error and not by the number that could
> change...
> 
> Any ideas?
> 
> Best regards,
> 
> Paulo
>  
> > -mike
> > 
> > On Mon, Jul 08, 2002 at 02:16:17PM +0100, Paulo J. Matos wrote:
> > > [Please handle PLT Scheme list administrative tasks through the Web:
> > >    http://list.cs.brown.edu/mailman/listinfo/plt-scheme]
> > > 
> > > Hi all,
> > > 
> > > Is it possible to create a enumeration type in scheme? Just like
> > > enums in C? Or a way to emulate the workings?
> > > 
> > > I though about:
> > > (define ENUM1 1)
> > > (define ENUM2 2)
> > > ...
> > > (define ENUMn n)
> > > 
> > > but this is dirty... is there a cleaner way?
> > > 
> > > Best regards,
> > > 
> > > -- 
> > > Paulo J. Matos : pocm(_at_)rnl.ist.utl.pt
> > > Instituto Superior Tecnico - Lisbon    
> > > Software & Computer Engineering - A.I.
> > >  - > http://www.rnl.ist.utl.pt/~pocm 
> > >  ---	
> > > 	Yes, God had a deadline...
> > > 		So, He wrote it all in Lisp!
> > > 
> > > 
> > 
> > 
> 
> -- 
> Paulo J. Matos : pocm(_at_)rnl.ist.utl.pt
> Instituto Superior Tecnico - Lisbon    
> Software & Computer Engineering - A.I.
>  - > http://www.rnl.ist.utl.pt/~pocm 
>  ---	
> 	Yes, God had a deadline...
> 		So, He wrote it all in Lisp!
> 
> 




Posted on the users mailing list.