- Determine the name of the function and what parameter we need.
- Determine what problem we will solve. Make a plan how to resolve the problem.
- Write the function in LISP.
- Format of the function is
(defun function-name (parameter1 parameter2 parameter3 ...)
(process how to solve problem)
)
Some example:
1. This function will add a b.
(defun add (a b)
(+ a b)
)
2. This function will multiple a to b
(defun multiple (a b)
(* a b)
)
In LISP, we just need to write the name of function.
1. (add 4 5)
==> 9
2. (multiple 3 4)
==> 12
Screenshot

No comments:
Post a Comment