Bracmat - the art of failing

Bart Jongejan 20081014

In Bracmat you can't

use types
Data is described by what it looks like, not by its computer internal representation.
use pointers
Data is described by what it looks like, not by its computer internal memory location.
use fixed or floating point numbers
Bracmat implements integers and fractions of indefinite size.
test with 'false' and 'true'
A Bracmat program tests for the success of all its expressions and chooses the next step depending on the result.
subtract and divide
Subtraction is a combination of a multiplication and an addition, division is a combination of exponentiation and multiplication.
use IF condition THEN onething ELSE theotherthing
you do condition & onething | theotherthing
use regular expressions
because they are very difficult to read when things become complex. And they only take a string as subject, not a list of tuples or a tree.

In Bracmat you won't

use arrays
you use lists
allocate and deallocate memory
Bracmat does it where needed.
use numbers very much
a number is a poor vehicle for your imagination
normally use quotes or apostrophes around strings
no clutter
use libraries
if you want graphics, sound, internet, numbercrunching or statistics this isn't the right place
have to learn many build-in functions
three - is that too much? (There are less than 20 built-in functions, of which you mostly use three or four.)
run out of space anytime soon
Bracmat was designed when computer memory was still very precious.
develop programs that are dumb-minded or that run at excessive speeds
next door
expect that your input is flawless
Bracmat smiles and does not throw exceptions at you

With Bracmat you

analyse data
such as a large text, old invalid html, your colleage's C++ source or a conversation between your avatar and a software agent
evaluate expressions
So A+A is?
find what you want with a descriptive pattern
that is more clever and more elegant than a regular expression
write programs incrementally
while you learn to break down your data
do difficult things
in an afternoon
have fun
because it is different

Bracmat

simplifies and normalises algebraic expressions
So that A+A becomes 2*A, so that B+A becomes A+B and so that (A B) C becomes A (B C), which is written as A B C.
evaluates quite advanced algebraic expressions
so that x\D(N^x) becomes N^x*e\LN or
           x
        d N     x  log N
        ---- = N  e
        d x
supports evaluation of expressions in a pattern matching context
So that

(William.McKinley)
(Theodore.Roosevelt)
(William.Howard Taft)
(Woodrow.Wilson)
(Warren "G.". Harding)
(Calvin.Coolidge)
(Herbert.Hoover)
(Franklin "D.". Roosevelt)
(Harry "S.". Truman)
(Dwight "D.". Eisenhower):? (?name1.?surname) ? (?name2.!surname) ?


assigns Theodore to name1 and Franklin D. to name2, because these two presidents have the same surname Roosevelt, and so that

24 25 26 27 28 29:? (?n&!n^1/3:#) ?

assigns 27 to n, because 27 is the first (and only) number in the list that is the cube of an integer.
supports functional programming
So you are allowed to assigne a new value to a variable, but you can never change the value itself.
supports structure sharing
Because of the immutability of values, the same memory location can safely be referenced by conceptually unrelated variables. They will never know of each other's existence.
supports reference counting and automatic deletion
Unreferenced data is at once freed.

Valid XHTML 1.0 Strict