- Subject: [slang-users] Newbie question
- From: TJ Walls <twalls@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 8 Nov 2004 01:49:45 -0500 (EST)
Hello All,
I am currently learning S-lang and am running into some conceptual
troubles. Most of my experience is in strongly typed languages, so I am
have problems with the following code snippet from the slrn macros page,
with my questions inserted:
<snip>
variable
article = article_as_string(),
% TJ: Ok, article_as_string returns a String_Type ...
% TJ: so far, so good ...
i = is_substr (article, "\n\n"),
sortres,
header = "",
% TJ: And header is a String_Type, initialized empty ...
body = "";
% seperate header and body, taking into account empty bodies
if (i == 0)
header = article;
else
{
header = article[[0:i-1]];
% TJ: Here the problems start ... [0:i-1] is an array with
% TJ: elements initialized from 0 to (i-1), ok but
% TJ: article is a String_Type what does article[array] mean?
% TJ: Is it the first i members of the string ... it would seem
% TJ: we want the first i lines, but why does this work?
body = article[[i:]];
}
% remove continuation lines from the header
while (str_replace (header, "\n ", " "))
% TJ: Ok, replace the first newline character with a single
% TJ: whitespace ...
header = ();
% TJ: What does this mean!?
while (str_replace (header, "\n\t", " "))
header = ();
% convert the header to an array of strings
header = strtok (header, "\n");
% TJ: Didn't we just replace all the newline characters??
% do the actual sorting
sortres = array_sort (header, cmp);
header = header[sortres];
% TJ: header was a String_Type ... now it seems to be an array
% TJ: of strings??
<snip>
Thanks in advance for any advice for a newbie. Is there further
documentation on S-lang beyond http://www.s-lang.org so that I might not
bother you with such silly questions in the future?
Also, does anyone know of a S-Lang editing mode for XEmacs?
Sincerely,
-TJ Walls
"It's not easy being green." -Kermit the Frog
---------------------------------------------------------------------------
TJ Walls <twalls@xxxxxxxxxxxxxxxxxxxxxxx> | PhD Candidate
SUNY - Stony Brook | http://www.physics.sunysb.edu
_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html
[2004 date index]
[2004 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]