Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

string-trim
Why does (string-trim '(#\Tab) nil) return "NIL" and not nil?

Report this thread to moderator Post Follow-up to this message
Old Post
Bob Felts
04-03-08 03:57 AM


Re: string-trim
On 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."


Report this thread to moderator Post Follow-up to this message
Old Post
Raffael Cavallaro
04-03-08 03:57 AM


Re: string-trim
wrf3@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

Report this thread to moderator Post Follow-up to this message
Old Post
Thomas A. Russ
04-03-08 03:57 AM


Re: string-trim
På 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

Report this thread to moderator Post Follow-up to this message
Old Post
John Thingstad
04-03-08 11:28 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Lisp archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 12:21 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.