Common Lisp Package: INFIX-DOLLAR-READER

README:

infix-dollar-reader


Infix $ operator for reducing redundant paranthesis.

usage:

  1. load package;
  2. (asdf:load-system :infix-dollar-reader)  
     
    
  3. enable to use infix $ notation;
  4. (syntax:use-syntax :infix-dollar)  
     
    
  5. write your forms with infix $ notation s.t. (the fixnum $ + x 10)

example:

    (fun x y $ fun2 z)  
 

This form above would be expanded to below form.

    (fun x y (fun2 z))  
 

And also,

    (= (+ 1 2 $ * 3 4 $ + 5 6) (+ 1 2 (* 3 4 (+ 5 6)))) ; => T  
 

limitation:

A symbol name which has any $ characters would cause unexpected behavior.

You should not use any $ characters in a symbol name without barrier or intern from a string.

e.g.

    (syntax:use-syntax :infix-dollar)  
 
 
 
    (defconstant foo$- 1) ; => FOO  
 
    ;; would be parsed as (defconstant foo(- 1))  
 
 
 
    (defconstant |FOO$-| 1) ; => FOO$- or |FOO$-|  
 
    ;; not be parsed a #\$ as a #\( because of barrier  
 
 
 
    (intern "FOO$-") ; => FOO$-  
 
    ;; #\$, $-in-a-string and $-in-a-comment are not affected  
 

license:

infix-dollar-reader is under MIT license.

FUNCTION

Public

UNUSE-INFIX-DOLLAR (&OPTIONAL PRINT-NOTE)

Restore whole *readtable*. CAUTION: unuse-infix-dollar could rollback all of the changes on *readtable* after invoking enable-infix-dollar.

USE-INFIX-DOLLAR (&OPTIONAL PRINT-NOTE)

Enable infix $ operator. CAUTION: enable-infix-dollar could modify *readtable* globally.

Private

Undocumented

FIND-SYNTAX (NAME)

INFIX-DOLLAR-READER (STREAM CHAR)

MACRO

Private

Undocumented

DEFINE-PACKAGE-SYNTAX (&BODY (PACKAGE . OPTIONS))

VARIABLE

Private

*ORIGINAL-READTABLE*

Saving original readtable