dat@hpcnof.UUCP (10/18/85)
I'd be most grateful if someone could translate the following (simple) Snobol program into Icon for me, so that I can get a quick feel for the new language (any references to Icon would also be appreciated!!) Anyway, here's the program: * Very Simple Snobol Program to ask a question until the correct answer * is posted. * * Dave Taylor &ANCHOR = 1 &TRIM = 1 TOP OUTPUT = "WHAT IS YOUR NAME?" STRING = INPUT STRING "DAVE" RTAB(0) :F(OTHER) OUTPUT = "HELLO DAVE!" :(END) OTHER OUTPUT = "I DON'T KNOW YOU!" :(TOP) END (I warned you it was rather simple!) Thanks a lot! -- Dave Taylor ihnp4!hpfcla!d_taylor hplabs!hpcnof!dat hpcnof!dat@HPLABS
gregg@bocklin.UUCP (10/29/85)
In article <45000004@hpcnof.UUCP> dat@hpcnof.UUCP writes: > > &ANCHOR = 1 > &TRIM = 1 >TOP OUTPUT = "WHAT IS YOUR NAME?" > STRING = INPUT > STRING "DAVE" RTAB(0) :F(OTHER) > OUTPUT = "HELLO DAVE!" :(END) >OTHER OUTPUT = "I DON'T KNOW YOU!" :(TOP) >END Here's a reasonably straightforward translation: procedure main() repeat { write("What is your name?") if trim(read()) == "DAVE" then stop("Hello, Dave!") write("I don't know you!") } end -- Gregg Townsend / Computer Science Dept / Univ of Arizona / Tucson, AZ 85721 +1 602 621 4325 110 57 03 W / 32 14 07 N {noao|mcnc|ihnp4|utah-cs}!arizona!gregg gregg%arizona@csnet-relay.ARPA