diff --git a/CHANGELOG.md b/CHANGELOG.md index 084a353..c0095f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,24 +1,17 @@ # Change Log All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/). -## [Unreleased] +## [0.2.1] - 2023-03-?? + ### Changed -- Add a new arity to `make-widget-async` to provide a different widget shape. +- this is fundamentally a working Lisp. The reader reads S-Expressions fully and M-Expressions at least partially. It is not (yet) a feature complete Lisp 1.5. -## [0.1.1] - 2019-08-12 -### Changed -- Documentation on how to make the widgets. - -### Removed -- `make-widget-sync` - we're all async, all the time. - -### Fixed -- Fixed widget maker to keep working when daylight savings switches over. - -## 0.1.0 - 2019-08-12 ### Added -- Files from the new template. -- Widget maker public API - `make-widget-sync`. +- working EVAL, APPLY, READ and 24 other basic functions, of which at least four are not actually parts of the Lisp 1.5 specification. However, sufficient are present to allow the +vast majority of Lisp 1.5 functions to be defined. + +### Known to be missing +- property lists. [Unreleased]: https://github.com/your-name/beowulf/compare/0.1.1...HEAD [0.1.1]: https://github.com/your-name/beowulf/compare/0.1.0...0.1.1 diff --git a/resources/count.lsp b/resources/count.lsp new file mode 100644 index 0000000..ca55508 --- /dev/null +++ b/resources/count.lsp @@ -0,0 +1 @@ +(DEFUN COUNT (L) (COND ((EQ '() L) 0) (T (PLUS 1 (COUNT (CDR L)))))) \ No newline at end of file diff --git a/src/beowulf/bootstrap.clj b/src/beowulf/bootstrap.clj index df1f8ce..aab240b 100644 --- a/src/beowulf/bootstrap.clj +++ b/src/beowulf/bootstrap.clj @@ -33,6 +33,15 @@ (declare APPLY EVAL) +(defn lax? + "Are we in lax mode? If so. return true; is not, throw an exception with + this `symbol`." + [symbol] + (when (:strict *options*) + (throw (ex-info (format "%s is not available in Lisp 1.5" symbol) + {:cause :strict + :extension symbol}))) + true) (defmacro NULL "Returns `T` if and only if the argument `x` is bound to `NIL`; else `F`." @@ -348,9 +357,10 @@ return the current value of the object list. Note that in PSL this function returns a list of the symbols bound, not the whole association list." [] - (if (instance? ConsCell @oblist) - (make-beowulf-list (map CAR @oblist)) - NIL)) + (when (lax? 'OBLIST) + (if (instance? ConsCell @oblist) + (make-beowulf-list (map CAR @oblist)) + NIL))) (defn DEFINE "Bootstrap-only version of `DEFINE` which, post boostrap, can be overwritten @@ -406,19 +416,20 @@ EQUAL (apply EQUAL args) ;; think about EVAL. Getting the environment right is subtle FIXP (apply FIXP args) - INTEROP (apply INTEROP args) + INTEROP (when (lax? INTEROP) (apply INTEROP args)) NUMBERP (apply NUMBERP args) OBLIST (OBLIST) PLUS (apply PLUS args) - PRETTY (apply pretty-print args) + PRETTY (when (lax? 'PRETTY) + (apply pretty-print args)) QUOTIENT (apply QUOTIENT args) READ (READ) REMAINDER (apply REMAINDER args) RPLACA (apply RPLACA args) RPLACD (apply RPLACD args) SET (apply SET args) - SYSIN (apply SYSIN args) - SYSOUT (apply SYSOUT args) + SYSIN (when (lax? 'SYSIN) (apply SYSIN args)) + SYSOUT (when (lax? 'SYSOUT) (apply SYSOUT args)) TIMES (apply TIMES args) ;; else (ex-info "No function found" diff --git a/src/beowulf/core.clj b/src/beowulf/core.clj index 6abe653..e46a4a0 100644 --- a/src/beowulf/core.clj +++ b/src/beowulf/core.clj @@ -78,6 +78,7 @@ "\nSprecan '" stop-word "' tó laéfan\n")) (binding [*options* (:options args)] + (pprint *options*) (when (:read *options*) (try (SYSIN (:read *options*)) (catch Throwable any