diff --git a/init/defmfun-array.lisp b/init/defmfun-array.lisp index 9b2a67629712035b9d6838b5b69dea81324eeac2..0edea019c6f62f596193dcdd01a1fff8c3a775a7 100644 --- a/init/defmfun-array.lisp +++ b/init/defmfun-array.lisp @@ -1,6 +1,6 @@ ;; Helpers for defining GSL functions on arrays ;; Liam Healy 2009-01-07 22:01:16EST defmfun-array.lisp -;; Time-stamp: <2009-10-18 19:35:15EDT defmfun-array.lisp> +;; Time-stamp: <2009-11-30 16:13:13EST defmfun-array.lisp> ;; $Id: $ (in-package :gsl) @@ -132,13 +132,6 @@ (string-downcase (symbol-name category)) :category base-name)))))))))) -(defun number-class-from-type (type) - "Find a class name that contains this type." - ;; Not exhaustive; just trying to separate reals and complex. - (cond ((subtypep type 'complex) 'complex) - ((subtypep type 'float) 'float) - (t (error "Can't pass type ~a." type)))) - (defun actual-class-arglist (arglist element-type c-arguments &optional replace-both) "Replace the prototype arglist with an actual arglist." @@ -152,9 +145,9 @@ (if (and replacing (listp arg)) (list (first arg) (case (second arg) - (:element-type (number-class-from-type element-type)) + (:element-type (number-class element-type)) (:component-float-type - (number-class-from-type (component-float-type element-type))) + (number-class (component-float-type element-type))) (otherwise (data-class-name (if (and (eq (second arg) 'both) replace-both) diff --git a/init/types.lisp b/init/types.lisp index 5e498dcbca5c97e21dce01847131e687e3bbcf76..baef60e33a17ce2591a8b67a5715c4743673abfe 100644 --- a/init/types.lisp +++ b/init/types.lisp @@ -1,6 +1,6 @@ ;; Number types used by GSL functions, and specification conversion ;; Liam Healy 2008-12-31 21:06:34EST types.lisp -;; Time-stamp: <2009-11-14 10:54:53EST types.lisp> +;; Time-stamp: <2009-11-30 16:13:18EST types.lisp> ;; $Id: $ (in-package :gsl) @@ -207,3 +207,9 @@ "The CL type from the CFFI element type." (unless (eq cffi-type :pointer) (lookup-type cffi-type *cstd-cl-type-mapping*))) + +;;; For future use +(defparameter *cl-numeric-classes* '(ratio integer rational float real complex number)) +(defun number-class (type) + "Find the class corresponding to the numeric type." + (find-if (lambda (class) (subtypep type class)) *cl-numeric-classes*))