Worked my way through CTM, but with a different language. But I in translating some other code where I needed file io (writing out postscript files), I ran into the same problem.

The solution is to download File.oz from the book's supplement web page and compile it. Source can be found at:

http://www.info.ucl.ac.be/~pvr/ds/mitbook.html

Chris

Justin Henzie wrote:
Hi all,

Sorry for the newb question but I am a little stuck

I am working my way through CTM and I am trying to get the WordFreq program at the end of Chapter 3 up and running.

My specific problem is how the File.readList is accessing stdin.

If I execute the code as written:

*/L={File.readList stdin}/*

The following error occurs

%********************** error in URL support ********************
%**
%** Cannot locate file
%**
%** File name: stdin
%** Operation: open
%**
%** Call Stack:
%** procedure 'Get' in file "/Users/bmejias/Mozart/mozart-1-4-x/mozart/share/lib/init/Resolve.oz", line 394, column 6, PC = 4061088
%**--------------------------------------------------------------

Investigating a little further I added the following

*/StdIn = {New Open.file init(name:stdin)}/*
*/   /**/ /**/L={File.readList StdIn}/*

Which generates

%*************************** type error *************************
%**
%** Expected type: virtualstring
%** At argument:   1
%** In statement:  {VirtualString.toString <O: File> _<optimized>}
%**
%** Call Stack:
%** procedure 'ToString' in file "/Users/raph/devel/mozdss-branch/mozart/share/lib/base/VirtualString.oz", line 54, column 6, PC = 8632344 %** procedure 'PARSE' in file "/Users/bmejias/Mozart/mozart-1-4-x/mozart/share/lib/dp/URL.oz", line 215, column 3, PC = 4283680 %** procedure 'Get' in file "/Users/bmejias/Mozart/mozart-1-4-x/mozart/share/lib/init/Resolve.oz", line 394, column 6, PC = 4060480 %** procedure 'File,init' in file "/Users/bmejias/Mozart/mozart-1-4-x/mozart/share/lib/op/Open.oz", line 291, column 2, PC = 4121972 %** procedure 'ReadList' in file "./File.oz", line 30, column 3, PC = 8571596
%** procedure in file "./WordApp.oz", line 1, column 0, PC = 8565672
%** procedure 'RootManager,Pickle/fast' in file "/Users/bmejias/Mozart/mozart-1-4-x/mozart/share/lib/init/Module.oz", line 244, column 6, PC = 8543904 %** procedure in file "/Users/raph/devel/mozdss-branch/mozart/share/lib/base/Base.oz", line 92, column 7, PC = 4264612
%**--------------------------------------------------------------


Any help would be greatly appreciated.

Regards,

Justin

------------------------------------------------------------------------

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to