= lsp-misc.a(8) :doctype: manpage :revdate: {sys:date "+%Y-%m-%d %H:%M:%S"} == NAME lsp-misc.a - Misceallaneous useful functions. == SYNOPSIS .With packnl (example) packnl _main.lsp_ *-A lsp-misc.a* .With incore.lsp (load "incore.lsp") + (archive "lsp-misc.a") + (load "misc.lsp") == DESCRIPTION *lsp-misc.a* provides a few global utility functions. === misc.lsp API (prog1 [_term_]*):: The *prog1* function is like a *begin* function except that it returns the value of the first term rather than the last. (die [_N_ [_term_]]):: The *die* function printes to stderr the join of term values as strings with space separation, and if _N_ is a number, then the function exits the program with that return code. + .Example of stderr logging (die nil 'This "is" 'printed "to stderr") (octal-byte _B_):: Print binary byte as octal or as ASCII character [32-126]. (octals-string _S_):: Print string as a succesion of +octal-byte+. (human-byte _B_):: Return byte code as printable (string) or as code (number). (human-bytes _BL_):: Return a list of human-byte elements from a list of byte codes but also joining consecutive string elements to form packed strings. === foop.lsp API This newlisp module provides Functional Object-Oriented Programming (FOOP) modelling support. FOOP is an abstraction overlay using the newlisp context notion as a simile to the _class_ notion in genuine object-oriented programming languages. This is set out in newlisp by means of the representation principle that an instance of a FOOP "class" (i.e. context) is a list headed by the context itself, and followed by the "member values". FOOP further includes by the "method invocation" syntax where a function is preceded by ':' and then followed by the instance concerned before actual function arguments. That instance is then stoved away as implicitly available via the (self) function, and the member values accessible via index, e.g. the term (self 3) refers to the third member of the instance. The self references are destructively assignable with setf. This modelling support adds member name declaration together with automatic getter and setter defintions. The (FOOP ...) term is used for declaring member names in order. For example: (FOOP [_name_]):: *FOOP* is like a language extension to declare the field names of a FOOP class, and thereby gain "get" and "set" functions generated with the respective naming formats (:%name obj) and (:!name obj value). .illustration ---- (context 'MAIN:EX) (FOOP here there more) (define (EX HERE THERE MORE) (list (context) HERE THERE MORE)) (context MAIN) (setf A (EX 1 2 3)) --> A = (EX 1 2 3) (:!there A 4) --> A = (EX 1 4 3) ---- == SEE ALSO *newlisp* == AUTHOR Ralph Ronnquist