Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,23 @@
|
|||
open System;;
|
||||
open System.IO;;
|
||||
|
||||
let file_path = "notes.txt";;
|
||||
|
||||
let show_notes () =
|
||||
try
|
||||
printfn "%s" <| File.ReadAllText(file_path)
|
||||
with
|
||||
_ -> printfn "Take some notes first!";;
|
||||
|
||||
let take_note (note : string) =
|
||||
let now = DateTime.Now.ToString() in
|
||||
let note = sprintf "%s\n\t%s" now note in
|
||||
use file_stream = File.AppendText file_path in (* 'use' closes file_stream automatically when control leaves the scope *)
|
||||
file_stream.WriteLine note;;
|
||||
|
||||
[<EntryPoint>]
|
||||
let main args =
|
||||
match Array.length args with
|
||||
| 0 -> show_notes()
|
||||
| _ -> take_note <| String.concat " " args;
|
||||
0;;
|
||||
Loading…
Add table
Add a link
Reference in a new issue