|
@@ -2644,23 +2644,28 @@ durations computations @ref{Durations and time values}.
|
|
|
@subsection Emacs Lisp forms as formulas
|
|
|
@cindex Lisp forms, as table formulas
|
|
|
|
|
|
-It is also possible to write a formula in Emacs Lisp; this can be useful for
|
|
|
-string manipulation and control structures, if Calc's functionality is not
|
|
|
-enough. If a formula starts with a single-quote followed by an opening
|
|
|
-parenthesis, then it is evaluated as a Lisp form. The evaluation should
|
|
|
-return either a string or a number. Just as with @file{calc} formulas, you
|
|
|
-can specify modes and a printf format after a semicolon. With Emacs Lisp
|
|
|
-forms, you need to be conscious about the way field references are
|
|
|
-interpolated into the form. By default, a reference will be interpolated as
|
|
|
-a Lisp string (in double-quotes) containing the field. If you provide the
|
|
|
-@samp{N} mode switch, all referenced elements will be numbers (non-number
|
|
|
-fields will be zero) and interpolated as Lisp numbers, without quotes. If
|
|
|
-you provide the @samp{L} flag, all fields will be interpolated literally,
|
|
|
-without quotes. I.e., if you want a reference to be interpreted as a string
|
|
|
-by the Lisp form, enclose the reference operator itself in double-quotes,
|
|
|
-like @code{"$3"}. Ranges are inserted as space-separated fields, so you can
|
|
|
-embed them in list or vector syntax. Here are a few examples---note how the
|
|
|
-@samp{N} mode is used when we do computations in Lisp:
|
|
|
+It is also possible to write a formula in Emacs Lisp. This can be useful
|
|
|
+for string manipulation and control structures, if Calc's functionality is
|
|
|
+not enough.
|
|
|
+
|
|
|
+If a formula starts with a single-quote followed by an opening parenthesis,
|
|
|
+then it is evaluated as a Lisp form. The evaluation should return either a
|
|
|
+string or a number. Just as with @file{calc} formulas, you can specify modes
|
|
|
+and a printf format after a semicolon.
|
|
|
+
|
|
|
+With Emacs Lisp forms, you need to be conscious about the way field
|
|
|
+references are interpolated into the form. By default, a reference will be
|
|
|
+interpolated as a Lisp string (in double-quotes) containing the field. If
|
|
|
+you provide the @samp{N} mode switch, all referenced elements will be numbers
|
|
|
+(non-number fields will be zero) and interpolated as Lisp numbers, without
|
|
|
+quotes. If you provide the @samp{L} flag, all fields will be interpolated
|
|
|
+literally, without quotes. I.e., if you want a reference to be interpreted
|
|
|
+as a string by the Lisp form, enclose the reference operator itself in
|
|
|
+double-quotes, like @code{"$3"}. Ranges are inserted as space-separated
|
|
|
+fields, so you can embed them in list or vector syntax.
|
|
|
+
|
|
|
+Here are a few examples---note how the @samp{N} mode is used when we do
|
|
|
+computations in Lisp:
|
|
|
|
|
|
@example
|
|
|
@r{Swap the first two characters of the content of column 1}
|