2024-03-11 10:34:40 +01:00
|
|
|
# Lösung: Vor- und Nachbedingung
|
2024-03-11 10:32:49 +01:00
|
|
|
|
2024-03-11 10:39:04 +01:00
|
|
|
|
2024-03-11 10:41:23 +01:00
|
|
|
```clojure
|
|
|
|
(defn sqrt [n]
|
2024-03-11 10:39:04 +01:00
|
|
|
{ :pre [(>= n 0)]
|
2024-07-07 13:05:30 +02:00
|
|
|
:post [(>= % 0)]}
|
2024-03-11 10:39:04 +01:00
|
|
|
(Math/sqrt n))
|
2024-07-07 13:05:30 +02:00
|
|
|
|
2024-03-11 10:39:04 +01:00
|
|
|
```
|