The trivial-left-pad Reference Manual

Table of Contents

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

The trivial-left-pad Reference Manual

This is the trivial-left-pad Reference Manual, generated automatically by Declt version 2.4 patchlevel 1 "Will Decker" on Fri May 24 09:58:35 2019 GMT+0.


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

1 Introduction

Introduction

trivial-left-pad is the Common Lisp version of the extremely popular node.js left-pad package. It is designed to have as similar an API to node's left-pad as possible while still remaining idiomatic Lisp. For more information on the principles behind this project, see design-philosophy.md

Installation

trivial-left-pad is not on Quicklisp. To make Quicklisp recognize trivial-left-pad, create a link to this directory in Quicklisp's local-projects. By default, the path to local-projects is:

~/quicklisp/local-projects

Quicklisp is the recommended way to use ASDF systems. Any other method of installation is currently unsupported. If you need to install Quicklisp, read this link.

Loading

You should be able to load trivial-left-pad from your REPL with:

(ql:quickload :trivial-left-pad)

You will also be able to use it as an ASDF dependency from any project also in local-projects. To add it as an ASDF dependency, add this line to your asdf:defsystem expression:

:depends-on (:trivial-left-pad)

If the depends-on line already exists, don't add another depends-on line. Instead, append it to the existing list like in this example:

:depends-on (:some-other-package :trivial-left-pad)

You will also should add it to your defpackage expression, which could be in package.lisp or could be in another file. You need to append it to your :use list like in this example:

(:use #:cl #:trivial-left-pad)

After this, you should be able to call left-pad from your Lisp program.

Testing

To test trivial-left-pad, run the following command from your REPL:

(asdf:test-system :trivial-left-pad)

Example usage

(left-pad "foobar" 10) ; "    foobar"
(left-pad "Hello, world!" 15 #\_) ; "__Hello, world!"

Differences with node's left-pad

While compatibility with node's left-pad is a goal, there are some differences that should be kept in mind:


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 trivial-left-pad

Author

Michael Babich

License

MIT

Description

Ports the functionality of the very popular left-pad from npm.

Dependency

alexandria

Source

trivial-left-pad.asd (file)

Components

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 trivial-left-pad.asd

Location

trivial-left-pad.asd

Systems

trivial-left-pad (system)


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

3.1.2 trivial-left-pad/package.lisp

Parent

trivial-left-pad (system)

Location

package.lisp

Packages

trivial-left-pad


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

3.1.3 trivial-left-pad/trivial-left-pad.lisp

Dependency

package.lisp (file)

Parent

trivial-left-pad (system)

Location

trivial-left-pad.lisp

Exported Definitions

left-pad (function)

Internal Definitions

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

4 Packages

Packages are listed by definition order.


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

4.1 trivial-left-pad

Source

package.lisp (file)

Use List

common-lisp

Exported Definitions

left-pad (function)

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


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

5.1.1 Functions

Function: left-pad STRING LENGTH &optional PADDING

Pads the left of string to be length long. It inserts padding in front. If padding is nil, a space is inserted. If string is not a string, it is converted to a string. The maximum allowed length is 10,000,000.

Package

trivial-left-pad

Source

trivial-left-pad.lisp (file)


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

5.2 Internal definitions


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

5.2.1 Functions

Function: %advanced-left-pad STRING LENGTH PADDING
Package

trivial-left-pad

Source

trivial-left-pad.lisp (file)

Function: %simple-left-pad STRING LENGTH PADDING
Package

trivial-left-pad

Source

trivial-left-pad.lisp (file)


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

5.2.2 Types

Type: reasonable-string-length ()
Package

trivial-left-pad

Source

trivial-left-pad.lisp (file)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   F   L   T  
Index Entry  Section

F
File, Lisp, trivial-left-pad.asd: The trivial-left-pad<dot>asd file
File, Lisp, trivial-left-pad/package.lisp: The trivial-left-pad/package<dot>lisp file
File, Lisp, trivial-left-pad/trivial-left-pad.lisp: The trivial-left-pad/trivial-left-pad<dot>lisp file

L
Lisp File, trivial-left-pad.asd: The trivial-left-pad<dot>asd file
Lisp File, trivial-left-pad/package.lisp: The trivial-left-pad/package<dot>lisp file
Lisp File, trivial-left-pad/trivial-left-pad.lisp: The trivial-left-pad/trivial-left-pad<dot>lisp file

T
trivial-left-pad.asd: The trivial-left-pad<dot>asd file
trivial-left-pad/package.lisp: The trivial-left-pad/package<dot>lisp file
trivial-left-pad/trivial-left-pad.lisp: The trivial-left-pad/trivial-left-pad<dot>lisp file

Jump to:   F   L   T  

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

A.2 Functions

Jump to:   %  
F   L  
Index Entry  Section

%
%advanced-left-pad: Internal functions
%simple-left-pad: Internal functions

F
Function, %advanced-left-pad: Internal functions
Function, %simple-left-pad: Internal functions
Function, left-pad: Exported functions

L
left-pad: Exported functions

Jump to:   %  
F   L  

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

A.3 Variables


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

A.4 Data types

Jump to:   P   R   S   T  
Index Entry  Section

P
Package, trivial-left-pad: The trivial-left-pad package

R
reasonable-string-length: Internal types

S
System, trivial-left-pad: The trivial-left-pad system

T
trivial-left-pad: The trivial-left-pad system
trivial-left-pad: The trivial-left-pad package
Type, reasonable-string-length: Internal types

Jump to:   P   R   S   T