First Attempt at Lisp

I tried out Lisp for the first time. It’s a functional/declarative programming language which is so much more different from an imperative language like Java that I was totally confused at first. I wrote a few lines of simple code.

I think that this sort of coding would be useful for AIs that have to solve problems given certain values and constraints such as chess AIs or Tic Tac Toe AIs. However, AIs that actually “do” something should be programmed in declarative languages like Java and C++.


(defun add(A B)
(+ A B))

(defun subtract(A B)
(- A B))

(defun multiply(A B)
(* A B))

(defun factorial(N)
(if (or (= N 1) (= N 0))
(* N (factorial(- N 1)))))

(print(factorial 8))
(print(add 8 5))
(print(subtract 8 2))
(print(multiply 8 5))



4 responses to “First Attempt at Lisp

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s