Subject: Re: [Q] Regular expressions and environment vars in Scheme
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 1998/08/01
Newsgroups: comp.lang.scheme
Message-ID: <6pu4r4$epnb@fido.engr.sgi.com>
Chris Wareham  <chris.wareham@blackwell.co.uk> wrote:
+---------------
| 1) Is it possible to access Unix environment variables in Scheme?
+---------------

Most implementations provide "getenv". (Fewer provide "putenv" or "setenv"
as well).

+---------------
| 2) Is there a regular expression implementation in Scheme...
+---------------

As other have said, it's not part of the language, though many
*implementations* have various flavors/APIs. I find the version
in MzScheme quite useful for writing small Web clients, e.g.:


	% stockquote SGI IBM DEC MSFT
	As of close on Jul 31, SGI = 11 1/8 = 11.125
	As of close on Jul 31, IBM = 132 1/2 = 132.5
[*]==>	As of close on Jun 11, DEC = 56 11/16 = 56.6875
	As of close on Jul 31, MSFT = 109 15/16 = 109.9375
	% 

[*Note that the "DEC" value froze when they were acquired by Compaq]

The "stockquote" script (about 125 lines of Scheme) makes heavy use of
MzScheme's regexp library functions, as well as its TCP support, to
directly connect to one of the quote pages (well, through a proxy)
and tear apart the HTML that comes back to extract just the bits *I*
want to see...  ;-}  ;-}

I'll also second the recommendation to look at the SIOD distribution
which (even though SIOD is not R[45]RS) contains several cool examples
of hacking the Web with Scheme.


-Rob

-----
Rob Warnock, 7L-551		rpw3@sgi.com   http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673
2011 N. Shoreline Blvd.		FAX: 650-933-4392
Mountain View, CA  94043	PP-ASEL-IA