This package provides a mechanism for construction Unix shell
pipelines by the composition of terms representing primitive Unix
processes. Each process is given a type and the compositon mechanism
checks that the types of processes combined in to a pipeline match
correctly
Simple usage
:- use_module(library(swipe)).
% define grep as a command taking a stream of T to a stream of T.
% Argument specified with @/1, so will be escaped properly for bash.
swipe:def(grep(Pattern), sh($T >> $T,"grep ~s",[@Pattern])).
% define sort with type stream of T to stream of T
swipe:def(sort, sh($T >> $T,"sort")).
% pipe contents from file spec =|library('swipe.pl')|= (ie using
% file search path mechanism) as type =|pl|= into grep and sort,
% with output to stdout.
:- run(library('swipe.pl')^pl :> grep(module) >> sort).
Change history
Version 0.1.0
Version 0.2.0