login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for BootProgramming revision 3 of 5

1 2 3 4 5
Editor: test1
Time: 2018/02/15 15:44:26 GMT+0
Note:

changed:
-Boot is used internally in Axiom for some of the interpreter
Boot is used internally in FriCAS for some of the interpreter

Boot is used internally in FriCAS? for some of the interpreter and compiler code. Here is a detailed description of the Boot Language

This is a simple example of Boot programming.

Define a function.

boot
pairBoot(a,b) ==
  a>b => [-b,-a]
  [a,b]
boot
 
   >> System error:
   invalid number of arguments: 1
; compiling file "/var/aw/var/LatexWiki/9211484592716052519-25px001.clisp" (written 27 MAR 2011 03:16:11 AM):
; /var/aw/var/LatexWiki/9211484592716052519-25px001.fasl written ; compilation finished in 0:00:00.006 Value = T

Now call it.

fricas
pairBoot(1,4)$Lisp

\label{eq1}\left(1 \  4 \right)(1)
Type: SExpression?
fricas
map(integer,destruct(pairBoot(3,2)$Lisp))
>> System error: The function BOOT::SPADDIFFERENCE is undefined.

That's my first Boot function!

You can now write for example:

boot
foobar(x,y) == x + y
boot
 
   >> System error:
   invalid number of arguments: 1
; compiling file "/var/aw/var/LatexWiki/7491012761112044243-25px003.clisp" (written 27 MAR 2011 03:16:12 AM):
; /var/aw/var/LatexWiki/7491012761112044243-25px003.fasl written ; compilation finished in 0:00:00.002 Value = T

And call it with

fricas
integer(foobar(2,3)$Lisp)
>> System error: The function BOOT::PLUS is undefined.

In FriCAS? (from revision 1049 on) the simplest way to compile and load boot code is to write it into a file and then call something like:

  )read FILE.boot