[Openmcl-devel] name (string) to function
rpgoldman at sift.info
Sun Dec 5 13:13:37 CST 2010
On 12/5/10 Dec 5 -2:11 AM, Taoufik Dachraoui wrote:
> While implementing the matching function I wanted to represent the type
> as follows: (:type x :name) and then to transform :name -> "name" ->
> now, I am using typep as suggested by Greg
Got it. TYPEP seems better because it doesn't interact weirdly with the
package system the way your approach of using a keyword symbol to
represent a symbol that's not in the keyword package, but instead is in
whatever *PACKAGE* is.
If you want to avoid having to supply quotes, instead of using keywords,
which have this odd semantics, you can use a macro and just not quote.
That would allow you to use
(instead of 'FOO) to denote the FOO function, in the current package,
but would also allow you to use
to denote the FOO function in the BAR package, which you cannot do if
you use keywords as in your original.
> On Sun, Dec 5, 2010 at 6:12 AM, Robert P. Goldman <rpgoldman at sift.info
> <mailto:rpgoldman at sift.info>> wrote:
> I don't understand.
> String -> function
> Isn't really meaningful. Don't you want
> String x package -> function?
> On Dec 4, 2010, at 1:36, Stas Boukarev <stassats at gmail.com
> <mailto:stassats at gmail.com>> wrote:
> > Taoufik Dachraoui <dachraoui.taoufik at gmail.com
> <mailto:dachraoui.taoufik at gmail.com>> writes:
> >> 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
> > read-from-string interns symbol, which may be undesirable, and it can
> > execute arbitrary code, so you need to bind *read-eval* to nil.
> > --
> > With Best Regards, Stas.
> > _______________________________________________
> > Openmcl-devel mailing list
> > Openmcl-devel at clozure.com <mailto:Openmcl-devel at clozure.com>
> > http://clozure.com/mailman/listinfo/openmcl-devel
More information about the Openmcl-devel