Login
7 branches 0 tags
Ben (X13/Arch) Fixed wasm build e3ff1ee 3 years ago 833 Commits
nujel / tests / fuzz / euler001.nuj
#!/usr/bin/env nujel
; Multiples of 3 or 5
; https://projecteuler.net/problem=1
;
; Find the sum of all the multiples of 3 or 5 below 1000.

[defn multiple-of-3? [α]
       [zero? [rem α 3]]]

[defn multiple-of-5? [α]
       [zero? [rem α 5]]]

[defn multiple-of-3-or-5? [α]
       [or [multiple-of-3? α]
           [multiple-of-5? α]]]

[def result [-> [range 1000]
                [filter multiple-of-3-or-5?]
                [sum]]]
[when [not= result 233168]
      [throw [list :wrong-result "Wrong result" result]]]
[return :success]