Path: news.cs.au.dk!not-for-mail From: Flemming Gram Christensen Newsgroups: comp.lang.beta Subject: Re: More newbie questions ... Date: 02 Jun 2000 15:43:36 +0200 Organization: University of Aarhus, Department of Computer Science (DAIMI) Lines: 97 Message-ID: References: <3932AB74.640B7ABE@skynet.be> <39341A7B.745D47B3@skynet.be> NNTP-Posting-Host: odin.mjolner.dk X-Trace: xinwen.cs.au.dk 959953420 15573886 255.255.255.255 (2 Jun 2000 13:43:40 GMT) X-Complaints-To: news@cs.au.dk NNTP-Posting-Date: 2 Jun 2000 13:43:40 GMT X-Newsreader: Gnus v5.7/Emacs 20.4 Xref: news.cs.au.dk comp.lang.beta:12385 Atle writes: > Flemming Gram Christensen wrote: > > > > Most are. Which do you have in mind? > Eh, I was just unsure ... but I suppose I can work my way through to a mid-sized program without bumping into any incompatabilities > (to put it another way?) > > > > Imperatives are similar to statements in Pascal or C. They do not generate a result value. > > This is opposed to evaluations. > Thanks! That put that one in place! > > Is there a one-liner to descripe each of these? > > | l:(# a:@integer; enter a do (if a=7 then leave l if); ... #); > > | l:(# a:@integer; enter a do ... (if a=7 then leave restart if); ... #); or loopforever:(# do inner; restart loopforever #); > > | p:(# do 4->putint; inner #); q:p(# do 2->putint; #); will print 42. > > > I see coroutines ... are there also 'generators' like in Icon? > (If there aren't and your reaction is WHAT?? then it is related to the ProLog inference engine, and not in Beta :-) I do not know generators, but you can generate (instantiate) a component from any pattern: p:(# ... do ... #); do &|P; > > Both. You can do a loop like: > > > > (for 10 repeat > > "do something ten times" > > for); > Can you replace 10 by any evaluation (=expression?) yes. > > > > or > > > > (for i:12 repeat > > "do something parametrized by 'i' 12 times" > > "eg. i->putint;" > > for); > Bearing in mind the WHAT?? possibility above, is i:12 a generator? the 'i:12' introduces a new local variable, and loops until i>12; > > > > or using a combination of a labelled imperative and restart/leave: > > > > (# i:@integer; > > do 0->i; (* assign 0 (zero) to i *) > > loop: > > (if i < 8 then > > i->putint; ' is less than 8'->putline; > > i+1 -> i; (* assign i+1 to i *) > > restart loop; (* begin from if again *) > > if); > > #); > Is this a variant of goto? Yes a variant. But notice it can only be used for reducible flows. You can only leave or restart anything you have earlier entered and not left yet. Or said another way, the legal names form a stack. (similar to exceptions in SML and Java(?)) > > > > You are welcome in this newsgroup. Ask away. > Thanks! I have 'studied' Beta for a couple of days now, but I still feel kinda 'fresh' :-) > > Atle -- /Flemming Gram Christensen ------------------------------------------------------------------------ Mjolner Informatics ApS Phone: +45 86 20 20 00 Science Park Aarhus Fax: +45 86 20 12 22 Gustav Wieds Vej 10 DK-8000 Aarhus C Denmark E-mail: gram@mjolner.dk ------------------------------------------------------------------------