This is neat...

Miscellaneous Forums/General Discussion/This is neat...

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

This particular lisp implentation (Allegro Common Lisp) only goes that high. Any higher and it spits out an error "return too long to print in english" or something to that effect.

I tested a couple of other lisp implementations and none of them went quite as high as the above number.

(well, actually the above number could be bigger...it could handle 999 vigintilion, but can't handle an extra digit)

The power of that function alone is amazing...for instance the following line

(format t "~{~{~a:~10t~a~%~}~%~}" *db*))

does a double (nested) loop (where the '{' intiates the loop) over the *db* variable, printing it's values in a tab column 10 spaces wide. So if *db* is a variable that contains a list of lists representing say audio cd entries, it might print the following

TITLE: Black Album
ARTIST: Metallica
RATING: 5
RIPPED: T

TITLE: Dark Side of the Moon
ARTIST: Pink Floyd
RATING: 10
RIPPED: T

etc...

(example taken from the free online book at http://www.gigamonkeys.com/book/)

Another cool example is

(format nil "~d" (/ 14124 52))

which prints 3531/13 <-- the simplified version of the expression 14124/52 which is what the (/ 14124 52) represents. Lisp handles fractions properly. It converts ints to bignums ...it can handle any size number

So the following, which is 4 * the huge number... returns the proper result

(* 4 222222222222222222222222222222222222222222222222222222222222222222222222222222222)

returns

888888888888888888888888888888888888888888888888888888888888888888888888888888888