## Overview
> Programming languages should be designed not by piling feature on top of feature, but by removing the weaknesses and restrictions that make additional features appear necessary.
->
-> Revised7 Report on the Algorithmic Language Scheme [1]
->
+>
Revised7 Report on the Algorithmic Language Scheme [1]
Meevax is an implementation of Lisp-1 programming language, supporting subset of the [Scheme](http://www.scheme-reports.org/) (R7RS) and [SRFI](https://srfi.schemers.org/)s.
@@ -45,12 +56,14 @@ Subset of R7RS-small.
|--------------------------------------------------------:|:-------------------------------------------------------|:------------------------------------------------------|:------------------|
| [ 1](https://srfi.schemers.org/srfi-1/srfi-1.html) | List Library | [`(srfi 1)`](./basis/srfi-1.ss) | |
| [ 6](https://srfi.schemers.org/srfi-6/srfi-6.html) | Basic String Ports | [`(srfi 6)`](./basis/srfi-6.ss) | R7RS 6.13 |
+| [ 4](https://srfi.schemers.org/srfi-4/srfi-4.html) | Homogeneous numeric vector datatypes | [`(srfi 4)`](./basis/srfi-4.ss) | R7RS 6.9 |
| [ 8](https://srfi.schemers.org/srfi-8/srfi-8.html) | receive: Binding to multiple values | [`(srfi 8)`](./basis/srfi-8.ss) | |
| [ 9](https://srfi.schemers.org/srfi-9/srfi-9.html) | Defining Record Types | [`(srfi 9)`](./basis/srfi-9.ss) | R7RS 5.5 |
| [ 10](https://srfi.schemers.org/srfi-10/srfi-10.html) | #, external form | | |
| [ 11](https://srfi.schemers.org/srfi-11/srfi-11.html) | Syntax for receiving multiple values | [`(srfi 11)`](./basis/srfi-11.ss) | R7RS 4.2.2 |
| [ 23](https://srfi.schemers.org/srfi-23/srfi-23.html) | Error reporting mechanism | [`(srfi 23)`](./basis/srfi-23.ss) | R7RS 6.11 |
| [ 30](https://srfi.schemers.org/srfi-30/srfi-30.html) | Nested Multi-line Comments | | R7RS 2.2 |
+| [ 31](https://srfi.schemers.org/srfi-31/srfi-31.html) | A special form rec for recursive evaluation | [`(srfi 31)`](./basis/srfi-31.ss) | |
| [ 34](https://srfi.schemers.org/srfi-34/srfi-34.html) | Exception Handling for Programs | [`(srfi 34)`](./basis/srfi-34.ss) | R7RS 6.11 |
| [ 38](https://srfi.schemers.org/srfi-38/srfi-38.html) | External Representation for Data With Shared Structure | [`(srfi 38)`](./basis/srfi-38.ss) | R7RS 6.13.3 |
| [ 39](https://srfi.schemers.org/srfi-39/srfi-39.html) | Parameter objects | [`(srfi 39)`](./basis/srfi-39.ss) | R7RS 4.2.6 |
@@ -58,12 +71,12 @@ Subset of R7RS-small.
| [ 62](https://srfi.schemers.org/srfi-62/srfi-62.html) | S-expression comments | | R7RS 2.2 |
| [ 78](https://srfi.schemers.org/srfi-78/srfi-78.html) | Lightweight testing | [`(srfi 78)`](./basis/srfi-78.ss) | Except `check-ec` |
| [ 87](https://srfi.schemers.org/srfi-87/srfi-87.html) | => in case clauses | | R7RS 4.2.1 |
+| [ 98](https://srfi.schemers.org/srfi-98/srfi-98.html) | An interface to access environment variables | [`(srfi 98)`](./basis/srfi-98.ss) | R7RS 6.14 |
| [149](https://srfi.schemers.org/srfi-149/srfi-149.html) | Basic syntax-rules template extensions | [`(srfi 149)`](./basis/srfi-149.ss) | R7RS 4.3.2 |
-| [211](https://srfi.schemers.org/srfi-211/srfi-211.html) | Scheme Macro Libraries | [`(srfi 211 explicit-renaming)`](./basis/srfi-211.ss) | |
-## Requirements
+## Installation
-### Software
+### Requirements
- [GCC](https://gcc.gnu.org/) (>= 9.4.0) or [Clang](https://clang.llvm.org/) (>= 11.0.0)
- [CMake](https://cmake.org/) (>= 3.16.3)
@@ -71,50 +84,53 @@ Subset of R7RS-small.
- [GNU Binutils](https://www.gnu.org/software/binutils/)
- [GNU Multiple Precision Arithmetic Library (GMP)](https://gmplib.org/)
-To install the above software, it is easy to use the following script.
+### Install
``` bash
-$ ./script/setup.sh
+cmake -B build -DCMAKE_BUILD_TYPE=Release
+cd build
+make install.deb
```
-## Installation
-
-### Install
+or
``` bash
-$ cmake -B build -DCMAKE_BUILD_TYPE=Release
-$ cd build
-$ make install.deb
+cmake -B build -DCMAKE_BUILD_TYPE=Release
+cd build
+make install
```
### Uninstall
+If you installed with `make install.deb`,
+
``` bash
-$ sudo apt remove meevax
+sudo apt remove meevax
+```
+
+or if you installed with `make install`,
+
+``` bash
+sudo rm -rf /usr/local/bin/meevax
+sudo rm -rf /usr/local/include/meevax
+sudo rm -rf /usr/local/lib/libmeevax*
+sudo rm -rf /usr/local/share/meevax
```
### CMake targets
| Target Name | Description
|--------------------|---
-| `all` (default) | Build shared-library `libmeevax.0.4.597.so` and executable `meevax`.
-| `test` | Test executable `meevax`.
-| `package` | Generate debian package `meevax_0.4.597_amd64.deb`.
-| `install` | Copy files into `/usr/local` __(1)__.
+| `all` (default) | Build shared-library `libmeevax.0.4.653.so` and executable `meevax`
+| `test` | Test executable `meevax`
+| `package` | Generate debian package `meevax_0.4.653_amd64.deb`
+| `install` | Copy files into `/usr/local`
| `install.deb` | `all` + `package` + `sudo apt install .deb`
-| `safe-install.deb` | `all` + `test` + `package` + `sudo apt install .deb`
-
-__(1)__ Meevax installed by `make install` cannot be uninstalled by the system's package manager (for example, `apt remove meevax`). You need to manually delete the following files to uninstall:
-
-- `/usr/local/bin/meevax`
-- `/usr/local/include/meevax`
-- `/usr/local/lib/libmeevax*`
-- `/usr/local/share/meevax`
## Usage
```
-Meevax Lisp 0.4.597
+Meevax Lisp 0.4.653
Usage:
meevax [option...] [file...]
@@ -129,13 +145,6 @@ Options:
```
-| Example | Effects |
-|:-------------------------------------------|:--|
-| `$ meevax -i` | Start interactive session. You can exit the session by input `(exit)` or Ctrl+C or Ctrl+D.
-| `$ meevax foo.ss` | Evaluate a script `foo.ss`. |
-| `$ meevax -e '(+ 1 2 3)'` | Display `6`.
-| `$ meevax -e "(define home \"$HOME\")" -i` | Define value of shell-environment variable `$HOME` as string typed Scheme variable `home`, and then start interactive session on environment includes the variable `home`.
-
## License
See [LICENSE](./LICENSE).
@@ -146,5 +155,6 @@ See [LICENSE](./LICENSE).
### Resources
-* [TinyScheme](http://tinyscheme.sourceforge.net/)
+* [Chibi-Scheme](https://github.com/ashinn/chibi-scheme)
* [SECDR-Scheme](http://www.maroon.dti.ne.jp/nagar17/mulasame/)
+* [TinyScheme](http://tinyscheme.sourceforge.net/)
diff --git a/VERSION b/VERSION
index 20975a8bb..e4b7959f1 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.4.597
+0.4.653
diff --git a/basis/meevax.ss b/basis/meevax.ss
new file mode 100644
index 000000000..d883dff98
--- /dev/null
+++ b/basis/meevax.ss
@@ -0,0 +1,107 @@
+(define-library (meevax macro-transformer)
+ (import (only (meevax comparator) eq? eqv?)
+ (only (meevax core) begin define if lambda quote set!)
+ (only (meevax list) null?)
+ (only (meevax macro) identifier? syntactic-closure? make-syntactic-closure)
+ (only (meevax pair) cons car cdr caar cdar))
+
+ (export make-syntactic-closure
+ identifier?
+ identifier=?
+ sc-macro-transformer
+ rsc-macro-transformer
+ er-macro-transformer)
+
+ (begin (define (sc-macro-transformer f)
+ (lambda (form use-env mac-env)
+ (make-syntactic-closure mac-env '() (f form use-env))))
+
+ (define (rsc-macro-transformer f)
+ (lambda (form use-env mac-env)
+ (make-syntactic-closure use-env '() (f form mac-env))))
+
+ (define (assq x alist)
+ (if (null? alist)
+ #f
+ (if (eq? x (caar alist))
+ (car alist)
+ (assq x (cdr alist)))))
+
+ (define (identifier=? environment1 identifier1
+ environment2 identifier2)
+ (eqv? (if (syntactic-closure? identifier1) identifier1 (make-syntactic-closure environment1 '() identifier1))
+ (if (syntactic-closure? identifier2) identifier2 (make-syntactic-closure environment2 '() identifier2))))
+
+ (define (er-macro-transformer f)
+ (lambda (form use-env mac-env)
+ (define cache '())
+ (f form
+ (lambda (x)
+ ((lambda (pare)
+ (if pare
+ (cdr pare)
+ (begin (set! cache (cons (cons x (make-syntactic-closure mac-env '() x))
+ cache))
+ (cdar cache))))
+ (assq x cache)))
+ (lambda (x y)
+ (identifier=? use-env x use-env y)))))))
+
+(define-library (meevax continuation)
+ (import (only (meevax context) emergency-exit)
+ (only (meevax comparator) eq?)
+ (only (meevax core) begin call-with-current-continuation! current define if install lambda)
+ (only (meevax pair) caar car cdar cdr cons pair?)
+ (only (meevax list) null?))
+
+ (export call-with-current-continuation dynamic-wind exit)
+
+ (begin (define (current-dynamic-extents)
+ (current 0))
+
+ (define (install-dynamic-extents! extents)
+ (install 0 extents))
+
+ (define (dynamic-wind before thunk after) ; https://www.cs.hmc.edu/~fleck/envision/scheme48/meeting/node7.html
+ (before)
+ (install-dynamic-extents! (cons (cons before after)
+ (current-dynamic-extents)))
+ ((lambda (result) ; TODO let-values
+ (install-dynamic-extents! (cdr (current-dynamic-extents)))
+ (after)
+ result) ; TODO (apply values result)
+ (thunk)))
+
+ (define (call-with-current-continuation procedure)
+ (define (windup! from to)
+ (install-dynamic-extents! from)
+ (if (eq? from to)
+ #t
+ (if (null? from)
+ (begin (windup! from (cdr to))
+ ((caar to)))
+ (if (null? to)
+ (begin ((cdar from))
+ (windup! (cdr from) to))
+ (begin ((cdar from))
+ (windup! (cdr from)
+ (cdr to))
+ ((caar to))))))
+ (install-dynamic-extents! to))
+ ((lambda (dynamic-extents)
+ (call-with-current-continuation!
+ (lambda (continue)
+ (procedure (lambda (x)
+ (windup! (current-dynamic-extents) dynamic-extents)
+ (continue x))))))
+ (current-dynamic-extents)))
+
+ (define (exit . xs)
+ (letrec ((for-each (lambda (f x)
+ (if (pair? x)
+ (begin (f (car x))
+ (for-each f (cdr x)))))))
+ (for-each (lambda (before/after)
+ ((cdr before/after)))
+ (current-dynamic-extents))
+ (emergency-exit . xs)))))
diff --git a/basis/r4rs-essential.ss b/basis/r4rs-essential.ss
index 0f8e2b1c7..4756c1c93 100644
--- a/basis/r4rs-essential.ss
+++ b/basis/r4rs-essential.ss
@@ -2,10 +2,12 @@
(import (meevax character)
(meevax core)
(meevax comparator)
+ (meevax continuation)
(rename (meevax environment)
(load %load))
(meevax function)
(meevax list)
+ (only (meevax macro-transformer) er-macro-transformer identifier?)
(meevax number)
(meevax pair)
(meevax port)
@@ -15,32 +17,32 @@
(meevax symbol)
(meevax vector)
(rename (meevax write)
- (write %write))
- (srfi 211 explicit-renaming))
+ (write %write)))
(export quote lambda if set! cond case and or let letrec begin quasiquote
define not boolean? eqv? eq? equal? pair? cons car cdr set-car!
- set-cdr! caar cadr cdar cddr caaar caadr cadar caddr cdaar cdadr cddar
- cdddr caaaar caaadr caadar caaddr cadaar cadadr caddar cadddr cdaaar
- cdaadr cdadar cdaddr cddaar cddadr cdddar cddddr null? list? list
- length append reverse list-ref memq memv member assq assv assoc
- symbol? symbol->string string->symbol number? complex? real? rational?
- integer? exact? inexact? = < > <= >= zero? positive? negative? odd?
- even? max min + * - / abs quotient remainder modulo gcd lcm floor
- ceiling truncate round number->string string->number char? char=?
- char char>? char<=? char>=? char-ci=? char-ci char-ci>? char-ci<=?
- char-ci>=? char-alphabetic? char-numeric? char-whitespace?
- char-upper-case? char-lower-case? char->integer integer->char
- char-upcase char-downcase string? make-string string string-length
- string-ref string-set! string=? string string>? string<=? string>=?
- string-ci=? string-ci string-ci>? string-ci<=? string-ci>=?
- substring string-append string->list list->string vector? make-vector
- vector vector-length vector-ref vector-set! vector->list list->vector
- procedure? apply map for-each call-with-current-continuation
- call-with-input-file call-with-output-file input-port? output-port?
- current-input-port current-output-port open-input-file
- open-output-file close-input-port close-output-port read read-char
- peek-char eof-object? write display newline write-char load)
+ set-cdr! caar cadr cdar cddr caaar caadr cadar caddr cdaar cdadr
+ cddar cdddr caaaar caaadr caadar caaddr cadaar cadadr caddar cadddr
+ cdaaar cdaadr cdadar cdaddr cddaar cddadr cdddar cddddr null? list?
+ list length append reverse list-ref memq memv member assq assv assoc
+ symbol? symbol->string string->symbol number? complex? real?
+ rational? integer? exact? inexact? = < > <= >= zero? positive?
+ negative? odd? even? max min + * - / abs quotient remainder modulo
+ gcd lcm floor ceiling truncate round number->string string->number
+ char? char=? char char>? char<=? char>=? char-ci=? char-ci
+ char-ci>? char-ci<=? char-ci>=? char-alphabetic? char-numeric?
+ char-whitespace? char-upper-case? char-lower-case? char->integer
+ integer->char char-upcase char-downcase string? make-string string
+ string-length string-ref string-set! string=? string string>?
+ string<=? string>=? string-ci=? string-ci string-ci>? string-ci<=?
+ string-ci>=? substring string-append string->list list->string
+ vector? make-vector vector vector-length vector-ref vector-set!
+ vector->list list->vector procedure? apply map for-each
+ call-with-current-continuation call-with-input-file
+ call-with-output-file input-port? output-port? current-input-port
+ current-output-port open-input-file open-output-file close-input-port
+ close-output-port read read-char peek-char eof-object? write display
+ newline write-char load)
(begin (define (list . xs) xs)
@@ -318,7 +320,7 @@
(define (exact? z)
(define (exact-complex? x)
- (and (%complex? x)
+ (and (imaginary? x)
(exact? (real-part x))
(exact? (imag-part x))))
(or (exact-complex? z)
@@ -327,7 +329,7 @@
(define (inexact? z)
(define (inexact-complex? x)
- (and (%complex? x)
+ (and (imaginary? x)
(or (inexact? (real-part x))
(inexact? (imag-part x)))))
(define (floating-point? z)
@@ -496,16 +498,9 @@
(list->string xs))
(define (string-map f x . xs) ; r7rs
- (define (string-map-1 x)
- (list->string
- (map f (string->list x))))
- (define (string-map-n xs)
- (map list->string
- (map (lambda (c) (map f c))
- (map string->list xs))))
(if (null? xs)
- (string-map-1 x)
- (string-map-n (cons x xs))))
+ (list->string (map f (string->list x)))
+ (list->string (apply map f (map string->list (cons x xs))))))
(define (string-foldcase s) ; r7rs
(string-map char-downcase s))
@@ -542,9 +537,6 @@
(begin (apply map f x xs)
(if #f #f))))
- (define (call-with-current-continuation f)
- (call-with-current-continuation! f))
-
(define (call-with-input-file path f) ; r7rs incompatible (values unsupported)
(define (call-with-input-port port f)
(let ((result (f port)))
diff --git a/basis/r4rs.ss b/basis/r4rs.ss
index 3130da404..16a1040f8 100644
--- a/basis/r4rs.ss
+++ b/basis/r4rs.ss
@@ -1,14 +1,14 @@
(define-library (scheme r4rs)
(import (meevax inexact)
(only (meevax core) define-syntax)
+ (only (meevax macro-transformer) er-macro-transformer)
(only (meevax number) exact-integer? expt exact inexact ratio? ratio-numerator ratio-denominator)
(only (meevax port) input-port output-port)
(only (meevax read) get-ready?)
(only (meevax string) string-copy)
(only (meevax vector) vector-fill!)
(scheme r4rs essential)
- (srfi 45)
- (srfi 211 explicit-renaming))
+ (srfi 45))
(export quote lambda if set! cond case and or let let* letrec begin do delay
quasiquote define not boolean? eqv? eq? equal? pair? cons car cdr
@@ -16,29 +16,29 @@
cdadr cddar cdddr caaaar caaadr caadar caaddr cadaar cadadr caddar
cadddr cdaaar cdaadr cdadar cdaddr cddaar cddadr cdddar cddddr null?
list? list length append reverse list-tail list-ref memq memv member
- assq assv assoc symbol? symbol->string string->symbol number? complex?
- real? rational? integer? exact? inexact? = < > <= >= zero? positive?
- negative? odd? even? max min + * - / abs quotient remainder modulo
- gcd lcm numerator denominator floor ceiling truncate round rationalize
- exp log sin cos tan asin acos atan sqrt expt make-rectangular
- make-polar real-part imag-part magnitude angle
+ assq assv assoc symbol? symbol->string string->symbol number?
+ complex? real? rational? integer? exact? inexact? = < > <= >= zero?
+ positive? negative? odd? even? max min + * - / abs quotient remainder
+ modulo gcd lcm numerator denominator floor ceiling truncate round
+ rationalize exp log sin cos tan asin acos atan sqrt expt
+ make-rectangular make-polar real-part imag-part magnitude angle
(rename inexact exact->inexact) (rename exact inexact->exact)
number->string string->number char? char=? char char>? char<=?
char>=? char-ci=? char-ci char-ci>? char-ci<=? char-ci>=?
char-alphabetic? char-numeric? char-whitespace? char-upper-case?
char-lower-case? char->integer integer->char char-upcase
char-downcase string? make-string string string-length string-ref
- string-set! string=? string string>? string<=? string>=? string-ci=?
- string-ci string-ci>? string-ci<=? string-ci>=? substring
- string-append string->list list->string string-copy string-fill!
- vector? make-vector vector vector-length vector-ref vector-set!
- vector->list list->vector vector-fill! procedure? apply map for-each
- force call-with-current-continuation call-with-input-file
- call-with-output-file input-port? output-port? current-input-port
- current-output-port with-input-from-file with-output-to-file
- open-input-file open-output-file close-input-port close-output-port
- read read-char peek-char eof-object? char-ready? write display newline
- write-char load)
+ string-set! string=? string string>? string<=? string>=?
+ string-ci=? string-ci string-ci>? string-ci<=? string-ci>=?
+ substring string-append string->list list->string string-copy
+ string-fill! vector? make-vector vector vector-length vector-ref
+ vector-set! vector->list list->vector vector-fill! procedure? apply
+ map for-each force call-with-current-continuation
+ call-with-input-file call-with-output-file input-port? output-port?
+ current-input-port current-output-port with-input-from-file
+ with-output-to-file open-input-file open-output-file close-input-port
+ close-output-port read read-char peek-char eof-object? char-ready?
+ write display newline write-char load)
(begin (define-syntax let*
(er-macro-transformer
@@ -108,10 +108,10 @@
(* radius (sin phi))))
(define (real-part z)
- (if (%complex? z) (car z) z))
+ (if (imaginary? z) (car z) z))
(define (imag-part z)
- (if (%complex? z) (cdr z) 0))
+ (if (imaginary? z) (cdr z) 0))
(define (magnitude z)
(sqrt (+ (square (real-part z))
diff --git a/basis/r5rs.ss b/basis/r5rs.ss
index 610342c8b..3950fd30e 100644
--- a/basis/r5rs.ss
+++ b/basis/r5rs.ss
@@ -1,54 +1,8 @@
-(define-library (scheme r5rs continuation)
- (import (meevax context)
- (only (meevax core) call-with-current-continuation! current define-syntax install)
- (except (scheme r4rs) call-with-current-continuation))
-
- (export call-with-current-continuation dynamic-wind exit)
-
- ; https://www.cs.hmc.edu/~fleck/envision/scheme48/meeting/node7.html
-
- (begin (define (current-dynamic-extents)
- (current 0))
-
- (define (install-dynamic-extents! extents)
- (install 0 extents))
-
- (define (dynamic-wind before thunk after)
- (before)
- (install-dynamic-extents! (cons (cons before after)
- (current-dynamic-extents)))
- ((lambda (result) ; TODO let-values
- (install-dynamic-extents! (cdr (current-dynamic-extents)))
- (after)
- result) ; TODO (apply values result)
- (thunk)))
-
- (define (call-with-current-continuation procedure)
- (define (windup! from to)
- (install-dynamic-extents! from)
- (cond ((eq? from to))
- ((null? from) (windup! from (cdr to)) ((caar to)))
- ((null? to) ((cdar from)) (windup! (cdr from) to))
- (else ((cdar from)) (windup! (cdr from) (cdr to)) ((caar to))))
- (install-dynamic-extents! to))
- (let ((dynamic-extents (current-dynamic-extents)))
- (call-with-current-continuation!
- (lambda (continue)
- (procedure (lambda (x)
- (windup! (current-dynamic-extents) dynamic-extents)
- (continue x)))))))
-
- (define (exit . normally?)
- (for-each (lambda (before/after)
- ((cdr before/after)))
- (current-dynamic-extents))
- (apply emergency-exit normally?))))
-
(define-library (scheme r5rs)
- (import (only (meevax core) define-syntax let-syntax letrec-syntax)
+ (import (only (meevax continuation) dynamic-wind)
+ (only (meevax core) define-syntax let-syntax letrec-syntax)
(only (meevax environment) environment eval)
- (except (scheme r4rs) call-with-current-continuation)
- (except (scheme r5rs continuation) exit)
+ (scheme r4rs)
(srfi 149))
(export quote lambda if set! cond case and or let let* letrec begin do delay
@@ -71,9 +25,9 @@
make-string string string-length string-ref string-set! string=?
string string>? string<=? string>=? string-ci=? string-ci
string-ci>? string-ci<=? string-ci>=? substring string-append
- string->list list->string string-copy string-fill! vector? make-vector
- vector vector-length vector-ref vector-set! vector->list list->vector
- vector-fill! procedure? apply map for-each force
+ string->list list->string string-copy string-fill! vector?
+ make-vector vector vector-length vector-ref vector-set! vector->list
+ list->vector vector-fill! procedure? apply map for-each force
call-with-current-continuation values call-with-values dynamic-wind
eval scheme-report-environment null-environment
interaction-environment call-with-input-file call-with-output-file
diff --git a/basis/r7rs.ss b/basis/r7rs.ss
index a4ef8d7b7..8e7213950 100644
--- a/basis/r7rs.ss
+++ b/basis/r7rs.ss
@@ -1,10 +1,12 @@
(define-library (scheme base)
(import (only (meevax error) error-object? read-error? file-error?)
+ (only (meevax macro-transformer) er-macro-transformer)
(only (meevax number) exact-integer? exact-integer-square-root)
- (only (meevax vector) vector-append vector-copy vector-copy! string->vector)
(only (meevax port) binary-port? textual-port? port? input-port open? output-port flush error-port eof-object)
(only (meevax read) get-char get-char! get-ready?)
(only (meevax string) string-copy! vector->string)
+ (only (meevax vector homogeneous) u8vector? make-u8vector u8vector u8vector-length u8vector-ref u8vector-set! u8vector-copy u8vector-copy! u8vector-append u8vector->string string->u8vector)
+ (only (meevax vector) vector-append vector-copy vector-copy! string->vector)
(only (meevax version) features)
(only (meevax write) put-char put-string)
(scheme r5rs)
@@ -13,18 +15,16 @@
(srfi 11)
(srfi 23)
(srfi 34)
- (srfi 39)
- (srfi 211 explicit-renaming))
+ (srfi 39))
(export ; 4.1. Primitive expression types
quote lambda if set!
- ; include
- ; include-ci
+ ; include include-ci
cond else => case and or when unless
; cond-expand
- let let* letrec letrec* let-values let*-values begin do make-parameter
- parameterize guard quasiquote unquote unquote-splicing let-syntax
- letrec-syntax syntax-rules _ ... syntax-error
+ let let* letrec letrec* let-values let*-values begin do
+ make-parameter parameterize guard quasiquote unquote unquote-splicing
+ let-syntax letrec-syntax syntax-rules _ ... syntax-error
; 5.3. Variable definitions
define define-values define-syntax define-record-type
@@ -36,28 +36,31 @@
number? complex? real? rational? integer? exact? inexact?
exact-integer? = < > <= >= zero? positive? negative? odd? even? max
min + * - / abs floor/ floor-quotient floor-remainder truncate/
- truncate-quotient truncate-remainder quotient remainder modulo gcd lcm
- numerator denominator floor ceiling truncate round rationalize square
- exact-integer-sqrt expt inexact exact number->string string->number
+ truncate-quotient truncate-remainder quotient remainder modulo gcd
+ lcm numerator denominator floor ceiling truncate round rationalize
+ square exact-integer-sqrt expt inexact exact number->string
+ string->number
; 6.3. Booleans
not boolean? boolean=?
; 6.4. Pairs and lists
pair? cons car cdr set-car! set-cdr! caar cadr cdar cddr null? list?
- make-list list length append reverse list-tail list-ref list-set! memq
- memv member assq assv assoc list-copy
+ make-list list length append reverse list-tail list-ref list-set!
+ memq memv member assq assv assoc list-copy
; 6.5. Symbols
symbol? symbol=? symbol->string string->symbol
; 6.6. Characters
- char? char=? char char>? char<=? char>=? char->integer integer->char
+ char? char=? char char>? char<=? char>=? char->integer
+ integer->char
; 6.7. Strings
string? make-string string string-length string-ref string-set!
- string=? string>? string string<=? string>=? substring string-append
- string->list list->string string-copy string-copy! string-fill!
+ string=? string>? string string<=? string>=? substring
+ string-append string->list list->string string-copy string-copy!
+ string-fill!
; 6.8. Vectors
vector? make-vector vector vector-length vector-ref vector-set!
@@ -65,24 +68,13 @@
vector-copy! vector-append vector-fill!
; 6.9. Bytevectors
- ; bytevector?
- ; make-bytevector
- ; bytevector
- ; bytevector-length
- ; bytevector-u8-ref
- ; bytevector-u8-set!
- ; bytevector-copy
- ; bytevector-copy!
- ; bytevector-append
- ; utf8->string
- ; string->utf8
+ bytevector? make-bytevector bytevector bytevector-length
+ bytevector-u8-ref bytevector-u8-set! bytevector-copy bytevector-copy!
+ bytevector-append utf8->string string->utf8
; 6.10. Control features
- procedure? apply map string-map
- ; vector-map
- for-each
- ; string-for-each
- ; vector-for-each
+ procedure? apply map string-map vector-map for-each
+ ; string-for-each vector-for-each
call-with-current-continuation call/cc values call-with-values
dynamic-wind
@@ -96,21 +88,14 @@
current-output-port current-error-port close-port close-input-port
close-output-port open-input-string open-output-string
get-output-string
- ; open-input-bytevector
- ; open-output-bytevector
- ; get-output-bytevector
+ ; open-input-bytevector open-output-bytevector get-output-bytevector
read-char peek-char
; read-line
eof-object? eof-object char-ready?
- ; read-string
- ; read-u8
- ; peek-u8
- ; u8-ready?
- ; read-bytevector
+ ; read-string read-u8 peek-u8 u8-ready? read-bytevector
; read-bytevector!
newline write-char write-string
- ; write-u8
- ; write-bytevector
+ ; write-u8 write-bytevector
flush-output-port
; 6.14. System interface
@@ -224,17 +209,37 @@
(define symbol=? eqv?)
+ (define bytevector? u8vector?)
+
+ (define make-bytevector make-u8vector)
+
+ (define bytevector u8vector)
+
+ (define bytevector-length u8vector-length)
+
+ (define bytevector-u8-ref u8vector-ref)
+
+ (define bytevector-u8-set! u8vector-set!)
+
+ (define bytevector-copy u8vector-copy)
+
+ (define bytevector-copy! u8vector-copy!)
+
+ (define bytevector-append u8vector-append)
+
+ (define utf8->string u8vector->string)
+
+ (define string->utf8 string->u8vector)
+
(define (string-map f x . xs)
- (define (string-map-1 x)
- (list->string
- (map f (string->list x))))
- (define (string-map-n xs)
- (map list->string
- (map (lambda (c) (map f c))
- (map string->list xs))))
(if (null? xs)
- (string-map-1 x)
- (string-map-n (cons x xs))))
+ (list->string (map f (string->list x)))
+ (list->string (apply map f (map string->list (cons x xs))))))
+
+ (define (vector-map f x . xs)
+ (if (null? xs)
+ (list->vector (map f (vector->list x)))
+ (list->vector (apply map f (map vector->list (cons x xs))))))
(define call/cc call-with-current-continuation)
@@ -510,16 +515,14 @@
(export load))
(define-library (scheme process-context)
- (import (meevax context)
- (scheme r5rs continuation)
- )
- (export ; command-line
+ (import (only (meevax context) command-line emergency-exit)
+ (only (meevax continuation) exit)
+ (srfi 98))
+ (export command-line
exit
emergency-exit
- ; get-environment-variable
- ; get-environment-variables
- )
- )
+ get-environment-variable
+ get-environment-variables))
(define-library (scheme time)
(export current-second
diff --git a/basis/srfi-1.ss b/basis/srfi-1.ss
index 91cbe72c5..d5d71bc1a 100644
--- a/basis/srfi-1.ss
+++ b/basis/srfi-1.ss
@@ -1,10 +1,10 @@
-; https://srfi.schemers.org/srfi-1/srfi-1.html
-;
-; Copyright (c) 1998, 1999 by Olin Shivers.
-;
-; You may do as you please with this code as long as you do not remove this
-; copyright notice or hold me liable for its use. Please send bug reports to
-; shivers@ai.mit.edu. -Olin
+#|
+ Copyright (c) 1998, 1999 by Olin Shivers.
+
+ You may do as you please with this code as long as you do not remove this
+ copyright notice or hold me liable for its use. Please send bug reports to
+ shivers@ai.mit.edu. -Olin
+|#
(define-library (srfi 1)
(import (scheme base)
diff --git a/basis/srfi-149.ss b/basis/srfi-149.ss
index fba760e2f..5bc999ab4 100644
--- a/basis/srfi-149.ss
+++ b/basis/srfi-149.ss
@@ -1,33 +1,33 @@
-; Copyright (c) 2009-2021 Alex Shinn
-; All rights reserved.
-;
-; Redistribution and use in source and binary forms, with or without
-; modification, are permitted provided that the following conditions
-; are met:
-; 1. Redistributions of source code must retain the above copyright
-; notice, this list of conditions and the following disclaimer.
-; 2. Redistributions in binary form must reproduce the above copyright
-; notice, this list of conditions and the following disclaimer in the
-; documentation and/or other materials provided with the distribution.
-; 3. The name of the author may not be used to endorse or promote products
-; derived from this software without specific prior written permission.
-;
-; THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-; OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-; IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-; NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#|
+ Copyright (c) 2009-2021 Alex Shinn All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|#
(define-library (srfi 149)
(import (only (meevax core) define-syntax quote-syntax)
+ (only (meevax macro-transformer) er-macro-transformer identifier?)
(only (meevax symbol) identifier->symbol)
- (scheme r4rs)
- (srfi 211 explicit-renaming))
+ (scheme r4rs))
(export syntax-rules)
diff --git a/basis/srfi-211.ss b/basis/srfi-211.ss
deleted file mode 100644
index f06075d3a..000000000
--- a/basis/srfi-211.ss
+++ /dev/null
@@ -1,45 +0,0 @@
-(define-library (srfi 211 syntactic-closures)
- (import (meevax core)
- (meevax macro))
-
- (begin (define (sc-macro-transformer f)
- (lambda (form use-env mac-env)
- (make-syntactic-closure mac-env '() (f form use-env))))
-
- (define (rsc-macro-transformer f)
- (lambda (form use-env mac-env)
- (make-syntactic-closure use-env '() (f form mac-env)))))
-
- (export sc-macro-transformer rsc-macro-transformer make-syntactic-closure identifier?))
-
-(define-library (srfi 211 explicit-renaming)
- (import (meevax comparator)
- (meevax core)
- (meevax list)
- (meevax macro)
- (meevax pair))
-
- (begin (define (er-macro-transformer f)
- (lambda (form use-env mac-env)
- (define renames '())
- (define (rename x)
- (letrec ((assq (lambda (x alist)
- (if (null? alist) #f
- (if (eq? x (caar alist))
- (car alist)
- (assq x (cdr alist))))))
- (alist-cons (lambda (key x alist)
- (cons (cons key x) alist))))
- (define key/value (assq x renames))
- (if key/value
- (cdr key/value)
- (begin (set! renames (alist-cons x (make-syntactic-closure mac-env '() x) renames))
- (cdar renames)))))
- (define (compare x y)
- (eqv? (if (syntactic-closure? x) x
- (make-syntactic-closure use-env '() x))
- (if (syntactic-closure? y) y
- (make-syntactic-closure use-env '() y))))
- (f form rename compare))))
-
- (export er-macro-transformer identifier?))
diff --git a/basis/srfi-31.ss b/basis/srfi-31.ss
new file mode 100644
index 000000000..ff72d7641
--- /dev/null
+++ b/basis/srfi-31.ss
@@ -0,0 +1,31 @@
+#|
+ Copyright (C) Dr. Mirko Luedde (2002). All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to
+ deal in the Software without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ IN THE SOFTWARE.
+|#
+
+(define-library (srfi 31)
+ (import (scheme base))
+ (export rec)
+ (begin (define-syntax rec
+ (syntax-rules ()
+ ((rec (name . variables) . body)
+ (letrec ((name (lambda variables . body))) name))
+ ((rec name expression)
+ (letrec ((name expression)) name))))))
diff --git a/basis/srfi-34.ss b/basis/srfi-34.ss
index 038590f59..f92271826 100644
--- a/basis/srfi-34.ss
+++ b/basis/srfi-34.ss
@@ -1,22 +1,24 @@
-; Copyright (C) Richard Kelsey, Michael Sperber (2002). All Rights Reserved.
-;
-; Permission is hereby granted, free of charge, to any person obtaining a copy
-; of this software and associated documentation files (the "Software"), to
-; deal in the Software without restriction, including without limitation the
-; rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-; sell copies of the Software, and to permit persons to whom the Software is
-; furnished to do so, subject to the following conditions:
-;
-; The above copyright notice and this permission notice shall be included in
-; all copies or substantial portions of the Software.
-;
-; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-; IN THE SOFTWARE.
+#|
+ Copyright (C) Richard Kelsey, Michael Sperber (2002). All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to
+ deal in the Software without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ IN THE SOFTWARE.
+|#
(define-library (srfi 34)
(import (only (meevax error) throw kernel-exception-handler-set!)
diff --git a/basis/srfi-38.ss b/basis/srfi-38.ss
index 2aff3a845..9edbe2397 100644
--- a/basis/srfi-38.ss
+++ b/basis/srfi-38.ss
@@ -1,22 +1,24 @@
-; Copyright (C) Ray Dillinger 2003. All Rights Reserved.
-;
-; Permission is hereby granted, free of charge, to any person obtaining a copy
-; of this software and associated documentation files (the "Software"), to deal
-; in the Software without restriction, including without limitation the rights
-; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-; copies of the Software, and to permit persons to whom the Software is
-; furnished to do so, subject to the following conditions:
-;
-; The above copyright notice and this permission notice shall be included in
-; all copies or substantial portions of the Software.
-;
-; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-; THE SOFTWARE.
+#|
+ Copyright (C) Ray Dillinger 2003. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to
+ deal in the Software without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ IN THE SOFTWARE.
+|#
(define-library (srfi 38)
(import (scheme r5rs)
diff --git a/basis/srfi-39.ss b/basis/srfi-39.ss
index fd4697f8b..00e047a61 100644
--- a/basis/srfi-39.ss
+++ b/basis/srfi-39.ss
@@ -1,27 +1,29 @@
-; Copyright (C) Marc Feeley 2002. All Rights Reserved.
-;
-; Permission is hereby granted, free of charge, to any person obtaining a copy
-; of this software and associated documentation files (the "Software"), to deal
-; in the Software without restriction, including without limitation the rights
-; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-; copies of the Software, and to permit persons to whom the Software is
-; furnished to do so, subject to the following conditions:
-;
-; The above copyright notice and this permission notice shall be included in all
-; copies or substantial portions of the Software.
-;
-; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-; SOFTWARE.
+#|
+ Copyright (C) Marc Feeley 2002. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to
+ deal in the Software without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ IN THE SOFTWARE.
+|#
(define-library (srfi 39)
(import (only (meevax core) current install)
- (scheme r5rs)
- (srfi 211 explicit-renaming))
+ (only (meevax macro-transformer) er-macro-transformer)
+ (scheme r5rs))
(export make-parameter parameterize)
diff --git a/basis/srfi-4.ss b/basis/srfi-4.ss
new file mode 100644
index 000000000..0fe6465ac
--- /dev/null
+++ b/basis/srfi-4.ss
@@ -0,0 +1,32 @@
+(define-library (srfi 4)
+ (import (meevax vector homogeneous))
+ (export
+ f32vector? make-f32vector f32vector f32vector-length f32vector-ref
+ f32vector-set! f32vector->list list->f32vector
+
+ f64vector? make-f64vector f64vector f64vector-length f64vector-ref
+ f64vector-set! f64vector->list list->f64vector
+
+ s8vector? make-s8vector s8vector s8vector-length s8vector-ref
+ s8vector-set! s8vector->list list->s8vector
+
+ s16vector? make-s16vector s16vector s16vector-length s16vector-ref
+ s16vector-set! s16vector->list list->s16vector
+
+ s32vector? make-s32vector s32vector s32vector-length s32vector-ref
+ s32vector-set! s32vector->list list->s32vector
+
+ s64vector? make-s64vector s64vector s64vector-length s64vector-ref
+ s64vector-set! s64vector->list list->s64vector
+
+ u8vector? make-u8vector u8vector u8vector-length u8vector-ref
+ u8vector-set! u8vector->list list->u8vector
+
+ u16vector? make-u16vector u16vector u16vector-length u16vector-ref
+ u16vector-set! u16vector->list list->u16vector
+
+ u32vector? make-u32vector u32vector u32vector-length u32vector-ref
+ u32vector-set! u32vector->list list->u32vector
+
+ u64vector? make-u64vector u64vector u64vector-length u64vector-ref
+ u64vector-set! u64vector->list list->u64vector))
diff --git a/basis/srfi-45.ss b/basis/srfi-45.ss
index d3f2ce071..6e07b5634 100644
--- a/basis/srfi-45.ss
+++ b/basis/srfi-45.ss
@@ -1,7 +1,7 @@
(define-library (srfi 45) ; Based on r7rs reference implementation.
- (import (scheme r4rs essential)
- (only (meevax core) define-syntax)
- (srfi 211 explicit-renaming))
+ (import (only (meevax core) define-syntax)
+ (only (meevax macro-transformer) er-macro-transformer)
+ (scheme r4rs essential))
(export delay eager force lazy promise?)
diff --git a/basis/srfi-78.ss b/basis/srfi-78.ss
index 780fd3133..f70cd5876 100644
--- a/basis/srfi-78.ss
+++ b/basis/srfi-78.ss
@@ -1,23 +1,23 @@
#|
Copyright (C) Sebastian Egner (2005-2006). All Rights Reserved.
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to
+ deal in the Software without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- DEALINGS IN THE SOFTWARE.
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ IN THE SOFTWARE.
|#
(define-library (srfi 78)
diff --git a/basis/srfi-8.ss b/basis/srfi-8.ss
index a7522b28f..4303a77c0 100644
--- a/basis/srfi-8.ss
+++ b/basis/srfi-8.ss
@@ -1,23 +1,23 @@
#|
Copyright (C) John David Stone (1999). All Rights Reserved.
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to
+ deal in the Software without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- DEALINGS IN THE SOFTWARE.
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ IN THE SOFTWARE.
|#
(define-library (srfi 8)
diff --git a/basis/srfi-9.ss b/basis/srfi-9.ss
index cc4b9c8b3..136d905c1 100644
--- a/basis/srfi-9.ss
+++ b/basis/srfi-9.ss
@@ -1,23 +1,23 @@
#|
Copyright (C) Richard Kelsey (1999). All Rights Reserved.
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to
+ deal in the Software without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- DEALINGS IN THE SOFTWARE.
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ IN THE SOFTWARE.
|#
(define-library (srfi 9)
diff --git a/basis/srfi-98.ss b/basis/srfi-98.ss
new file mode 100644
index 000000000..57af949b0
--- /dev/null
+++ b/basis/srfi-98.ss
@@ -0,0 +1,4 @@
+(define-library (srfi 98)
+ (import (meevax system))
+ (export get-environment-variable
+ get-environment-variables))
diff --git a/configure/README.md b/configure/README.md
index a5c15bbdb..359605361 100644
--- a/configure/README.md
+++ b/configure/README.md
@@ -3,26 +3,37 @@
-
+
## Overview
> Programming languages should be designed not by piling feature on top of feature, but by removing the weaknesses and restrictions that make additional features appear necessary.
->
-> Revised7 Report on the Algorithmic Language Scheme [1]
->
+>
Revised7 Report on the Algorithmic Language Scheme [1]
Meevax is an implementation of Lisp-1 programming language, supporting subset of the [Scheme](http://www.scheme-reports.org/) (R7RS) and [SRFI](https://srfi.schemers.org/)s.
@@ -45,12 +56,14 @@ Subset of R7RS-small.
|--------------------------------------------------------:|:-------------------------------------------------------|:------------------------------------------------------|:------------------|
| [ 1](https://srfi.schemers.org/srfi-1/srfi-1.html) | List Library | [`(srfi 1)`](./basis/srfi-1.ss) | |
| [ 6](https://srfi.schemers.org/srfi-6/srfi-6.html) | Basic String Ports | [`(srfi 6)`](./basis/srfi-6.ss) | R7RS 6.13 |
+| [ 4](https://srfi.schemers.org/srfi-4/srfi-4.html) | Homogeneous numeric vector datatypes | [`(srfi 4)`](./basis/srfi-4.ss) | R7RS 6.9 |
| [ 8](https://srfi.schemers.org/srfi-8/srfi-8.html) | receive: Binding to multiple values | [`(srfi 8)`](./basis/srfi-8.ss) | |
| [ 9](https://srfi.schemers.org/srfi-9/srfi-9.html) | Defining Record Types | [`(srfi 9)`](./basis/srfi-9.ss) | R7RS 5.5 |
| [ 10](https://srfi.schemers.org/srfi-10/srfi-10.html) | #, external form | | |
| [ 11](https://srfi.schemers.org/srfi-11/srfi-11.html) | Syntax for receiving multiple values | [`(srfi 11)`](./basis/srfi-11.ss) | R7RS 4.2.2 |
| [ 23](https://srfi.schemers.org/srfi-23/srfi-23.html) | Error reporting mechanism | [`(srfi 23)`](./basis/srfi-23.ss) | R7RS 6.11 |
| [ 30](https://srfi.schemers.org/srfi-30/srfi-30.html) | Nested Multi-line Comments | | R7RS 2.2 |
+| [ 31](https://srfi.schemers.org/srfi-31/srfi-31.html) | A special form rec for recursive evaluation | [`(srfi 31)`](./basis/srfi-31.ss) | |
| [ 34](https://srfi.schemers.org/srfi-34/srfi-34.html) | Exception Handling for Programs | [`(srfi 34)`](./basis/srfi-34.ss) | R7RS 6.11 |
| [ 38](https://srfi.schemers.org/srfi-38/srfi-38.html) | External Representation for Data With Shared Structure | [`(srfi 38)`](./basis/srfi-38.ss) | R7RS 6.13.3 |
| [ 39](https://srfi.schemers.org/srfi-39/srfi-39.html) | Parameter objects | [`(srfi 39)`](./basis/srfi-39.ss) | R7RS 4.2.6 |
@@ -58,12 +71,12 @@ Subset of R7RS-small.
| [ 62](https://srfi.schemers.org/srfi-62/srfi-62.html) | S-expression comments | | R7RS 2.2 |
| [ 78](https://srfi.schemers.org/srfi-78/srfi-78.html) | Lightweight testing | [`(srfi 78)`](./basis/srfi-78.ss) | Except `check-ec` |
| [ 87](https://srfi.schemers.org/srfi-87/srfi-87.html) | => in case clauses | | R7RS 4.2.1 |
+| [ 98](https://srfi.schemers.org/srfi-98/srfi-98.html) | An interface to access environment variables | [`(srfi 98)`](./basis/srfi-98.ss) | R7RS 6.14 |
| [149](https://srfi.schemers.org/srfi-149/srfi-149.html) | Basic syntax-rules template extensions | [`(srfi 149)`](./basis/srfi-149.ss) | R7RS 4.3.2 |
-| [211](https://srfi.schemers.org/srfi-211/srfi-211.html) | Scheme Macro Libraries | [`(srfi 211 explicit-renaming)`](./basis/srfi-211.ss) | |
-## Requirements
+## Installation
-### Software
+### Requirements
- [GCC](https://gcc.gnu.org/) (>= 9.4.0) or [Clang](https://clang.llvm.org/) (>= 11.0.0)
- [CMake](https://cmake.org/) (>= ${CMAKE_MINIMUM_REQUIRED_VERSION})
@@ -71,45 +84,48 @@ Subset of R7RS-small.
- [GNU Binutils](https://www.gnu.org/software/binutils/)
- [GNU Multiple Precision Arithmetic Library (GMP)](https://gmplib.org/)
-To install the above software, it is easy to use the following script.
+### Install
``` bash
-$ ./script/setup.sh
+cmake -B build -DCMAKE_BUILD_TYPE=Release
+cd build
+make install.deb
```
-## Installation
-
-### Install
+or
``` bash
-$ cmake -B build -DCMAKE_BUILD_TYPE=Release
-$ cd build
-$ make install.deb
+cmake -B build -DCMAKE_BUILD_TYPE=Release
+cd build
+make install
```
### Uninstall
+If you installed with `make install.deb`,
+
``` bash
-$ sudo apt remove meevax
+sudo apt remove meevax
+```
+
+or if you installed with `make install`,
+
+``` bash
+sudo rm -rf ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME}
+sudo rm -rf ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
+sudo rm -rf ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}*
+sudo rm -rf ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}
```
### CMake targets
| Target Name | Description
|--------------------|---
-| `all` (default) | Build shared-library `libmeevax.${PROJECT_VERSION}.so` and executable `meevax`.
-| `test` | Test executable `meevax`.
-| `package` | Generate debian package `meevax_${PROJECT_VERSION}_amd64.deb`.
-| `install` | Copy files into `/usr/local` __(1)__.
+| `all` (default) | Build shared-library `libmeevax.${PROJECT_VERSION}.so` and executable `meevax`
+| `test` | Test executable `meevax`
+| `package` | Generate debian package `meevax_${PROJECT_VERSION}_amd64.deb`
+| `install` | Copy files into `/usr/local`
| `install.deb` | `all` + `package` + `sudo apt install .deb`
-| `safe-install.deb` | `all` + `test` + `package` + `sudo apt install .deb`
-
-__(1)__ Meevax installed by `make install` cannot be uninstalled by the system's package manager (for example, `apt remove meevax`). You need to manually delete the following files to uninstall:
-
-- `${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME}`
-- `${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}`
-- `${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}*`
-- `${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}`
## Usage
@@ -117,13 +133,6 @@ __(1)__ Meevax installed by `make install` cannot be uninstalled by the system's
${${PROJECT_NAME}_HELP_TEXT}
```
-| Example | Effects |
-|:-------------------------------------------|:--|
-| `$ meevax -i` | Start interactive session. You can exit the session by input `(exit)` or Ctrl+C or Ctrl+D.
-| `$ meevax foo.ss` | Evaluate a script `foo.ss`. |
-| `$ meevax -e '(+ 1 2 3)'` | Display `6`.
-| `$ meevax -e "(define home \"$HOME\")" -i` | Define value of shell-environment variable `$HOME` as string typed Scheme variable `home`, and then start interactive session on environment includes the variable `home`.
-
## License
See [LICENSE](./LICENSE).
@@ -134,5 +143,6 @@ See [LICENSE](./LICENSE).
### Resources
-* [TinyScheme](http://tinyscheme.sourceforge.net/)
+* [Chibi-Scheme](https://github.com/ashinn/chibi-scheme)
* [SECDR-Scheme](http://www.maroon.dti.ne.jp/nagar17/mulasame/)
+* [TinyScheme](http://tinyscheme.sourceforge.net/)
diff --git a/configure/basis.cpp b/configure/basis.cpp
index 353e36ca8..f0328455a 100644
--- a/configure/basis.cpp
+++ b/configure/basis.cpp
@@ -20,24 +20,30 @@ namespace meevax
{
inline namespace kernel
{
- script const basis = R"###(
-${${PROJECT_NAME}_BASIS_r4rs.ss}
-${${PROJECT_NAME}_BASIS_r4rs-essential.ss}
-${${PROJECT_NAME}_BASIS_r5rs.ss}
-${${PROJECT_NAME}_BASIS_r7rs.ss}
-${${PROJECT_NAME}_BASIS_srfi-1.ss}
-${${PROJECT_NAME}_BASIS_srfi-6.ss}
-${${PROJECT_NAME}_BASIS_srfi-8.ss}
-${${PROJECT_NAME}_BASIS_srfi-9.ss}
-${${PROJECT_NAME}_BASIS_srfi-11.ss}
-${${PROJECT_NAME}_BASIS_srfi-23.ss}
-${${PROJECT_NAME}_BASIS_srfi-34.ss}
-${${PROJECT_NAME}_BASIS_srfi-38.ss}
-${${PROJECT_NAME}_BASIS_srfi-39.ss}
-${${PROJECT_NAME}_BASIS_srfi-45.ss}
-${${PROJECT_NAME}_BASIS_srfi-78.ss}
-${${PROJECT_NAME}_BASIS_srfi-149.ss}
-${${PROJECT_NAME}_BASIS_srfi-211.ss}
-)###";
+ auto basis() -> std::vector
+ {
+ return {
+ R"##(${${PROJECT_NAME}_BASIS_meevax.ss})##",
+ R"##(${${PROJECT_NAME}_BASIS_r4rs-essential.ss})##",
+ R"##(${${PROJECT_NAME}_BASIS_r4rs.ss})##",
+ R"##(${${PROJECT_NAME}_BASIS_r5rs.ss})##",
+ R"##(${${PROJECT_NAME}_BASIS_r7rs.ss})##",
+ R"##(${${PROJECT_NAME}_BASIS_srfi-1.ss})##",
+ R"##(${${PROJECT_NAME}_BASIS_srfi-4.ss})##",
+ R"##(${${PROJECT_NAME}_BASIS_srfi-6.ss})##",
+ R"##(${${PROJECT_NAME}_BASIS_srfi-8.ss})##",
+ R"##(${${PROJECT_NAME}_BASIS_srfi-9.ss})##",
+ R"##(${${PROJECT_NAME}_BASIS_srfi-11.ss})##",
+ R"##(${${PROJECT_NAME}_BASIS_srfi-23.ss})##",
+ R"##(${${PROJECT_NAME}_BASIS_srfi-31.ss})##",
+ R"##(${${PROJECT_NAME}_BASIS_srfi-34.ss})##",
+ R"##(${${PROJECT_NAME}_BASIS_srfi-38.ss})##",
+ R"##(${${PROJECT_NAME}_BASIS_srfi-39.ss})##",
+ R"##(${${PROJECT_NAME}_BASIS_srfi-45.ss})##",
+ R"##(${${PROJECT_NAME}_BASIS_srfi-78.ss})##",
+ R"##(${${PROJECT_NAME}_BASIS_srfi-98.ss})##",
+ R"##(${${PROJECT_NAME}_BASIS_srfi-149.ss})##",
+ };
+ }
}
}
diff --git a/configure/version.cpp b/configure/version.cpp
index e6a5c06b1..7e6bd27ca 100644
--- a/configure/version.cpp
+++ b/configure/version.cpp
@@ -20,60 +20,35 @@ namespace meevax
{
inline namespace kernel
{
- auto version() -> object const&
- {
- let static const version = string_to_symbol("${PROJECT_VERSION}");
- return version;
- }
-
- auto major_version() -> object const&
- {
- let static const version = make("${PROJECT_VERSION_MAJOR}");
- return version;
- }
-
- auto minor_version() -> object const&
- {
- let static const version = make("${PROJECT_VERSION_MINOR}");
- return version;
- }
-
- auto patch_version() -> object const&
- {
- let static const version = make("${PROJECT_VERSION_PATCH}");
- return version;
- }
-
- auto exact_version() -> object const&
+ auto help() noexcept -> std::string_view
{
- let static const version = string_to_symbol("${${PROJECT_NAME}_VERSION_EXACT}");
- return version;
+ return R"(${${PROJECT_NAME}_HELP_TEXT})";
}
auto features() -> object const&
{
let static const features = list(
- string_to_symbol("r5rs"),
- string_to_symbol("exact-closed"),
- string_to_symbol("exact-complex"),
- string_to_symbol("ieee-float"),
- string_to_symbol("ratios"),
- string_to_symbol("posix"),
- string_to_symbol("${CMAKE_SYSTEM_NAME}"),
- string_to_symbol("${CMAKE_SYSTEM_PROCESSOR}"),
+ make_symbol("r5rs"),
+ make_symbol("exact-closed"),
+ make_symbol("exact-complex"),
+ make_symbol("ieee-float"),
+ make_symbol("ratios"),
+ make_symbol("posix"),
+ make_symbol("${CMAKE_SYSTEM_NAME}"),
+ make_symbol("${CMAKE_SYSTEM_PROCESSOR}"),
// TODO C memory model flags.
- string_to_symbol("${${PROJECT_NAME}_BYTE_ORDER}"),
- string_to_symbol("${PROJECT_NAME}"), // The name of this implementation.
- string_to_symbol("${PROJECT_NAME}-${PROJECT_VERSION}") // The name and version of this implementation.
+ make_symbol("${${PROJECT_NAME}_BYTE_ORDER}"),
+ make_symbol("${PROJECT_NAME}"), // The name of this implementation.
+ make_symbol("${PROJECT_NAME}-${PROJECT_VERSION}") // The name and version of this implementation.
);
return features;
}
- auto help() -> std::string const&
+ auto version() -> object const&
{
- std::string static const help = R"(${${PROJECT_NAME}_HELP_TEXT})";
- return help;
+ let static const version = make_symbol("${PROJECT_VERSION}");
+ return version;
}
} // namespace kernel
} // namespace meevax
diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt
index 9f5d8c6cb..a8a6c8a7d 100644
--- a/example/CMakeLists.txt
+++ b/example/CMakeLists.txt
@@ -16,5 +16,5 @@ add_test(NAME ${PROJECT_NAME}
COMMAND meevax ${PROJECT_NAME}.ss
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
-add_custom_target(demo COMMAND make
- COMMAND ${CMAKE_CTEST_COMMAND})
+add_custom_target(develop COMMAND ${CMAKE_MAKE_PROGRAM}
+ COMMAND ${CMAKE_CTEST_COMMAND})
diff --git a/include/meevax/algorithm/for_each.hpp b/include/meevax/algorithm/for_each.hpp
deleted file mode 100644
index b9d416af3..000000000
--- a/include/meevax/algorithm/for_each.hpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- Copyright 2018-2023 Tatsuya Yamasaki.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-#ifndef INCLUDED_MEEVAX_ALGORITHM_FOR_EACH_HPP
-#define INCLUDED_MEEVAX_ALGORITHM_FOR_EACH_HPP
-
-#include
-
-namespace meevax
-{
-inline namespace algorithm
-{
- template
- struct for_each
- {
- C const& container;
-
- std::ostream::char_type const* seperator;
-
- explicit constexpr for_each(C const& container, std::ostream::char_type const* seperator = " ")
- : container { container }
- , seperator { seperator }
- {}
-
- auto operator ()(std::ostream & os) const -> decltype(auto)
- {
- auto const* p = "";
-
- for (auto const& each : container)
- {
- os << p << each;
- p = seperator;
- }
-
- return os;
- }
- };
-
- template
- auto operator <<(std::ostream & os, for_each const& print) -> decltype(auto)
- {
- return print(os);
- }
-} // namespace algorithm
-} // namespace meevax
-
-#endif // INCLUDED_MEEVAX_ALGORITHM_FOR_EACH_HPP
diff --git a/include/meevax/kernel/basis.hpp b/include/meevax/kernel/basis.hpp
index 4e053aa9b..d9808bb45 100644
--- a/include/meevax/kernel/basis.hpp
+++ b/include/meevax/kernel/basis.hpp
@@ -17,19 +17,13 @@
#ifndef INCLUDED_MEEVAX_KERNEL_BASIS_HPP
#define INCLUDED_MEEVAX_KERNEL_BASIS_HPP
-#include
+#include
namespace meevax
{
inline namespace kernel
{
- #if __cpp_lib_string_view
- using script = std::string_view;
- #else
- using script = std::experimental::string_view;
- #endif
-
- script extern const basis;
+ auto basis() -> std::vector;
} // namespace kernel
} // namespace meevax
diff --git a/include/meevax/kernel/configurator.hpp b/include/meevax/kernel/configurator.hpp
index e26057916..21e5f7433 100644
--- a/include/meevax/kernel/configurator.hpp
+++ b/include/meevax/kernel/configurator.hpp
@@ -28,13 +28,8 @@ namespace meevax
inline namespace kernel
{
template
- class configurator
+ struct configurator
{
- friend Environment;
-
- configurator()
- {}
-
struct option
{
std::regex const pattern;
@@ -48,12 +43,18 @@ inline namespace kernel
{}
};
- public:
bool interactive = false;
+ std::vector command_line;
+
auto configure(const int argc, char const* const* const argv)
{
- return configure({ argv + 1, argv + argc });
+ for (auto i = 0; i < argc; ++i)
+ {
+ command_line.emplace_back(argv[i]);
+ }
+
+ return configure(command_line);
}
auto configure(std::vector const& args) -> void
@@ -138,7 +139,7 @@ inline namespace kernel
std::vector