> define-syntax list-of
> syntax-rules (is in)
> ; base case
> \
> . list-of x
> . \ list x
> ; handle (var in x) clause
> \
> . list-of x
> . var in expr
> . clauses \ ...
> . \ concatenate
> . . map
> . . lambda (var)
> . . list-of x
> . . clauses \ ...
> . . expr
> ; handle (var is x) clause
> \
> . list-of x
> . var is expr
> . clauses \ ...
> . \ let ((var expr))
> . . list-of x
> . . clauses \ ...
> ; handle (pred? x) clause
> \
> . list-of x
> . pred?(args ...)
> . clauses \ ...
> . \ if pred?(args ...)
> . . list-of x
> . . clauses \ ...
> . . '()
As a first experiment, let's see if I can easily recreate what this
translates to:
(define-syntax list-of
(syntax-rules (is in)
((list-of x)
(list x))
((list-of x (var in expr) clauses ...)
(concatenate (map (lambda (var) (list-of x clauses ...))
expr)))
((list-of x (var is expr) clauses ...)
(let ((var expr))
(list-of x clauses ...)))
((list-of x (pred? args ...) (clauses ...))
(if (pred? args ...)
(list-of x (clauses ...))
'()))))
Observations:
a) If this is right, why do we need the period-backslash construct, say in
the base case? Wouldn't just indentation (two periods) suffice?
b) Should we really have to insert a backslash in empty lines? Wart just
applies the enter-enter rule at the repl, not in batch mode. Did y'all
consider that?
c) Are the periods for indentation optional? It's confusing/distracting to
mix spaces with periods in the same code.
d) I notice that avoiding parens is *much* more compact. It lets me see the
global structure at a glance. Let me see if I can reconstruct that property
by bringing back some parens:
define-syntax list-of
syntax-rules (is in)
\ list-of x
list x
\ list-of x (var in expr) clauses ...
concatenate
map (lambda (var) (list-of x clauses ...))
expr
\ list-of x (var is expr) clauses ...
let ((var expr))
list-of x clauses ...
\ list-of x pred?(args ...) (clauses ...)
if pred?(args ...)
list-of x (clauses ...)
'()
Ok, I see why you need GROUP support :) It's because common lisp and scheme
use more parens than arc. I also found myself missing arc's syntax for
compose, so that I could say:
concatenate:map (lambda (var) (list-of x clauses ...))
expr
Is this translation correct? I'm not sure which proposal this maps to. Is
it subsumed by one of the suggestions?
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Readable-discuss mailing list
Readable-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/readable-discuss