Clarity theorytheory 0/50 · 0%
Foundations · easy

2. LISP Syntax

Understanding parentheses and prefix notation.

Clarity uses LISP-like syntax, which relies heavily on parentheses and prefix notation (where the operator comes before the operands). This structure makes the code easy for machines to parse and for humans to see the tree-like nature of the logic.

clarity
;; Adding two numbers
(+ 1 2)

;; Nested expression: (1 + 2) * 3
(* (+ 1 2) 3)

Every expression in Clarity is enclosed in parentheses, starting with a function name or operator, followed by its arguments.

Check your understanding

  1. 1. What notation does Clarity use?

  2. 2. How are expressions grouped in Clarity?

  3. 3. What is `(* 2 5)` in Clarity?