🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #3174

Using a backquote to quote the ASCII collating sequence (?)

#3174
From: Edouard Lagache
Date: Mon, 28 Mar 1988 00:48
48 lines
3162 bytes

               Chris Moss in one of his postings on strings complained
          about the need to have ASCII character codes appearing in his
          PROLOG programs.  His complaint is a sound one that should
          be easily solved.  My now feeble brain-box clicked and
          whirred, and quickly spitted out: "In C, double quotes are
          used for strings, and single quotes are reserved for
          characters - simple right?".  Unfortunately, 1/2 a chick
          later it occurred to me that single quotes are sort of
          already taken, so that solution was dashed.

               Undaunted, my brain whirred again and this time fixed on
          a fragment from my LISP programming days: "what about using a
          backquote?".  A quick check of the file cabinets didn't find
          any use of the backquote in PROLOG, and that like LISP a
          single quote operator would be needed since this quote would 
	  simply convert the next character (whatever it is) to its ASCII
          value.

               Experiencing the joy of victory, my brain quickly
          proceeded to push this small achievement over the edge (of
          the cliff): "Sucks, I can write a tiny function and operator
          to do this with my PROLOG and I will actually have a working
          model!"

               Two problems quickly arose: 1.) PROLOG operators
          require a space, which detracts from the effect of a quote
          (i.e. ` a  instead of `a ), and 2.) You are still thinking
          LISP, You can't write functions in PROLOG dummy!  Oh well, so
          the dream dies, but one can still mock up the basic concept
          with a two place operator and predicate.  The code is below.

               That still doesn't solve the problem of is the backquote
          really free for this job, and if one really wants an internal
          operator of this sort.  I kind of like the idea (as I am sure
          you suspected!)  What does the rest of the world think?

          Weary as ever!                               Edouard Lagache
                                           lagache@violet.berkeley.edu

/************************************************************************/
/* A mockup of the backquote to serve to expand ASCII characters        */
/* into their collating sequence,  The syntax isn't ideal.  This scheme */
/* is of the form: X ` a, while the ideal form would probably be `a.    */
/*									*/
?-op(100,xfx,'`').
Code ` Char :- name(Char,[Code]).
Technical Details
Message-ID: <8071@agate.BERKELEY.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!gatech!bloom-beacon!tut.cis.ohio-state.edu!uwmcsd1!ig!agate!violet.berkeley.edu!lagache

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!gatech!bloom-beacon!tut.cis.ohio-state.edu!uwmcsd1!ig!agate!violet.berkeley.edu!lagache
From: lagache@violet.berkeley.edu (Edouard Lagache)
Newsgroups: comp.lang.prolog
Subject: Using a backquote to quote the ASCII collating sequence (?)
Keywords: A -> 65, PROLOG strings, suggestion for standard?
Message-ID: <8071@agate.BERKELEY.EDU>
Date: 28 Mar 88 00:48:40 GMT
Sender: usenet@agate.BERKELEY.EDU
Reply-To: lagache@violet.berkeley.edu (Edouard Lagache)
Organization: University of California, Berkeley
Lines: 48