Thread View: comp.lang.prolog
13 messages
13 total messages
Started by Per Røn ne
Wed, 03 Mar 2004 07:46
Yap - insertion mode
Author: Per Røn ne
Date: Wed, 03 Mar 2004 07:46
Date: Wed, 03 Mar 2004 07:46
14 lines
1997 bytes
1997 bytes
Yesterday, I downloaded yap, "Yet Another Prolog", and a pdf-based manual too. Nevertheless, I'm not satisfied with the manual. I had to use lot of time before I found out that if I typed ^C and then h, I could see the possible commands like the "e" which exits the system. However, I'm still not able to insert predicates into the database. How do I exit query mode to be able to insert predicates /without/ the use of predicates like assert(C)? I'm running yap from a bash shell in MacOS X 10.3.2, a BSD Unix. -- Per Erik R�nne
Re: Yap - insertion mode
Author: Bart Demoen
Date: Wed, 03 Mar 2004 08:01
Date: Wed, 03 Mar 2004 08:01
37 lines
2310 bytes
2310 bytes
Per R�nne wrote:
> Yesterday, I downloaded yap, "Yet Another Prolog", and a pdf-based
> manual too.
>
> Nevertheless, I'm not satisfied with the manual. I had to use lot of
> time before I found out that if I typed ^C and then h, I could see the
> possible commands like the "e" which exits the system.
>
> However, I'm still not able to insert predicates into the database. How
> do I exit query mode to be able to insert predicates /without/ the use
> of predicates like assert(C)?
>
> I'm running yap from a bash shell in MacOS X 10.3.2, a BSD Unix.
Here is a session:
[ YAP version Yap-4.4.4 ]
?- [user].
| asd.
| qwe(9).
| yes
?- asd.
yes
?- qwe(X).
X = 9 ? ;
no
However, instead of consulting 'user', it is generally better to
put your clauses in a file named something.pl and then at the query toplevel
do
?- [something].
Cheers
Bart Demoen
Re: Yap - insertion mode
Author: Per Røn ne
Date: Wed, 03 Mar 2004 21:42
Date: Wed, 03 Mar 2004 21:42
28 lines
1876 bytes
1876 bytes
Bart Demoen <bmd@cs.kuleuven.ac.be> wrote: > Here is a session: > > [ YAP version Yap-4.4.4 ] > ?- [user]. > | asd. > | qwe(9). > | yes > ?- asd. > yes > ?- qwe(X). > X = 9 ? ; > no Unfortunately, typing "yes" doesn't seem to end it: G4:~ per$ yap [ Restoring file /sw/lib/Yap/startup ] [ YAP version Yap-4.4.2 ] ?- [user]. | asd. | qwe(9). | yes | -- Per Erik R�nne
Re: Yap - insertion mode
Author: Bart Demoen
Date: Wed, 03 Mar 2004 22:17
Date: Wed, 03 Mar 2004 22:17
37 lines
2235 bytes
2235 bytes
Per R�nne wrote: > Bart Demoen <bmd@cs.kuleuven.ac.be> wrote: > > >>Here is a session: >> >>[ YAP version Yap-4.4.4 ] >> ?- [user]. >>| asd. >>| qwe(9). >>| yes >> ?- asd. >>yes >> ?- qwe(X). >>X = 9 ? ; >>no > > > Unfortunately, typing "yes" doesn't seem to end it: > > G4:~ per$ yap > [ Restoring file /sw/lib/Yap/startup ] > [ YAP version Yap-4.4.2 ] > ?- [user]. > | asd. > | qwe(9). > | yes > | > That's because you didn't see the ^D I typed - yes is the response by Yap. All this is in the manual.Much faster to look it up than to wait for me to respond to you. Cheers Bart Demoen
Re: Yap - insertion mode
Author: Per Røn ne
Date: Thu, 04 Mar 2004 02:16
Date: Thu, 04 Mar 2004 02:16
51 lines
2704 bytes
2704 bytes
Per R�nne <per.ronne@doesnt.work.spam.filter.invalid> wrote: > Bart Demoen <bmd@cs.kuleuven.ac.be> wrote: > > > Here is a session: > > > > [ YAP version Yap-4.4.4 ] > > ?- [user]. > > | asd. > > | qwe(9). > > | yes > > ?- asd. > > yes > > ?- qwe(X). > > X = 9 ? ; > > no > > Unfortunately, typing "yes" doesn't seem to end it: > > G4:~ per$ yap > [ Restoring file /sw/lib/Yap/startup ] > [ YAP version Yap-4.4.2 ] > ?- [user]. > | asd. > | qwe(9). > | yes > | I've found out [more or less guessed]: G4:~ per$ yap [ Restoring file /sw/lib/Yap/startup ] [ YAP version Yap-4.4.2 ] ?- parent(hans,per). no ?- [att]. [ consulting /Users/per/att... ] [ consulted /Users/per/att in module user, 0 msec 568 bytes ] yes ?- [user]. | end_of_file. yes ?- [user]. | parent(johannes,hans). | end_of_file. yes ?- parent(johannes,hans). yes ?- -- Per Erik R�nne
Re: Yap - insertion mode
Author: Per Røn ne
Date: Thu, 04 Mar 2004 04:16
Date: Thu, 04 Mar 2004 04:16
12 lines
2188 bytes
2188 bytes
Bart Demoen <bmd@cs.kuleuven.ac.be> wrote: > That's because you didn't see the ^D I typed - yes is the response by Yap. > All this is in the manual.Much faster to look it up than to wait for me to > respond to you. Maybe we're having different manuals. I don't see anything like that in the manual [pdf-format] I've downloaded. But thank you, I think I can use it now :-). -- Per Erik R�nne
Re: Yap - insertion mode
Author: Bart Demoen
Date: Thu, 04 Mar 2004 12:02
Date: Thu, 04 Mar 2004 12:02
8 lines
1802 bytes
1802 bytes
Per R�nne wrote: > > Maybe we're having different manuals. I don't see anything like that in > the manual [pdf-format] I've downloaded. > section 4.2 Bart Demoen
Re: Yap - insertion mode
Author: Per Røn ne
Date: Thu, 04 Mar 2004 21:11
Date: Thu, 04 Mar 2004 21:11
177 lines
8052 bytes
8052 bytes
Bart Demoen <bmd@cs.kuleuven.ac.be> wrote: > Per R�nne wrote: > > > > Maybe we're having different manuals. I don't see anything like that in > > the manual [pdf-format] I've downloaded. > > > section 4.2 Which says: > 4.2 Changing the Compiler's Behavior > This section presents a set of built-ins predicates designed to set the > environment for the compiler. > > source_mode(-O,+N) > > The state of source mode can either be on or off. When the source mode > is on, all clauses are kept both as compiled code and in a "hidden" > database. O is unified with the previous state and the mode is set > according to N. source After executing this goal, YAP keeps information > on the source of the predicates that will be consulted. This enables the > use of listing/0, listing/1 and clause/2 for those clauses. > > The same as source_mode(_,on) or as declaring all newly defined static > procedures as public. > > no_source > > The opposite to source. > The same as source_mode(_,off). > > compile_expressions > > After a call to this predicate, arithmetical expressions will be > compiled. (see example below). This is the default behavior. > > do_not_compile_expressions > > After a call to this predicate, arithmetical expressions will not be compiled. > > ?- source, do_not_compile_expressions. > yes > ?- [user]. > | p(X) :- X is 2 * (3 + 8). > | :- end_of_file. > ?- compile_expressions. > yes > ?- [user]. > | q(X) :- X is 2 * (3 + 8). > | :- end_of_file. A clearcut error. It is "end_of_file.", without :-, or ^D. And ^C with help and other stuff isn't mentioned at all. What I demand in the beginning of any manual [how to exit a program] isn't mentioned at all. > :- listing. > p(A):- > A is 2 * (3 + 8). > q(A):- > A is 22. > > hide(+Atom) > > Make atom Atom invisible. > > unhide(+Atom) > > Make hidden atom Atom visible. > > hide_predicate(+Pred) > > Make predicate Pred invisible to current_predicate/2, listing, and friends. > > expand_exprs(-O,+N) > > Puts YAP in state N (on or off) and unify O with the previous state, where > On is equivalent to compile_expressions and off is equivalent to do_not_ > compile_expressions. This predicate was kept to maintain compatibility > with C-Prolog. > > path(-D) Unifies D with the current directory search-path of YAP. Note > that this searchpath is only used by YAP to find the files for consult/1, > reconsult/1 and restore/1 and should not be taken for the system search > path. > > add_to_path(+D) > > Adds D to the end of YAP's directory search path. > > add_to_path(+D,+N) > > Inserts D in the position, of the directory search path of YAP, specified > by N. N must be either of first or last. > > remove_from_path(+D) > > Remove D from YAP's directory search path. > > style_check(+X) > > Turns on style checking according to the attribute specified by X, which > must be one of the following: > > single_var > > Checks single occurrences of named variables in a clause. discontiguous > Checks non-contiguous clauses for the same predicate in a file. multiple > Checks the presence of clauses for the same predicate in more than one > file when the predicate has not been declared as multifile all Performs > style checking for all the cases mentioned above. By default, style > checking is disabled in YAP unless we are in sicstus or iso language mode. > The style_check/1 built-in is now deprecated. Please use the set_prolog_ > flag/1 instead. > > no_style_check(+X) > > Turns off style checking according to the attribute specified by X, which > has the same meaning as in style_check/1. The no_style_check/1 built-in is > now deprecated. Please use the set_prolog_ flag/1 instead. > > multifile P [ISO] > > Instructs the compiler about the declaration of a predicate P in more than > one file. It must appear in the first of the loaded files where the > predicate is declared, and before declaration of any of its clauses. > Multifile declarations affect reconsult/1 and compile/1: when a multifile > predicate is reconsulted, only the clauses from the same file are removed. > Since Yap4.3.0 multifile procedures can be static or dynamic. > > discontiguous(+G) [ISO] > > Declare that the arguments are discontiguous procedures, that is, clauses > for discontigous procedures may be separated by clauses from other > procedures. > > initialization(+G) [ISO] > > The compiler will execute goals G after consulting the current file. > library_directory(+D) Succeeds when D is a current library directory name. > Library directories are the places where files specified in the form > library(File) are searched by the predicates consult/1, reconsult/1, > use_module/1 or ensure_loaded/1. > > file_search_path(+NAME,-DIRECTORY) > > Allows writing file names as compound terms. The NAME and DIRECTORY must > be atoms. The predicate may generate multiple solutions. The predicate is > originally defined as follows: > > file_search_path(library,A) :- library_directory(A). > file_search_path(system,A) :- prolog_flag(host_type,A). > > Thus, [library(A)] will search for a file using library directory/1 to > obtain the prefix. > > library_directory(+D) > > Succeeds when D is a current library directory name. Library directories > are the places where files specified in the form library(File) are > searched by the predicates consult/1, reconsult/1, use_module/1 or > ensure_loaded/1. prolog_file_name(+Name,-FullPath) Unify FullPath with the > absolute path YAP would use to consult file Name. > > public P [ISO] > > Instructs the compiler that the source of a predicate of a list of > predicates P must be kept. This source is then accessible through the > clause/2 procedure and through the listing family of built-ins. Note that > all dynamic procedures are public. The source directive defines all new or > redefined predicates to be public. Since Yap4.3.0 multifile procedures can > be static or dynamic. -- Per Erik R�nne
Re: Yap - insertion mode
Author: Bart Demoen
Date: Fri, 05 Mar 2004 08:17
Date: Fri, 05 Mar 2004 08:17
32 lines
2500 bytes
2500 bytes
Per R�nne wrote: > Bart Demoen <bmd@cs.kuleuven.ac.be> wrote: >>section 4.2 > > [...] > Which says: > >>?- [user]. >>| p(X) :- X is 2 * (3 + 8). >>| :- end_of_file. >>?- compile_expressions. >>yes >>?- [user]. >>| q(X) :- X is 2 * (3 + 8). >>| :- end_of_file. > > > A clearcut error. It is "end_of_file.", without :-, or ^D. The :- is wrong, but where I live end_of_file <==> ^D > And ^C with help and other stuff isn't mentioned at all. What I demand > in the beginning of any manual [how to exit a program] isn't mentioned > at all. I agree. But you should complain to Yap maintainers directly. Cheers Bart Demoen
Re: Yap - insertion mode
Author: Cesar Rabak
Date: Fri, 05 Mar 2004 14:25
Date: Fri, 05 Mar 2004 14:25
25 lines
2137 bytes
2137 bytes
Bart Demoen escreveu: [snipped] > >> And ^C with help and other stuff isn't mentioned at all. What I demand >> in the beginning of any manual [how to exit a program] isn't mentioned >> at all. > > > I agree. But you should complain to Yap maintainers directly. > This brings me a question about this kind of interface: A lot of recent Prolog implementations seem to behave (at least to me let and give some cents on my memory :-) very similar on this aspect. On the toplevels once you press Ctrl-C you get a menu of single letter options like "e" for exit, "h" for Help, etc. My question is (I do not have access to an updated ISO Standard) this a standarized behaviour or is becoming a kind of 'de facto' norm? -- Cesar Rabak
Re: Yap - insertion mode
Author: Bart Demoen
Date: Fri, 05 Mar 2004 20:58
Date: Fri, 05 Mar 2004 20:58
18 lines
2651 bytes
2651 bytes
Cesar Rabak wrote: > A lot of recent Prolog implementations seem to behave (at least to me > let and give some cents on my memory :-) very similar on this aspect. > > On the toplevels once you press Ctrl-C you get a menu of single letter > options like "e" for exit, "h" for Help, etc. > > My question is (I do not have access to an updated ISO Standard) this a > standarized behaviour or is becoming a kind of 'de facto' norm? ISO was not concerned with such stuff - deemed to be "environmental". Also debug/0 or trace/0 are not specified by ISO. But ^C and its effects are more or less de facto standard. Cheer Bart Demoen
Re: Yap - insertion mode
Author: Cesar Rabak
Date: Fri, 05 Mar 2004 23:01
Date: Fri, 05 Mar 2004 23:01
35 lines
2462 bytes
2462 bytes
Bart Demoen escreveu: > Cesar Rabak wrote: > >> A lot of recent Prolog implementations seem to behave (at least to >> me let and give some cents on my memory :-) very similar on this >> aspect. >> >> On the toplevels once you press Ctrl-C you get a menu of single >> letter options like "e" for exit, "h" for Help, etc. >> >> My question is (I do not have access to an updated ISO Standard) >> this a standarized behaviour or is becoming a kind of 'de facto' >> norm? > > > ISO was not concerned with such stuff - deemed to be "environmental". > OK. From this I understand we should take care of a more thorough documentation then. > Also debug/0 or trace/0 are not specified by ISO. So also we need to specify clearly to avoid mismatching between expectations and different design decisions by the various implementors. > But ^C and its > effects are more or less de facto standard. I see. It was yy perception. > Thank you very much Bart! -- Cesar Rabak
Re: Yap - insertion mode
Author: Cesar Rabak
Date: Fri, 05 Mar 2004 23:01
Date: Fri, 05 Mar 2004 23:01
35 lines
2462 bytes
2462 bytes
Bart Demoen escreveu: > Cesar Rabak wrote: > >> A lot of recent Prolog implementations seem to behave (at least to >> me let and give some cents on my memory :-) very similar on this >> aspect. >> >> On the toplevels once you press Ctrl-C you get a menu of single >> letter options like "e" for exit, "h" for Help, etc. >> >> My question is (I do not have access to an updated ISO Standard) >> this a standarized behaviour or is becoming a kind of 'de facto' >> norm? > > > ISO was not concerned with such stuff - deemed to be "environmental". > OK. From this I understand we should take care of a more thorough documentation then. > Also debug/0 or trace/0 are not specified by ISO. So also we need to specify clearly to avoid mismatching between expectations and different design decisions by the various implementors. > But ^C and its > effects are more or less de facto standard. I see. It was my perception. > Thank you very much Bart! -- Cesar Rabak
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads