/usr/share/genius/gel/misc/misc.gel is in genius-common 1.0.21-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | # Misc Constants/functions for Dr. Genius
#make something a string
SetHelp("string","basic","Make a string");
function string(s) = s + ""
SetHelp("Compose","basic","Compose two functions")
function Compose(f,g) = (`(x)[f,g]=(local *;f(g(x))))
SetHelp("ComposePower","basic","Compose a function with itself n times, passing x as argument, and returning x if n == 0")
function ComposePower(f,n,x) = (
local *;
for k=1 to n do
x = f call (x);
x
)
SetHelp("PrintTable","basic","Print a table of values for f(n) for numbers from from vector v, or if v is a number for integers from 1 to v")
function PrintTable(f,v) = (
local *;
# Note we can't check the 2 arguments, FIXME
if not IsFunction(f) then
(error("PrintTable: f must be a function of one argument");bailout);
if IsVector(v) then (
for k in v do
print("" + k + "\t" + (f call (k)))
) else if IsPositiveInteger(v) then (
for k=1 to v do
print("" + k + "\t" + (f call (k)))
) else (
(error("PrintTable: v must be a vector or a positive integer");bailout)
)
)
|