Hi.

Here's my Racket implementation of:

sh:> md5 -q README.md > README.md.md5

scsh:> (run (md5 -q README.md) (> README.md.md5))

>  (begin
>    (define md5 (find-executable-path "md5" #f))
>    (define infile "README.md")
>    (define outfile "README.md.md5")   
>    (parameterize 
>        ([current-custodian (make-custodian)])
>      (current-subprocess-custodian-mode #f)
>      (let*-values
>          ([(to) (open-output-file outfile #:mode 'text #:exists 'replace)]
>           [(sub in out err) (subprocess to #f 'stdout md5 "-q" infile)])
>        (begin
>          (subprocess-wait sub)
>          (custodian-shutdown-all (current-custodian))
>          (subprocess-status sub))))))


I could of course cheat:
> (system "md5 -q README.md > README.md.md5")

Can my code be improved? Source on github if you want to play with it.
I hope to add more examples.
---
Vlad Kozin <[email protected]>



____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to