Re: Newbie problem



On 2007-05-19, angelraposo@xxxxxxxxx <angelraposo@xxxxxxxxx> wrote:
On 19 mai, 21:10, Jan Wielemaker <j...@xxxxxxxxxxxxxxxxxxx> wrote:

<snip>

On 2007-05-19, angelrap...@xxxxxxxxx <angelrap...@xxxxxxxxx> wrote:
It probably executes it already, but the user_output stream is
line-buffered, so it doesn't write anything as long as there is
no newline or explicit flush. When reading from the console a
flush of the output is implied. When reading from the GUI this
no longer works and you'll have to call flush_output/1 explicitely.

--- Jan

Oh, I don�t think that's the problem becuase I also tried to append a
text to my editor to check if it was executing. It�s a problem with
the "string" received from the user. According to my rules, when I�m
using the prolog console, it recognized that I wrote the how command
and the variable Objective takes the rest of the text as its value

Adding the execute(_) catch all or using ?- spy(execute/1). would have
saved time for all of us ...

execute(how(Objetive)):-
write('I�m working`),
how(Objetive),
!.

I've also tried the next:

execute('how(Objetive)'):-
write('I�m working`),
how(Objetive),
!.

In this case if the user writes literaly 'how(Objective)' the message
it�s printed. However in the normal case if the user writes
'how(bird('mybird'))' it doesn�t recognize that the user is writing a
how command (and obviosuly it doesn't give the variable Objective the
right value). It just goes to the failure message "command not
recognized" which is the last order.

execute(_):-
write('Command not recognized....`),
!.

Is there anyway in prolog to define a rule like execute(something
begining with 'how') and later take out the part of text I need?

* Define a syntax to use and write a DCG (Grammar rules) for
it.
* When using Prolog syntax, use atom_to_term/3.
* Use hacky tests such as sub_atom/5.
* Use one of the zillion other possibilities ...

Consider an A-Z scan of the predicate summary in the documentation. It
gives you an impression what is there and which terms are used in the
documentation, so you can use the search page at
http://gollem.science.uva.nl/SWI-Prolog/pldoc/

--- Jan
.



Relevant Pages

  • Re: xp_cmdshell default path (system32) problem
    ... purge all files from a given directory. ... that xp_cmdshell ALWAYS executes under the security context of defined ... I'm use xp_cmdShell to execute "erase" command like ... I haven't executed the actual erase statements yet but rather have been ...
    (microsoft.public.sqlserver.programming)
  • Re: Simple IF statement
    ... My resistive power and acceleration power data points are stored ... > executes the stuff after "then", ... What Randy has described is called logical indexing. ... though -- was there anything in the documentation ...
    (comp.soft-sys.matlab)
  • Re: Newbie question on C library system() function
    ... rest of my app executes. ... printer to see whether it completed a command yet. ... the characters to the printer, but the characters are getting buffered ... Most operating systems provide ways outside of C to wait gracefully; ...
    (comp.lang.c)
  • Re: Using os.system() and string concatenation
    ... > I think take those lists and provide them to an os.systemcall. ... > This executes without any errors, but doesn't execute the command ... > supply it to os.systemit executes just fine. ... a shell command out of data from files, ...
    (comp.lang.python)
  • Re: RH 9.0 log in question: seems a bit long
    ... No lag after I enter my password. ... in my username. ... When I type in command, it executes right away. ...
    (RedHat)