I actually think that “speeding up” is not aaaaall that important.
Kindly permit me a “philosophical” observation: everything you usually do on a machine demands “memory”. The “scarce” memory is the RAM, the “available” memory is the flash. If you could somehow “shift” the “memory burden” from the RAM into the flash, you will have freed more of the most precious resource. “How can one do that?” - Yeah, there are different ways, and this time I do not mean “virtual memory”. Rather, I mean “TYPICAL” operations. “Things a user would do”: compute mean and standard deviation of a range, compute calendar dates, etc.
Philosophically, “programming” is itself a “problem”. The most “typical” style of computation still takes place as in the 1940s: people sum up columns of numbers, compute interest, etc. For this, they use not the Manchester Mark I, but… Microsoft Excel or LibreOffice Calc or whatever. Every time you have to “enter into a loop” or a recursion - you “wager” whether you will actually come out of it. “Columns of numbers” seem, on the other hand, for about a century to “be the thing that people compute on”. Columns are “safe”. Programmers are focused on VARIABLES, and then they put lipstick on the pig by using “objects” and “functions” and whatnot. But “common people” use “something that works on columns of numbers”. (I have devised a system which I call 1V0 (I have been working on it like obsessed for the last month) which operates just on that - the “number column in memory” is quasi its prime target of operations.)
So where “copious” space is available, I advise creating and using “libraries of functions”, and perhaps even letting the user pick which to include at compile time.
Operations I am using in my system - I refer to memory ranges, but here I shall call them simply “lists” are e.g.:
-
add two lists, number by number;
-
divide two lists, without getting hysteric about division by zero and just giving 0 as return;
-
fill a list from a value on in steps with a value;
-
compute mean and standard deviation on a list;
-
I actually put a look-up-function in there to say “at what standard deviation a certain probability should be covered” and vice versa;
-
take the square root of a list;
-
divide a list by a number;
-
return the list with an area “zeroed”;
-
etc.
My system allows up to 63 functions total, and yes, 1V0 operates ONLY AND EXCLUSIVELY on numbers, whereas uLisp faces no such constraints.
I know that most of these suggestions are laughably easy to implement with a simple map or a simple apply. But AMATEURS (School kids? Their teachers? Their parents?) actually HATE the “fancy stuff to begin with”.
WHAT to implement? - Just google “the 100 most useful Excel functions”, you will find several works on that.
Of course, this will totally “blow up” the language reference, and hence I suggest not actually making these part of “core” uLisp, but making them part of “libraries”. @johnsondavies of course has already made MANY libraries available, particularly considering physical I/O and sensor reading, and whatnot. But I am having another “basic” view: I simply think the Arduino DUE or the BBC micro could be a very nice bookkeeping machine if properly configured.
What I thus propose for a basic design idea is to make to the user the following possible:
(fn … (f3 (f2 (f1 SOME-LIST)) …)
where these functions are aimed at fulfilling many of the most common tasks a user would normally perform.
It DOES require some design though, mind you. For instance, what do you do when you really compute mean and standard deviation of a list? Do you return just these two values? Is only one value returned, depending on the function? Is the original list to be returned, with these two values at the front?
Another question is, “how do you return MULTIPLE values”, and here, I actually have another “non-standard” proposal: “multiple-value-bind”, for instance, is ABSOLUTE TRASH for the novice. Seriously?! These people are afraid to even CALL a function, and you want them to handle its multiple values? - My “terrible” proposal is thus another: set certain pre-defined global variables to certain values.
In essence, the basic idea of my proposal is to let the user come as far as possible using one or two lists as arguments to a series of “stacked operations”, and to set, where necessary, certain (automatically generated?) global variables to certain values. The aim of the effort is to avoid any fancy “map apply …”, and to avoid looping.
If none of these ideas sound convincing, then the “easiest space-waster”, by the way, is a look-up-table. (Particularly as used in statistics for standard deviation and probability coverage.)