|
Practical Common LispFirst we have to write. . . "Hello, World," Lisp Style No programming book is complete without a "hello, world"[16] program. As it turns out, it's trivially easy to get the REPL to print "hello, world." CL-USER> "hello, world" "hello, world" This works because strings, like numbers, have a literal syntax that's understood by the Lisp reader and are self-evaluating objects: Lisp reads the double-quoted string and instantiates a string object in memory that, when evaluated, evaluates to itself and is then printed in the same literal syntax. The quotation marks aren't part of the string object in memory—they're just the syntax that tells the reader to read a string. The printer puts them back on when it prints the string because it tries to print objects in the same syntax the reader understands. However, this may not really qualify as a "hello, world" program. It's more like the "hello, world" value. You can take a step toward a real program by writing some code that as a side effect prints the string "hello, world" to standard output ...» |
Код для вставки книги в блог HTML
phpBB
текст
|
|