Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

can prolog do shell scripting kinda tasks?

62 views
Skip to first unread message

vispha...@gmail.com

unread,
Apr 25, 2013, 4:37:45 PM4/25/13
to
can 1 prolog program go out to 500 linux boexes and configure them?

Jan Wielemaker

unread,
May 4, 2013, 7:56:58 AM5/4/13
to
On 2013-04-25, vispha...@gmail.com <vispha...@gmail.com> wrote:
> can 1 prolog program go out to 500 linux boexes and configure them?

Many Prolog systems can do this. The downside is that people trying
to write portable code often complain about the many differences and
capabilities to access system resources.

Of course, whether it is useful ... I sometimes do siginificant amounts
of tasks one should normally write as a shell script. I recognise some
situations where might be useful:

- The script must run on both Windows and Unix systems. Of course,
you can use cygwin in that case. If you already need Prolog from
the remainder of the program though ...
- There are lots of issues with shell quoting. In such cases it
is generally easier to keep values in variables that are not
subject to shell expansion further down the road.
- You need complicated rules that are much easier expressed as
Prolog or constraint programs than using endless if-then-else
or case/esac.

Cheers --- Jan

johannes falcone

unread,
May 6, 2013, 4:07:25 PM5/6/13
to
How does prolog replace endless if then else?

neng...@gmail.com

unread,
May 6, 2013, 6:20:10 PM5/6/13
to
Scripting is one of the main reasons why we designed the Picat language. You will find the functional notations and loops pleasant for scripting. Please wait for one month or so to see the first working version of Picat. Meanwhile you can learn Picat by reading the proposal at www.picat-lang.org.

Cheers,
Neng-Fa

Graham Cooper

unread,
May 25, 2013, 10:57:07 PM5/25/13
to
On Apr 26, 6:37 am, visphatesj...@gmail.com wrote:
> can 1 prolog program go out to 500 linux boexes and configure them?
>

www.BLOCKPROLOG.com is written in PHP.

I'm thinking of just allowing the PROLOG PROGRAM to shell back down to
PHP.

public static function test() {
$args = func_get_args();
echo static::NAME, " ".join(',', $args)." \n";
}


This is a bit like EVAL( 'function-in-a-string' ) in LISP.

This would cut down my work in doing add on modules...

e.g. to WRITE text the PROLOG code would be..


test X :-
PHP echo X


So you could effectively do anything that PHP does within
BLoCKPROLOG.com!


Herc

Graham Cooper

unread,
May 26, 2013, 5:48:10 PM5/26/13
to
On May 26, 12:57 pm, Graham Cooper <grahamcoop...@gmail.com> wrote:
> On Apr 26, 6:37 am, visphatesj...@gmail.com wrote:
>
> > can 1 prolog program go out to 500 linux boexes and configure them?
>
> www.BLOCKPROLOG.comis written in PHP.
>
> I'm thinking of just allowing the PROLOG PROGRAM to shell back down to
> PHP.
>
>     public static function test() {
>         $args = func_get_args();
>         echo static::NAME, " ".join(',', $args)." \n";
>     }
>
> This is a bit like EVAL( 'function-in-a-string' )  in LISP.
>
> This would cut down my work in doing add on modules...
>
> e.g. to WRITE text the PROLOG code would be..
>
> test X :-
>   PHP echo X
>
> So you could effectively do anything that PHP does within
> BLoCKPROLOG.com!
>
> Herc


Yeh so I think you want an INTERPRETED PROLOG to do this.


Interpreted languages can run any commands on that system on the fly.


<?php
// outputs the username that owns the running php/httpd process
// (on a system with the "whoami" executable in the path)
echo exec('whoami');
?>


<?php
exec("/usr/bin/secureprogram password");
?>


PHP-PROLOG calls PHP-command

PHP-commands calls UNIX commands


Something like:

unix COM :-
PHP exec('usr/bin/' . COM . ');

is DO-ABLE in a scripted PROLOG.


-----------------


It wouldn't be wise to allow this control from BlockProlog.com

on my shared Web Host!

maybe if BlockPROLOG gets to the CMS website development stage...


Herc
--
www.BLoCKPROLOG.com

Dhu on Gate

unread,
May 29, 2013, 5:40:27 AM5/29/13
to
On Thu, 25 Apr 2013 13:37:45 -0700, visphatesjava wrote:

> can 1 prolog program go out to 500 linux boexes and configure them?

Yes. 500 < a 32 bit integer. My own preference for this sort of thing
would be gprolog, as it integrates with GNU stuff easily and has all the
correct system interfaces for tying prolog semantics to a *nix os, but
you'd also find the necessary hooks in SWI and others.

Dhu


--
Ne obliviscaris, vix ea nostra voco.

johannes falcone

unread,
May 29, 2013, 7:19:36 PM5/29/13
to
NICE

0 new messages