One of the most useful Common Lisp functions for text processing is search ; it lets you search for a substring in a string, and returns its position. I've recently written two extensions to search to help with processing the HTML in web pages, and I thought they might be useful. search2 The first routine search2 searches in a target for a string enclosed between an opening string and a closing…
Calculating the digits of pi
One of the examples I wanted to include for my Simple infinite precision arithmetic package is a function to calculate an arbitrary number of digits of π. I finally got it working, so here it is. Digits of π The formula is based on the following equation found by John Machin, an 18th century astronomer and mathematician: π 4 = 4 arctan 1 5 – arctan 1 239 If you're wondering where…
Simple infinite precision arithmetic
This is a simple infinite precision arithmetic package I wrote as an example program for my Lisp interpreter for small microcontrollers, uLisp. First a couple of disclaimers: This could probably be written more efficiently. However, one of the aims of the package was to keep it concise and understandable, to show how easy it is to write this type of application in Lisp. Secondly, bignums are a…