Convert one more test in the spec to use expressions.
Chris Pressey
5 years ago
245 | 245 | When in a Robin program proper, a symbol can be bound to a value, and |
246 | 246 | in this context is it referred to as an _identifier_. However, if an |
247 | 247 | attempt is made to evaluate a symbol which is not an identifier, |
248 | an exception will be raised. For a symbol to appear unevaluated in a Robin | |
249 | program, it must be an argument to a macro. For that reason, we can't | |
250 | show an example of a literal symbol without first defining a macro... but | |
251 | will go ahead and show the example, and will explain macros later. | |
252 | ||
253 | -> Tests for functionality "Execute core Robin Program" | |
254 | ||
255 | | (define literal (macro (self args env) (head args))) | |
256 | | (display (literal hello)) | |
248 | an exception will be raised. | |
249 | ||
250 | | this-symbol-is-not-bound | |
251 | ? uncaught exception: (unbound-identifier this-symbol-is-not-bound) | |
252 | ||
253 | For a symbol to appear unevaluated in a Robin program, it must be | |
254 | introduced as a literal. However, there is no intrinsic way to do this, | |
255 | so in order to demonstrate it, we must use something we haven't | |
256 | covered yet: a macro. We'll just go ahead and show the example, and | |
257 | will explain macros later. | |
258 | ||
259 | | ((macro (s a e) (head a)) hello) | |
257 | 260 | = hello |
258 | 261 | |
259 | 262 | A Robin implementation is not expected to be able to generate new symbols |
263 | 266 | it is what the symbol is bound to in the environment that is applied. |
264 | 267 | |
265 | 268 | ### Booleans ### |
266 | ||
267 | -> Tests for functionality "Evaluate core Robin Expression" | |
268 | 269 | |
269 | 270 | There are two values of Boolean type, `#t`, representing truth, and `#f`, |
270 | 271 | representing falsehood. By convention, an identifier which ends in `?` |
433 | 434 | |
434 | 435 | Non-empty lists do not evaluate to themselves; rather, they represent a macro |
435 | 436 | application. However, the `literal` macro (whose definition is |
436 | `(macro (s a e) (head a))` may be used to obtain a literal list. | |
437 | `(macro (s a e) (head a))`) may be used to obtain a literal list. | |
437 | 438 | |
438 | 439 | | ((macro (s a e) (head a)) (7 8))) |
439 | 440 | = (7 8) |