diff --git a/talks/demo.hoc b/talks/demo.hoc new file mode 100644 index 00000000..dd872777 --- /dev/null +++ b/talks/demo.hoc @@ -0,0 +1,5 @@ +23 +2*log(10) +1e100 +2^64 +0x234 diff --git a/talks/demo.ivy b/talks/demo.ivy new file mode 100755 index 00000000..ed61fb2a --- /dev/null +++ b/talks/demo.ivy @@ -0,0 +1,82 @@ +#This is ivy. Each step in the demo is one line of input followed by some output. +# Arithmetic +23 +23 + 45 +# Rationals +1/3 +1/3 + 4/5 +1.2 +# Big numbers +1e10 # Still an integer. +1e100 # Still an integer. +2**64 +2**640 +2**6400 +# Vectors +1 2 3 +1 2 3 + 4 5 6 +23 + 1 2 3 +1 << 1 2 3 4 5 +iota 10 +2 ** iota 100 +(2 ** iota 100) == (1< 0 { + // User typed a non-empty line of text; send that. + line := []byte(fmt.Sprintf("%s\n", scan.Bytes())) + _, err = input.Write(line) + } else { + // User typed newline; send next line of file's text. + if len(text) == 0 { + break + } + for i := 0; i < len(text); i++ { + if text[i] == '\n' { + os.Stdout.Write(text[:i+1]) + _, err = input.Write(text[:i+1]) + text = text[i+1:] + break + } + } + } + ck(err) + } + ck(scan.Err()) +} + +func ck(err error) { + if err != nil { + log.Fatal(err) + } +}