# lisp

## Playing Around With Racket

Lately I’ve been playing around with the racket dialect of lisp. Racket is a language of the scheme family, and so far I’ve found it simple enough to pick up through the provided tutorials. Things I like about it are Simple syntax. It is a lisp, after all, so there are plenty of parentheses. One thing racket does, however, is treat all brackets: (, [, and {, the same. As long as they are balanced by the appropriate closing bracket, they are interchangeable.

## A Basic Monte-Carlo Simulation in Common Lisp

Monte-Carlo simulations are algorithms that approximate numerical results by repeatedly sampling some space. Generally, the more samples you collect, the higher the accuracy of the result. In this blog post I am going to demonstrate how to use such a technique to approximate the value of the mathematical constant pi. The high level idea is as follows. We know the area of a circle can be found using the formula A = pi * r ^ 2, where r is the radius of the circle.

## An example anaphoric macro in Common Lisp

Anaphoric macros are macros that capture symbols intentionally, only to refer to them by a different name (an apaphor is an expression referring to another.) A popular example in Common Lisp is the loop macro, which uses the symbol “it” to refer to certain things in different contexts. Here’s an example from wikipedia: (loop for element in '(nil 1 nil 2 nil nil 3 4 6) when element sum it) As another example, here we will introduce a special version of the built-in “lambda” special form, that introduces a symbol “self” that refers to the lambda being defined.