about summary refs log tree commit diff stats
path: root/index.html
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-06-29 13:57:40 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-06-29 13:57:40 -0700
commit21da851e5e75632d3d955c608451b6fced990184 (patch)
treef4dcaeabd69872dc8f1b950c29c23c1b139dc241 /index.html
parent872dd0018bdf023612db8aef6e3fef7c8ee0746b (diff)
downloadmu-21da851e5e75632d3d955c608451b6fced990184.tar.gz
3077
Diffstat (limited to 'index.html')
0 files changed, 0 insertions, 0 deletions
016-09-17 00:43:20 -0700 3380' href='/akkartik/mu/commit/real_files.mu?h=main&id=192d59d3bb9ee0baa1afd82cb5d0f352bdc6e403'>192d59d3 ^
dff1abb2 ^
9458918f ^
dff1abb2 ^
734eef7c ^
dff1abb2 ^
734eef7c ^
dff1abb2 ^
734eef7c ^

dff1abb2 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
                                                                         
                                           
                                                   
                                   


             
                                                  
                                             
                                        
                                  
                    
                                              
                                         
                                            

                     
 
# example program: read a character from one file and write it to another
# BEWARE: this will modify your file system
# before running it, put a character into /tmp/mu-x
# after running it, check /tmp/mu-y

def main [
  local-scope
  f:num/file <- $open-file-for-reading [/tmp/mu-x]
  $print [file to read from: ], f, 10/newline
  c:char, eof?:bool <- $read-from-file f
  $print [copying ], c, 10/newline
  f <- $close-file f
  $print [file after closing: ], f, 10/newline
  f <- $open-file-for-writing [/tmp/mu-y]
  $print [file to write to: ], f, 10/newline
  $write-to-file f, c
  f <- $close-file f
]