Commit graph

239 commits

Author SHA1 Message Date
Alex Shinn
4dab8b81d4 Implementing array-decurry. 2023-02-16 21:20:37 +09:00
Marc Nieper-Wißkirchen
c6db239882 Provide identifier-syntax and make-variable-transformer through standardized SRFI libraries. 2023-02-01 10:33:09 +01:00
Alex Shinn
49f95dc107 Fix bug in procedure-flags in (chibi ast) (issue #864)
We were incorrectly boxing an already boxed value.
2022-10-05 09:06:51 +09:00
Alex Shinn
1e47c78b8a Fix reversal of results in rounding all leading 9's (issue #859). 2022-09-15 21:24:00 +09:00
Alex Shinn
54d3aafc7b update test 2022-06-12 16:11:16 +09:00
Alex Shinn
38fc7e0932 Initial SRFI 231 implementation. 2022-06-12 16:04:38 +09:00
Jeronimo Pellegrini
32ce583927 Add some more unit tests to SRFI-144
Tests for flmin, flmax, fl-least, fl-epsilon, fl-greatest are
included.
2022-05-15 08:30:27 -03:00
Jeronimo Pellegrini
1ecf7f9c8a SRFI-144: accept zero arguments for flmax/flmin
SRFI-144 requires that (flmin) returns +inf.0 and that
(flmax) returns -inf.0, so these procedures can't really
be aliases to the Chibi implementation of R7RS max and min.
2022-05-14 08:14:08 -03:00
Alex Shinn
42332bb04f compute least double properly (issue #831) 2022-05-14 16:30:27 +09:00
Alex Shinn
eb6a2eeb78 fix integer type in object-cmp 2022-02-12 07:48:14 +09:00
Alex Shinn
f6e8e71c41 Merge branch 'master' of github.com:ashinn/chibi-scheme 2021-12-25 10:56:10 +09:00
Alex Shinn
58e9715c2b handle non-positive numbers in numeric/si (fixes issue #801) 2021-12-25 10:55:58 +09:00
Alex Shinn
f812bbc96b
Merge pull request #797 from dpk/reference-barrier
Fix SRFI 124 imports for reference-barrier
2021-12-15 07:01:43 +09:00
Daphne Preston-Kendal
f9f384c45b Fix SRFI 124 imports for reference-barrier 2021-12-14 15:45:12 +01:00
Alex Shinn
50188a6668
Merge pull request #796 from dpk/reference-barrier
Add reference-barrier to (srfi 124)
2021-12-14 21:36:53 +09:00
Daphne Preston-Kendal
2d8ce631c7 Add reference-barrier to (srfi 124) 2021-12-14 13:04:21 +01:00
Marc Nieper-Wißkirchen
232dc6ef20 Fix SRFI 227 exports 2021-12-11 14:27:20 +01:00
Alex Shinn
9a17254536 guard against opcodes 2021-12-03 08:33:28 +09:00
Alex Shinn
9a48a110b8 add bounds check 2021-12-02 22:07:57 +09:00
Alex Shinn
0da288d053 implement (srfi 229) 2021-12-02 22:03:58 +09:00
Daphne Preston-Kendal
427629a43e Add support for SRFI 227 2021-11-24 10:24:21 +01:00
Jeronimo Pellegrini
ce97808201 Add missing constants to SRFI-144
The following constants were missing from Chibi's SRFI-144
implementation:

 fl-1/e
 fl-e-pi/4
 fl-1/log-2
 fl-log-3
 fl-log-pi
 fl-1/log-10
 fl-2pi
 fl-pi-squared
 fl-degree
 fl-gamma-1/2
 fl-gamma-1/3
 fl-gamma-2/3
2021-09-29 00:57:31 -03:00
Alex Shinn
22e89b168a fix array-tile 2021-08-19 19:22:29 +09:00
Alex Shinn
57e4652ea6 Assert same domains in array-for-each, as per the spec and implicitly
depended on by the implementation.
2021-08-16 20:28:03 +09:00
Alex Shinn
6cafda8916 Decouple syntax-case from the Chibi core.
This restores third-party (ab)users of the Chibi macro system such
as in https://gist.github.com/baguette/2632464, while allowing us
to break those uses in more interesting ways.

It also keeps the core slightly smaller (both in C and Scheme)
and speeds up the macro expansion process.
2021-08-10 23:19:35 +09:00
Alex Shinn
73da0a88d4 scan for appropriate 2nd element to take the mean with when calling vector-find-median on an even length vector (issue #754) 2021-06-29 21:09:41 +09:00
Alex Shinn
5207bdfde2 Defining list->u8vector (issue #749). 2021-06-18 13:04:20 +09:00
Alexei Lozovsky
6f35aa75f4
Fix usage of signbit() in SRFI 144
C standard defines signbit() as a macro returning "non-zero value" for
negative arguments (see 7.12.3.6 of C11 standard). SRFI 144's flsign-bit
is defined to return exactly 1.

Make sure to convert the result of signbit() call into "boolean int"
which is either 0 or 1.

This is not a theoretical issue. This causes SRFI 144 test suite to fail
on many architectures that are not x86_64.

GCC on x86_64 compiles signbit() as

        movmskpd %xmm0, %eax
        andl     $1, %eax

which indeed returns either 0 or 1. movmskpd extracts 2-bit sign mask
from the FP value in src register and stores that in low-order bits of
the dst register. Then the unneded extra bit is masked out, leaving only
the lowest bit set or unset.

However, other architectures don't have such conveniences and go with
more direct approach. For example, GCC on ARMv7 produces this:

        sub     sp, sp, #8
        vstr.64 d0, [sp]
        ldr     r0, [sp, #4]
        and     r0, r0, #0x80000000
        add     sp, sp, #8
        bx      lr

which effectively returns either 0 or -1. Generated code masks out
everything but the sign bit and returns the result as is. The value
0x80000000 is the representation of -1.

Even on i386 signbit() is compiled as

        fldl    4(%esp)
        fxam
        fnstsw  %ax
        fstp    %st(0)
        andl    $512, %eax
        ret

which effectively returns either 0 or 512: fxam sets C1 bit FPU status
word to the sign of FP value, then the status word is extracted, the
"sign bit" is masked out, and left as is.
2021-06-06 13:49:44 +09:00
Alex Shinn
037a7b24fc exporting array-coeffs 2021-05-10 22:56:36 +09:00
Alex Shinn
3eab7bf226 package SRFI 179 2021-05-10 17:49:02 +09:00
Alex Shinn
6e5278b7a1 separating out SRFI 179 base library 2021-05-07 22:39:53 +09:00
Alex Shinn
ca47a41ccf array simplification and performance tweaks 2021-05-07 16:15:48 +09:00
Alex Shinn
12ad1d37d8 add docs and tests for assert, unify with SRFI 145 2021-05-06 20:34:03 +09:00
Alex Shinn
e3083062fa Flattening indexing further.
We can pre-subtract each coeff times its lower bound from the
base coefficient in SRFI 179 indexers.
2021-04-30 14:25:39 +09:00
Alex Shinn
d11106b2f7 Fix upper bounds checks in u64vectors. 2021-04-30 14:02:29 +09:00
Alex Shinn
3c138dc808 Fix validation on specialized-array-reshape. 2021-04-30 13:38:53 +09:00
Alex Shinn
76284f79f0 flattening array indexers 2021-04-28 22:53:16 +09:00
Alex Shinn
cd5bf03537
Merge pull request #740 from lassik/219
Add SRFI 219: Define higher-order lambda
2021-04-18 18:58:39 +09:00
Lassi Kortela
7178d22928 Add SRFI 219: Define higher-order lambda 2021-04-18 12:21:32 +03:00
Alex Shinn
d0510bebe6 simplify array-reduce 2021-04-16 23:35:16 +09:00
Alex Shinn
c8f5f49890 add initial SRFI 179 implementation 2021-04-16 19:53:51 +09:00
Alex Shinn
487ea21d77 check value domains on uvector-set! ops 2021-04-16 10:13:37 +09:00
Alex Shinn
fc6e5da915 make-u1vector takes an optional fill 2021-04-15 17:02:44 +09:00
Alex Shinn
e74614d4b3 removing redundant uvector definitions 2021-04-14 17:06:34 +09:00
Alex Shinn
8b27ce9726 add proper grammar support to srfi 130 string-split 2021-04-02 13:51:02 +09:00
Alex Shinn
adec61993b adding domain checks on uvector accessors 2021-03-26 17:34:25 +09:00
Lassi Kortela
fa52b4987a Add SRFI 193 Scheme library
This was accidentally left out of the previous commit.
2021-02-05 14:08:31 +02:00
Alex Shinn
9f0ed1a869
Revert "Implement SRFI 193: Command lines" 2021-01-24 19:57:55 +09:00
Alex Shinn
751675c6b2
Merge pull request #619 from lassik/command-lines
Implement SRFI 193: Command lines
2021-01-24 16:44:35 +09:00
Alex Shinn
0597ea68a5
save a char and a beta reduction 2020-11-25 14:39:49 +09:00