The reader Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The reader Reference Manual

This is the reader Reference Manual, version 0.9.1, generated automatically by Declt version 3.0 "Montgomery Scott" on Tue Apr 28 12:50:31 2020 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

Examples

(named-readtables:in-readtables reader:reader) ; not recommended with slime
;;  OR 
(reader:enable-reader-syntax &rest reader-macro-identifiers) ; check (describe)
;; another way, until SLIME allows changing readtables more than twice
;; (disable-reader-syntax) ; is complementary
CL-USER> (mapcar λ(write-to-string -) '(2 3 4)) ; lambdas
("2" "3" "4")
CL-USER> #[[1 2 3
            4 5 6]
           [3 2 1
            7 8 9]]
#3A(((1 2 3) (4 5 6)) ((3 2 1) (7 8 9)))        ; cleaner syntax for arrays
CL-USER> (gethash 'a {:eq 'a 1 'b 2})           ; hash-tables
1
T
CL-USER> (hash-set:hs-memberp #{"a" "b" "c"} "c") ; hash-set - can change in future
T
CL-USER> [#2A((1 2 3) (4 5 6)) 1 0]             ; accessors
4
CL-USER> (let ((arr #2A((1 2 3) (4 5 6))))      ; arrays are unsimplified by default
           [arr t 0])                           ; and numcl:aref is used
#(1 4)                                          ; see reader:*automatically-unsimplify-array*
CL-USER> [{"a" 1 "b" 2} "a"]                    ; accessors
1
T
CL-USER> [(cl-json:decode-json-from-string "{\"a\":1, \"b\":2}") :b]
2                                               ; works with alists
CL-USER> (-> {"a" "apple" "b" "ball"} ["b"] [1]); accessors can be chained using arrow-macros:->
#\a                                             ; arrow-macros is not included
CL-USER> #!echo -n hello world                  ; execute shell commands 
hello world                                     ; using uiop:run-program
NIL                                             ; not intended for using variables
NIL
0
CL-USER> (let ((a t)) !a)                       ; not
NIL
CL-USER> (let ((a 5.0d0)) $a)                   ; write-to-string
"5.0d0"                   ; should this be "ensure-string"? raise an issue!
CL-USER> ?reader:enable-reader-syntax           ; variable use not intended
READER:ENABLE-READER-SYNTAX
  [symbol]
ENABLE-READER-SYNTAX names a macro:
  Lambda-list: (&REST READER::READER-MACRO-IDENTIFIERS)
  Documentation:
    READER-MACRO-IDENTIFIERS are any of the following symbols:
      LAMBDA, GET-VAL, HASH-TABLE, NOT, STRING, DESCRIBE, ARRAY, HASH-SET, RUN-PROGRAM
  Source file: /home/user/portacle/projects/reader/reader.lisp

See reader-test.lisp for more examples.

Notes

Testing

(ql:quickload :reader-test)
(reader-test:run)

Modifications for emacs

(modify-syntax-entry ?\[ "(]" lisp-mode-syntax-table)
(modify-syntax-entry ?\] ")[" lisp-mode-syntax-table)
(modify-syntax-entry ?\{ "(}" lisp-mode-syntax-table)
(modify-syntax-entry ?\} "){" lisp-mode-syntax-table)
(define-key paredit-mode-map (kbd "{") 'paredit-open-curly)
(define-key paredit-mode-map (kbd "}") 'paredit-close-curly)
(global-set-key (kbd "C-S-l") (lambda () ; for inserting lambda
                                (interactive)
                                (insert-char (aref (symbol-name 'λ) 0))))
(setq paredit-space-for-delimiter-predicates
      (list (lambda (endp delimiter)
              (not (and (eql ?\( delimiter)
                        (member (char-before (point))
                                '(?\@ ?λ))))))))
(set-language-environment "UTF-8")

Motivation: paredit curly brace matching in swank-clojure repl - Stack OverFlow

Known Issues

Known issues include aligning hash-tables without first-element-as-key:

{"hello" 1
         "world" 2}

A work-around is to specify the test as the first element, and let that default exist for one-liners:

{:equal "hello" 1
        "world" 2}
{"hello" 1 "world" 2}

Comments

I'm aware of the lambda syntax in rutils and clojure. However, emacs seems to treat ^ specially and something like (member ?\^ '(?\^)) gives an "End of file during parsing" error. This is an issue with the modification marked ; for inserting lambda. Regarding - instead of %1: the former is easier to type than the latter. The λ() can take up to 3 (optional) arguments - -- ---.


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 reader

Author

Shubhamkar Ayare (shubhamayare@yahoo.co.in)

License

MIT

Description

A utility library intended at providing reader macros for lambda, get-val, hash-table, not, string, describe, array, hash-set and run-program.

Version

0.9.1

Dependencies
Source

reader.asd (file)

Component

reader.lisp (file)


Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 reader.asd

Location

reader.asd

Systems

reader (system)


Previous: , Up: Lisp files   [Contents][Index]

3.1.2 reader/reader.lisp

Parent

reader (system)

Location

reader.lisp

Packages

reader

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 reader

Source

reader.lisp (file)

Use List
Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Macros

Macro: disable-reader-syntax ()
Package

reader

Source

reader.lisp (file)

Macro: enable-reader-syntax &rest READER-MACRO-IDENTIFIERS

READER-MACRO-IDENTIFIERS are any of the following symbols:
LAMBDA, GET-VAL, HASH-TABLE, NOT, STRING, DESCRIBE, ARRAY, HASH-SET, RUN-PROGRAM

Package

reader

Source

reader.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Generic functions

Generic Function: get-val OBJECT &rest KEY/S
Package

reader

Source

reader.lisp (file)

Writer

(setf get-val) (generic function)

Methods
Method: get-val (OBJECT array) &rest KEY/S
Method: get-val (OBJECT list) &rest KEY/S
Method: get-val (OBJECT hash-table) &rest KEY/S
Method: get-val (OBJECT sequence) &rest KEY/S
Method: get-val (OBJECT structure-object) &rest KEY/S
Generic Function: (setf get-val) G0 OBJECT &rest KEY/S
Package

reader

Reader

get-val (generic function)

Methods
Method: (setf get-val) NEW-VALUE (OBJECT array) &rest KEY/S
Source

reader.lisp (file)

Method: (setf get-val) NEW-VALUE (OBJECT list) &rest KEY/S
Source

reader.lisp (file)

Method: (setf get-val) G0 (OBJECT hash-table) &rest KEY/S
Source

reader.lisp (file)

Method: (setf get-val) G0 (OBJECT sequence) &rest KEY/S
Source

reader.lisp (file)

Method: (setf get-val) G0 (OBJECT structure-object) &rest KEY/S
Source

reader.lisp (file)

Method: (setf get-val) G0 (OBJECT standard-object) &rest KEY/S
Source

reader.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Special variables

Special Variable: *previous-readtables*
Package

reader

Source

reader.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Macros

Macro: defmethods-with-setf FUN-NAME LAMBDA-LIST &rest METHODS
Package

reader

Source

reader.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.3 Functions

Function: %disable-reader-syntax ()
Package

reader

Source

reader.lisp (file)

Function: %enable-reader-syntax &rest READER-MACRO-IDENTIFIERS
Package

reader

Source

reader.lisp (file)

Function: array-reader-macro STREAM CHAR N
Package

reader

Source

reader.lisp (file)

Function: construct-parameter-list BODY MAY-BE-BODY
Package

reader

Source

reader.lisp (file)

Function: describe-reader-macro STREAM CHAR
Package

reader

Source

reader.lisp (file)

Function: get-val-reader-macro STREAM CHAR
Package

reader

Source

reader.lisp (file)

Function: hash-set-reader-macro STREAM CHAR N
Package

reader

Source

reader.lisp (file)

Function: hash-table-reader-macro STREAM CHAR
Package

reader

Source

reader.lisp (file)

Function: lambda-reader-macro STREAM CHAR
Package

reader

Source

reader.lisp (file)

Function: not-reader-macro STREAM CHAR
Package

reader

Source

reader.lisp (file)

Function: read-array STREAM
Package

reader

Source

reader.lisp (file)

Function: read-row-from-string STRING
Package

reader

Source

reader.lisp (file)

Function: read-stream-as-string-until STREAM UNTIL-CHAR
Package

reader

Source

reader.lisp (file)

Function: read-stream-until STREAM UNTIL-CHAR
Package

reader

Source

reader.lisp (file)

Function: run-program-reader-macro STREAM CHAR N
Package

reader

Source

reader.lisp (file)

Function: string-reader-macro STREAM CHAR
Package

reader

Source

reader.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   R  
Index Entry  Section

F
File, Lisp, reader.asd: The reader․asd file
File, Lisp, reader/reader.lisp: The reader/reader․lisp file

L
Lisp File, reader.asd: The reader․asd file
Lisp File, reader/reader.lisp: The reader/reader․lisp file

R
reader.asd: The reader․asd file
reader/reader.lisp: The reader/reader․lisp file

Jump to:   F   L   R  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   %   (  
A   C   D   E   F   G   H   L   M   N   R   S  
Index Entry  Section

%
%disable-reader-syntax: Internal functions
%enable-reader-syntax: Internal functions

(
(setf get-val): Exported generic functions
(setf get-val): Exported generic functions
(setf get-val): Exported generic functions
(setf get-val): Exported generic functions
(setf get-val): Exported generic functions
(setf get-val): Exported generic functions
(setf get-val): Exported generic functions

A
array-reader-macro: Internal functions

C
construct-parameter-list: Internal functions

D
defmethods-with-setf: Internal macros
describe-reader-macro: Internal functions
disable-reader-syntax: Exported macros

E
enable-reader-syntax: Exported macros

F
Function, %disable-reader-syntax: Internal functions
Function, %enable-reader-syntax: Internal functions
Function, array-reader-macro: Internal functions
Function, construct-parameter-list: Internal functions
Function, describe-reader-macro: Internal functions
Function, get-val-reader-macro: Internal functions
Function, hash-set-reader-macro: Internal functions
Function, hash-table-reader-macro: Internal functions
Function, lambda-reader-macro: Internal functions
Function, not-reader-macro: Internal functions
Function, read-array: Internal functions
Function, read-row-from-string: Internal functions
Function, read-stream-as-string-until: Internal functions
Function, read-stream-until: Internal functions
Function, run-program-reader-macro: Internal functions
Function, string-reader-macro: Internal functions

G
Generic Function, (setf get-val): Exported generic functions
Generic Function, get-val: Exported generic functions
get-val: Exported generic functions
get-val: Exported generic functions
get-val: Exported generic functions
get-val: Exported generic functions
get-val: Exported generic functions
get-val: Exported generic functions
get-val-reader-macro: Internal functions

H
hash-set-reader-macro: Internal functions
hash-table-reader-macro: Internal functions

L
lambda-reader-macro: Internal functions

M
Macro, defmethods-with-setf: Internal macros
Macro, disable-reader-syntax: Exported macros
Macro, enable-reader-syntax: Exported macros
Method, (setf get-val): Exported generic functions
Method, (setf get-val): Exported generic functions
Method, (setf get-val): Exported generic functions
Method, (setf get-val): Exported generic functions
Method, (setf get-val): Exported generic functions
Method, (setf get-val): Exported generic functions
Method, get-val: Exported generic functions
Method, get-val: Exported generic functions
Method, get-val: Exported generic functions
Method, get-val: Exported generic functions
Method, get-val: Exported generic functions

N
not-reader-macro: Internal functions

R
read-array: Internal functions
read-row-from-string: Internal functions
read-stream-as-string-until: Internal functions
read-stream-until: Internal functions
run-program-reader-macro: Internal functions

S
string-reader-macro: Internal functions

Jump to:   %   (  
A   C   D   E   F   G   H   L   M   N   R   S  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
S  
Index Entry  Section

*
*previous-readtables*: Internal special variables

S
Special Variable, *previous-readtables*: Internal special variables

Jump to:   *  
S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   P   R   S  
Index Entry  Section

P
Package, reader: The reader package

R
reader: The reader system
reader: The reader package

S
System, reader: The reader system

Jump to:   P   R   S