Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Languages Misc > Re: RPN maps to...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 22 of 55 Topic 1073 of 1217
Post > Topic >>

Re: RPN maps to basic mathematic expressions nicely

by "cr88192" <cr88192@[EMAIL PROTECTED] > Nov 19, 2007 at 07:48 AM

"Andrew Haley" <andrew29@[EMAIL PROTECTED]
> wrote in message 
news:13k0uqca84ruue1@[EMAIL PROTECTED]
> In comp.lang.forth cr88192 <cr88192@[EMAIL PROTECTED]
> wrote:
>
>> <slava@[EMAIL PROTECTED]
> wrote in message
>>
news:95ed2e82-0159-44fa-b98d-8df924b2604d@[EMAIL PROTECTED]
>>> On Nov 17, 5:39 pm, "cr88192" <cr88...@[EMAIL PROTECTED]
> wrote:
>>>> how about:
>>>> fun hyp(x,y) sqrt(x*x+y*y);
>>>> {/x def /y def x x times y y times add sqrt} /hyp def
>>>
>>> : hyp ( x y -- z ) >r sq r> sq + sqrt ;
>
>> realized my prev example was incorrect (got the args to def backwards).
>
>> should be:
>> /hyp {/x exch def /y exch def x x times y y times add sqrt} def
>
>> but, yeah, it seems one RPN language is different than another.  I
>> personally don't really know forth, but do have a passing
>> familiarity with PostScript, which is partly what I was using in my
>> general views regarding RPN...
>
> So, cr88192, we have now discovered that as well as being unfamiliar
> with Forth you are also unfamiliar with PostScript.  I'm guessing that
> you are not really familiar with *any* reverse polish programming
> langauge.  However, you don't let a mere lack of knowledge get in the
> way of having an opinion.
>

well, I have used them before, but mostly I have created my own (used for 
things like an IL), in the past I have also used them for other things
(such 
as geometric calculations, parametic geometry, ...).

now, here is a difference:
I almost always ordanize stack args differently '<value> <name> 
<whatever>'', because this is more useful in my experience. this managed
to 
interfere with my thoughts of postscript as well, since I haven't really 
used it much, in itself, but more just sort of partly used it as a
syntactic 
template for some of my own languages, which have drifed pretty far away.


now, my opinion is based on my own personal experiences with said
languages, 
which generally lead me to believe that such languages are not
particularly 
readable...

I can complain similarly about s-expressions, though I have a lot more 
experience with those...

so, mostly, I am a fan of C-like systax, as IMO, it is actually about the 
only real kind of syntax that both looks nice and I find readable...


here is an example of my RPNIL language (a piece of the IL code dumped
from 
my compiler):

VAR pl:x65536
FUNC main:i VARS np:i i:i j:i k:i BODY

$"bprime21.c" fn 11 ln
13 ln
15 ln 0 =np
18 ln
2 =i GS1: %i 65536 >=GS3

23 ln
0 =j GS4: %j %np >=GS6

26 ln %i %pl %j loadindex % ?GS7
*GS6 GS7:
28 ln %pl %j loadindex =k
29 ln %k %k * %i <=GS8

31 ln %i %pl %np dup inc =np storeindex
32 ln *GS6 GS8: GS5:
%j inc =j *GS4 GS6:
37 ln %j %np >=GS9
*GS2 GS9:
39 ln %i %pl %np dup inc =np storeindex GS2:
%i inc =i *GS1 GS3:
43 ln printf( %np , "NP %d\n" , ) pop
45 ln
0 =i GS10: %i %np 12 / >=GS12

47 ln
0 =j GS13: %j 12 >=GS15
48 ln printf( %pl %i 12 * %j + loadindex , " %4d," , ) pop GS14:
%j inc =j *GS13 GS15:
49 ln printf( "\n" , ) pop GS11:
%i inc =i *GS10 GS12:
51 ln
0 =j GS16: %j %np 12 % >=GS18
52 ln printf( %pl %i 12 * %j + loadindex , " %4d," , ) pop GS17:
%j inc =j *GS16 GS18:
53 ln printf( "\n" , ) pop ret_v END



> Andrew.
 




 55 Posts in Topic:
