File tree Expand file tree Collapse file tree 6 files changed +24
-12
lines changed
Expand file tree Collapse file tree 6 files changed +24
-12
lines changed Original file line number Diff line number Diff line change 223223# @details The original list is not modified.
224224# =begin
225225# (import std.Math)
226- # (print (list:filter [1 2 3 4 5 6 7 8 9] math:even)) # [2 4 6 8]
226+ # (print (list:filter [1 2 3 4 5 6 7 8 9] math:even? )) # [2 4 6 8]
227227# =end
228228# @author https://github.com/rstefanic
229229(let filter (fun (_L _f) {
Original file line number Diff line number Diff line change 169169# @brief Return true if the number is even, false otherwise
170170# @param _n the number
171171# @author https://github.com/rstefanic
172- (let even (fun (_n) (= 0 (mod _n 2))))
172+ (let even? (fun (_n) (= 0 (mod _n 2))))
173+
174+ # @brief Return true if the number is even, false otherwise
175+ # @details **Deprecated, use `even?`**
176+ # @param _n the number
177+ # @author https://github.com/rstefanic
178+ (let even even?)
179+
180+ # @brief Return true if the number is odd, false otherwise
181+ # @param _n the number
182+ # @author https://github.com/rstefanic
183+ (let odd? (fun (_n) (= 1 (abs (mod _n 2)))))
173184
174185# @brief Return true if the number is odd, false otherwise
186+ # @details **Deprecated, use `odd?`**
175187# @param _n the number
176188# @author https://github.com/rstefanic
177- (let odd (fun (_n) (= 1 (abs (mod _n 2)))) )
189+ (let odd odd? )
178190
179191# @brief Get the minimum between two numbers
180192# @param _a the first number
Original file line number Diff line number Diff line change 6161# =begin
6262# (import std.Math)
6363# (let obj (range:range 1 10))
64- # (print (range:filter obj math:even)) # [2 4 6 8]
64+ # (print (range:filter obj math:even? )) # [2 4 6 8]
6565# =end
6666# @author https://github.com/SuperFola
6767(let filter (fun (_range _fun) {
Original file line number Diff line number Diff line change 11(import std.List)
2- (import std.Math :even)
2+ (import std.Math :even? )
33(import std.Testing)
44
55(let a [1 2 3])
6969 (test:eq (list:dropWhile a (fun (c) (< c 5))) []) })
7070
7171 (test:case "filter" {
72- (test:eq (list:filter a math:even) [2])
72+ (test:eq (list:filter a math:even? ) [2])
7373 (test:eq (list:filter a (fun (e) (> e 100))) [])
7474 (test:eq (list:filter [] (fun (e) (> e 100))) []) })
7575
Original file line number Diff line number Diff line change 3333
3434 (test:eq (math:abs -1) 1)
3535 (test:eq (math:abs 1) 1)
36- (test:expect (math:even 2))
37- (test:expect (math:even -2))
38- (test:expect (math:odd 1))
39- (test:expect (math:odd -1))
36+ (test:expect (math:even? 2))
37+ (test:expect (math:even? -2))
38+ (test:expect (math:odd? 1))
39+ (test:expect (math:odd? -1))
4040 (test:eq (math:min 1 2) 1)
4141 (test:eq (math:min 1 -2) -2)
4242 (test:eq (math:min 0.5 0.2) 0.2)
Original file line number Diff line number Diff line change 11(import std.Range:*)
2- (import std.Math :even)
2+ (import std.Math :even? )
33(import std.Testing)
44
55(test:suite range {
1717 (range:forEach r (fun (e)
1818 (test:neq e nil)))
1919
20- (let filtered (range:filter r math:even))
20+ (let filtered (range:filter r math:even? ))
2121 (test:eq filtered [0 2 4 6 8])
2222
2323 (let mapped (range:map r (fun (e) (* e e))))
You can’t perform that action at this time.
0 commit comments