Skip to content

Latest commit

 

History

History
42 lines (34 loc) · 1.4 KB

File metadata and controls

42 lines (34 loc) · 1.4 KB

Hacky Lisp

Common Lisp has a lot of simplicity in it, but there are some parts of the language that are incredibly complex… Functions that can be used to hack out a ton of functionality really quickly.

Two examples of this are format function and the loop macro.

format

format is a function that allows you to output a formatted string from pretty much anything.

format accepts a minimum of 2 arguments, the first being where the string would be output, passing in t will output the string to standard output and return nil, having the second parameter as nil will output the string as the result of the function. Any other values for the function will output the string to that place as if it were a stream or a string with a thing called a “fill pointer”.

The second parameter is the “control string”, which supports eons of directives to output your textual data in pretty much any way possible.

(format nil "|~{~<|~%|~,33:;~2d ~>~}|" (loop for x upto 99 collect x))