Post Reply 
newRPL: Output to a text console
01-13-2017, 03:14 PM (This post was last modified: 01-13-2017 03:18 PM by Claudio L..)
Post: #7
RE: newRPL: Output to a text console
Another idea, that deviates a bit from a traditional console (expanding on DavidM's idea above):

Extending the idea of putting graphics: how about putting input controls? and evaluation of formulas? or running code?
Then this console browser will become the replacement of the INFORM system. The console would become more like a MathCAD sheet than an actual console.

I'm still not sure what format this would have, here's an early proposal (all text):

Code:

"@! TITLE Triangle solver

@! EVAL 'CHANGEMENU'

Side A: @! INPUTVAR 'A' 1
Side B: @! INPUTVAR 'B' 1
Side C: @! INPUTVAR 'C' 1
Angle ɑ: @! INPUTVAR 'Alpha' ∡60°
Angle β: @! INPUTVAR 'Beta'  ∡60°
Angle ɣ: @! INPUTVAR 'Gamma'  ∡60°

@! EVAL 'TRIANGSOLVER'
@! EVAL 'UPDATESKETCH'

@! INCLUDE 'SKETCH'

@! INCLUDE 'LAWOFSINESFORMULA'
@! INCLUDE 'LAWOFCOSINESFORMULA'

@! IFEXISTS 'HAVESOLUTION'
Solution:
Side A: @! FORMAT 'A' #.###
Side B: @! FORMAT 'B' #.###
Side C: @! FORMAT 'C' #.###
Angle ɑ: @! FORMAT 'Alpha' ∡#°
Angle β: @! FORMAT 'Beta' ∡#°
Angle ɣ: @! FORMAT 'Gamma' ∡#°

@! ELSE
No solution yet.
@! ENDIF


"

In the example above, the @! lines have special commands for the browser. In this example, @! INPUTVAR creates an edit control, the value after the variable name is the initial default value in the editor if the variable doesn't exist.
@! EVAL will simply evaluate the given variable, in the example, 'UPDATESKETCH' contains a program that will plot a sketch of the triangle to a PLOT object and store it in the variable 'SKETCH'. 'CHANGEMENU' contains a program that changes the current menu to the "app" menu, for example with options to exit the app, export the solution, reset the app, etc.
@! INCLUDE will insert the content of the given variable into the console. The variable can contain text, graphics or even more console browser pseudocode, so you can make the sheet dynamic. Also, formulae should be converted to pretty print automatically when included with @! INCLUDE, so the lines including 'LAWOFSINESFORMULA' would display nicely.
@! IFEXISTS, @! ELSE and @! ENDIF here does the obvious: check if a variable exists, then include a portion of text or the other.

The idea is that any change would automatically trigger a reevaluation of the entire sheet, so if the user edits a variable value while browsing, the menu will change again, the solution recalculated and the sketch will be updated.

This sheet should perhaps go into a variable called 'Form', then the 'Form' is evaluated following all the pseudo-commands and the output goes to 'Console'. The browser displays 'Console' and allows interaction with its input fields. Then again, any change will cause 'Form' to be rescanned and a new 'Console' generated and displayed.

Does it seem a reasonable syntax? Does it improve over the old INFORM system?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: newRPL: Output to a text console - Claudio L. - 01-13-2017 03:14 PM
RE: newRPL: Output to a text console - Han - 01-13-2017, 03:22 PM
RE: newRPL: Output to a text console - Han - 01-13-2017, 08:12 PM



User(s) browsing this thread: 1 Guest(s)