diff --git a/CHANGELOG.md b/CHANGELOG.md index 20307351..d0ff15a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,16 @@ All notable changes to this project will be documented in this file. ## Unreleased - ??? +- The gc interval is now autotuned, to prevent very bad gc behavior. +- Improvements to the bytecode compiler, Janet will now generate more efficient bytecode. +- Add `peg/find`, `peg/find-all`, `peg/replace`, and `peg/replace-all` +- Add `math/nan` +- Add `forv` macro - Add `symbol/slice` - Add `keyword/slice` - Allow cross compilation with Makefile. - Change `compare-primitve` to `cmp` and make it more efficient. -- Change `reverse` to `reversed`, reverse now mutates the backing array +- Add `reverse!` for reversing an array or buffer in place. - `janet_dobytes` and `janet_dostring` return parse errors in \*out - Add `repeat` macro for iterating something n times. - Add `eachy` (each yield) macro for iterating a fiber. diff --git a/src/boot/boot.janet b/src/boot/boot.janet index a4ede24c..c90fae8d 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -1202,13 +1202,13 @@ (if x nil (set res x))) res) -(defn reverse +(defn reverse! "Reverses the order of the elements in a given array or buffer and returns it mutated." [t] (def len-1 (- (length t) 1)) (def half (/ len-1 2)) - (for i 0 half + (forv i 0 half (def j (- len-1 i)) (def l (in t i)) (def r (in t j)) @@ -1216,7 +1216,7 @@ (put t j l)) t) -(defn reversed +(defn reverse "Reverses the order of the elements in a given array or tuple and returns a new array. If string or buffer is provided function returns array of chars reversed." [t] diff --git a/src/core/util.c b/src/core/util.c index 7277f95b..847e7471 100644 --- a/src/core/util.c +++ b/src/core/util.c @@ -26,6 +26,9 @@ #include "util.h" #include "state.h" #include "gc.h" +#ifdef JANET_WINDOWS +#include +#endif #endif #include