git @ Cat's Eye Technologies Robin / 4529a6a
Convert one more test in the spec to use expressions. Chris Pressey 5 years ago
1 changed file(s) with 13 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
245245 When in a Robin program proper, a symbol can be bound to a value, and
246246 in this context is it referred to as an _identifier_. However, if an
247247 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)
257260 = hello
258261
259262 A Robin implementation is not expected to be able to generate new symbols
263266 it is what the symbol is bound to in the environment that is applied.
264267
265268 ### Booleans ###
266
267 -> Tests for functionality "Evaluate core Robin Expression"
268269
269270 There are two values of Boolean type, `#t`, representing truth, and `#f`,
270271 representing falsehood. By convention, an identifier which ends in `?`
433434
434435 Non-empty lists do not evaluate to themselves; rather, they represent a macro
435436 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.
437438
438439 | ((macro (s a e) (head a)) (7 8)))
439440 = (7 8)