Article View: comp.lang.prolog
Article #2049Re: converting ascii character lists to functors
From: Fernando Pereira
Date: Mon, 22 Apr 1991 14:43
Date: Mon, 22 Apr 1991 14:43
31 lines
1674 bytes
1674 bytes
In article <EIVERSON.91Apr19200202@aigyptos.nmsu.edu> eiverson@nmsu.edu (Eric Iverson) writes:
>
>The following is a letter I just wrote to Quintus:
> [...]
>I called today about converting ascii character lists into functors
>which could be unified with other functors.
Quintus Prolog comes with an excellent source library, mostly due to Richard
O'Keefe. When in doubt, look in the documentation or in the library
directory. What you want is provided by library(charsio). Here's an example:
Quintus Prolog Release 3.1 (Sun-4, SunOS 4.1)
Copyright (C) 1990, Quintus Corporation. All rights reserved.
2100 Geng Road, Palo Alto, California U.S.A. (415) 813-3800
| ?- use_module(library(charsio)).
% loading file /usr/local/newprolog/generic/qplib3.1/library/charsio.qof
% charsio.qof loaded, 0.417 sec 6,456 bytes
% module charsio imported into user
yes
| ?- with_output_to_chars(write(foo(bar,moo,3)),C), format('~s',[C]).
foo(bar,moo,3)
C = [102,111,111,40,98,97,114,44,109,111,111,44,51,41]
| ?-
Fernando Pereira
2D-447, AT&T Bell Laboratories
600 Mountain Ave, Murray Hill, NJ 07974
pereira@research.att.com
Technical Details
Message-ID:
<20247@alice.att.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!emory!att!att!alice!pereiraReferences:
<EIVERSON.91Apr19200202@aigyptos.nmsu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!emory!att!att!alice!pereira From: pereira@alice.att.com (Fernando Pereira) Newsgroups: comp.lang.prolog Subject: Re: converting ascii character lists to functors Message-ID: <20247@alice.att.com> Date: 22 Apr 91 14:43:48 GMT References: <EIVERSON.91Apr19200202@aigyptos.nmsu.edu> Reply-To: pereira@alice.UUCP () Distribution: comp Organization: AT&T, Bell Labs Lines: 31