The listopia Reference Manual

Table of Contents

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

The listopia Reference Manual

This is the listopia Reference Manual, version 0.5.0, generated automatically by Declt version 2.3 "Robert April" on Wed Mar 14 04:15:42 2018 GMT+0.


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

1 Introduction

Listopia

This is no official port of Haskell package Data.List

Usage

(:use :listopia)

Installation

(ql:quickload :listopia)

Functions

All functions and constructs in the library are prefixed with a point (.)

Basic functions

.head (list &optional (default nil))

Extract the first element of a list. If list is empty, returns default value.

(.head '(1 2 3)) ;; => 1
(.head '(1)) ;; => 1
(.head '() 666) ;; => 666

.last (list &optional (default nil))

Extract the last element of a list. If list is empty, returns default value.

(.last '(1 2 3)) ;; => 3
(.last '(1)) ;; => 1
(.last '() 666) ;; => 666

.tail (list &optional (default nil))

Extract the elements after the head of a list. If list is empty, returns default value.

(.tail '(1 2 3)) ;; => '(2 3)
(.tail '(1)) ;; => '()
(.tail '() 666) ;; => 666

.init (list &optional (default nil))

Return all the elements of a list except the last one. If list is empty, returns default value.

(.init '(1 2 3)) ;; => '(1 2)
(.init '(1)) ;; => '()
(.init '() 666) ;; => 666

.uncons (list &optional (default nil))

Decompose a list into its head and tail. If the list is empty, returns default. If the list is non-empty, returns '(x, xs), where x is the head of the list and xs its tail.

(.uncons '(1 2 3)) ;; => '(1 (2 3))
(.uncons '(1)) ;; => '(1 ())
(.uncons '() 666) ;; => 666

List transformations

.map (fn list)

Result - is the list obtained by applying FN to each element of LIST.

(.map #'1+ '(1 2 3)) ;; => '(2 3 4)
(.map #'1+ '()) ;; => nil

.intersperse (sep lisp)

The .intersperse function takes an element and a list and 'intersperses' that element between the elements of the list.

(.intersperse 0 '(1 2 3)) ;; => '(1 0 2 0 3)
(.intersperse "," '("1" "2" "3")) ;; => '("1" "," "2" "," "3")
(.intersperse 0 '()) ;; => nil

.intercalate (sep list)

(.intercalate sep list) is equivalent to (.concat (.intersperse sep list)). It inserts the list SEP in between the lists in LIST and concatenates the result.

(.intercalate '(0) '((1) (2) (3))) ;; => '(1 0 2 0 3)
(.intercalate '(0) '((1) (2 3) (4 5 6))) ;; => '(1 0 2 3 0 4 5 6)
(.intercalate '(0) '()') ;; => nil

Reducing lists (folds)

.foldl (fn init-val list)

Left-associative fold of a list.

(.foldl (lambda (acc x) (append acc (list (1+ x))) '(1 2) '(2 3 4))) ;; => '(1 2 3 4 5)
(.foldl (lambda (acc x) (cons x acc)) '() '(1 2 3)) ;; => '(3 2 1)
(.foldl (lambda (acc x) (cons x acc)) '() '()) ;; => '()

.foldl1 (fn list)

A variant of .foldl that has no base case, and thus may only be applied to non-empty lists.

(.foldl1 #'+ '(1 2 3)) ;; => 6
(.foldl1 #'list '(1 2 3 4)) ;; => '(((1 2) 3) 4)

.foldr (fn init-val list)

Right-associative fold of a list.

(.foldr (lambda (x acc) (append acc (list (1+ x))) '(1 2) '(4 3 2))) ;; => '(1 2 3 4 5)
(.foldr (lambda (x acc) (cons x acc)) '() '(1 2 3)) ;; => '(1 2 3)
(.foldr (lambda (x acc) (cons x acc)) '() '()) ;; => '()

.foldr1 (fn list)

A variant of .foldr that has no base case, and thus may only be applied to non-empty lists.

(.foldr1 #'+ '(1 2 3)) ;; => 6
(.foldr1 #'list '(1 2 3 4)) ;; => '(1 (2 (3 4)))

Special folds

.concat (list)

The concatenation of all the elements of a container of lists.

(.concat '((1) (2 3) (4 5 6))) ;; => '(1 2 3 4 5 6)
(.concat '((1)) ;; => '(1)
(.concat '(() ()) ;; => '()

.concat-map (fn list)

Map a function over all the elements of a container and concatenate the resulting lists.

(.concat-map #'list '(1 2 3)) ;; => '(1 2 3)
(.concat-map (lambda (x) 
              (list x x)) 
             '(1 2 3)) ;; => '(1 1 2 2 3 3)
(.concat-map #'null '()) ;; => NIL

.and (list)

.and returns the conjunction of values in list.

(.and '(t t)) ;; => t
(.and '(t nil)) ;; => nil
(.and '()) ;; => t

.or (list)

.or returns the disjunction of values in list.

(.or '(t nil t)) ;; => t
(.or '(nil nil nil)) ;; => nil
(.or '()) ;; => nil

.any (fn list)

Determines whether any element of the list satisfies the predicate.

(.any #'numberp '("1" "2" 3)) ;; => t
(.any #'numberp '()) ;; => nil

.all (fn list)

Determines whether all elements of the list satisfy the predicate.

(.all #'numberp '(1 2 3)) ;; => t
(.all #'numberp '(1 "2" 3)) ;; => nil
(.all #'numberp '()) ;; => t

.sum (list)

The .sum function computes the sum of the numbers of a list.

(.sum '(1 2 3)) ;; => 6
(.sum '()) ;; => 0

.product (list)

The .product function computes the product of the numbers of a list.

(.product '(1 2 3)) ;; => 6
(.product '()) ;; => 1

.maximum (list)

The largest element of a non-empty list.

(.maximum '(1 2 3 4 5)) ;; => 5
(.maximum '(1 2 3.0)) ;; => 3.0

.minimum (list)

The least element of a non-empty list.

(.minimum '(1 2 3 4 5)) ;; => 1
(.minimum '(1.0 2 3)) ;; => 1.0

Special folds

Scans

.scanl (fn init-value list)

.scanl is similar to foldl, but returns a list of successive reduced values from the left:

(.scanl fn init '(x1 x2 ...)) == (list init (fn init x1) (fn (fn init x1) x2) ...)

(.scanl #'+ 1 '(2 3 4)) ;; => '(1 3 6 10)
(.scanl #'+ 1 '()) ;; => '(1)

.scanl1 (fn list)

.scanl1 is a variant of .scanl that has no starting value argument.

(.scanl1 #'+ '(1 2 3 4)) ;; => '(1 3 6 10)
(.scanl1 #'+ '()) ;; => nil

.scanr (fn init-value list)

.scanr is the right-to-left dual of .scanl.

(.scanr #'+ 1 '(2 3 4)) ;; => '(10 8 5 1)
(.scanr #'+ 1 '()) ;; => '(1)

.scanr1 (fn list)

.scanr1 is a variant of .scanr that has no starting value argument.

(.scanr1 #'+ '(2 3 4 1)) ;; => '(10 8 5 1)
(.scanr1 #'+ '(5 4 3 2 1)) ;; => '(15 10 6 3 1)
(.scanr1 #'+ '()) ;; => nil

Accumulating maps

.map-accum-l (fn init-val list)

.map-accum-l applies a function to each element of a list, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new structure.

(.map-accum-l (lambda (acc x) (list acc (+ x acc))) 1 '(1 2 3)) ;; => '(1 (2 3 4))
(.map-accum-l (lambda (acc x) (list (1+ acc) (+ x acc))) 1 '(1 2 3)) ;; => '(4 (2 4 6))

.map-accum-r (fn init-val list)

.map-accum-r applies a function to each element of a list, passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new structure.

(.map-accum-r (lambda (acc x) (list acc (+ x acc))) 1 '(1 2 3)) ;; => '(1 (2 3 4))
(.map-accum-r (lambda (acc x) (list (1+ acc) (+ x acc))) 1 '(1 2 3)) ;; => '(4 (4 4 4))

Infinite lists

.iterate (fn init-val size)

(.iterate fn val n) returns an list of repeated applications of fn to val:

(.iterate f x size) == (list x (f x) (f (f x)) ...)

Returned list has a size equal to parameter SIZE.

(.iterate #'1+ 0 4) ;; => '(0 1 2 3)'
(.iterate #'1+ 0 0) ;; => nil

.repeat (init-val size)

(.repeat x n) is an list, with x the value of every element.

Returned list has a size equal to parameter SIZE.

(.repeat 1 4) ;; => '(1 1 1 1)
(.repeat :foo 2) ;; => '(:foo :foo)
(.repeat :foo 0) ;; => nil

.replicate (size init-val)

(.replicate n x) is a list of length n with x the value of every element.

(.replicate 4 1) ;; => '(1 1 1 1)
(.replicate 2 :foo) ;; => '(:foo :foo)
(.replicate 0 :foo) ;; => nil

.cycle (list size)

.cycle ties a finite list into a circular one, or equivalently.

Returned list has a size equal to parameter SIZE.

(.cycle '(1 2 3) 5) ;; => '(1 2 3 1 2)
(.cycle '(1 2 3) 0) ;; => nil

Unfolding

.unfoldr (fn init-val)

The .unfoldr function is a dual to .foldr: while .foldr reduces a list to a summary value, .unfoldr builds a list from a seed value. The function takes the element and returns NIL if it is done producing the list or returns '(a b), in which case, a is a prepended to the list and b is used as the next element in a recursive call.

(.unfoldr (lambda (x) (if (= x 0) nil (list x (1- x)))) 10) ;; => '(10 9 8 7 6 5 4 3 2 1)
(.unfoldr (lambda (x) (if (= x 6) nil (list (expt 2 x) (1+ x)))) 1) ;; => '(2 4 8 16 32)

Sublists

Extracting sublists

.take (count list)

(.take n xs) returns the prefix of xs of length n, or xs itself if n > length xs.

(.take 3 '(1 2 3 4 5)) ;; => '(1 2 3)
(.take 3 '(1 2)) ;; => '(1 2)
(.take 3 '()) ;; => nil
(.take -1 '(1 2)) ;; => nil
(.take 0 '(1 2)) ;; => nil

.drop (count list)

(.drop n xs) returns the suffix of xs after the first n elements, or NIL if n > length xs.

(.drop 3 '(1 2 3 4 5)) ;; => '(4 5)
(.drop 3 '(1 2)) ;; => nil
(.drop 3 '()) ;; => nil
(.drop -1 '(1 2)) ;; => '(1 2)
(.drop 0 '(1 2)) ;; => '(1 2)

.split-at (count list)

splitAt n xs returns a list where first element is xs prefix of length n and second element is the remainder of the list.

(.split-at 3 '(1 2 3 4 5)) ;; =>  '((1 2 3) (4 5))
(.split-at 1 '(1 2 3) ;; => '((1) (2 3))
(.split-at 3 '(1 2 3) ;; => '((1 2 3) nil)
(.split-at 4 '(1 2 3) ;; => '((1 2 3) ())
(.split-at 0 '(1 2 3) ;; => '(nil (1 2 3))
(.split-at -1 '(1 2 3) ;; => '(nil (1 2 3))

.take-while (pred list)

.take-while, applied to a predicate PRED and a LIST, returns the longest prefix (possibly empty) of LIST of elements that satisfy PRED.

(.take-while #'evenp '(1 2 3 4)) ;; => '()
(.take-while #'evenp '(2 4 5 6)) ;; => '(2 4)

.drop-while (pred list)

.drop-while p xs returns the suffix remaining after .take-while p xs.

(.drop-while #'numberp '(1 2 3 nil nil 1 2 3)) ;; => '(nil nil 1 2 3)
(.drop-while #'numberp '(1 2 3)) ;; => '()
(.drop-while #'stringp '(1 2 3)) ;; => '(1 2 3)

.drop-while-end (pred list)

The .drop-while-end function drops the largest suffix of a list in which the given predicate holds for all elements.

(.drop-while-end #'numberp '("foo" "bar" 1 2 3)) ;; => '("foo" "bar")
(.drop-while-end #'numberp '("foo" 1 2 3 "bar")) ;; => '("foo" 1 2 3 "bar")
(.drop-while-end #'numberp '(1 2 3)) ;; => '()

Author

Copyright

Copyright (c) 2018 Ito Dimercel (xolcman@gmail.com)

License

Licensed under the LLGPL License.


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 listopia

Author

Ito Dimercel

License

LLGPL

Description
Long Description

# Listopia

This is no official port of Haskell package [Data.List](https://hackage.haskell.org/package/base-4.10.1.0/docs/Data-List.html)

## Usage

“‘common-lisp
(:use :listopia)
“‘

## Installation

“‘common-lisp
(ql:quickload :listopia)
“‘

## Functions

All functions and constructs in the library are prefixed with a point (.)

### Basic functions

#### .head ‘(list &optional (default nil))‘

Extract the first element of a list. If list is empty, returns default value.

“‘common-lisp
(.head ’(1 2 3)) ;; => 1
(.head ’(1)) ;; => 1
(.head ’() 666) ;; => 666
“‘

#### .last ‘(list &optional (default nil))‘

Extract the last element of a list. If list is empty, returns default value.

“‘common-lisp
(.last ’(1 2 3)) ;; => 3
(.last ’(1)) ;; => 1
(.last ’() 666) ;; => 666
“‘

#### .tail ‘(list &optional (default nil))‘

Extract the elements after the head of a list. If list is empty, returns default value.

“‘common-lisp
(.tail ’(1 2 3)) ;; => ’(2 3)
(.tail ’(1)) ;; => ’()
(.tail ’() 666) ;; => 666
“‘

#### .init ‘(list &optional (default nil))‘

Return all the elements of a list except the last one. If list is empty, returns default value.

“‘common-lisp
(.init ’(1 2 3)) ;; => ’(1 2)
(.init ’(1)) ;; => ’()
(.init ’() 666) ;; => 666
“‘

#### .uncons ‘(list &optional (default nil))‘

Decompose a list into its head and tail. If the list is empty, returns default. If the list is non-empty, returns ’(x, xs), where x is the head of the list and xs its tail.

“‘common-lisp
(.uncons ’(1 2 3)) ;; => ’(1 (2 3))
(.uncons ’(1)) ;; => ’(1 ())
(.uncons ’() 666) ;; => 666
“‘

### List transformations

#### .map ‘(fn list)‘

Result - is the list obtained by applying ‘FN‘ to each element of ‘LIST‘.

“‘common-lisp
(.map #’1+ ’(1 2 3)) ;; => ’(2 3 4)
(.map #’1+ ’()) ;; => nil
“‘

#### .intersperse ‘(sep lisp)‘

The ‘.intersperse‘ function takes an element and a list and ’intersperses’ that element between the elements of the list.

“‘common-lisp
(.intersperse 0 ’(1 2 3)) ;; => ’(1 0 2 0 3)
(.intersperse "," ’("1" "2" "3")) ;; => ’("1" "," "2" "," "3")
(.intersperse 0 ’()) ;; => nil
“‘

#### .intercalate ‘(sep list)‘

‘(.intercalate sep list)‘ is equivalent to ‘(.concat (.intersperse sep list))‘. It inserts the list ‘SEP‘ in between the lists in ‘LIST‘ and concatenates the result.

“‘common-lisp
(.intercalate ’(0) ’((1) (2) (3))) ;; => ’(1 0 2 0 3)
(.intercalate ’(0) ’((1) (2 3) (4 5 6))) ;; => ’(1 0 2 3 0 4 5 6)
(.intercalate ’(0) ’()’) ;; => nil
“‘

### Reducing lists (folds)

#### .foldl ‘(fn init-val list)‘

Left-associative fold of a list.

“‘common-lisp
(.foldl (lambda (acc x) (append acc (list (1+ x))) ’(1 2) ’(2 3 4))) ;; => ’(1 2 3 4 5)
(.foldl (lambda (acc x) (cons x acc)) ’() ’(1 2 3)) ;; => ’(3 2 1)
(.foldl (lambda (acc x) (cons x acc)) ’() ’()) ;; => ’()
“‘

#### .foldl1 ‘(fn list)‘

A variant of .foldl that has no base case, and thus may only be applied to non-empty lists.

“‘common-lisp
(.foldl1 #’+ ’(1 2 3)) ;; => 6
(.foldl1 #’list ’(1 2 3 4)) ;; => ’(((1 2) 3) 4)
“‘

#### .foldr ‘(fn init-val list)‘

Right-associative fold of a list.

“‘common-lisp
(.foldr (lambda (x acc) (append acc (list (1+ x))) ’(1 2) ’(4 3 2))) ;; => ’(1 2 3 4 5)
(.foldr (lambda (x acc) (cons x acc)) ’() ’(1 2 3)) ;; => ’(1 2 3)
(.foldr (lambda (x acc) (cons x acc)) ’() ’()) ;; => ’()
“‘

#### .foldr1 ‘(fn list)‘

A variant of .foldr that has no base case, and thus may only be applied to non-empty lists.

“‘common-lisp
(.foldr1 #’+ ’(1 2 3)) ;; => 6
(.foldr1 #’list ’(1 2 3 4)) ;; => ’(1 (2 (3 4)))
“‘

### Special folds

#### .concat ‘(list)‘

The concatenation of all the elements of a container of lists.

“‘common-lisp
(.concat ’((1) (2 3) (4 5 6))) ;; => ’(1 2 3 4 5 6)
(.concat ’((1)) ;; => ’(1)
(.concat ’(() ()) ;; => ’()
“‘

#### .concat-map ‘(fn list)‘

Map a function over all the elements of a container and concatenate the resulting lists.

“‘common-lisp
(.concat-map #’list ’(1 2 3)) ;; => ’(1 2 3)
(.concat-map (lambda (x)
(list x x))
’(1 2 3)) ;; => ’(1 1 2 2 3 3)
(.concat-map #’null ’()) ;; => NIL
“‘

#### .and ‘(list)‘

.and returns the conjunction of values in list.

“‘common-lisp
(.and ’(t t)) ;; => t
(.and ’(t nil)) ;; => nil
(.and ’()) ;; => t
“‘

#### .or ‘(list)‘

.or returns the disjunction of values in list.

“‘common-lisp
(.or ’(t nil t)) ;; => t
(.or ’(nil nil nil)) ;; => nil
(.or ’()) ;; => nil
“‘

#### .any ‘(fn list)‘

Determines whether any element of the list satisfies the predicate.

“‘common-lisp
(.any #’numberp ’("1" "2" 3)) ;; => t
(.any #’numberp ’()) ;; => nil
“‘

#### .all ‘(fn list)‘

Determines whether all elements of the list satisfy the predicate.

“‘common-lisp
(.all #’numberp ’(1 2 3)) ;; => t
(.all #’numberp ’(1 "2" 3)) ;; => nil
(.all #’numberp ’()) ;; => t
“‘

#### .sum ‘(list)‘

The .sum function computes the sum of the numbers of a list.

“‘common-lisp
(.sum ’(1 2 3)) ;; => 6
(.sum ’()) ;; => 0
“‘

#### .product ‘(list)‘

The .product function computes the product of the numbers of a list.

“‘common-lisp
(.product ’(1 2 3)) ;; => 6
(.product ’()) ;; => 1
“‘

#### .maximum ‘(list)‘

The largest element of a non-empty list.

“‘common-lisp
(.maximum ’(1 2 3 4 5)) ;; => 5
(.maximum ’(1 2 3.0)) ;; => 3.0
“‘

#### .minimum ‘(list)‘

The least element of a non-empty list.

“‘common-lisp
(.minimum ’(1 2 3 4 5)) ;; => 1
(.minimum ’(1.0 2 3)) ;; => 1.0
“‘

### Special folds

### Scans

#### .scanl ‘(fn init-value list)‘

.scanl is similar to foldl, but returns a list of successive reduced values from the left:

‘(.scanl fn init ’(x1 x2 ...)) == (list init (fn init x1) (fn (fn init x1) x2) ...)‘

“‘common-lisp
(.scanl #’+ 1 ’(2 3 4)) ;; => ’(1 3 6 10)
(.scanl #’+ 1 ’()) ;; => ’(1)
“‘
#### .scanl1 ‘(fn list)‘

.scanl1 is a variant of .scanl that has no starting value argument.

“‘common-lisp
(.scanl1 #’+ ’(1 2 3 4)) ;; => ’(1 3 6 10)
(.scanl1 #’+ ’()) ;; => nil
“‘

#### .scanr ‘(fn init-value list)‘

.scanr is the right-to-left dual of .scanl.

“‘common-lisp
(.scanr #’+ 1 ’(2 3 4)) ;; => ’(10 8 5 1)
(.scanr #’+ 1 ’()) ;; => ’(1)
“‘

#### .scanr1 ‘(fn list)‘

.scanr1 is a variant of .scanr that has no starting value argument.

“‘common-lisp
(.scanr1 #’+ ’(2 3 4 1)) ;; => ’(10 8 5 1)
(.scanr1 #’+ ’(5 4 3 2 1)) ;; => ’(15 10 6 3 1)
(.scanr1 #’+ ’()) ;; => nil
“‘

### Accumulating maps

#### .map-accum-l ‘(fn init-val list)‘

.map-accum-l applies a function to each element of a list, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new structure.

“‘common-lisp
(.map-accum-l (lambda (acc x) (list acc (+ x acc))) 1 ’(1 2 3)) ;; => ’(1 (2 3 4))
(.map-accum-l (lambda (acc x) (list (1+ acc) (+ x acc))) 1 ’(1 2 3)) ;; => ’(4 (2 4 6))
“‘

#### .map-accum-r ‘(fn init-val list)‘

.map-accum-r applies a function to each element of a list, passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new structure.

“‘common-lisp
(.map-accum-r (lambda (acc x) (list acc (+ x acc))) 1 ’(1 2 3)) ;; => ’(1 (2 3 4))
(.map-accum-r (lambda (acc x) (list (1+ acc) (+ x acc))) 1 ’(1 2 3)) ;; => ’(4 (4 4 4))
“‘

### Infinite lists

#### .iterate ‘(fn init-val size)‘

‘(.iterate fn val n)‘ returns an list of repeated applications of fn to val:

‘(.iterate f x size) == (list x (f x) (f (f x)) ...)‘

Returned list has a size equal to parameter SIZE.

“‘common-lisp
(.iterate #’1+ 0 4) ;; => ’(0 1 2 3)’
(.iterate #’1+ 0 0) ;; => nil
“‘

#### .repeat ‘(init-val size)‘

‘(.repeat x n)‘ is an list, with x the value of every element.

Returned list has a size equal to parameter SIZE.

“‘common-lisp
(.repeat 1 4) ;; => ’(1 1 1 1)
(.repeat :foo 2) ;; => ’(:foo :foo)
(.repeat :foo 0) ;; => nil
“‘

#### .replicate ‘(size init-val)‘

‘(.replicate n x)‘ is a list of length n with x the value of every element.

“‘common-lisp
(.replicate 4 1) ;; => ’(1 1 1 1)
(.replicate 2 :foo) ;; => ’(:foo :foo)
(.replicate 0 :foo) ;; => nil
“‘

#### .cycle ‘(list size)‘

.cycle ties a finite list into a circular one, or equivalently.

Returned list has a size equal to parameter SIZE.

“‘common-lisp
(.cycle ’(1 2 3) 5) ;; => ’(1 2 3 1 2)
(.cycle ’(1 2 3) 0) ;; => nil
“‘

### Unfolding

#### .unfoldr ‘(fn init-val)‘

The .unfoldr function is a dual to .foldr: while .foldr reduces a list to a summary value, .unfoldr builds a list from a seed value. The function takes the element and returns NIL if it is done producing the list or returns ’(a b), in which case, a is a prepended to the list and b is used as the next element in a recursive call.

“‘common-lisp
(.unfoldr (lambda (x) (if (= x 0) nil (list x (1- x)))) 10) ;; => ’(10 9 8 7 6 5 4 3 2 1)
(.unfoldr (lambda (x) (if (= x 6) nil (list (expt 2 x) (1+ x)))) 1) ;; => ’(2 4 8 16 32)
“‘

### Sublists

### Extracting sublists

#### .take ‘(count list)‘

‘(.take n xs)‘ returns the prefix of xs of length n, or xs itself if n > length xs.

“‘common-lisp
(.take 3 ’(1 2 3 4 5)) ;; => ’(1 2 3)
(.take 3 ’(1 2)) ;; => ’(1 2)
(.take 3 ’()) ;; => nil
(.take -1 ’(1 2)) ;; => nil
(.take 0 ’(1 2)) ;; => nil
“‘

#### .drop ‘(count list)‘

‘(.drop n xs)‘ returns the suffix of xs after the first n elements, or NIL if n > length xs.

“‘common-lisp
(.drop 3 ’(1 2 3 4 5)) ;; => ’(4 5)
(.drop 3 ’(1 2)) ;; => nil
(.drop 3 ’()) ;; => nil
(.drop -1 ’(1 2)) ;; => ’(1 2)
(.drop 0 ’(1 2)) ;; => ’(1 2)
“‘

#### .split-at ‘(count list)‘

‘splitAt n xs‘ returns a list where first element is xs prefix of length n and second element is the remainder of the list.

“‘common-lisp
(.split-at 3 ’(1 2 3 4 5)) ;; => ’((1 2 3) (4 5))
(.split-at 1 ’(1 2 3) ;; => ’((1) (2 3))
(.split-at 3 ’(1 2 3) ;; => ’((1 2 3) nil)
(.split-at 4 ’(1 2 3) ;; => ’((1 2 3) ())
(.split-at 0 ’(1 2 3) ;; => ’(nil (1 2 3))
(.split-at -1 ’(1 2 3) ;; => ’(nil (1 2 3))
“‘

#### .take-while ‘(pred list)‘

.take-while, applied to a predicate PRED and a LIST, returns the longest prefix (possibly empty) of LIST of elements that satisfy PRED.

“‘common-lisp
(.take-while #’evenp ’(1 2 3 4)) ;; => ’()
(.take-while #’evenp ’(2 4 5 6)) ;; => ’(2 4)
“‘

#### .drop-while ‘(pred list)‘

‘.drop-while p xs‘ returns the suffix remaining after ‘.take-while p xs‘.

“‘common-lisp
(.drop-while #’numberp ’(1 2 3 nil nil 1 2 3)) ;; => ’(nil nil 1 2 3)
(.drop-while #’numberp ’(1 2 3)) ;; => ’()
(.drop-while #’stringp ’(1 2 3)) ;; => ’(1 2 3)
“‘

#### .drop-while-end ‘(pred list)‘

The .drop-while-end function drops the largest suffix of a list in which the given predicate holds for all elements.

“‘common-lisp
(.drop-while-end #’numberp ’("foo" "bar" 1 2 3)) ;; => ’("foo" "bar")
(.drop-while-end #’numberp ’("foo" 1 2 3 "bar")) ;; => ’("foo" 1 2 3 "bar")
(.drop-while-end #’numberp ’(1 2 3)) ;; => ’()
“‘

## Author

* Ito Dimercel (xolcman@gmail.com)

## Copyright

Copyright (c) 2018 Ito Dimercel (xolcman@gmail.com)

## License

Licensed under the LLGPL License.

Version

0.5.0

Source

listopia.asd (file)

Component

src (module)


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

3 Modules

Modules are listed depth-first from the system components tree.


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

3.1 listopia/src

Parent

listopia (system)

Location

src/

Component

listopia.lisp (file)


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

4 Files

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


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

4.1 Lisp


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

4.1.1 listopia.asd

Location

listopia.asd

Systems

listopia (system)


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

4.1.2 listopia/src/listopia.lisp

Parent

src (module)

Location

src/listopia.lisp

Packages

listopia

Exported Definitions

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

5 Packages

Packages are listed by definition order.


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

5.1 listopia

Source

listopia.lisp (file)

Use List

common-lisp

Exported Definitions

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

6 Definitions

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


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

6.1 Exported definitions


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

6.1.1 Functions

Function: .all FN LIST
Package

listopia

Source

listopia.lisp (file)

Function: .and LIST
Package

listopia

Source

listopia.lisp (file)

Function: .any FN LIST
Package

listopia

Source

listopia.lisp (file)

Function: .concat LIST
Package

listopia

Source

listopia.lisp (file)

Function: .concat-map FN LIST
Package

listopia

Source

listopia.lisp (file)

Function: .cycle LIST SIZE
Package

listopia

Source

listopia.lisp (file)

Function: .drop COUNT LIST
Package

listopia

Source

listopia.lisp (file)

Function: .drop-while PRED LIST
Package

listopia

Source

listopia.lisp (file)

Function: .drop-while-end PRED LIST
Package

listopia

Source

listopia.lisp (file)

Function: .foldl FN INIT-VAL LIST
Package

listopia

Source

listopia.lisp (file)

Function: .foldl1 FN LIST
Package

listopia

Source

listopia.lisp (file)

Function: .foldr FN INIT-VAL LIST
Package

listopia

Source

listopia.lisp (file)

Function: .foldr1 FN LIST
Package

listopia

Source

listopia.lisp (file)

Function: .head LIST &optional DEFAULT
Package

listopia

Source

listopia.lisp (file)

Function: .init LIST &optional DEFAULT
Package

listopia

Source

listopia.lisp (file)

Function: .intercalate SEP LIST
Package

listopia

Source

listopia.lisp (file)

Function: .intersperse SEP LIST
Package

listopia

Source

listopia.lisp (file)

Function: .iterate FN INIT-VAL SIZE
Package

listopia

Source

listopia.lisp (file)

Function: .last LIST &optional DEFAULT
Package

listopia

Source

listopia.lisp (file)

Function: .map FN LIST
Package

listopia

Source

listopia.lisp (file)

Function: .map-accum-l FN INIT-VAL LIST
Package

listopia

Source

listopia.lisp (file)

Function: .map-accum-r FN INIT-VAL LIST
Package

listopia

Source

listopia.lisp (file)

Function: .maximum LIST
Package

listopia

Source

listopia.lisp (file)

Function: .minimum LIST
Package

listopia

Source

listopia.lisp (file)

Function: .or LIST
Package

listopia

Source

listopia.lisp (file)

Function: .product LIST
Package

listopia

Source

listopia.lisp (file)

Function: .repeat INIT-VAL SIZE
Package

listopia

Source

listopia.lisp (file)

Function: .replicate SIZE INIT-VAL
Package

listopia

Source

listopia.lisp (file)

Function: .scanl FN INIT-VAL LIST
Package

listopia

Source

listopia.lisp (file)

Function: .scanl1 FN LIST
Package

listopia

Source

listopia.lisp (file)

Function: .scanr FN INIT-VAL LIST
Package

listopia

Source

listopia.lisp (file)

Function: .scanr1 FN LIST
Package

listopia

Source

listopia.lisp (file)

Function: .split-at COUNT LIST
Package

listopia

Source

listopia.lisp (file)

Function: .sum LIST
Package

listopia

Source

listopia.lisp (file)

Function: .tail LIST &optional DEFAULT
Package

listopia

Source

listopia.lisp (file)

Function: .take COUNT LIST
Package

listopia

Source

listopia.lisp (file)

Function: .take-while PRED LIST
Package

listopia

Source

listopia.lisp (file)

Function: .uncons LIST &optional DEFAULT
Package

listopia

Source

listopia.lisp (file)

Function: .unfoldr FN INIT-VAL
Package

listopia

Source

listopia.lisp (file)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   F   L   M  
Index Entry  Section

F
File, Lisp, listopia.asd: The listopia<dot>asd file
File, Lisp, listopia/src/listopia.lisp: The listopia/src/listopia<dot>lisp file

L
Lisp File, listopia.asd: The listopia<dot>asd file
Lisp File, listopia/src/listopia.lisp: The listopia/src/listopia<dot>lisp file
listopia.asd: The listopia<dot>asd file
listopia/src: The listopia/src module
listopia/src/listopia.lisp: The listopia/src/listopia<dot>lisp file

M
Module, listopia/src: The listopia/src module

Jump to:   F   L   M  

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

A.2 Functions

Jump to:   .  
F  
Index Entry  Section

.
.all: Exported functions
.and: Exported functions
.any: Exported functions
.concat: Exported functions
.concat-map: Exported functions
.cycle: Exported functions
.drop: Exported functions
.drop-while: Exported functions
.drop-while-end: Exported functions
.foldl: Exported functions
.foldl1: Exported functions
.foldr: Exported functions
.foldr1: Exported functions
.head: Exported functions
.init: Exported functions
.intercalate: Exported functions
.intersperse: Exported functions
.iterate: Exported functions
.last: Exported functions
.map: Exported functions
.map-accum-l: Exported functions
.map-accum-r: Exported functions
.maximum: Exported functions
.minimum: Exported functions
.or: Exported functions
.product: Exported functions
.repeat: Exported functions
.replicate: Exported functions
.scanl: Exported functions
.scanl1: Exported functions
.scanr: Exported functions
.scanr1: Exported functions
.split-at: Exported functions
.sum: Exported functions
.tail: Exported functions
.take: Exported functions
.take-while: Exported functions
.uncons: Exported functions
.unfoldr: Exported functions

F
Function, .all: Exported functions
Function, .and: Exported functions
Function, .any: Exported functions
Function, .concat: Exported functions
Function, .concat-map: Exported functions
Function, .cycle: Exported functions
Function, .drop: Exported functions
Function, .drop-while: Exported functions
Function, .drop-while-end: Exported functions
Function, .foldl: Exported functions
Function, .foldl1: Exported functions
Function, .foldr: Exported functions
Function, .foldr1: Exported functions
Function, .head: Exported functions
Function, .init: Exported functions
Function, .intercalate: Exported functions
Function, .intersperse: Exported functions
Function, .iterate: Exported functions
Function, .last: Exported functions
Function, .map: Exported functions
Function, .map-accum-l: Exported functions
Function, .map-accum-r: Exported functions
Function, .maximum: Exported functions
Function, .minimum: Exported functions
Function, .or: Exported functions
Function, .product: Exported functions
Function, .repeat: Exported functions
Function, .replicate: Exported functions
Function, .scanl: Exported functions
Function, .scanl1: Exported functions
Function, .scanr: Exported functions
Function, .scanr1: Exported functions
Function, .split-at: Exported functions
Function, .sum: Exported functions
Function, .tail: Exported functions
Function, .take: Exported functions
Function, .take-while: Exported functions
Function, .uncons: Exported functions
Function, .unfoldr: Exported functions

Jump to:   .  
F  

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

A.3 Variables


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

A.4 Data types

Jump to:   L   P   S  
Index Entry  Section

L
listopia: The listopia system
listopia: The listopia package

P
Package, listopia: The listopia package

S
System, listopia: The listopia system

Jump to:   L   P   S