[Openmcl-devel] inverse function

Taoufik Dachraoui taoufik at mazeboard.com
Sat Feb 13 11:10:02 PST 2010


Hi

....
> (defun square (x)
>  (* x x))
>
> (inverse #'square) => #'sqrt ;; or something very like sqrt
>
> (funcall (inverse #'square) (square -3)) => 3 ;; i.e., not -3 as it you
want it to

I would like an inverse function that returns all possible values

? (funcall (inverse #'square) 4)
(2 -2)


Many lisp functions are invertable and many are not as in Mathematics.

What I would like to have is a function to generate an inverse of a given
lisp function
(without side-effects) if it has an inverse and the generated inverse
function returns
all possible results (as in sqrt above).

The inverse generator will fail for many functions with side-effects or
functions
that do not have an inverse, but will return an inverse function for all
others.

The generated function, as said above, will return all possibilities.


Kind regards
Taoufik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20100213/ee0af4b2/attachment.htm>


More information about the Openmcl-devel mailing list