Thread: Question for Prolog Experts

  1. #1
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,732

    Question for Prolog Experts

    Hello all,

    Have a quick question. Does this code make any sense for anyone here?

    Code:
    clear:-
         put(27), 
         put("["),  
         put("2"), 
         put("J").


    This code seems to be doing something clever. But I can’t figure it out how. It sees like that there is an internal code which is understood by the SWI-Prolog. Then ties to clears the current screen.

    Any explanation?

    Thanks a lot!

    Ssharish

    Life is like riding a bicycle. To keep your balance you must keep moving - Einstein

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    27 is the ascii code for "escape". That looks like a VT100 escape sequence. Google "ESC[2J".

    gg

  3. #3
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,732
    haha spot on mate. I dint know about the VT100 escape sequences.

    Thanks a lot!

    ssharish
    Life is like riding a bicycle. To keep your balance you must keep moving - Einstein

  4. #4
    Registered User
    Join Date
    Jan 2007
    Posts
    330
    I think there was even a bug in some windows version where code like this would make the system hang. Or maybe that was with backspaces dont remember

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  2. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  3. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  4. Question about linked lists.
    By cheeisme123 in forum C++ Programming
    Replies: 6
    Last Post: 02-25-2003, 01:36 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 01:47 AM