Code: Select all
(define (f a b)
	(set
		'a (or a 1)
		'b (or b 3))
	(+ a b b a))
This is how a newLISPer gives default values to parameters.
Using a pattern becomes easier if it is encoded into the language. Rather than having to explain the steps necessary to implement the idiom (usually to a newbieLISPer), you can just point them to the right function.
Here is an example using an imaginary "idiom-encapsulating function" called default:
Code: Select all
(define (f a b)
	(default
		a 1
		b 2)
	(+ a b b a))
In the spirit of implicit indexing, we could further simplify the code to something like this:
Code: Select all
(define (f (a 1) (b 3))
	(+ a b b a))
FFtI (Feel Free to Ignore)
m i c h a e l