The digikar-utilities Reference Manual

Table of Contents

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

The digikar-utilities Reference Manual

This is the digikar-utilities Reference Manual, generated automatically by Declt version 2.4 patchlevel 1 "Will Decker" on Fri May 24 08:04:28 2019 GMT+0.


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

1 Introduction

Background and Introduction

This is yet another utility library for common lisp. (Several libraries can be found at cliki. Notable ones besides those include Alexandria and cl21. There's also a good discussion on reddit about "fixing" common lisp.

I don't think it is good enough yet; therefore, I'm using a personalized name - in case someone comes up with a "God" level library, let them use a good name. (Learnt over reddit that one should give a good name, only after it is proven to be good. And it is reasonable: we don't want to waste good names. :p)

1 Min Overview

Packages and exported functions / macros

digikar-utilities

digikar-utilities.logic

The documentation for each of these can be viewed using (describe ,symbol-name). (Eg. (describe 'join-using).)

Examples

    CL-USER> (load "digikar-utilities.lisp")
    ;; some warnings
    T

    CL-USER> (digikar-utilities:make-vector '(1 2 3))
    #(1 2 3)

    CL-USER> (setq myvar 555)
    555

    CL-USER> (setq a #(4 5 'a myvar))
    #(4 5 A 555)

    CL-USER> (setq *eval-in-vector* nil) ;; also *eval-in-hash-table*
    ;; however, also note that this does not work in progn
    nil

    CL-USER> #(a b)
    #(a b)

    CL-USER> (setq *eval-in-vector* t)

    CL-USER> (digikar-utilities:join-using " " '("aa" "b")) ; also works with vectors
    "aa b"

    CL-USER> (digikar-utilities:make-hash '(("a" 1) (5 25)))
    #<HASH-TABLE :TEST EQUAL :COUNT 2 {1003B1AD33}>

    CL-USER> (setq b #{"b" 1, 5 "five", "5+6" (+ 5 6), 'a 7, 'myvar myvar})
    #<HASH-TABLE :TEST EQUAL :COUNT 5 {1003B18ED3}>

    CL-USER> (get-val a 0) ; also works for hash-tables
    4

    CL-USER> (set-val b '(+ 1 2) 3) ; also works for vectors
    3

    CL-USER> #{"one" #{1 2}} ; other combinations also work
    #<HASH-TABLE :TEST EQUAL :COUNT 1 {1003B1E513}>

    CL-USER> (digikar-utilities:list-case '(1 2 3)
                                          ((x y) (+ x y))
	                                  ((x y z) (- (+ x y) z)))
    0
    
    CL-USER> (digikar-utilities:add 4 5 6)
    15

    CL-USER> (digikar-utilities:add "a" "b")
    "ab"

    CL-USER> (digikar-utilities:add '(1 2 3) '(4)) ; those are only three cases here
    (1 2 3 4)

    CL-USER> (digikar-utilities:prefix-to-infix '(+ a (- 4 5) b))
    (A + (4 - 5) + B)

    CL-USER> (digikar-utilities:write-file "testing" '(a b c))
    NIL

    CL-USER> (digikar-utilities:read-file "testing")
    (a b c)

    CL-USER> (digikar-utilities:getf-equal '("a" "b" "c" "d") "a")
    "b"

    CL-USER> (digikar-utilities:replace-all "hello" "l" "a")
    "heaao"

    CL-USER> (digikar-utilities.logic:gen-truth-table (a b c) (and a b c))
    ((T (T T T)) (NIL (T T NIL)) (NIL (T NIL T)) (NIL (T NIL NIL)) (NIL (NIL T T))
     (NIL (NIL T NIL)) (NIL (NIL NIL T)) (NIL (NIL NIL NIL)))
    (A B C)
    

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 digikar-utilities

Author

Maintained by Shubhamkar Ayare (shubhamayare@yahoo.co.in)

License

MIT

Description

A utility library, primarily intended to provide an easy interface to vectors and hash-tables.

Source

digikar-utilities.asd (file)

Component

digikar-utilities.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 digikar-utilities.asd

Location

digikar-utilities.asd

Systems

digikar-utilities (system)


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

3.1.2 digikar-utilities/digikar-utilities.lisp

Parent

digikar-utilities (system)

Location

digikar-utilities.lisp

Packages
Exported Definitions
Internal Definitions

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

4 Packages

Packages are listed by definition order.


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

4.1 digikar-utilities

Source

digikar-utilities.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

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

4.2 digikar-utilities.logic

Source

digikar-utilities.lisp (file)

Use List

common-lisp

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 Special variables

Special Variable: *eval-in-hash-table*

If true #{a b} can be read as #{1 2}, where a=1 and b=2; else as #{a b}.

Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Special Variable: *eval-in-vector*

If true #(a b) can be read as #(1 2), where a=1 and b=2; else as #(a b).

Package

digikar-utilities

Source

digikar-utilities.lisp (file)


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

5.1.2 Macros

Macro: gen-truth-table SYMBOLS EXPRESSION

Generate truth table of expression. symbols should be a list of all the boolean variables present in expr.

Package

digikar-utilities.logic

Source

digikar-utilities.lisp (file)

Macro: list-case LIST &rest CLAUSES

Case using different lengths of list.
Example: CL-USER> (list-case ’(1 2 3)
((x y) (+ x y))
((x y z) (- (+ x y) z))) 0

Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Macro: nand &rest ARGS
Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Macro: nor &rest ARGS
Package

digikar-utilities

Source

digikar-utilities.lisp (file)


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

5.1.3 Functions

Function: -> X Y

Truth value of x implies y

Package

digikar-utilities.logic

Source

digikar-utilities.lisp (file)

Function: <- X Y

Truth value of y implies x

Package

digikar-utilities.logic

Source

digikar-utilities.lisp (file)

Function: <> X Y

Truth value of x if and only if y

Package

digikar-utilities.logic

Source

digikar-utilities.lisp (file)

Function: add &rest ARGS

Returns the addition of numbers, or concatenation of strings or lists.

Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Function: get-val VEC/HASH KEY

Get the value associated with key in the hash-table, or the value at position key in the vector.

Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Function: getf-equal PLIST INDICATOR

getf using #’equal for comparison

Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Function: join-using DELIMITER LIST/VECTOR

Joins the elements of list / vector using the delimiter. Equivalent of the python delimiter.join function.

Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Function: make-hash PAIRS

Takes input in the form ’((1 2) (3 4)) and returns a hash-table with the mapping 1=>2 and 3=>4.

Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Function: make-vector LIST

Converts list to vector.

Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Function: prefix-to-infix EXPR
Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Function: read-file FILENAME

Read and returns the first lisp-object from file filename.

Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Function: replace-all STRING PART REPLACEMENT &key TEST

Returns a new string in which all the occurences of the part is replaced with replacement. Credits: Common Lisp Cookbook

Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Function: set-val VEC/HASH KEY VALUE

Set the value (destructive) associated with key in the hash-table, or the value at position key in the vector, to value.

Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Function: write-file FILENAME LISP-OBJECT

Writes the lisp-object to file filename, overwrites if the file already exists.

Package

digikar-utilities

Source

digikar-utilities.lisp (file)


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

5.2 Internal definitions


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

5.2.1 Constants

Constant: +comma+
Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Constant: +hash+
Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Constant: +left-brace+
Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Constant: +left-bracket+
Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Constant: +right-brace+
Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Constant: +right-bracket+
Package

digikar-utilities

Source

digikar-utilities.lisp (file)


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

5.2.2 Special variables

Special Variable: +format-delimiters+
Package

digikar-utilities

Source

digikar-utilities.lisp (file)


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

5.2.3 Functions

Function: gen-all-cases SYM
Package

digikar-utilities.logic

Source

digikar-utilities.lisp (file)

Function: get-format-delimiters DELIMITER

format uses some seemingly obscure delimiters, such as ~% instead of n.

Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Function: nilp LIST

Returns nil if the list is not nil.

Package

digikar-utilities.logic

Source

digikar-utilities.lisp (file)

Function: read-delimiter STREAM CHAR
Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Function: read-left-brace STREAM CHAR N
Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Function: read-left-bracket STREAM CHAR N
Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Function: read-next-object-for-hash-table DELIMITER SEPARATOR &optional INPUT-STREAM
Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Function: read-next-object-for-vector DELIMITER &optional INPUT-STREAM
Package

digikar-utilities

Source

digikar-utilities.lisp (file)

Function: read-separator STREAM CHAR
Package

digikar-utilities

Source

digikar-utilities.lisp (file)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   D   F   L  
Index Entry  Section

D
digikar-utilities.asd: The digikar-utilities<dot>asd file
digikar-utilities/digikar-utilities.lisp: The digikar-utilities/digikar-utilities<dot>lisp file

F
File, Lisp, digikar-utilities.asd: The digikar-utilities<dot>asd file
File, Lisp, digikar-utilities/digikar-utilities.lisp: The digikar-utilities/digikar-utilities<dot>lisp file

L
Lisp File, digikar-utilities.asd: The digikar-utilities<dot>asd file
Lisp File, digikar-utilities/digikar-utilities.lisp: The digikar-utilities/digikar-utilities<dot>lisp file

Jump to:   D   F   L  

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

A.2 Functions

Jump to:   -   <  
A   F   G   J   L   M   N   P   R   S   W  
Index Entry  Section

-
->: Exported functions

<
<-: Exported functions
<>: Exported functions

A
add: Exported functions

F
Function, ->: Exported functions
Function, <-: Exported functions
Function, <>: Exported functions
Function, add: Exported functions
Function, gen-all-cases: Internal functions
Function, get-format-delimiters: Internal functions
Function, get-val: Exported functions
Function, getf-equal: Exported functions
Function, join-using: Exported functions
Function, make-hash: Exported functions
Function, make-vector: Exported functions
Function, nilp: Internal functions
Function, prefix-to-infix: Exported functions
Function, read-delimiter: Internal functions
Function, read-file: Exported functions
Function, read-left-brace: Internal functions
Function, read-left-bracket: Internal functions
Function, read-next-object-for-hash-table: Internal functions
Function, read-next-object-for-vector: Internal functions
Function, read-separator: Internal functions
Function, replace-all: Exported functions
Function, set-val: Exported functions
Function, write-file: Exported functions

G
gen-all-cases: Internal functions
gen-truth-table: Exported macros
get-format-delimiters: Internal functions
get-val: Exported functions
getf-equal: Exported functions

J
join-using: Exported functions

L
list-case: Exported macros

M
Macro, gen-truth-table: Exported macros
Macro, list-case: Exported macros
Macro, nand: Exported macros
Macro, nor: Exported macros
make-hash: Exported functions
make-vector: Exported functions

N
nand: Exported macros
nilp: Internal functions
nor: Exported macros

P
prefix-to-infix: Exported functions

R
read-delimiter: Internal functions
read-file: Exported functions
read-left-brace: Internal functions
read-left-bracket: Internal functions
read-next-object-for-hash-table: Internal functions
read-next-object-for-vector: Internal functions
read-separator: Internal functions
replace-all: Exported functions

S
set-val: Exported functions

W
write-file: Exported functions

Jump to:   -   <  
A   F   G   J   L   M   N   P   R   S   W  

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

A.3 Variables

Jump to:   *   +  
C   S  
Index Entry  Section

*
*eval-in-hash-table*: Exported special variables
*eval-in-vector*: Exported special variables

+
+comma+: Internal constants
+format-delimiters+: Internal special variables
+hash+: Internal constants
+left-brace+: Internal constants
+left-bracket+: Internal constants
+right-brace+: Internal constants
+right-bracket+: Internal constants

C
Constant, +comma+: Internal constants
Constant, +hash+: Internal constants
Constant, +left-brace+: Internal constants
Constant, +left-bracket+: Internal constants
Constant, +right-brace+: Internal constants
Constant, +right-bracket+: Internal constants

S
Special Variable, *eval-in-hash-table*: Exported special variables
Special Variable, *eval-in-vector*: Exported special variables
Special Variable, +format-delimiters+: Internal special variables

Jump to:   *   +  
C   S  

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

A.4 Data types

Jump to:   D   P   S  
Index Entry  Section

D
digikar-utilities: The digikar-utilities system
digikar-utilities: The digikar-utilities package
digikar-utilities.logic: The digikar-utilities<dot>logic package

P
Package, digikar-utilities: The digikar-utilities package
Package, digikar-utilities.logic: The digikar-utilities<dot>logic package

S
System, digikar-utilities: The digikar-utilities system

Jump to:   D   P   S