[Swift-user] fifth tutorial problem

Daniel S. Katz dsk at ci.uchicago.edu
Thu Oct 14 11:07:38 CDT 2010


Hi,

This is the first real error in the tutorial.  Section 3.3 is incomplete, and doesn't make any sense.

It refers to greeting.txt from the previous section, but there is no greeting.txt in the previous section.  There's a greeting procedure, but no greeting file.  It seems that this might refer to hello.txt.  Also, the line in the box refers to outfile, which wasn't defined.


So, the text in section 3.3 should read:


In the previous section, the file hello.txt is used only to store an intermediate result. We don't really care about which name is used for the file, and we can let Swift choose the name.

To do that, omit the mapping entirely when declaring outfile:


And line in the box should read:

messagefile hellofile;  


For completeness, the code from the previous example could be restated with this change:


type messagefile {}   
  
(messagefile t) greeting (string s) {     
    app {  
        echo s stdout=@filename(t);  
    }  
}  
  
(messagefile o) capitalise(messagefile i) {     
    app {  
        tr "[a-z]" "[A-Z]" stdin=@filename(i) stdout=@filename(o);  
    }  
}  
  
messagefile hellofile;  
messagefile final <"capitals.txt">;  
  
hellofile = greeting("hello from Swift");  
final = capitalise(hellofile);  


Dan
-- 
Daniel S. Katz
University of Chicago
(773) 834-7186 (voice)
(773) 834-3700 (fax)
d.katz at ieee.org or dsk at ci.uchicago.edu
http://www.ci.uchicago.edu/~dsk/




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-user/attachments/20101014/2dcbf322/attachment.html>


More information about the Swift-user mailing list