Skip to content

Commit 9f6f25c

Browse files
committed
Remove non-lambda positive? and negative? rules
These just aren't worth it.
1 parent 9b354d6 commit 9f6f25c

File tree

2 files changed

+1
-39
lines changed

2 files changed

+1
-39
lines changed

default-recommendations/numeric-shortcuts-test.rkt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,6 @@ test: "lambda equivalent to sub1 refactorable to sub1"
2121
- (map sub1 (list 1 2 3))
2222

2323

24-
test: "comparison equivalent to positive? refactorable to positive?"
25-
- (> 42 0)
26-
- (< 0 42)
27-
- (not (<= 42 0))
28-
- (not (>= 0 42))
29-
- (positive? 42)
30-
31-
32-
test: "comparison equivalent to negative? refactorable to negative?"
33-
- (< 42 0)
34-
- (> 0 42)
35-
- (not (>= 42 0))
36-
- (not (<= 0 42))
37-
- (negative? 42)
38-
39-
4024
test: "lambda equivalent to positive? refactorable to positive?"
4125
- (filter (λ (x) (> x 0)) (list -2 -1 0 1 2))
4226
- (filter (λ (x) (< 0 x)) (list -2 -1 0 1 2))

default-recommendations/numeric-shortcuts.rkt

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,6 @@
3434
sub1)
3535

3636

37-
(define-refactoring-rule zero-comparison-to-positive?
38-
#:description "This expression is equivalent to calling the `positive?` predicate."
39-
#:literals (< > <= >= not)
40-
(~or (> e:expr 0)
41-
(< 0 e:expr)
42-
(not (<= e:expr 0))
43-
(not (>= 0 e:expr)))
44-
(positive? e))
45-
46-
4737
(define-refactoring-rule zero-comparison-lambda-to-positive?
4838
#:description "This lambda function is equivalent to the built-in `positive?` predicate."
4939
#:literals (< > <= >= not)
@@ -56,16 +46,6 @@
5646
positive?)
5747

5848

59-
(define-refactoring-rule zero-comparison-to-negative?
60-
#:description "This expression is equivalent to calling the `negative?` predicate."
61-
#:literals (< > <= >= not)
62-
(~or (< e:expr 0)
63-
(> 0 e:expr)
64-
(not (>= e:expr 0))
65-
(not (<= 0 e:expr)))
66-
(negative? e))
67-
68-
6949
(define-refactoring-rule zero-comparison-lambda-to-negative?
7050
#:description "This lambda function is equivalent to the built-in `negative?` predicate."
7151
#:literals (< > <= >= not)
@@ -98,6 +78,4 @@
9878
single-argument-plus-to-identity
9979
sub1-lambda-to-sub1
10080
zero-comparison-lambda-to-negative?
101-
zero-comparison-lambda-to-positive?
102-
zero-comparison-to-negative?
103-
zero-comparison-to-positive?))
81+
zero-comparison-lambda-to-positive?))

0 commit comments

Comments
 (0)