[Openmcl-devel] name (string) to function
    Taoufik Dachraoui 
    dachraoui.taoufik at gmail.com
       
    Fri Dec  3 23:28:27 PST 2010
    
    
  
I found another way
(defun f (string)
  (read-from-string (format nil "(function ~A)" string)))
I am interested  to know the pros and cons of using read-from-string
and to compare this to your code
Kind regards
Taoufik
On Sat, Dec 4, 2010 at 8:23 AM, Stas Boukarev <stassats at gmail.com> wrote:
> Taoufik Dachraoui <dachraoui.taoufik at gmail.com> writes:
>
> > Hello
> >
> >
> > I would like to return the function object from a string
> >
> > (f "+") == (function +)
>
> (defun f (string)
>  (let ((symbol (find-symbol string)))
>    (when (fboundp symbol)
>      (fdefinition symbol))))
>
> --
> With Best Regards, Stas.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20101204/3f612300/attachment.htm>
    
    
More information about the Openmcl-devel
mailing list