Commits

Dominic Kexel committed e2dfcfc

use Function-Composition operator

Comments (0)

Files changed (1)

-let args = System.Environment.GetCommandLineArgs()
-
-if args.Length <> 2
-then 
-    System.Console.WriteLine("Usage: Adler32 [filename]")
-    exit 0
-
 let _base = 65521
     
 let proceed (a, b) (x : byte) = 
     let (a, b) = Array.fold proceed (1, 0) data
     int (b <<< 16) ||| a
 
-System.Console.WriteLine (adler32 (System.IO.File.ReadAllBytes args.[1]))
+let load = 
+    System.IO.File.ReadAllBytes
+    >> adler32
+    >> string
+    
+let args = System.Environment.GetCommandLineArgs()
+let result = match args.Length with 
+             | 2 -> load args.[1]
+             | _ -> "Usage: Adler32 [filename]"
+
+System.Console.WriteLine result