An open API service indexing awesome lists of open source software.

https://github.com/stylewarning/cl-generic-arithmetic


https://github.com/stylewarning/cl-generic-arithmetic

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

          

CL-GENERIC-ARITHMETIC
=====================

AUTHOR
------

Robert Smith

ABSTRACT
--------

This system provides generic arithmetic operators in CL. Most
arithmetic/numerical functions -- such as +, MAX, COS, or SQRT -- are
"CLOS-ified". They are provided in the form of packages which are
alternatives to the standard common lisp packages.

Standard Package CLOSified
---------------- -----------------------------------
COMMON-LISP COMMON-LISP/GENERIC-ARITHMETIC
COMMON-LISP-USER COMMON-LISP/GENERIC-ARITHMETIC-USER
CL CL/GA
CL-USER CL/GA-USER

DEPENDENCIES
------------

This package makes use of CONDUIT-PACKAGES

EXAMPLE
-------

CL-USER> (ql:quickload "cl-generic-arithmetic")
To load "cl-generic-arithmetic":
Load 1 ASDF system:
cl-generic-arithmetic
; Loading "cl-generic-arithmetic"
.....
("cl-generic-arithmetic")
CL-USER> (in-package :cl/ga-user)
#
CL/GA-USER> (+ 1 2 3 4 5)
15
CL/GA-USER> (defmethod nullary-+ ((type string)) "")
#
CL/GA-USER> (defmethod unary-+ ((x string)) x)
#
CL/GA-USER> (defmethod binary-+ ((x string) (y string))
(concatenate 'string x y))
#
CL/GA-USER> (+ "hello" "world")
"helloworld"
CL/GA-USER> (defmethod abs ((x string)) (length x))
#
CL/GA-USER> (abs (+ "hello" "world"))
10

LIMITATIONS
-----------

Genericizing operators with &REST arguments requires defining NULLARY,
UNARY, and BINARY versions of the operator. This should be fixed.

COPYRIGHT
---------

Copyright (c) Robert Smith, 2011

LICENSE
-------

Please see the included file LICENSE.