Category : Miscellaneous Language Source Code
Archive   : SNOBOL4A.ZIP
Filename : DIFF.INC

 
Output of file : DIFF.INC contained in archive : SNOBOL4A.ZIP
* DIFF.INC
*
* Function to return the difference of two strings. Given
* strings S1 and S2, returns the set difference S1 - S2.
*
* DIFF('PURPLE','LEP') returns 'UR'.
*
* Handy for set arithmetic, and to obtain character sets.
* For example, DIFF(&ALPHABET, &LCASE &UCASE) returns the
* full ASCII set less the upper- and lower-case characters.
*
* Requires &ANCHOR = 0
*
* This is one of the many programs and functions from
* "Algorithms in SNOBOL4," by James F. Gimpel.

DEFINE('DIFF(S1,S2)') :(DIFF_END)
DIFF DIFF = S1
IDENT(S2) :S(RETURN)
S2 = SPAN(S2)

* Remove any occurances of S2's characters from result.
DIFF_1 DIFF S2 = :S(DIFF_1)F(RETURN)

DIFF_END


  3 Responses to “Category : Miscellaneous Language Source Code
Archive   : SNOBOL4A.ZIP
Filename : DIFF.INC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/