Code Comments
Programming Forum and web based access to our favorite programming groups.Why does (string-trim '(#\Tab) nil) return "NIL" and not nil?
Post Follow-up to this messageOn 2008-04-02 21:14:37 -0400, wrf3@stablecross.com (Bob Felts) said: > Why does (string-trim '(#\Tab) nil) return "NIL" and not nil? Because string-trim returns a string not a string designator. "NIL" is a string and nil, though a string designator and therfore suitable as the second arg, is not a string and so cannot be the return value. "Function STRING-TRIM, STRING-LEFT-TRIM, STRING-RIGHT-TRIM Syntax: string-trim character-bag string => trimmed-string string-left-trim character-bag string => trimmed-string string-right-trim character-bag string => trimmed-string Arguments and Values: character-bag---a sequence containing characters. string---a string designator. trimmed-string---a string."
Post Follow-up to this messagewrf3@stablecross.com (Bob Felts) writes: > Why does (string-trim '(#\Tab) nil) return "NIL" and not nil? Because symbols are "string designators" which can be used in place of strings. And nil is a symbol with the symbol-name "NIL", which is therefore used as the string being processed by STRING-TRIM. Compare: (string-trim '(#\Tab) "NIL") (string-trim '(#\Tab) 'foo) (string-trim '(#\Tab) t) -- Thomas A. Russ, USC/Information Sciences Institute
Post Follow-up to this messagePå Thu, 03 Apr 2008 03:14:37 +0200, skrev Bob Felts <wrf3@stablecross.com>: > Why does (string-trim '(#\Tab) nil) return "NIL" and not nil? As a curiosity string-lessp treats nil as "NIL" as well. (At least under LispWorks.) -------------- John Thingstad
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.