Alexander Burger wrote:
> Hi Cle,

Hi Alex,

>> The usage of 'unify' is interesting, however. I had found it, but did
>> not understand, how to use it from the manual. It seems, it is only
>> usable in Lisp statements of Pilog clauses. Otherwise, I got SIGSEGV
>> regulary :-/
> Yeah, it tries to unify variables with the current Pilog environment.
> Gets angry if it doesn't find any env ;-)

hmmm ... then let me make the statement, that picoLisp is also, ahh ...,
"different" from other interpreted languages here. The most languages
try the hell to avoid such ugly things like a SIGSEGV or SIGBUS ;-)


> hmm, you could stick with 'solve' (as you did in a previous version):
>    (be findall (@Var @Pred @Result)
>       (@Result solve
>          (list (-> @Pred))
>          (or (val '@Var) (fill (-> @Var))) ) )

Yeah! I like this a lot better :-D That prove you again being the guru
and me the disciple :-)

I used 'solve' before, but as it didn't fit my needs, I switched to
'goal' and 'prove'. But after found a working version, I did not came
back to 'solve' :-( But I learn ... :-)

But I have switched the implementation a bit by replacing '(list (->
@Pred))' by '(-> @Pred)' alone to be consistent with clause 'or' for
allowing a whole query instead a clause only. So I can formulate this:

  (? (findall @C ((ascii @C @N) (different @N 66)) @L))

I like it now :-D

>> rules, I would like to stay away from Lisp statements within Pilog
>> clauses as far as possible. Only if performance really matters or if
> But the above version ('make' or 'solve') also calls Lisp ;-)

Yeah! But this is only one place, where Lisp is being used. And the
whole Pilog will get the the possibility to search for all solutions of
a query without implementing the query in Lisp :-)


>> Anyway, if we finish our 'findall' would you also consider to put it
>> into the pilog.l to be included into the standard library?
> I'm not yet convinced if and why 'findall' is useful. If so, yes.

Oh, what a pitty! But to be fair, it may be useless, if you are willing
to use 'solve' in a Pilog clause. It is useful if you decide to stay in
Pilog as far as possible, though :-)

> Otherwise, I would prefer to keep it separate, like other also possible
> useful predicates (e.g. 'mapcar' in "misc/pilog.l"). I dont' want to put
> too much load on the base system, which is more focused on using Pilog
> as a database query engine. For dedicated Prolog programs, a dedicated
> library (could also be included into the standard release) might be more
> suitable.

Ah, this is understandable. I fear I was unclear, though! My question
should be, if 'findall' has a chance to get into the official picoLisp
implementation ("misc/pilog.l" would be ok), or whether I have to reside
the implementation in my own library?

> Cheers,
> - Alex



Reply via email to