Talk:Tiki forum archive/Forum 5/7910

From Lojban

Source: 2013 Tiki forum 5, thread #7910. Original authors, UTC times, post IDs, and reply-parent IDs are preserved. This is an archive, not an active article discussion.

A completely different RPN solution.

A completely different RPN solution.

rlpowell · 2009-02-07 20:53 UTC · Tiki post #7910

Just sending this because I haven't actually put it anywhere yet.

-Robin


Forwarded message from Robin Lee Powell <[email protected]> -----

Subject: Palm Writings + RPN From: Robin Lee Powell <[email protected]> To: [email protected] Date: Tue, 28 Oct 2008 18:17:34 -0700


Dammit, I'm too scared to put it on the Palm when I can't sync, so:

@h1 A Completely Different RPN Solution

We could have explicit push and pop operators in KOhA. Call them xa'a and xu'u, respectively. Usage would be like so:

xa'a li pa sumji li re .i sumji li vo xu'u

The first bridi adds 1 and 2 and pushes the result onto the stack. The second adds 4 to the topmost stack element.

Given that, there could also be an RPN marker that would allow dropping the explicit push and pop, given text such as:

li pa li re te sumji .i li vo li mu te sumji .i te pilji

Determining where the implicit pops and pushes go doesn't even need to be semantic; it can be as simple as "How many places are free? If 1, push. If w e have N-1 on the stack, pull them in order, push the last. If we have less than that, error."

With the occasional special case like a print bridi, which pulls exactly one and pushes none.

For the implicit version, you probably want 2-argument sumji and pilji. You can use the explicit version with the inf-arg ones though.

12:34 < Eimi> This is starting to sound like the hammer I need for my prenex nail. {le mi mlatu goi -push zo'u mi terpa tu'a -pop}

-Robin

-- They say: "The first AIs will be built by the military as weapons." And I'm thinking: "Does it even occur to you to try for something other than the default outcome?" -- http://shorl.com/tydruhedufogre http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/


End forwarded message -----

-- They say: "The first AIs will be built by the military as weapons." And I'm thinking: "Does it even occur to you to try for something other than the default outcome?" -- http://shorl.com/tydruhedufogre http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/


To unsubscribe from this list, send mail to [email protected] with the subject unsubscribe, or go to http://www.lojban.org/lsg2/, or if

you're really stuck, send mail to [email protected] for help.

A completely different RPN solution.

Jim Carter <[email protected]> · 2009-02-10 22:00 UTC · Tiki post #7938 · reply to Tiki post #7910

On Sat, 7 Feb 2009, Robin Lee Powell wrote:

> Subject: Palm Writings + RPN > From: Robin Lee Powell <[email protected]> > To: [email protected] > Date: Tue, 28 Oct 2008 18:17:34 -0700 > > @h1 A Completely Different RPN Solution > > We could have explicit push and pop operators in KOhA. Call them > xa'a and xu'u, respectively. Usage would be like so: > > xa'a li pa sumji li re .i sumji li vo xu'u > > The first bridi adds 1 and 2 and pushes the result onto the stack. > The second adds 4 to the topmost stack element. > > Given that, there could also be an RPN marker that would allow > dropping the explicit push and pop, given text such as: > > li pa li re te sumji .i li vo li mu te sumji .i te pilji

(etc.)

This brings back fond memories. The mathematical expression syntax in Old Loglan was rather horrendous, and I was not satisfied with the grammar for simple dimensioned quantitites such as "I am 1.73 meters high". When I worked on gua\spi I took the opportunity to define mathematical expressions as RPN. This document section begins with math expressions (and continues with quantification, and sentence forms, which are not today's topic).

   http://www.math.ucla.edu/~jimc/guaspi/vocab2.html

In "real" RPN no explicit stack pushing and popping are needed because the operators have a predetermined number of arguments; they always pop all their arguments and then push the single result. But if an operator had multiple results (e.g. quotient and remainder), or where you want to optimize a computation by computing a sub-expression once and then replicating the result, then explicit stack manipulation is needed.


James F. Carter Voice 310 825 2897 FAX 310 206 6673 UCLA-Mathnet; 6115 MSA; 405 Hilgard Ave.; Los Angeles, CA, USA 90095-1555 Email: [email protected] http://www.math.ucla.edu/~jimc (q.v. for PGP key)


To unsubscribe from this list, send mail to [email protected] with the subject unsubscribe, or go to http://www.lojban.org/lsg2/, or if

you're really stuck, send mail to [email protected] for help.