Skip to content

Commit

Permalink
Update procedure procedure? to built-in
Browse files Browse the repository at this point in the history
Signed-off-by: yamacir-kit <[email protected]>
  • Loading branch information
yamacir-kit committed Oct 2, 2023
1 parent c9943f3 commit 87f2218
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Procedures for each standard are provided by the following R7RS-style libraries:
cmake -B build -DCMAKE_BUILD_TYPE=Release
cd build
make package
sudo apt install build/meevax_0.5.4_amd64.deb
sudo apt install build/meevax_0.5.5_amd64.deb
```

or
Expand Down Expand Up @@ -131,9 +131,9 @@ sudo rm -rf /usr/local/share/meevax

| Target Name | Description
|-------------|-------------
| `all` | Build shared-library `libmeevax.0.5.4.so` and executable `meevax`
| `all` | Build shared-library `libmeevax.0.5.5.so` and executable `meevax`
| `test` | Test executable `meevax`
| `package` | Generate debian package `meevax_0.5.4_amd64.deb`
| `package` | Generate debian package `meevax_0.5.5_amd64.deb`
| `install` | Copy files into `/usr/local` directly

## Usage
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.4
0.5.5
13 changes: 4 additions & 9 deletions basis/r4rs.ss
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
(define-library (scheme r4rs)
(import (only (meevax boolean) boolean? not)
(meevax character)
(meevax core)
(only (meevax core) begin define define-syntax if lambda letrec quote set!)
(only (meevax comparator) eq? eqv? equal?)
(meevax continuation)
(prefix (meevax environment) %)
(meevax function)
(only (meevax continuation) call-with-current-continuation)
(prefix (only (meevax environment) load) %)
(only (meevax function) procedure?)
(meevax inexact)
(meevax list)
(only (meevax macro-transformer) er-macro-transformer identifier?)
Expand Down Expand Up @@ -549,11 +549,6 @@
(begin (string-set! s k c)
(rec (- k 1)))))))

(define (procedure? x)
(or (closure? x)
(continuation? x)
(foreign-function? x)))

(define (for-each f x . xs) ; Chibi-Scheme
(if (null? xs)
(letrec ((for-each (lambda (f x)
Expand Down
2 changes: 1 addition & 1 deletion example/example.ss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(import (meevax function)
(import (only (meevax function) foreign-function? foreign-function)
(scheme base)
(scheme process-context)
(scheme write)
Expand Down
14 changes: 10 additions & 4 deletions src/kernel/boot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,12 @@ inline namespace kernel

define<library>("(meevax function)", [](library & library)
{
library.define<predicate>("procedure?", [](let const& xs)
{
let const& x = xs[0];
return x.is<closure>() or x.is<continuation>() or x.is_also<procedure>();
});

library.define<predicate>("closure?", [](let const& xs)
{
return xs[0].is<closure>();
Expand All @@ -325,14 +331,14 @@ inline namespace kernel
return xs[0].is<continuation>();
});

library.define<function>("foreign-function", [](let const& xs)
library.define<predicate>("foreign-function?", [](let const& xs)
{
return make<function>(xs[1].as<string>(), xs[0].as<string>());
return xs[0].is_also<procedure>();
});

library.define<predicate>("foreign-function?", [](let const& xs)
library.define<function>("foreign-function", [](let const& xs)
{
return xs[0].is_also<procedure>();
return make<function>(xs[1].as<string>(), xs[0].as<string>());
});
});

Expand Down

0 comments on commit 87f2218

Please sign in to comment.