Ben Booth:
>  I agree that curly infix is definitely simpler to understand and implement. 
> I guess I'm just thinking about the use case of sweet-expressions lisp for a 
> shell scripting language. I would rather be able to type this:
>  $ cat file1 file2 file3 > outputfile
> than this:
>  $ {(cat file1 file2 file3) > outputfile}

You might want to look more seriously at Scheme shell, scsh, which is 
documented here:
  http://www.scsh.net/docu/docu.html
(Click on "HTML version" to see the documentation in HTML.  Below I'll quote a 
few snippets from it.)

It solves the approach in a different way that I think is more "Lispy"; it's 
certainly easier to understand.

Scsh defines an "extended process form" (epf) to specify a Unix process to run 
in a particular I/O environment. An epf has this form:
    epf ::= (pf redir1 ... redirn )
where pf is a process form and the rediri are redirection specs. A redirection 
spec is one of:
    (< [fdes] file-name)        Open file for read.
    (> [fdes] file-name)        Open file create/truncate.
    (<< [fdes] object)  Use object's printed rep.
    (>> [fdes] file-name)       Open file for append.
    (= fdes fdes/port)  Dup2
    (- fdes/port)       Close fdes/port.
    stdports    0,1,2 dup'd from standard ports.

What can you with epfs?  Well, scsh defines several forms that take an epf as a 
parameter:
  (exec-epf . epf)     --->     no return value - replace current process 
(exec).
  (& . epf)     --->     proc         (syntax)     - run in background.
  (run . epf)     --->     status         (syntax) - run and wait for return 
(typical shell action)

so, for example, here's a sweet-expression in scsh:

run
! sed -e "s/bad/good/g" <(input-file) >>(output-file)

If we implement SUBLIST, it'd be even easier:

run $ sed -e "s/bad/good/g" <(input-file) >>(output-file)

Note that no infix-with-precedence-levels is needed at all.  It looks like it'd 
work pretty well.  So again, I'm not convinced that this other infix system 
would be better; allowing people to define their own nfx macro (in the rare 
cases where they want it) seems enough.  This *is* an argument for the value of 
SUBLIST though; it looks like the scsh approach involves initial functions that 
take complicated expressions, cases where SUBLIST is helpful.

--- David A. Wheeler

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/readable-discuss

Reply via email to