Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornell!travelers.mail.cornell.edu!news.kei.com!news.mathworks.com!hookup!news.moneng.mei.com!howland.reston.ans.net!vixen.cso.uiuc.edu!newsrelay.iastate.edu!dunix.drake.edu!sparky!kwiudl.kwi.com!usenet
From: tom@kwi.com (Tom Howland)
Subject: Re: accessing unix through prolog
In-Reply-To: ridoux@irisa.fr's message of 9 Nov 1994 12:02:02 GMT
Message-ID: <TOM.94Nov14125002@heather.kwi.com>
Lines: 41
Sender: usenet@kwiudl.kwi.com
Organization: KnowledgeWare Inc, Redwood City, CA 94065-1417
References: <570@swallow.ukc.ac.uk> <39qdnq$chj@irisa.irisa.fr>
Date: Mon, 14 Nov 1994 20:50:01 GMT

>>>>> "OR" == Olivier Ridoux <ridoux@irisa.fr> writes:
In article <39qdnq$chj@irisa.irisa.fr> ridoux@irisa.fr (Olivier Ridoux) writes:


    OR> From article <570@swallow.ukc.ac.uk>, by csw4@ukc.ac.uk
    OR> (C.S.Williams):
    >> Question:
    >> 
    >> In SICStus Prolog I can jump from the SICStus shell to a Unix
    >> shell by having a predicate such as:
    >> 
    >> vi :- unix(system('vi prog')),[prog].  ...  Would anyone know how
    >> to do multiple Unix commands from within a SICSTus shell?

    OR> There is a bunch of trivial answers: - Write a script and call
    OR> it.  - Use the ';' construct of the shell language.  - Iterate
    OR> in Prolog.

    OR> If I send a follow-up to this message is because it gives me an
    OR> occasion to complain about a detail.  I do think the use of a
    OR> symbol identifier for denoting Unix commands is ridiculous.  It
    OR> should be a string.  It is an example of a perverse bias for
    OR> using symbols when strings are largely enough.  Symbols are very
    OR> special.  They are known by the run-time system via a symbol
    OR> table, they have a scope, they need special care for
    OR> garbage-collecting.  All this is irrelevant to denoting Unix
    OR> commands.  Comments?

    OR> That a symbol name is more readily available for sending a
    OR> string to the Unix shell than is a list of chars is NOT a good
    OR> reason.

    OR> Olivier Ridoux

That there is a difference between "symbols" and "strings" is merely an
indication that your implementation of Prolog didn't get atoms right,
imho. Who cares? They'll both have to be garbage collected, won't they?

In any case, under Quintus, there is a library "pipe" which takes a
stream for input (or output). In this way you can set up a shell slave
to do your bidding, and never create atoms in the process.
