tiny beautification
This commit is contained in:
10
doc/Doc.md
10
doc/Doc.md
@@ -14,14 +14,14 @@
|
|||||||
|`(while cond ...)`|`while` evaluates only its cond argument.|`while` evaluates its condition expression every iteration before running. If it is true, it continues to evaluate every expression in the `while` body. It then returns the last value evaluated.|
|
|`(while cond ...)`|`while` evaluates only its cond argument.|`while` evaluates its condition expression every iteration before running. If it is true, it continues to evaluate every expression in the `while` body. It then returns the last value evaluated.|
|
||||||
|
|
||||||
|
|
||||||
## Examples
|
## Library
|
||||||
|
|
||||||
#### Using the binary
|
#### Using the binary
|
||||||
|
|
||||||
Run wisp in interactive mode:
|
Run ml in interactive mode:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ ./wisp
|
$ ./ml
|
||||||
>>> (print "Hello world!")
|
>>> (print "Hello world!")
|
||||||
Hello world!
|
Hello world!
|
||||||
=> "Hello world!"
|
=> "Hello world!"
|
||||||
@@ -30,13 +30,13 @@ Hello world!
|
|||||||
Interpret a file:
|
Interpret a file:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ ./wisp -f "examples/hello_world.lisp"
|
$ ./ml -f "examples/hello_world.lisp"
|
||||||
Hello world!
|
Hello world!
|
||||||
```
|
```
|
||||||
|
|
||||||
Interpret from command line argument:
|
Interpret from command line argument:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ ./wisp -c '(print "Hello world!")'
|
$ ./ml -c '(print "Hello world!")'
|
||||||
Hello world!
|
Hello world!
|
||||||
```
|
```
|
||||||
|
|||||||
6
ml.cpp
6
ml.cpp
@@ -15,7 +15,6 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
|
|
||||||
@@ -1350,8 +1349,8 @@ namespace builtin {
|
|||||||
eval_args(args, env);
|
eval_args(args, env);
|
||||||
|
|
||||||
if (args.size() != 1)
|
if (args.size() != 1)
|
||||||
throw MlError(MlValue(FLOAT_TYPE, cast_to_float), env,
|
throw MlError(MlValue(FLOAT_TYPE, cast_to_float), env, args.size() > 1 ? TOO_MANY_ARGS : TOO_FEW_ARGS);
|
||||||
args.size() > 1 ? TOO_MANY_ARGS : TOO_FEW_ARGS);
|
|
||||||
return args[0].cast_to_float();
|
return args[0].cast_to_float();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1361,6 +1360,7 @@ namespace builtin {
|
|||||||
|
|
||||||
if (args.size() != 1)
|
if (args.size() != 1)
|
||||||
throw MlError(MlValue(INT_TYPE, cast_to_int), env, args.size() > 1 ? TOO_MANY_ARGS : TOO_FEW_ARGS);
|
throw MlError(MlValue(INT_TYPE, cast_to_int), env, args.size() > 1 ? TOO_MANY_ARGS : TOO_FEW_ARGS);
|
||||||
|
|
||||||
return args[0].cast_to_int();
|
return args[0].cast_to_int();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user