Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Simon Brooke 2023-03-29 08:50:44 +01:00
commit 64ff020cb4
No known key found for this signature in database
GPG key ID: A7A4F18D1D4DF987
4 changed files with 28 additions and 22 deletions

View file

@ -1,24 +1,17 @@
# Change Log # 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/). 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 ### 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 ### Added
- Files from the new template. - 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
- Widget maker public API - `make-widget-sync`. 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 [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 [0.1.1]: https://github.com/your-name/beowulf/compare/0.1.0...0.1.1

1
resources/count.lsp Normal file
View file

@ -0,0 +1 @@
(DEFUN COUNT (L) (COND ((EQ '() L) 0) (T (PLUS 1 (COUNT (CDR L))))))

View file

@ -33,6 +33,15 @@
(declare APPLY EVAL) (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 (defmacro NULL
"Returns `T` if and only if the argument `x` is bound to `NIL`; else `F`." "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 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." returns a list of the symbols bound, not the whole association list."
[] []
(if (instance? ConsCell @oblist) (when (lax? 'OBLIST)
(make-beowulf-list (map CAR @oblist)) (if (instance? ConsCell @oblist)
NIL)) (make-beowulf-list (map CAR @oblist))
NIL)))
(defn DEFINE (defn DEFINE
"Bootstrap-only version of `DEFINE` which, post boostrap, can be overwritten "Bootstrap-only version of `DEFINE` which, post boostrap, can be overwritten
@ -406,19 +416,20 @@
EQUAL (apply EQUAL args) EQUAL (apply EQUAL args)
;; think about EVAL. Getting the environment right is subtle ;; think about EVAL. Getting the environment right is subtle
FIXP (apply FIXP args) FIXP (apply FIXP args)
INTEROP (apply INTEROP args) INTEROP (when (lax? INTEROP) (apply INTEROP args))
NUMBERP (apply NUMBERP args) NUMBERP (apply NUMBERP args)
OBLIST (OBLIST) OBLIST (OBLIST)
PLUS (apply PLUS args) PLUS (apply PLUS args)
PRETTY (apply pretty-print args) PRETTY (when (lax? 'PRETTY)
(apply pretty-print args))
QUOTIENT (apply QUOTIENT args) QUOTIENT (apply QUOTIENT args)
READ (READ) READ (READ)
REMAINDER (apply REMAINDER args) REMAINDER (apply REMAINDER args)
RPLACA (apply RPLACA args) RPLACA (apply RPLACA args)
RPLACD (apply RPLACD args) RPLACD (apply RPLACD args)
SET (apply SET args) SET (apply SET args)
SYSIN (apply SYSIN args) SYSIN (when (lax? 'SYSIN) (apply SYSIN args))
SYSOUT (apply SYSOUT args) SYSOUT (when (lax? 'SYSOUT) (apply SYSOUT args))
TIMES (apply TIMES args) TIMES (apply TIMES args)
;; else ;; else
(ex-info "No function found" (ex-info "No function found"

View file

@ -78,6 +78,7 @@
"\nSprecan '" stop-word "' tó laéfan\n")) "\nSprecan '" stop-word "' tó laéfan\n"))
(binding [*options* (:options args)] (binding [*options* (:options args)]
(pprint *options*)
(when (:read *options*) (when (:read *options*)
(try (SYSIN (:read *options*)) (try (SYSIN (:read *options*))
(catch Throwable any (catch Throwable any