SyntaxHow does it look like?
The syntax was inspired by LISP and bash. Sounds strange? For example,
(* (+ 2 4 (#FACT 4)) 3) means (2 + 4 + fact(4)) * 3 where fact is userdefined function for factorial. BasicsAs you've probably noticed, DL/SQL has got prefix (polish) notation with compulsory bracketing. That means, in front any name of function there must be opening bracket and after last parameter of a function there must be closing bracket. With this rule it's really easy to implement variablelength argument lists. DatatypesAs for now, DL/SQL supports only two types: float and list of floats (no lists of lists, etc.). Lists syntaxThere's special syntax of lists in DL/SQL. The regular (yes, we need just regular expression with simple lists) expression describing the list is:{\(?[09]*\(\.[09]+\)\([+]?\([eE][09]+\)?:\)*} Well, that doesn't help much, so:
Boolean valuesWhen evaluating logical functions, the input value of TRUE is every nonzero value. Input value of FALSE is 0, 0.0, an empty list and list with one zero member ({0:} ).
Output value of TRUE is 1 and output value of FALSE is 0, meaning
that result of (* 3 (+ (> 3 2) 1)) is 6 .
Hardcoded functionsHere follows list of functions implemented in DL/SQL.
ConditionThe only function with strict evaluation strategy isIF (form of ?
is also acceptable). If first parameter equals true the second is returned,
otherwise the third one is returned.
Calling user functionsI wanted the parser to be the simplest one, so there's little hack about calling custom functions. Every name of called user function must have prepended the hash sign (#). So calling custom function called QUICKSORT is done like this:(#QUICKSORT {10:20:30:}) Defining user functionsBecause the idea of putting everything in the database, we don't need to have semantic construction for defining custom function  we simply put another row into database with correct definition of function body and that's it. :)For referencing parameters in function's definition, we can use several ways to do so: Bashlike parametersFirst parameter is referenced as$1 , second as $2 and so on.
Parameter $0 contains number of parameters passed to function.
Passing all parametersThere's special construction for passing all parameters passed to function to another function. This construction is made through$* .
Selective parameter passingThis one is little hack: sign$ can be taken as a special function. Its
parameter is list of parameter indexes, which should be pushed into variable stack. Following
example clears the situation up:
Lets say we have function called #SUMPARS246 defined as (+ ($ {2:4:6:})) .
If we call the function with paremeters (#RETPARS246 10 20 30 40 50 60 70) ,
its result will be 20+40+60 = 120. (sum parameters 2, 4 and 6)
(the fact that $3 = ($ 3) = ($ {3:}) is not coincidence at all)
