I’ve been enjoying playing around with Rosetta Code problems lately. Here’s a solution I posted last week for the Five Weekends problem in Common Lisp: 190 more words

## Tags » Common Lisp

#### Passphrase Generation Revisited

One of my hobbies is to try out scripts in multiple programming languages, so I found myself dusting off the passphrase generation script. Mostly it’s an exercise in figuring out how languages do things differently. 519 more words

#### Largest Remainder

Largest Possible Remainder problem in racket:

```
;;lr = largest remainder so far lrd = divisor with largest remainder
(define (largest-remainder n d (lr 0) (lrd 0))
(cond
[(= d 0) (values lr lrd)] ;;catch cases like n = 6, d = 3
[(> lr d) (values lr lrd)] ;;stop when d is < largest remainder
[(> (modulo n d) lr)
(largest-remainder n (sub1 d) (modulo n d) d)] ;;save new largest remainder
)) ;;iterate with d-1
… 90 more words
```

#### (if) vs (cond)

(if) requires a test AND an action for T but an action for NIL is not required. If the test returns NIL, and there’s no action, (if) will return NIL. 62 more words

#### Predicates vs Non-Predicates

Predicates like (listp) or (zerop) or (null) or (equal) are considered predicates because they will always return T or NIL, no matter what type of arguments are provided. 32 more words

#### The results of evaluating logical functions

T is an atom. T is not a list.

NIL is an atom and a list; Only NIL and ‘() evluate to NIL. 23 more words