Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #9429
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: Sets in Forth |
| Date | 2012-02-07 15:44 +0000 |
| Organization | Institut fuer Computersprachen, Technische Universitaet Wien |
| Message-ID | <2012Feb7.164443@mips.complang.tuwien.ac.at> (permalink) |
| References | <jgrfp0$m45$1@speranza.aioe.org> |
Steve Graham <jsgrahamus@yahoo.com> writes:
>Is there a way to create a set in Forth? Of course, there is. I could
>do it with a linked list and when a number is chosen, simply reorient
>the links to/from it, essentially removing it from the list.
>
>Is there another or better way?
A simple array, initialized with numbers 1..24. Select a random one,
and swap it with the first one. Select a random one of the remaining
23, and swap it with the next one; repeat until there is only one
remaining number.
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2011: http://www.euroforth.org/ef11/
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Sets in Forth Steve Graham <jsgrahamus@yahoo.com> - 2012-02-07 08:25 -0700
Re: Sets in Forth anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-02-07 15:44 +0000
Re: Sets in Forth Steve Graham <jsgrahamus@yahoo.com> - 2012-02-07 09:49 -0700
Re: Sets in Forth Paul Rubin <no.email@nospam.invalid> - 2012-02-07 19:24 -0800
Re: Sets in Forth mhx@iae.nl (Marcel Hendrix) - 2012-02-07 22:12 +0200
csiph-web