RPN maps to basic mathematic expressions nicely
"metaperl.com"   2007-11-11 12:50:24 
Re: RPN maps to basic mathematic expressions nicely
"Paul E. Bennett&quo  2007-11-11 13:06:24 
Re: RPN maps to basic mathematic expressions nicely
"cr88192" <c  2007-11-12 09:25:56 
Re: RPN maps to basic mathematic expressions nicely
Marco van de Voort <ma  2007-11-12 09:21:48 
Re: RPN maps to basic mathematic expressions nicely
"cr88192" <c  2007-11-12 21:40:58 
Re: RPN maps to basic mathematic expressions nicely
Marco van de Voort <ma  2007-11-12 11:46:48 
Re: RPN maps to basic mathematic expressions nicely
Jerry Avins <jya@[EMAI  2007-11-12 13:51:05 
Re: RPN maps to basic mathematic expressions nicely
Andrew Haley <andrew29  2007-11-12 11:39:14 
Re: RPN maps to basic mathematic expressions nicely
Jerry Avins <jya@[EMAI  2007-11-12 13:54:50 
Re: RPN maps to basic mathematic expressions nicely
stephenXXX@[EMAIL PROTECT  2007-11-16 17:49:33 
Re: RPN maps to basic mathematic expressions nicely
Andrew Haley <andrew29  2007-11-16 18:26:39 
Re: RPN maps to basic mathematic expressions nicely
"cr88192" <c  2007-11-17 19:22:07 
Re: RPN maps to basic mathematic expressions nicely
mhx@[EMAIL PROTECTED] (M  2007-11-17 12:34:02 
Re: RPN maps to basic mathematic expressions nicely
Albert van der Horst <  2007-11-17 16:01:42 
Re: RPN maps to basic mathematic expressions nicely
Jerry Avins <jya@[EMAI  2007-11-17 13:37:04 
Re: RPN maps to basic mathematic expressions nicely
"cr88192" <c  2007-11-18 08:39:07 
Re: RPN maps to basic mathematic expressions nicely
Richard Owlett <rowlet  2007-11-17 17:16:33 
Re: RPN maps to basic mathematic expressions nicely
mhx@[EMAIL PROTECTED] (M  2007-11-18 00:21:13 
Re: RPN maps to basic mathematic expressions nicely
mhx@[EMAIL PROTECTED] (M  2007-11-18 00:54:13 
Re: RPN maps to basic mathematic expressions nicely
"cr88192" <c  2007-11-18 11:17:04 
Re: RPN maps to basic mathematic expressions nicely
Andrew Haley <andrew29  2007-11-18 17:50:04 
Re: RPN maps to basic mathematic expressions nicely
"cr88192" <c  2007-11-19 07:48:22 
Re: RPN maps to basic mathematic expressions nicely
Andrew Haley <andrew29  2007-11-19 10:03:11 
Re: RPN maps to basic mathematic expressions nicely
"cr88192" <c  2007-11-20 06:22:12 
Re: RPN maps to basic mathematic expressions nicely
Jerry Avins <jya@[EMAI  2007-11-19 15:39:14 
Re: RPN maps to basic mathematic expressions nicely
"cr88192" <c  2007-11-20 08:33:48 
Re: RPN maps to basic mathematic expressions nicely
Jerry Avins <jya@[EMAI  2007-11-19 17:57:09 
Re: RPN maps to basic mathematic expressions nicely
"cr88192" <c  2007-11-20 16:56:28 
Re: RPN maps to basic mathematic expressions nicely
Jerry Avins <jya@[EMAI  2007-11-20 11:58:40 
Re: RPN maps to basic mathematic expressions nicely
"cr88192" <c  2007-11-21 07:13:13 
Re: RPN maps to basic mathematic expressions nicely
Jerry Avins <jya@[EMAI  2007-11-20 17:55:00 
Re: RPN maps to basic mathematic expressions nicely
"cr88192" <c  2007-11-21 12:03:34 
Re: RPN maps to basic mathematic expressions nicely
Jerry Avins <jya@[EMAI  2007-11-20 21:34:26 
Re: RPN maps to basic mathematic expressions nicely
"cr88192" <c  2007-11-21 14:24:44 
Re: RPN maps to basic mathematic expressions nicely
Elizabeth D Rather <er  2007-11-17 15:30:04 
Re: RPN maps to basic mathematic expressions nicely
anton@[EMAIL PROTECTED]   2007-11-18 09:48:12 
Re: RPN maps to basic mathematic expressions nicely
"cr88192" <c  2007-11-21 09:43:55 
Re: RPN maps to basic mathematic expressions nicely
"cr88192" <c  2007-11-22 13:52:20 
Re: RPN maps to basic mathematic expressions nicely
Elizabeth D Rather <er  2007-11-21 22:48:50 
Re: RPN maps to basic mathematic expressions nicely
"cr88192" <c  2007-11-24 12:00:16 
Re: RPN maps to basic mathematic expressions nicely
stephenXXX@[EMAIL PROTECT  2007-11-24 14:31:22 
Re: RPN maps to basic mathematic expressions nicely
"cr88192" <c  2007-11-25 08:20:06 
Re: RPN maps to basic mathematic expressions nicely
stephenXXX@[EMAIL PROTECT  2007-11-24 14:31:22 
Re: RPN maps to basic mathematic expressions nicely
"cr88192" <c  2007-11-25 08:20:06 
Re: RPN maps to basic mathematic expressions nicely
"slava@[EMAIL PROTEC  2007-11-11 16:14:02 
Re: RPN maps to basic mathematic expressions nicely
"cr88192" <c  2007-11-12 11:21:04 
Re: RPN maps to basic mathematic expressions nicely
Bernd Paysan <bernd.pa  2007-11-23 11:10:48 
Re: RPN maps to basic mathematic expressions nicely
Andrew Haley <andrew29  2007-11-23 15:49:07 
Re: RPN maps to basic mathematic expressions nicely
Bernd Paysan <bernd.pa  2007-11-23 17:24:16 
Re: RPN maps to basic mathematic expressions nicely
"Rod Pemberton"  2007-11-12 01:16:25 
Re: RPN maps to basic mathematic expressions nicely
"cr88192" <c  2007-11-12 16:44:53 
Re: RPN maps to basic mathematic expressions nicely
Marco van de Voort <ma  2007-11-12 17:15:35 
Re: RPN maps to basic mathematic expressions nicely
Jerry Avins <jya@[EMAI  2007-11-12 14:17:04 
Re: RPN maps to basic mathematic expressions nicely
Gary Coulbourne <bear@  2007-11-19 11:22:53 
Re: RPN maps to basic mathematic expressions nicely
John Doty <jpd@[EMAIL   2007-11-19 15:11:44 
Re: RPN maps to basic mathematic expressions nicely
"cr88192" <c  2007-11-20 16:59:49 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 23:35:41 CDT 2008.