Path: news.cs.au.dk!news.net.uni-c.dk!arclight.uoregon.edu!hammer.uoregon.edu!logbridge.uoregon.edu!news.rediris.es!news.unizar.es!not-for-mail From: Alejandro Villanueva <190921@cepsz.unizar.es> Newsgroups: comp.lang.beta Subject: Re: Am I missing something obvious Date: Tue, 24 Oct 2000 15:50:59 +0200 Organization: Universidad de Zaragoza Lines: 182 Message-ID: <39F593C3.EB309B74@cepsz.unizar.es> References: <20001024092406.22334.qmail@noatun.mjolner.dk> NNTP-Posting-Host: 155.210.154.31 Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.unizar.es 972396482 19094 155.210.154.31 (24 Oct 2000 14:08:02 GMT) X-Complaints-To: usenet@news.unizar.es NNTP-Posting-Date: 24 Oct 2000 14:08:02 GMT X-Mailer: Mozilla 4.07 [en] (X11; I; Linux 2.0.36 i686) Xref: news.cs.au.dk comp.lang.beta:12618 Well, having read section 5.10.2 of the BETA book, I'm told that the procedure will be inlined. This is ok for something like: P: (# I, J: @Integer; enter (I, J) do I+J -> I exit (J, I) #) TEST: @(# N, M: @Integer; do (2, 3) -> P -> (N, M); #) This, as long as I understand it, leads to: TEST: @(# N, M: @Integer; do (2, 3) -> (# I, J: @Integer; enter (I, J) do I+J -> I exit (J, I) #) -> (N, M); #) But... what about this one: Q: (# A, B: @Integer; PP: (# I, J: @Integer; enter (I, J) do A+I -> A; B+J -> B; exit (A, B) #) #) TEST: (# Q1: @Q; N, M: @Integer; do 3 -> Q1.A; 5 -> Q2.B; (1, 2) -> Q1.PP -> (N, M); #) where Q1 is not a pattern, but a pattern instance? How to inline it? What's the final value of N and M? and why? What's the difference if I wrote (1, 2) -> &Q1.PP -> (N, M) instead? Alejandro. Alejandro Villanueva wrote: > --------------1DA993BD7F44B08CB1F38DB8 > Content-Type: text/plain; charset=iso-8859-1 > Content-Transfer-Encoding: 8bit > > Well, I noticed that too, and thought the way the Beta book does was Ok... but I do like you: I never write the "&" and it works... I > don't know why! If anyone knows, please, tell us... ;-) > > Alex. > > Atle wrote: > > > I have been (sucessfully :-) creating lots of little Beta-programs now for a while. > > Sweet little thingies, but not doing much useful work :-) > > So, before embarking on the great Bet-hack, I wanted to read the Betabook again. > > And then I saw lots of things that I had forgotten: > > > > sample: > > (# > > i, j : @INTEGER; > > > > proc: > > (# > > ENTER j > > DO j +1 -> i > > EXIT i > > #) > > #) > > > > Not very useful, but I see that the Betabook call the proc like this > > > > 1 -> &sample.proc > > > > and explains that the & executes the proc patterns, and had I used &proc[] then it would not have been executed, but created and a > > reference returned. > > > > I find this completely logical and OK. > > But, I went back to my sample programs, and noticed that I had forgotten the & in front of every procedure and function pattern I > > had written, and they all work as expected. > > > > So my question is: Have I overlooked somethng obvious? > > Are my programs wrong, and if they are, why do they work? > > > > I know this is a potentially idiotic question, but I have gathered the courage for weeks now to ask it, so please be kind :-) > > > > -- > > Best wishes, Atle > > > > users.skynet.be/atle > > -- > ------------------------------------------------------ > ¿Quieres Cobrar por Navegar en Internet? > Visita: http://www.navegana.com/dinero/flintstone.html > ------------------------------------------------------ > Alejandro Villanueva > 190921@cepsz.unizar.es > ------------------------------------------------------ > > --------------1DA993BD7F44B08CB1F38DB8 > Content-Type: text/html; charset=us-ascii > Content-Transfer-Encoding: 7bit > > > > Well, I noticed that too, and thought the way the Beta book does was Ok... > but I do like you: I never write the "&" and it works... I don't > know why! If anyone knows, please, tell us... ;-) >

Alex. >

Atle wrote: >

I have been (sucessfully :-) creating lots of little > Beta-programs now for a while. >
Sweet little thingies, but not doing much useful work :-) >
So, before embarking on the great Bet-hack, I wanted to read the Betabook > again. >
And then I saw lots of things that I had forgotten: >

sample: >
(# >
        i, j : @INTEGER; >

        proc: >
        (# >
        ENTER j >
        DO      > j +1 -> i >
        EXIT i >
        #) >
#) >

Not very useful, but I see that the Betabook call the proc like this >

1 -> &sample.proc >

and explains that the & executes the proc patterns, and had I used > &proc[] then it would not have been executed, but created and a >
reference returned. >

I find this completely logical and OK. >
But, I went back to my sample programs, and noticed that I had forgotten > the & in front of every procedure and function pattern I >
had written, and they all work as expected. >

So my question is: Have I overlooked somethng obvious? >
Are my programs wrong, and if they are, why do they work? >

I know this is a potentially idiotic question, but I have gathered the > courage for weeks now to ask it, so please be kind :-) >

-- >
Best wishes, Atle >

users.skynet.be/atle

> >
-- 
> ------------------------------------------------------
> ¿Quieres Cobrar por Navegar en Internet? 
> Visita: http://www.navegana.com/dinero/flintstone.html 
> ------------------------------------------------------ 
> Alejandro Villanueva
> 190921@cepsz.unizar.es
> ------------------------------------------------------
>   > > --------------1DA993BD7F44B08CB1F38DB8-- -- ------------------------------------------------------ ¿Quieres Cobrar por Navegar en Internet? Visita: http://www.navegana.com/dinero/flintstone.html ------------------------------------------------------ Alejandro Villanueva 190921@cepsz.unizar.es ------------------------------------------------------