read / prin1 question
From: Chris Wright (caw_at_cs.mu.oz.au)
Date: 02/26/04
- Next message: David Steuber: "Re: Popularity of programming languages"
- Previous message: james anderson: "Re: gensym-macrolet ? [ Re: Scheme macros"
- Next in thread: Yang, Chul-Woong: "Re: read / prin1 question"
- Reply: Yang, Chul-Woong: "Re: read / prin1 question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 25 Feb 2004 22:55:29 -0800
I want to write a hash-table to a file and then read it later. I'm
relying on
"prin1 produces output suitable for input to read." from the
HyperSpec.
But I get an error. I've tried Googling and the lisp FAQ. I'd be
grateful for help
cheers
Chris
Code sample:
<17:34>~ $: uname -a
Darwin Chris-Wrights-Computer.local 7.2.0 Darwin Kernel Version 7.2.0:
Thu Dec 11 16:20:23 PST 2003; root:xnu/xnu-517.3.7.obj~1/RELEASE_PPC
Power Macintosh powerpc
<17:37>~ $: sbcl
This is SBCL 0.8.8, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* (defvar *t* (make-hash-table))
*T*
* (with-open-file (str "test" :direction :output)
(prin1 *t* str))
#<HASH-TABLE :TEST EQL :COUNT 0 {48016829}>
* (with-open-file (str "test" :direction :input)
(read str))
debugger invoked on a READER-ERROR in thread 457:
READER-ERROR at 2 (line 1, column 2) on #<FILE-STREAM
for "file
\"/Users/caw/test\""
{4807EFD9}>:
illegal sharp macro character: #\<
You can type HELP for debugger help, or (SB-EXT:QUIT) to exit from
SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [ABORT ] Reduce debugger level (leaving debugger, returning to
toplevel).
1: [TOPLEVEL] Restart at toplevel READ/EVAL/PRINT loop.
(SB-IMPL::%READER-ERROR
3
#<FILE-STREAM for "file \"/Users/caw/test\"" {4807EFD9}>
"illegal sharp macro character: ~S")[:EXTERNAL]
- Next message: David Steuber: "Re: Popularity of programming languages"
- Previous message: james anderson: "Re: gensym-macrolet ? [ Re: Scheme macros"
- Next in thread: Yang, Chul-Woong: "Re: read / prin1 question"
- Reply: Yang, Chul-Woong: "Re: read / prin1 question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|