Hi, Excuse me folks, while I am a (very) experienced embedded programmer Forth for me is a new experience. So here's another joy discovery. The old Forth sage tell us to use decision tables rather than case and nested if-s, so here's my "sling" for your review that I use in the implementation of a state machine:
\ sling table generator, doc via example: \ : first ." first" ; \ : second ." second" ; \ : third ." third" ; \ ' third ' second ' first sling shot \ \ 1 shot → second ok \ -1 shot → ok : sling create ( i × xt -- ) depth , begin depth while , repeat does> ( n -- ? ) over over @i U< if 1+ + @i execute else 2drop then ; Cheers, Enoch. ------------------------------------------------------------------------------ The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials, tech docs, whitepapers, evaluation guides, and opinion stories. Check out the most recent posts - join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amforth-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amforth-devel