[plt-scheme] String functions in Dr. Scheme

From: Daniel Yoo (dyoo at cs.wpi.edu)
Date: Mon Apr 30 02:42:22 EDT 2007


On Sat, 28 Apr 2007, jmcaxolotl at gmail.com wrote:

> I have some experience with Common Lisp and emacs' elisp, but am new to 
> Scheme.  I'm trying to fool around with some functions I wrote in elisp, 
> that need to be able to map the characters in a string to their 
> numerical places in the alphabet.

Hi Jmc,

Sounds good!  If you search for "integer->char" and "char->integer" in the 
Help Desk, you should be able to find the relevant documentation.  You can 
also see character-specific functions here:

http://download.plt-scheme.org/doc/360/html/r5rs/r5rs-Z-H-9.html#%25_sec_6.3.4

in the "Revised^5 Report on the Algorithmic Language Scheme" (R5RS) 
document.


> It's no great surprise that string handling is utterly different in 
> Scheme than it is in elisp, but I'm not finding the docs on just what 
> string-handling functions are defined in Dr. Scheme.  And of course, at 
> what language level I have to be in order to get at them.

I'm assuming you're an experienced programmer, in which case you'll 
probably want either "Pretty Big" or the "module" language.  Probably 
Pretty Big until you get more acquainted with the module system in PLT 
Scheme.


About strings: there's a section in the R5RS document that talk about the 
primitives that work on strings:

http://download.plt-scheme.org/doc/360/html/r5rs/r5rs-Z-H-9.html#%25_sec_6.3.5

Those functions are supported by any Scheme implementation, and it's a bit 
sparse.  PLT Scheme is richer, and adds extra primitives on top:

http://download.plt-scheme.org/doc/360/html/mzscheme/mzscheme-Z-H-3.html#node_sec_3.5

It also includes a regex library:

http://download.plt-scheme.org/doc/360/html/mzscheme/mzscheme-Z-H-10.html#node_chap_10


Is there anything particular that you're looking for?  People here might 
be able to point to a library module that can help what you're doing, 
depending on the task.

You might also find the Scheme Cookbook handy here:

     http://schemecookbook.org/Cookbook/StringRecipes

since it'll include things that people will often do with strings.



> Maybe I just need a pointer to the right doc page?  Which is a little 
> surprising, because mostly the PLT web interface looks remarkably 
> complete and well thought-out.

Documentation is slightly spread out.  The language reference manual, 
unlike the web-server manual, mostly holds just the "diffs" between the 
standard document (that R5RS document) and the PLT Scheme system.  This 
means you probably want to at least do a quick pass through the R5RS docs 
to get an overall feel for the primitive functions.

I'm not sure I like how the language docs are dependent on each other, but 
I can understand the rationale: it's an economical way to describe the 
system.  But maybe someone with spare time can write a "PLT Scheme in a 
Nutshell"-style book to centralize the documentation and make it more 
digestible for Scheme beginners.


But if you have questions, please feel free to ask.  Good luck!


Posted on the users mailing list.