From: Luke Lau Date: Sat, 9 Nov 2019 17:51:23 +0000 (+0000) Subject: Start the standard library X-Git-Url: http://git.lukelau.me/?p=kaleidoscope-hs.git;a=commitdiff_plain;h=0b171dce6581f540f231ec877d35304c50f7a37b Start the standard library Our standard library so far is just going to contain a single function that acts as a version of putchar(3), except it operates on doubles. We'll also flush stdout so that we can immediately see what we've printed when we're inside the repl. --- diff --git a/stdlib.c b/stdlib.c new file mode 100644 index 0000000..9749ee3 --- /dev/null +++ b/stdlib.c @@ -0,0 +1,7 @@ +#include +// Takes a double and writes it to stdout +double putchard(double x) { + int res = putchar((int)x); + fflush(stdout); + return (double)res; +}