Tags » Common Lisp

Is Common Lisp suitable for simple numerical computations?

Main stream imperative programming languages like C/C++ and Fortran are most of the time the preferred choice for number crunching applications. Moving to more evolved languages in the last year, I want to evaluate how good they are for that task. 789 more words

C++

Mandelbrot: SETL & Lisp

SETL is a general-purpose programming language developed by Jack Schwartz back in the late 1960s. The language is multiparadigm – both Procedural (containing subroutines and control structures like if statements) and Set Theoretical. 397 more words

Computer Science

A Solution to the Five Weekends Problem in Common Lisp

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

Programming

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

When to define a function rather than a local variable

Define a local variable when you want to use the same value in different ways.

Define a function when you want to compute different values in the same way.

Common Lisp

(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

Common Lisp