From raptor@unacs.bg Tue Mar  6 11:00:20 2001
Received: from radius.unacs.bg (mail.unacs.bg [212.5.134.23])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f26A0GZ04527
	for <prolog@swi.psy.uva.nl>; Tue, 6 Mar 2001 11:00:17 +0100 (MET)
Received: from chemistry (unverified [212.5.134.25]) by radius.unacs.bg
 (Rockliffe SMTPRA 4.5.4) with SMTP id <B0002040462@radius.unacs.bg> for <prolog@swi.psy.uva.nl>;
 Tue, 6 Mar 2001 11:59:40 +0200
Message-ID: <001d01c0a634$d7e0ad70$198605d4@unacs>
From: "raptor" <raptor@unacs.bg>
To: <prolog@swi.psy.uva.nl>
Date: Tue, 6 Mar 2001 11:59:05 -0000
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
Subject: [SWIPL] Some beginers questions

hi,

Could U help to one beginer.. sorry if the questions are very stupid, I'm
still two-day PROLOG programmer :").
And here they are :

1. Does SWI-prolog support RegEx, I didn't found anything in the Docs. If
not, is there i way to use them !?!
2. How can I tokenize text .. example.
3. Is there a way to set a VAR, what i have in mind. F.e. I need to make
some tests with
lists and want to say something like this :

MyList = [1,4,56,dd,66].

so not to write this every time but pass it like argument to list functions
i.e. :

?- liststuff(Result,MyList).

4. Where I can find more info about DCG grammar rules, of cource with more
examples as for the beginer.

5. What is the difference between call(p) & normal invoking of rule ?! I
can't figure out :"(

6. Is there something like EVAL in Perl. What I mean ? F.e.:

expr(Str) :- eval(Str).

expr("35 > 12").

OR better.

expr(X,C,Y):- eval([X,C,Y]).  OR  expr(List):- eval(List).

expr(34, > , 78)   OR expr([34, > , 78])

I mean that all these expressions will be created on the fly.
Currently I'm using something like this, don't laught :")

cond_type(X,'>',Y) :- X > Y.
cond_type(X,'<',Y) :- X < Y.
cond_type(X,'=',Y) :- X = Y.

cond([X,C,Y]) :- integer(X),integer(Y),cond_type(X,C,Y),writef("Condition %w
%w %w met\n",[ X,C,Y]).

7. Is there a way to ALIAS some function.(not so important) f.e.:

alias(pop,last).

?- pop(Elem,[3,5,6,7,8]).

Elem = 8


8. How to print LIST on the screen ?!

9. After alot of experiments, I've got this solution for capturing content
of (),[],..etc..

next(Res,[H|_]) :- H == ")", Res = [].
next(Res,[H|T]) :-  next(Res2, T), Res = [ H | Res2 ].
braces(Res,[H|T]) :- H == "(", next(Res,T).

?- braces(Res,["(",f,g,4,3,")",d,f,g]).

Res = [f,g,4,3]

Is this the correct way ?! I still didn't tried parsing this ((...(..))) !!

U may see that the most of the questions are related to PARSING, this is
coinsidence.
I just can't figured out from where to begin.. 'cause I can't connect all
these

likes(mari,stefan).
likes(mari,peter).
?- likes(mari,X).

with some real problem yet :")


Thanx alot in advance for the help.

=====
iVAN
raptor@unacs.bg
=====

