Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > clear screens and list membership
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 11th June 14:05
jny0
External User
 
Posts: 1
Default clear screens and list membership



I am using swi-prolog, and have two problems:

I need to clear a screen. I have been using the following:

cls:- put(27),put(91),put(56),put(74).

It doesn't seem to work for me, despite being assured that it works.

The second problem I have, is that I need to test for whether a list
is empty. I would like it to work something like this:

is_empty(list) /*succeeds if empty, fails if not*/

Any ideas would be gratefully received.
Cheers
JNY
  Reply With Quote


  sponsored links


2 11th June 14:05
cesar rabak
External User
 
Posts: 1
Default clear screens and list membership



JNY escreveu:


This should work only in terminal that are or emulate the ANSI standard.
For a test in the shell try:

$echo -e '\E[2J'

and see if this clears the screen. If yes, then your cls predicate could
work, otherwise, you'll need to find alternatives.

HTH

--
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/
  Reply With Quote
3 11th June 14:06
paul williams
External User
 
Posts: 1
Default clear screens and list membership


You're using the sequence ESC [ 8 J, which isn't defined by any standard
I'm aware of. Try changing "56" to "50".

--
Paul
  Reply With Quote
4 21st June 00:32
chavez
External User
 
Posts: 1
Default clear screens and list membership


[] is the empty list.

is_the_empty_list([]).

:- is_the_empty_list([1]).
No.

:- is_the_empty_list([]).
Yes. :- is_the_empty_list(X).
X -> [].
One answer.

--
http://www.sonic.net/~sequitur

Maximize end-user autonomy.
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666