Skip to content

Common Lisp readtable modification package for using 'λ' as 'lambda'.

License

Notifications You must be signed in to change notification settings

koto-bank/veracious-lambda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Veracious lambda

Make λ behave like lambda.

What is it?

It’s a small library which extends the syntax by providing a reader-macro for λ character. It makes the reader treat λ as a shorthand for lambda in the code. Precautions taken to treat only symbol with this exact name to undergo transformation, so you can rest assured that your strings stay unchanged.

Examples

CL-USER> (let ((add-10 (λ (num) (+ 10 num))))
           (funcall add-10 10))
20 (5 bits, #x14, #o24, #b10100)
CL-USER> ((λ (a b) (+ a b)) 1 2)
3 (2 bits, #x3, #o3, #b11)
CL-USER> ((λ (λ) (+ λ 10)) 10)
20 (5 bits, #x14, #o24, #b10100)
CL-USER> (symbol-name 'λ-calculus)
"Λ-CALCULUS"
CL-USER> (symbol-name 'λ)
"LAMBDA"
CL-USER> "λ"
"λ"
CL-USER> 'λ
LAMBDA
CL-USER> 'λλ
ΛΛ
CL-USER> 'some-symbol-with-λ-in-name
SOME-SYMBOL-WITH-Λ-IN-NAME

How to enable?

1a. Copy (or symlink) the directory with the veracious-lambda to ~/quicklisp/local-projects, then type (ql:register-local-projects) in the REPL. After that, the system may be loaded via ql as usual: (ql:quickload :veracious-lambda)

1b. Just copy the files into your project.

  1. Use :around-compile asdf defsystem attribute:
(asdf:defsystem :your-system
  :license "Your License of Choice"
  :depends-on (:<...>
               :veracious-lambda)
  :around-compile (lambda (next)
                    ;; uiop:symbol-call is needed because objective-cl system
                    ;; is not yet loaded by the time the defsystem form is read,
                    ;; so the package also doesn't exists, which causes an error
                    (uiop:symbol-call '#:veracious-lambda '#:enable)
                    (unwind-protect (funcall next)
                      (uiop:symbol-call '#:veracious-lambda '#:disable)))
  :components
  ((:file "packages")
    <...>

About

Common Lisp readtable modification package for using 'λ' as 'lambda'.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published