alas, no. it has been a request from this community for a long time.
but it is possible to define named procedures for use in Action Formulas (ie. buttons and automations).
we can do this by creating a named button that executes the computations we require, and then invoke that button from within other action formulas.
let me illustrate that with an example; a procedure that computes the length of a 2d line.
the formula we want to define is…
D=squareroot( square( x2-x1 ) + square( y2-y1 )
lets assume that the parameters x1, x2, y1, y2, and the result LENGTH are columns in a table called LINES (its the most convenient way)
then we create a button called DISTANCE which has the following code
LINES.last().modifyrows(
LENGTH, squareroot( power( x2 - x1 ,2) + power( y2 - y1, 2) )
)
then anywhere we want to invoke this procedure we write the following code
runactions(
LINES.addrow( // set the parameters for the line
x1, pointA.x,
y1, pointA.y,
x2, pointB.x,
x2, pointB.x,
y2, pointB.y
),
DISTANCE // computes the LENGTH
)
this contrived example shows one way to create and use a ‘named procedure’ with parameters in CFL. for this trivial example, it may seem like more trouble than its worth.
but for more complicated business logic, it is a great way to abstract and encapsulate the logic inside a single procedure where it can be maintained easily and invoked from many places.
(btw: scheme is a GREAT language to learn and gives you a deep insight into how the Coda Formula Language (CFL) works - they are very similar in their ways internally.)
respect
max