Programming Help by Programmer`s hub
Common Lisp programming help
Common list is the modern ANSI-standardized descendent of Lisp programming languages. Common lisp is a highly flexible language and support the object oriented programming. Common lisp allow you to select the suitable paradigm according to your application domain. Several implementations of the common lisp are open-source and propriety products. Common lisp have many data types include scalar types and data structures. Some of the data types are pathname, Input and output stream, common lisp, conditions, classes, readtables.
Function to sort the list
{` (sort (list 5 2 6 3 1 4) #'>) ; Returns (6 5 4 3 2 1) (sort (list 5 2 6 3 1 4) #'<) ; Returns (1 2 3 4 5 6) `}
Program of probability
{` (defconstant +year-size+ 365) (defun birthday-paradox (probability number-of-people) (let ((new-probability (* (/ (- +year-size+ number-of-people) +year-size+) probability))) (if (< new-probability 0.5) (1+ number-of-people) (birthday-paradox new-probability (1+ number-of-people))))) `}
Advantages of Common Lisp
- Homoiconic code
- Syntax-aware macros
- Flexibility
- Wartiness
- unified, simple and elegant way of representing both code and data
- macros