Skip to content

Commit 37073cc

Browse files
authored
Merge pull request #419 from yamacir-kit/write
Write
2 parents d348b91 + e3000de commit 37073cc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+861
-383
lines changed

README.md

+21-21
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,24 @@ Subset of R7RS-small.
4141

4242
### SRFIs
4343

44-
| Number | Title | Import from | Note |
45-
|--------------------------------------------------------:|:---------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------|
46-
| [ 1](https://srfi.schemers.org/srfi-1/srfi-1.html) | List Library | [`(srfi 1)`](./basis/srfi-1.ss) | |
47-
| [ 5](https://srfi.schemers.org/srfi-5/srfi-5.html) | A compatible let form with signatures and rest arguments | [`(scheme r4rs essential)`](./basis/r4rs-essential.ss) <br> [`(scheme r4rs)`](./basis/r4rs.ss) <br> [`(scheme r5rs)`](./basis/r5rs.ss) <br> [`(scheme base)`](./basis/r7rs.ss) | R7RS 4.2.4 |
48-
| [ 6](https://srfi.schemers.org/srfi-6/srfi-6.html) | Basic String Ports | [`(srfi 6)`](./basis/srfi-6.ss) <br> [`(scheme base)`](./basis/r7rs.ss) | R7RS 6.13 |
49-
| [ 8](https://srfi.schemers.org/srfi-8/srfi-8.html) | receive: Binding to multiple values | [`(srfi 8)`](./basis/srfi-8.ss) | |
50-
| [ 10](https://srfi.schemers.org/srfi-10/srfi-10.html) | #, external form | built-in | |
51-
| [ 11](https://srfi.schemers.org/srfi-11/srfi-11.html) | Syntax for receiving multiple values | [`(srfi 11)`](./basis/srfi-11.ss) <br> [`(scheme base)`](./basis/r7rs.ss) | R7RS 4.2.2 |
52-
| [ 23](https://srfi.schemers.org/srfi-23/srfi-23.html) | Error reporting mechanism | [`(srfi 23)`](./basis/srfi-23.ss) <br> [`(scheme base)`](./basis/r7rs.ss) | R7RS 6.11 |
53-
| [ 30](https://srfi.schemers.org/srfi-30/srfi-30.html) | Nested Multi-line Comments | built-in | R7RS 2.2 |
54-
| [ 34](https://srfi.schemers.org/srfi-34/srfi-34.html) | Exception Handling for Programs | [`(srfi 34)`](./basis/srfi-34.ss) <br> [`(scheme base)`](./basis/r7rs.ss) | R7RS 6.11 |
55-
| [ 39](https://srfi.schemers.org/srfi-39/srfi-39.html) | Parameter objects | [`(srfi 39)`](./basis/srfi-39.ss) <br> [`(scheme base)`](./basis/r7rs.ss) | R7RS 4.2.6 |
56-
| [ 45](https://srfi.schemers.org/srfi-45/srfi-45.html) | Primitives for Expressing Iterative Lazy Algorithms | [`(srfi 45)`](./basis/srfi-45.ss) | [#296](https://github.com/yamacir-kit/meevax/issues/296)
57-
| [ 62](https://srfi.schemers.org/srfi-62/srfi-62.html) | S-expression comments | built-in | R7RS 2.2 |
58-
| [ 78](https://srfi.schemers.org/srfi-78/srfi-78.html) | Lightweight testing | [`(srfi 78)`](./basis/srfi-78.ss) | Except `check-ec`
59-
| [ 87](https://srfi.schemers.org/srfi-87/srfi-87.html) | => in case clauses | [`(scheme r4rs essential)`](./basis/r4rs-essential.ss) <br> [`(scheme r4rs)`](./basis/r4rs.ss) <br> [`(scheme r5rs)`](./basis/r5rs.ss) <br> [`(scheme base)`](./basis/r7rs.ss) | R7RS 4.2.1 |
60-
| [149](https://srfi.schemers.org/srfi-149/srfi-149.html) | Basic `syntax-rules` template extensions | [`(srfi 149)`](./basis/srfi-149.ss) <br> [`(scheme r5rs)`](./basis/r5rs.ss) <br> [`(scheme base)`](./basis/r7rs.ss) | R7RS 4.3.2 |
61-
| [211](https://srfi.schemers.org/srfi-211/srfi-211.html) | Scheme Macro Libraries | [`(srfi 211 explicit-renaming)`](./basis/srfi-211.ss) | |
44+
| Number | Title | Library name | Note |
45+
|--------------------------------------------------------:|:---------------------------------------------------------|:------------------------------------------------------|:------------------|
46+
| [ 1](https://srfi.schemers.org/srfi-1/srfi-1.html) | List Library | [`(srfi 1)`](./basis/srfi-1.ss) | |
47+
| [ 6](https://srfi.schemers.org/srfi-6/srfi-6.html) | Basic String Ports | [`(srfi 6)`](./basis/srfi-6.ss) | R7RS 6.13 |
48+
| [ 8](https://srfi.schemers.org/srfi-8/srfi-8.html) | receive: Binding to multiple values | [`(srfi 8)`](./basis/srfi-8.ss) | |
49+
| [ 10](https://srfi.schemers.org/srfi-10/srfi-10.html) | #, external form | | |
50+
| [ 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 |
51+
| [ 23](https://srfi.schemers.org/srfi-23/srfi-23.html) | Error reporting mechanism | [`(srfi 23)`](./basis/srfi-23.ss) | R7RS 6.11 |
52+
| [ 30](https://srfi.schemers.org/srfi-30/srfi-30.html) | Nested Multi-line Comments | | R7RS 2.2 |
53+
| [ 34](https://srfi.schemers.org/srfi-34/srfi-34.html) | Exception Handling for Programs | [`(srfi 34)`](./basis/srfi-34.ss) | R7RS 6.11 |
54+
| [ 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 |
55+
| [ 39](https://srfi.schemers.org/srfi-39/srfi-39.html) | Parameter objects | [`(srfi 39)`](./basis/srfi-39.ss) | R7RS 4.2.6 |
56+
| [ 45](https://srfi.schemers.org/srfi-45/srfi-45.html) | Primitives for Expressing Iterative Lazy Algorithms | [`(srfi 45)`](./basis/srfi-45.ss) | R7RS 4.2.5 |
57+
| [ 62](https://srfi.schemers.org/srfi-62/srfi-62.html) | S-expression comments | | R7RS 2.2 |
58+
| [ 78](https://srfi.schemers.org/srfi-78/srfi-78.html) | Lightweight testing | [`(srfi 78)`](./basis/srfi-78.ss) | Except `check-ec` |
59+
| [ 87](https://srfi.schemers.org/srfi-87/srfi-87.html) | => in case clauses | | R7RS 4.2.1 |
60+
| [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 |
61+
| [211](https://srfi.schemers.org/srfi-211/srfi-211.html) | Scheme Macro Libraries | [`(srfi 211 explicit-renaming)`](./basis/srfi-211.ss) | |
6262

6363
## Requirements
6464

@@ -105,9 +105,9 @@ sudo rm -rf /usr/local/share/meevax
105105

106106
| Target Name | Description
107107
|:-------------------|:--
108-
| `all` (default) | Build shared-library `libmeevax.0.4.278.so` and executable `meevax`.
108+
| `all` (default) | Build shared-library `libmeevax.0.4.302.so` and executable `meevax`.
109109
| `test` | Test executable `meevax`.
110-
| `package` | Generate debian package `meevax_0.4.278_amd64.deb`.
110+
| `package` | Generate debian package `meevax_0.4.302_amd64.deb`.
111111
| `install` | Copy files into `/usr/local` __(1)__.
112112
| `install.deb` | `all` + `package` + `sudo apt install <meevax>.deb`
113113
| `safe-install.deb` | `all` + `test` + `package` + `sudo apt install <meevax>.deb`
@@ -122,7 +122,7 @@ __(1)__ Meevax installed by `make install` cannot be uninstalled by the system's
122122
## Usage
123123

124124
```
125-
Meevax Lisp System, version 0.4.278
125+
Meevax Lisp System, version 0.4.302
126126
127127
Usage: meevax [OPTION...] [FILE...]
128128

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.278
1+
0.4.302

basis/r4rs-essential.ss

+10-8
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
(meevax symbol)
1616
(meevax syntax)
1717
(meevax vector)
18-
(meevax write)
18+
(prefix (meevax write) %)
1919
(srfi 211 explicit-renaming))
2020

2121
(export quote lambda if set! cond case and or let letrec begin quasiquote
@@ -579,9 +579,9 @@
579579
(current-input-port))))
580580

581581
(define (write x . port)
582-
(%write-simple x (if (pair? port)
583-
(car port)
584-
(current-output-port))))
582+
(%write x (if (pair? port)
583+
(car port)
584+
(current-output-port))))
585585

586586
(define (write-char x . port)
587587
(put-char x (if (pair? port)
@@ -594,10 +594,12 @@
594594
((1) (put-string string (car xs)))
595595
(else (put-string (apply string-copy string (cadr xs)) (car xs)))))
596596

597-
(define (display datum . port)
598-
(cond ((char? datum) (apply write-char datum port))
599-
((string? datum) (apply write-string datum port))
600-
(else (apply write datum port))))
597+
(define (display x . xs)
598+
(cond ((char? x)
599+
(apply write-char x xs))
600+
((string? x)
601+
(apply write-string x xs))
602+
(else (apply write x xs))))
601603

602604
(define (newline . port)
603605
(apply write-char #\newline port))

basis/r5rs.ss

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
(define (dynamic-wind before thunk after)
1818
(before)
1919
(install-dynamic-extents! (cons (cons before after)
20-
(current-dynamic-extents)))
20+
(current-dynamic-extents)))
2121
((lambda (result) ; TODO let-values
2222
(install-dynamic-extents! (cdr (current-dynamic-extents)))
2323
(after)

basis/r7rs.ss

+23-23
Original file line numberDiff line numberDiff line change
@@ -414,11 +414,7 @@
414414

415415
(define-library (scheme lazy)
416416
(import (srfi 45))
417-
(export delay
418-
(rename lazy delay-force)
419-
force
420-
promise?
421-
(rename eager make-promise)))
417+
(export delay (rename lazy delay-force) force promise? (rename eager make-promise)))
422418

423419
(define-library (scheme case-lambda)
424420
(export case-lambda
@@ -573,29 +569,33 @@
573569
(current-input-port))))))
574570

575571
(define-library (scheme write)
576-
(import (scheme base)
577-
(only (meevax write) %write-simple)
578-
(only (meevax port) put-char)
579-
)
580-
(export write
581-
; write-shared
582-
write-simple
583-
display
584-
)
585-
(begin (define (write-simple x . port)
572+
(import (prefix (meevax write) %)
573+
(scheme base)
574+
(srfi 38))
575+
576+
(begin (define (write x . port)
577+
(%write x (if (pair? port)
578+
(car port)
579+
(current-output-port))))
580+
581+
(define (write-shared x . port)
582+
(write-with-shared-structure x (if (pair? port)
583+
(car port)
584+
(current-output-port))))
585+
586+
(define (write-simple x . port)
586587
(%write-simple x (if (pair? port)
587588
(car port)
588589
(current-output-port))))
589590

590-
(define write write-simple) ; DUMMY
591+
(define (display x . xs)
592+
(cond ((char? x)
593+
(apply write-char x xs))
594+
((string? x)
595+
(apply write-string x xs))
596+
(else (apply write x xs)))))
591597

592-
(define (display datum . port)
593-
(cond ((char? datum) (apply write-char datum port))
594-
((string? datum) (apply write-string datum port))
595-
(else (apply write datum port))))
596-
597-
)
598-
)
598+
(export write write-shared write-simple display))
599599

600600
(define-library (scheme load)
601601
(import (only (scheme r5rs) load))

basis/srfi-1.ss

+6-4
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,15 @@
8383
(not (null? x)))))
8484

8585
(define (circular-list? x)
86-
(let rec ((x x) (lag x))
86+
(let rec ((x x)
87+
(y x))
8788
(and (pair? x)
8889
(let ((x (cdr x)))
8990
(and (pair? x)
90-
(let ((x (cdr x))
91-
(lag (cdr lag)))
92-
(or (eq? x lag) (rec x lag))))))))
91+
(let ((x (cdr x))
92+
(y (cdr y)))
93+
(or (eq? x y)
94+
(rec x y))))))))
9395

9496
(define (not-pair? x) (not (pair? x)))
9597

basis/srfi-34.ss

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
(inner x)
6161
(throw x))))))
6262

63-
(declare-raiser raise)
63+
(declare-raise raise)
6464

6565
(define-syntax guard
6666
(syntax-rules ()

0 commit comments

Comments
 (0)