Actual FormLis Powered Plots

I’ve been busy integrating charts into FormLis. Heres how they look together. Isn’t that lovely?

Chart
You generate charts from view data. In this case I used a food intake tracker that is helping people make sure they’re getting their recommended daily amounts. Here is the
relevant data — I’ve added the highlighting, column numbers and outlines — this is what the chart is seeing.
Dataset
And here is the magic tying them together:
PLOT bar chart ;
ON “/*/” leaf-totals ;
LIMIT 1 ;
POINTS-PER-ROW 6 ;
X p# 0 case “Protein” ; then
     1 case “Grains” ; then
     2 case “Vegetables” ; then
     3 case “Fruits” ; then
     4 case “Milk” ; then
     5 case “Fats” ; then ;
Y 5 p# + column ;

Plots describe how views are transformed into (X & Y) pairs. ON “/*/” leaf-totals ;  slices the data up into multiple plots. In this case 1 plot per  top level group (e.g. Tom, Peggy, etc). Its the pink boxes in the view above.  I’m using the leaf-totals as data because they contain my daily sum (I’ve highlighted them in white). Leaf-totals means the same as the sub-sub-sub-sub-totals. I could have chosen to use the rows or the overall totals.

I want to restrict the plot to just todays data, which is the first row in each group, so I say LIMIT 1 ;.

Each of these rows will produce several (X &Y) pairs. For example Tom’s row will produce (“Protein” & 12), (“Grains” & 6), (“Vegatables” & 2.5) etc. So I say POINTS-PER-ROW 6 ;

Lastly, I have to tell FormLis how to compute the X & Y values. That’s what the X and Y functions above do. X says “take the point number (p#), if its zero -> Protein, if its 1 -> Grains, etc”. Y says take the point number, add 5, and use that column’s data.


Forth Databases

“Over the years, applications were added and discarded, including a real-time breath-by-breath exercise testing system, and various database applications. It migrated to a PDP 11/84 in 1987 and then the application source was rewritten for LMI’s UR/Forth on a PC in 1998.”

“Today the main applications are all database applications; the real-time applications having been replaced by turnkey systems that connect serially. The main applications are RT order entry, billing, PFT/Exercise data and ABG lab data. There are over 5,000 blocks of active Forth source code – perhaps”

Forth Success Stories

Most languages have some libraries to connect to databases; modern languages often include one in the standard distribution. Forth is an exception. There don’t seem to be libraries to connect to standard SQL databases, and forth programmers don’t care. When forth programs need a database, they don’t use familiar ones. Read the rest of this entry »


HACK: Co-routines in SBCL Lisp

There is a lot of mystery around co-routines; What are they? What can you do with them? Does language X have them? Experts agree they can implement multithreading, and they are the mechanism behind the yield operator in certain languages and are thus the driving force of ‘generators’. They are often mentioned along with continuations; “Continuations”, they say “can be used to implement co-routines”. What on earth does it mean! Read the rest of this entry »


Programming Language Syntax

In last weeks article I used Python; I didn’t like the experience. I don’t like its syntax which is just like C, C++, Basic, Java, C#, Fortran, &c. These languages maintain an invented separation between statements and expressions. Read the rest of this entry »


Flexible Parsing without Regexps

I had trouble writing a wiki parser for FormLis because it had to feel natural. Some wiki’s require N spaces before the bullet asterisks, or exactly 4 spaces for an indented line. FormLis doesn’t care. The parser I’ve written has no lexer and no regexps. Read the rest of this entry »


Forth in Lisp

In preparation of FormLis leaving open alpha and entering beta status, I though I’d write about some of the technology behind the system. One cool feature is the powerful view engine, which permits powerful yet readable view descriptions. Read the rest of this entry »


Follow

Get every new post delivered to your Inbox.

Join 34 other followers