In shell it is easy to run a program, and it is easy to chain programs into a pipeline where each process writes to the following process.
In Gambit-C it appears to be easy to run a program and write to the process and read from the process. I failed to find a way to specify that the output of one process should be connected to the input of another. I have found open-process, process-status. I have found some discussions about running single processes.
How does one implement the following lines in Gambit-C?
$ sort infile | uniq -c | sort -nr $ sort < infile | uniq -c | sort -nr > outfile
Is this non-trivial? I'm looking for something like the following, so that those processes would wait for their input and proceed when it becomes available.
(let ((p (pipe '(path: "sort" arguments: ("infile")) '(path: "uniq" arguments: ("-c")) '(path: "sort" arguments: ("-nr"))))) (let* ((r1 (read-line p)) ...) ...))
(parameterize ((current-input-port (open-input-file "infile")) (current-output-port (open-output-file "outfile"))) (process-status (pipe "sort" '(path: "uniq" arguments: ("-c")) ...)))
I'm _not_ looking for (string-append ...).