Path: utzoo!yunexus!geac!syntron!jtsv16!uunet!mcvax!ukc!dcl-cs!nott-cs!abc
From: abc@cs.nott.ac.uk (Andy Cheese)
Newsgroups: comp.lang.prolog
Subject: Re: Parallel: lists or trees ?
Message-ID: <3098@robin.cs.nott.ac.uk>
Date: 14 Aug 88 10:22:35 GMT
Article-I.D.: robin.3098
References: <2939@robin.cs.nott.ac.uk> <267@quintus.UUCP>
Reply-To: abc@cs.nott.ac.uk (Andy Cheese)
Organization: Computer Science, Nottingham Univ., UK.
Lines: 46

In article <267@quintus.UUCP> ok@quintus.UUCP (Richard A. O'Keefe) writes:
>In article <2939@robin.cs.nott.ac.uk> abc@cs.nott.ac.uk (Andy Cheese) writes:
>>This is a response to Richard O'Keefe's message of some time ago, i meant
>>to follow it up ages ago but have only just got around to it.
>
>>The reason lists are so prevalent in FCP, Parlog, FGHC etc is that they are
>>all concurrent logic programming languages .... This paradigm more
>>or less forces you to think in terms of communicating processes and hence
>>streams, hence lists.
>
>But as my example showed, "this paradigm" does nothing of the kind.  It is
>just as easy to write code using binary trees as it is to write code using
>lists (this is hardly a novel observation, I got the idea from a 1985
>parallel functional language article).  Not only that, the experiment showed
>that writing code using trees *can* increase the available parallelism.
>
ok, what it should have said was :
This paradigm more or less forces you to think in terms of communicating
processes, and thus the communication model that first springs to mind is
streams, and hence lists.
i didn't say it was daft to use binary trees, in most cases it would be better.

>>> make_list(0, []).
>>> make_list(N, [N|Rest]) :- N > 0, M := N-1 |
>>>         make_list(M, Rest).
>
>>I don't understand why you have the unification "M := N-1" in the guard,
>
>BECAUSE IT WORKS.  I read through the LOGIX manual several times to try
>to find out where the arithmetic should be put.  I was having enough
>trouble with read-only annotations as it was.  When I tried putting the
>arithmetic in the bodies I ran into trouble.  I never did figure out
>what was going on (we have an early copy of LOGIX, and the debugger
>crashed after about 10 minutes), but putting the arithmetic in the
>guards fixed it.  I did say in my message that I was a beginner with
>FCP, so having found that putting the arithmetic in the guard gave me
>absolutely no trouble, I stuck with it.

BECAUSE IT WORKS - not a good reason for doing it but if your logix wasn't
working properly then i suppose you didn't have much choice, 
maybe you had the read-only annotations wrong.
Unnecessary goals in guards increases the time spent in selecting
a clause and maybe could mean more time unnecessarily spent reducing guards
in other clauses for a relation. if N < 0 in the above i still do M := N-1.
-- 
Andy Cheese