Subject: Re: 10 Reasons Why Scheme is Better Than C/C++
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 1996/11/28
Newsgroups: comp.lang.scheme
Message-ID: <57j3b1$ltd@tokyo.engr.sgi.com>

William D Clinger  <will@ccs.neu.edu> wrote:
+---------------
|   for(;P("\n"),R=R;P("|"))for(;e=C;e=P("_"+(*u++/8)%2))P("|"+(*u/4)%2);
|
| Observe how much more intelligible this becomes in Scheme:
| 
| (do((- ':-)(- -(P"|")))((begin(P(string #\newline))(set! R R)))(do((~
| '&(set! e (P(+(&"_")(modulo(quotient(^(:++ u))8)2))))))((set! e C))(P
| (+(&"|")(modulo(/(^u)4)2)))))
+---------------

And how much easier it is to debug!!  ;-}  ;-}

	;;Note: Startup chatter has been trimmed...

	% mzscheme
	> (do((- ':-)(- -(P"|")))((begin(P(string #\newline))(set! R R)))(do((~
	'&(set! e (P(+(&"_")(modulo(quotient(^(:++ u))8)2))))))((set! e C))(P
	(+(&"|")(modulo(/(^u)4)2)))))

	lambda: duplicate argument name at: - in: ((- -) (#%if (begin (p (string #\newl...


	% scm
	> (do((- ':-)(- -(P"|")))((begin(P(string #\newline))(set! R R)))(do((~
	'&(set! e (P(+(&"_")(modulo(quotient(^(:++ u))8)2))))))((set! e C))(P
	(+(&"|")(modulo(/(^u)4)2)))))

	ERROR: unbound variable:  p
	; in expression: (... p (string #\nl))
	; in scope:
	;   (- -)

	% scsh
	> (do((- ':-)(- -(P"|")))((begin(P(string #\newline))(set! R R)))(do((~
	'&(set! e (P(+(&"_")(modulo(quotient(^(:++ u))8)2))))))((set! e C))(P
	(+(&"|")(modulo(/(^u)4)2)))))

	Error: Illegal process form
	       "|"
	1> 

	% libscheme
	> (do((- ':-)(- -(P"|")))((begin(P(string #\newline))(set! R R)))(do((~
	'&(set! e (P(+(&"_")(modulo(quotient(^(:++ u))8)2))))))((set! e C))(P
	(+(&"|")(modulo(/(^u)4)2)))))

	reference to unbound symbol: p


	% rscheme
	top[0]=>(do((- ':-)(- -(P"|")))((begin(P(string #\newline))(set! R R)))(do((~
		'&(set! e (P(+(&"_")(modulo(quotient(^(:++ u))8)2))))))((set! e C))(P
		(+(&"|")(modulo(/(^u)4)2)))))  

	semantic error in expr: (do ((- ':-) (- - (P "|"))) ((begin (P (string #\n...
	>> (& "|"): "|" does not compile to a tl-ref
	warning in expr: (do ((- ':-) (- - (P "|"))) ((begin (P (string #\n...
	>> (#f) references unbound variable P
	warning in expr: (do ((- ':-) (- - (P "|"))) ((begin (P (string #\n...
	>> (#f) references unbound variable R
	warning in expr: (do ((- ':-) (- - (P "|"))) ((begin (P (string #\n...
	>> (#f) references unbound variable e
	warning in expr: (do ((- ':-) (- - (P "|"))) ((begin (P (string #\n...
	>> (#f) references unbound variable C
	break[0]=>


	% gsi	# gambit, interpreted
	: (do((- ':-)(- -(P"|")))((begin(P(string #\newline))(set! R R)))(do((~
		'&(set! e (P(+(&"_")(modulo(quotient(^(:++ u))8)2))))))((set! e C))(P
		(+(&"|")(modulo(/(^u)4)2)))))

	*** ERROR IN [compilation] -- Duplicate variable in bindings
	(do ((- ':-) (- - (p "|")))
	    ((begin (p (string #\newline)) (set! r r)))
	  (do ((~ '& (set! e (p (+ (& "_") (modulo (quotient (^ (:++ u)) 8) 2))))))
	      ((set! e c))
	    (p (+ (& "|") (modulo (/ (^u) 4) 2)))))


-Rob

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