Skip to content

Commit bbb5756

Browse files
committed
📝 Added example to README
1 parent c6c6e97 commit bbb5756

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,9 @@ All the Orion changes will be written here
126126

127127
## Fixed
128128

129-
- Fixed boolean and arithmetic Scopes and Function Calls bugs (index problems)
130-
- Fixed trigonometry with radians instead of degrees
129+
- Boolean and arithmetic Scopes and Function Calls bugs (index problems)
130+
- Trigonometry with radians instead of degrees
131+
- Input with a trim
131132

132133
## Added
133134

README.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,27 @@
3232
}))
3333
```
3434

35-
### Ackermann function
35+
### More or less game
3636

3737
```lisp
38-
(define ack (lambda (m n) {
39-
(if (= m 0) {
40-
(+ n 1)
41-
} {
42-
(if (= n 0) {
43-
(ack (- m 1) 1)
44-
} {
45-
(ack (- m 1) (ack m (- n 1)))
46-
})
38+
(math:initRng)
39+
(define toGuess (math:rand 1 100))
40+
(var guessed 0)
41+
(var tries 0)
42+
43+
(while (!= guessed toGuess) {
44+
(set tries (+ tries 1))
45+
(set guessed (static_cast "int" (input "Input number: ")))
46+
(if (< guessed toGuess) {
47+
(print "More !")
48+
} {
49+
(if (> guessed toGuess) {
50+
(print "Less !")
4751
})
48-
}))
52+
})
53+
})
54+
(print (+ "Well done, you found the number in " (+ (static_cast "string" tries) " tries")))
55+
4956
```
5057

5158
## Documentation

src/lib/interpreter/interpreter/stdlib/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl Interpreter {
2626
io::stdout().flush().unwrap();
2727
io::stdin().read_line(&mut line).unwrap();
2828
Value::String(
29-
line
29+
line.trim().to_owned()
3030
)
3131
})
3232
}

0 commit comments

Comments
 (0)