>>> Continued from previous message
There are a few peculiarities to ARDAF, however. Consider:
3}8
This means the "cube root of 8". The curly brace in this instance
is used as a radical symbol. The / symbol is used only for square
roots.
Arguments needn't be in base 10 with ARDAF, which is new to
v1.5. Consider the above cube root in binary notation:
&B11}&B1000
I leave it up to you to decide how useful the &O, &H, and &B
prefixes can be for your purposes. (NB: Results are always passed
back in base 10.)
Definable functions were introduced in v1.4 and are still available,
although a few "built in" functions have been added, such as COS(),
SIN(), ABS(), et cetera. You can add more built in functions
to suit your need. The function definitions syntax is like this:
my_function(arg list) := formula
Note that variables created within the formula portion of the
function are dynamic. Consider:
cube_root(x) := 3}x
The "x" referenced in the parameter list is local to the cube_root()
function. A pecularity of ARDAF functions is that parameters may
have default values, such as:
rand(high:100, seed:TIMER) := high?seed
(Note that the ? operator is unique to ARDAF and means "pass back
a random number from 0 to the left argument, seeded by the
right argument.")
If this function is called simply:
rand()
It will assume that the user wants to use the defaults.
If the user calls:
rand(10)
the function will pass back a number from 0 to 10, seeded by the
TIMER internal variable. If the user seeds it thus:
rand(10, 9.2)
It will seed the function with the user specified value.
I leave it up to you to decide what is possible with default
value parameters.
One final syntax note....
Sometimes, you might want to do a formula in steps. Consider:
y := 3.56
radius := 10y
area_of_circle(radius)
This can be done in ARDAF thus:
y := 3.56; radius := 10y; area_of_circle(radius)
Note that functions CANNOT have definitions longer than one
statement, so that this is not legal:
my_function(x) := y := 2x; 3.5y
COMPATIBILITY NOTES:
This version is PowerBASIC 3.1 compatible only, because it uses
an extension added only since v3.1. Namely, its functions use
the FUNCTION = x syntax. From the README.DOC distrubuted with
version 3.1:
X FUNCTION return values may now be assigned without
the necessity to use the name of the function. The
older method of using the name of the function can
still be used. The advantage to the new method is
to make source code more understandable when browsed.
Ex: FUNCTION AddOne(BYVAL int.param AS INTEGER)
FUNCTION = int.param + 1
END FUNCTION
This is easy enough to remedy with a search for "FUNCTION ="
if version 3.0 users want to port it backwards.
FUTURE RELEASES:
What more can I add to ARDAF? Will their be a version 1.6?
Well, yes and no.... RDF14.BAS was updated to 1.5 so that I
might be able to continue my work into aLIVE! v1.0 and Fermat,
the Object Oriented BASIC preprocessor. I needed a PowerBASIC
compatible version of my RDF engine, and since I had already
released 1.4 into the public domain for QuickBASIC users, I felt
that the minor revisions made in the 1.5 upgrade would allow
another public domain release. Version 1.6 may include
imaginary numbers, so that this is possible:
/-4 = 0 + 2i
i2 = -1
But, alas, version 1.6 will be an AhuraMazda(tm) Software in-house
tool.
Enjoy and modify version 1.5 to your heart's content, however,
and even include it as a *.TIP file with future versions of
PowerBASIC, if you want, PowerBASIC Inc.
Rope it, ride it, hang it out to dry.... Just don't expect me
to support public domain code that you have the source code
for.
$ENDIF
Jamshid
--- Maximus/2 2.01wb
---------------
* Origin: Sound Stage BBS - Live Via Satellite - (604)944-6476 (1:153/7070)
|