fix things, add things
This commit is contained in:
parent
84de1dae6c
commit
fcf3e4cdbe
13
language.md
13
language.md
|
@ -15,9 +15,9 @@ Ludus has four types of atomic values.
|
|||
`true` and `false`. That said, in all conditional constructs, `nil` and `false` are "falsy," and everything else is "truthy." Their type is `:boolean`.
|
||||
|
||||
### Numbers
|
||||
Ludus has numbers. At current, they rely on underlying number types. When Ludus runs in the browser, numbers are Javascript 64-bit floats. When Ludus runs at the command line in JVM-based Clojure, Ludus numbers could be ints, floats, or ratios, depending. Numbers are more complicated than you think.
|
||||
Ludus has numbers, which are IEEE-754 64-bit floats. Numbers are more complicated than you think, probably.
|
||||
|
||||
Number literals in Ludus are either integers or decimal floating point numbers.
|
||||
Number literals in Ludus are either integers or decimal floating point numbers, e.g. `32.34`, `42`, `-0.23`. Underscores in numbers are ignored, and can be used to separate long numbers, e.g. `1_234_567_890`.
|
||||
|
||||
Numbers' type is `:number`.
|
||||
|
||||
|
@ -40,7 +40,7 @@ Strings use backslashes for escapes, including `\n` for newline, `\t` for tab, `
|
|||
Strings' type is `:string`.
|
||||
|
||||
### String interpolation
|
||||
Strings may also insert a string representation of any Ludus value that is bound to a name, by inserting that name in curly braces, e.g.
|
||||
Strings may also insert a string representation of any Ludus value that is bound to a name, by inserting that name in curly braces. To wit,
|
||||
```
|
||||
let foo = :foo
|
||||
let bar = 42
|
||||
|
@ -93,6 +93,11 @@ Ludus provides functions that allow working with persistent collections. They're
|
|||
## Expressions
|
||||
Ludus is an expression-based language: all forms in the language are expressions and return values, except `panic!`. That said, not all expressions may be used everywhere.
|
||||
|
||||
### Terminating expressions
|
||||
Expressions in scripts and blocks are terminated by a newline or a semicolon. In compound forms, like, `if`, the terminator comes after the `else` expression.
|
||||
|
||||
In forms with multiple clauses surrounded by curly braces (i.e., function bodies, `match`, `when`, etc.), you may separate clauses with semicolons as well as newlines.
|
||||
|
||||
### Toplevel expressions
|
||||
Some expressions may only be used in the "top level" of a script. Because they are the toplevel, they are assured to be statically knowable. These include: `pkg`, `ns`, `use`, `import`, and `test`. (NB: not all of these are yet implemented.)
|
||||
|
||||
|
@ -205,7 +210,7 @@ let first = {
|
|||
add (outer, inner)
|
||||
} & first is now bound to 65
|
||||
|
||||
inner & Validation error! unbound name inner
|
||||
inner & Validation error: unbound name inner
|
||||
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user