7. Arithmetic operations

Common Lisp supports basic arithmetic operations such as addition, subtraction, multiplication, and division. Here are some examples:

* (+ 5 3)
8

* (- 10 4)
6

* (* 7 6)
42

* (/ 20 5)
4

* (1- 3)
2

* (1+ 4)
5

If you want to perform operations with more than two numbers, simply add more arguments:

* (+ 1 2 3 4 5)
15

To count the number of elements in a list, you can use the length function:

* (length '(a b c d e))
5

This work is under a Attribution-NonCommercial-NoDerivatives 4.0 International license.

Desafíos de programación atemporales y multiparadigmáticos

Desafíos de programación atemporales y multiparadigmáticos

Te encuentras ante un librillo de actividades, divididas en 2 niveles de dificultad. Te enfrentarás a los casos más comunes que te puedes encontrar en pruebas técnicas o aprender conceptos elementales de programación.

Buy the book

Will you buy me a coffee?

This is how I keep writing without ads or paywalls.

Comments

There are no comments yet.