Name

ecl_make_keyword — Find a lisp keyword

Function

cl_object ecl_make_keyword( char * name);

Description

Many Lisp functions take keyword arguments. When invoking a function with keyword arguments we need keywords, which are a kind of symbols that live in the KEYWORD package. This function does the task of finding or creating those keywords from C strings.

  • It is usually safe to store the resulting pointer, because keywords are always referenced by their package and will not be garbage collected (unless of course, you decide to delete it).

  • Remember that the case of the string is significant. ecl_make_keyword("TO") with return :TO, while ecl_make_keyword("to") returns a completely different keywod, :|to|. In short, you usually want to use uppercase.

Example

The following example converts a section of a string to uppercase characters:

cl_object start = ecl_make_keyword("START");
cl_object end = ecl_make_keyword("END");
...
sup = cl_string_upcase(4, s, start, ecl_make_fixnum(2),
                       end, ecl_make_fixnum(6));
...