Did you know ... | Search Documentation: |
Packs (add-ons) for SWI-Prolog |
Title: | Shell pipeline construction with type checking |
---|---|
Rating: | Not rated. Create the first rating! |
Latest version: | 0.2.6 |
SHA1 sum: | 7df0df09a85377a698abd5e03bbd83bb6c2f6677 |
Author: | Samer Abdallah <s.abdallah@ucl.ac.uk> |
Download URL: | https://raw.githubusercontent.com/samer--/prolog/master/swipe/release/swipe-0.2.6.tgz |
Requires: | dcgutils |
fileutils |
No reviews. Create the first review!.
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
:- 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).
Pack contains 8 files holding a total of 57.4K bytes.