Skip to content

Latest commit

 

History

History
23 lines (14 loc) · 654 Bytes

1.2.md

File metadata and controls

23 lines (14 loc) · 654 Bytes

1.2

Question

Translate the following expression into prefix form

$$ \frac{5 + 4 + (2 - (3 - (6 + \frac{4}{5})))}{3(6 - 2)(2 - 7)} $$

Answer

(/ (+ 5 4 (- 2 (- 3 (+ 6 (/ 4 5)))))
   (* 3 (- 6 2) (- 2 7)))

The similarity in syntax between question and answer illustrate Scheme's bias toward mathematical expression, a.k.a. "expression-oriented"-ness.

Languages designed for a different "logic" (way of speaking) deploy differerent syntax.1

Footnotes

  1. SICP 4.4, Logic Programming (p. 438) [link]