The nsort Reference Manual

Table of Contents

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

The nsort Reference Manual

This is the nsort Reference Manual, generated automatically by Declt version 2.4 "Will Decker" on Wed Jun 20 12:20:09 2018 GMT+0.


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

1 Introduction

nsort

short for numeric or natural sort

1 2 10 instead of 1 10 2

Code adapted from answer by Svante 2014-12-05 in

http://stackoverflow.com/questions/27307660/how-to-implement-natural-sort-in-common-lisp

Idea from

https://groups.google.com/forum/#!searchin/comp.lang.lisp/human$20sort/comp.lang.lisp/8-NU77NMl-I/AMXgN3NMbpQJ

Usage:

(defparameter words 
 '("+gray10+" "+gray11+" "+yellow+" "+gray1+" "+gray2+" "+gray+" "+gray0+"))

(sort (copy-list words) #'nsort:nstring<)
; ("+gray+" "+gray0+" "+gray1+" "+gray2+" "+gray10+" "+gray11+" "+yellow+")

(sort (copy-list words) #'nsort:nstring>)
; ("+yellow+" "+gray11+" "+gray10+" "+gray2+" "+gray1+" "+gray0+" "+gray+")



(defparameter words-case 
 '("+Gray10+" "+gray11+" "+YELLow+" "+gray1+" "+gray2+" "+gray+" "+gray0+"))

(sort (copy-list words-case) #'nsort:nstring-lessp)
; ("+gray+" "+gray0+" "+gray1+" "+gray2+" "+Gray10+" "+gray11+" "+YELLow+")

(sort (copy-list words-case) #'nsort:nstring-greaterp)
; ("+YELLow+" "+gray11+" "+Gray10+" "+gray2+" "+gray1+" "+gray0+" "+gray+")

Testfile

(prove:run #P"path-to/test.lisp")

using string-designators seems to work, 28.4.2015

(sort '("a20" #\0 "a2" a10 "a1") #'nsort:nstring<)  ; (#\0 "a1" "a2" A10 "a20")

except case convertion problems with 'bAr --> "bAr"

(sort '(bc2 |bc1| "bc10" a10 "a1") #'nsort:nstring<) ; ("a1" A10 |bc1| BC2 "bc10")
(sort '(bc2  bc1  "bc10" a10 "a1") #'nsort:nstring<) ; (BC1 BC2 "a1" A10 "bc10")

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 nsort

Author

<schatzer.johann@gmail>

License

BSD Simplified

Description

Natural or Numeric Sort

Dependency

prove

Source

nsort.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 nsort.asd

Location

nsort.asd

Systems

nsort (system)


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

3.1.2 nsort/package.lisp

Parent

nsort (system)

Location

package.lisp

Packages

nsort


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

3.1.3 nsort/nsort.lisp

Dependency

package.lisp (file)

Parent

nsort (system)

Location

nsort.lisp

Exported Definitions
Internal Definitions

defnsf (macro)


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

4 Packages

Packages are listed by definition order.


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

4.1 nsort

Source

package.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

defnsf (macro)


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: nstring-greaterp A B &key SA EA SB EB
Package

nsort

Source

nsort.lisp (file)

Function: nstring-lessp A B &key SA EA SB EB
Package

nsort

Source

nsort.lisp (file)

Function: nstring-not-greaterp A B &key SA EA SB EB
Package

nsort

Source

nsort.lisp (file)

Function: nstring-not-lessp A B &key SA EA SB EB
Package

nsort

Source

nsort.lisp (file)

Function: nstring< A B &key SA EA SB EB
Package

nsort

Source

nsort.lisp (file)

Function: nstring<= A B &key SA EA SB EB
Package

nsort

Source

nsort.lisp (file)

Function: nstring> A B &key SA EA SB EB
Package

nsort

Source

nsort.lisp (file)

Function: nstring>= A B &key SA EA SB EB
Package

nsort

Source

nsort.lisp (file)


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

5.2 Internal definitions


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

5.2.1 Macros

Macro: defnsf NAME FN DIR
Package

nsort

Source

nsort.lisp (file)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   F   L   N  
Index Entry  Section

F
File, Lisp, nsort.asd: The nsort<dot>asd file
File, Lisp, nsort/nsort.lisp: The nsort/nsort<dot>lisp file
File, Lisp, nsort/package.lisp: The nsort/package<dot>lisp file

L
Lisp File, nsort.asd: The nsort<dot>asd file
Lisp File, nsort/nsort.lisp: The nsort/nsort<dot>lisp file
Lisp File, nsort/package.lisp: The nsort/package<dot>lisp file

N
nsort.asd: The nsort<dot>asd file
nsort/nsort.lisp: The nsort/nsort<dot>lisp file
nsort/package.lisp: The nsort/package<dot>lisp file

Jump to:   F   L   N  

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

A.2 Functions

Jump to:   D   F   M   N  
Index Entry  Section

D
defnsf: Internal macros

F
Function, nstring-greaterp: Exported functions
Function, nstring-lessp: Exported functions
Function, nstring-not-greaterp: Exported functions
Function, nstring-not-lessp: Exported functions
Function, nstring<: Exported functions
Function, nstring<=: Exported functions
Function, nstring>: Exported functions
Function, nstring>=: Exported functions

M
Macro, defnsf: Internal macros

N
nstring-greaterp: Exported functions
nstring-lessp: Exported functions
nstring-not-greaterp: Exported functions
nstring-not-lessp: Exported functions
nstring<: Exported functions
nstring<=: Exported functions
nstring>: Exported functions
nstring>=: Exported functions

Jump to:   D   F   M   N  

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

A.3 Variables


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

A.4 Data types

Jump to:   N   P   S  
Index Entry  Section

N
nsort: The nsort system
nsort: The nsort package

P
Package, nsort: The nsort package

S
System, nsort: The nsort system

Jump to:   N   P   S