[hunchentoot-devel] interning strings under Hunchentoot

If I try to intern a string so I can call a function with this name, Hunchentoot returns an error that this function is not defined. For example, if in a HT request handler I call (apply 'some-func '("str1" "str2")) everything is OK, the function is called. If I call it like (apply (intern "SOME-FUNC") '("str1" "str2")) an exception occurs saying that SOME-FUNC is not defined. I need it to compose a function name by concatenating strings. BTW, when I do the same thing from REPL, both ways work. I am still just learing lisp and maybe this is not specifically HT related question, but I'd like to know why it happens. I am using hunchentoot-0.14.2 and sbcl 1.0.6. Thank you, Andrew

Andrei, Since you don't specify :package in (intern "SOME-FUNC"), the symbol returned will be in the current package. Probably that's not the package in which you defined some-func. Daniel On Sun, Apr 13, 2008 at 6:03 PM, Andrei Stebakov <lispercat@gmail.com> wrote:
If I try to intern a string so I can call a function with this name, Hunchentoot returns an error that this function is not defined. For example, if in a HT request handler I call (apply 'some-func '("str1" "str2")) everything is OK, the function is called. If I call it like (apply (intern "SOME-FUNC") '("str1" "str2")) an exception occurs saying that SOME-FUNC is not defined. I need it to compose a function name by concatenating strings. BTW, when I do the same thing from REPL, both ways work. I am still just learing lisp and maybe this is not specifically HT related question, but I'd like to know why it happens. I am using hunchentoot-0.14.2 and sbcl 1.0.6.
Thank you, Andrew
_______________________________________________ tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel

Right. Thank you, Daniel! On 4/13/08, Daniel Gackle <danielgackle@gmail.com> wrote:
Andrei,
Since you don't specify :package in (intern "SOME-FUNC"), the symbol returned will be in the current package. Probably that's not the package in which you defined some-func.
Daniel
On Sun, Apr 13, 2008 at 6:03 PM, Andrei Stebakov <lispercat@gmail.com> wrote:
If I try to intern a string so I can call a function with this name, Hunchentoot returns an error that this function is not defined. For example, if in a HT request handler I call (apply 'some-func '("str1" "str2")) everything is OK, the function is called. If I call it like (apply (intern "SOME-FUNC") '("str1" "str2")) an exception occurs saying that SOME-FUNC is not defined. I need it to compose a function name by concatenating strings. BTW, when I do the same thing from REPL, both ways work. I am still just learing lisp and maybe this is not specifically HT related question, but I'd like to know why it happens. I am using hunchentoot-0.14.2 and sbcl 1.0.6.
Thank you, Andrew
_______________________________________________ tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel
_______________________________________________ tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel
participants (2)
-
Andrei Stebakov
-
Daniel Gackle