https://github.com/stylewarning/cl-generic-arithmetic
https://github.com/stylewarning/cl-generic-arithmetic
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/stylewarning/cl-generic-arithmetic
- Owner: stylewarning
- License: bsd-3-clause
- Created: 2023-04-09T22:06:09.000Z (about 3 years ago)
- Default Branch: fix-min
- Last Pushed: 2023-11-13T17:23:48.000Z (over 2 years ago)
- Last Synced: 2025-10-27T08:59:08.966Z (8 months ago)
- Language: Common Lisp
- Size: 13.7 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README
- License: LICENSE
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.