since around the first years of school, ive been a philosopher, student and programmer. granted my programs up until age 10 were not much, but i was teaching myself with one or two books. i even taught myself how to write programming languages, and i can teach you the same.
in terms of philosophy, i declared myself an atheist at the age of 4. i didnt know the word, i grew up in the bible belt, but i was never pushed to go to church (or reject it, or to be agnostic, or anything.) i loved science, and it simply didnt jibe with this hand-wavey spiritual business (which i would come to accept at least in part, later on.)
at about the age of 4 is when i started using computers as well. its a fact that i was a bright kid. but i could show anyone how its done, explain it in plain terms (to anyone interested) and by the time i was in my 20s i was showing my best friends 7-year-old how to type in basic programs. if you really want to understand, dont just read them– type them in!
unfortunately, basic and programming have gotten a lot more complex. and by “a lot more,” i mean its optional. but unless you know a lot about computer languages, you simply have the whole thing dumped on your lap with no idea how much of it is optional and how much of it you must learn in order to understand the gist of the thing.
enter basic, in 1964.
basic was created in hanover, new hampshire to take the esoteric discipline of computing and make it conceptually accessible to everyone on campus. it was so wildly successful, that by the 1970s it had spread to secondary schools who could access the dartmouth timesharing system (dtss) via teletype, and basic for the altair 8800 was the original product microsoft was created to sell. there are several videos of an altair running basic on youtube:
another computer language from the 1960s to take over the world of education was logo, which is actually a full-featured programming language but you will probably only see it used to move a cartoon turtle around the screen, drawing colorful lines in its path. in some logo-inspired dialects this part of the language could not be easier:
u 40 l 40 d 40 r 40
in english: “draw upwards 40 points, draw left 40 points, draw down 40 points, draw right 40 points.”
this creates a square on the screen.
the problem with logo and most of its descendants is that it starts easy and becomes very complicated or esoteric very quickly. or alternatively, it starts out easy and becomes very cumbersome– you may never get past moving a turtle (or cat) around the screen, which makes it difficult to introduce logo to adults.
but in the 80s the way computing was taught to children and adults was to get them into typing itself, then into typing basic programs or exploring with logo. as the 90s gave way to training with applications and using tools online, we stopped exposing students to the very essence of computing. instead of understanding code as the building block of all software, we operated on the idea that showing how to click on magic boxes was like teaching someone to fish. but clicking on magic boxes will teach you nothing about fish, or about fishing; a better metaphor for 90s computer education is “teaching someone how to buy and eat a fish.”
this is not to disparage python– i coded in basic for 25 years and spent about 5 of them looking for the “basic of the 21st century” and came back from that quest with python itself. (a note to python 2 fans: i am referring specifically to python 2.)
but to share the joy and simplicity of basic, i spent a year working on a new language, which is inspired by basic and logo with a few cues from python, as all of these languages have their own nods to ease and simplicity.
from python it takes lists, which are like basics arrays but they do not restrict each array to “just strings” or “just numerics.” in python and fig, you can mix the two types.
from logo it takes the simplicity of syntax, which rivals basic and python in what you do NOT have to learn. want to create a variable “x” that is equal to 5? here you go:
but wait, you keep hitting equals (or you want to bring back the := for assignment?) voila:
x = 5 x=5 x := 5 x:=5
they all work.
for most of history, basic was not case-sensitive. python is. no problem:
X=5 p=x : PRINt
it works! and the colon : is optional. as in logo, you can use space, or you can use a semicolon, or a pipe:
X=5 p=x print p=x ; print p=x | print
the reason for this is that sometimes these syntax elements will provide valuable visual cues. but fig ignores most of them. it still pays attention to quotes:
now "hello, world!" print
that sets variable “now” to “hello, world!” and then prints the variable. qbasic has a ucase$ command, and so does fig:
now "hello, world!" ucase print
that prints HELLO, WORLD! instead.
fig goes left-to-right, because the last time i showed basic to a friend of mine, she told me “its too much like math.”
well of course it is. but i thought if it was more like english, that might help people learn how to code for the first time. want some more features? fig has about 100 commands. and one of those allows (tada!) inline python code:
function funkyfunky p now #you have to create it in fig to call it in fig fig python def funkyfunky(p): if p == 3: print "yeah!" fig now funkyfunky 3
in that example, the python code isnt necessary, just a demonstration:
function funkyfunky p ifequal p 3 now "yeah!" print fig fig
python indentation is great– but i know people that really have trouble with it. fig uses pascal/basic/bash-like commands instead of indentation or braces:
function funkyfunky p ifequal p 3 now "yeah!" print fig fig
the “fig” command is like unindenting in python, and also returns from inline python to, well… fig. in many cases you can use basic-like “next” or “wend” for aliases. if you like bash, then “fig” is one letter different than the “fi” command.
this year i wrote a book that pretty much explains the entire fig language, which (like fig itself) is in the public domain.
if you want a nifty live gnu/linux distro that features the fig language, there is fig os, or you can look at this review on distrowatch of the first operating system distro to include the fig language– refracta:
refracta is based on the “devuan” fork of the software they run on the international space station. because i havent found a screencap of fig running in refracta, here is one of it running in devuan:
i use fig to teach programming, but i would like to do that more often. i would also like to teach people how to create their own programming language.
the hardest part of creating a programming language is writing a program that can parse code. figs left-to-right parser demonstrates how a useful language can be parsed fairly easily. if fig were more strict and required syntax between commands, it could be parsed even more easily.
i have tried to create a recursive parser (the kind that makes a language “too much like math” in my friends words) on a few occasions, and i know its something trivial that im not doing, because ive seen them work.
why more languages? so we can get closer to making languages that truly anyone can learn. basic, logo and fig are really good for that, in my opinion. python isnt bad for it. fig is the most ambitious language project ive ever worked on, but i wouldnt mind participating in the design of another one.
because its written in python, fig runs on most gnu/linux distros, windows, mac os/x, android, bsd, and some other operating systems that are capable of running python.
- license: creative commons cc0 1.0 (public domain)