7.7

4 The Linter

A case study in static program analysis with Algebraic Racket.

 #lang algebraic/racket/base/linted package: algebraic

Adding /linted to the end of the #lang line’s module path enables non-fatal code quality checks at expansion time.

Example:
> ((compose
    (curry apply append)
    (curry map cons '(1 2 3)))
   '((4) (5) (6)))

'(1 4 2 5 3 6)

> ((λ (x) (+ x 2)) 1)

3

> (let ([f (φ* (x y z) (* x y z))])
    (f 2 3 4))

24

; eval:1:2: linter: Prelude function can be shortened to `..'

;   in: compose

; eval:2:3: linter: Prelude function can be shortened to `>>'

;   in: curry

; eval:2:9: linter: Prelude function can be shortened to `$'

;   in: apply

; eval:2:15: linter: Prelude function can be shortened to `++'

;   in: append

; eval:3:3: linter: Prelude function can be shortened to `>>'

;   in: curry

; eval:3:13: linter: Prelude function can be shortened to `::'

;   in: cons

; eval:5:1: linter: Univariate λ can be shortened to φ

;   in: (λ (x) (+ x 2))

; eval:6:9: linter: Simple φ* can be shortened to λ

;   in: (φ* (x y z) (* x y z))