-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from skx/examples
Examples
- Loading branch information
Showing
15 changed files
with
84 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# | ||
# Generate README.md, by running readme.lisp. | ||
# | ||
README.md: *.lisp | ||
../yal readme.lisp > README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Examples | ||
|
||
This directory contains some simple lisp examples, which can be executed via `yal`. | ||
|
||
|
||
* [dynamic.lisp](dynamic.lisp) | ||
* Execute code by name, via introspection. | ||
* [fibonacci.lisp](fibonacci.lisp) | ||
* Calculate the first 25 fibonacci numbers. | ||
* [fizzbuzz.lisp](fizzbuzz.lisp) | ||
* Show the fizzbuzz up to 50. | ||
* [hash.lisp](hash.lisp) | ||
* Demonstrate working with hashes. | ||
* [lisp-tests.lisp](lisp-tests.lisp) | ||
* A simple lisp-based testing framework for our primitives. | ||
* [mtest.lisp](mtest.lisp) | ||
* Simple tests of our macro system. | ||
* [readme.lisp](readme.lisp) | ||
* Generate a README.md file, based on directory contents. | ||
* [sorting.lisp](sorting.lisp) | ||
* Demonstrate generating random lists, and sorting them. | ||
* [test.lisp](test.lisp) | ||
* Simple feature-tests/demonstrations of our system. | ||
* [time.lisp](time.lisp) | ||
* Demonstrate our date/time functions. | ||
* [try.lisp](try.lisp) | ||
* Demonstrate our error-handling, with try/catch. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
;;; readme.lisp - Generate a README.md file, based on directory contents. | ||
|
||
;; | ||
;; This directory contains *.lisp, echo of which has a header-line prefixed | ||
;; with three semi-colons: | ||
;; | ||
;; ;;; foo.lisp - Information | ||
;; | ||
;; This script reads those files and outputs a simple index, of the filename | ||
;; and the information. | ||
;; | ||
|
||
(set! lisp:files (fn* () | ||
"Return a list of all the lisp files in the current directory" | ||
(sort (glob "*.lisp")))) | ||
|
||
|
||
(set! lisp:info (fn* (file) | ||
"Output a brief overview of the given file" | ||
(let* ( | ||
text (file:lines file) | ||
line (nth text 0) | ||
info (match "^([^-]*)-+[ ]+(.*)$" line)) | ||
(when (list? info) | ||
(print "* [%s](%s)" file file) | ||
(print " * %s" (nth info 2)))))) | ||
|
||
|
||
(set! lisp:index (fn* () | ||
"Generate a README.md snippet" | ||
(let* (files (lisp:files)) | ||
(apply files lisp:info())))) | ||
|
||
(print "# Examples\n") | ||
(print "This directory contains some simple lisp examples, which can be executed via `yal`.\n\n") | ||
|
||
(lisp:index) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters