mirror of
https://github.com/janet-lang/janet
synced 2025-01-12 16:40:27 +00:00
Don't break reverse backwards compat.
Breaking backwards compatibiliy here is not worth it. Also update changelog.
This commit is contained in:
parent
b89f0fac7b
commit
55cf9f5e1c
@ -2,11 +2,16 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
## Unreleased - ???
|
## 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 `symbol/slice`
|
||||||
- Add `keyword/slice`
|
- Add `keyword/slice`
|
||||||
- Allow cross compilation with Makefile.
|
- Allow cross compilation with Makefile.
|
||||||
- Change `compare-primitve` to `cmp` and make it more efficient.
|
- 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
|
- `janet_dobytes` and `janet_dostring` return parse errors in \*out
|
||||||
- Add `repeat` macro for iterating something n times.
|
- Add `repeat` macro for iterating something n times.
|
||||||
- Add `eachy` (each yield) macro for iterating a fiber.
|
- Add `eachy` (each yield) macro for iterating a fiber.
|
||||||
|
@ -1202,13 +1202,13 @@
|
|||||||
(if x nil (set res x)))
|
(if x nil (set res x)))
|
||||||
res)
|
res)
|
||||||
|
|
||||||
(defn reverse
|
(defn reverse!
|
||||||
"Reverses the order of the elements in a given array or buffer and returns it
|
"Reverses the order of the elements in a given array or buffer and returns it
|
||||||
mutated."
|
mutated."
|
||||||
[t]
|
[t]
|
||||||
(def len-1 (- (length t) 1))
|
(def len-1 (- (length t) 1))
|
||||||
(def half (/ len-1 2))
|
(def half (/ len-1 2))
|
||||||
(for i 0 half
|
(forv i 0 half
|
||||||
(def j (- len-1 i))
|
(def j (- len-1 i))
|
||||||
(def l (in t i))
|
(def l (in t i))
|
||||||
(def r (in t j))
|
(def r (in t j))
|
||||||
@ -1216,7 +1216,7 @@
|
|||||||
(put t j l))
|
(put t j l))
|
||||||
t)
|
t)
|
||||||
|
|
||||||
(defn reversed
|
(defn reverse
|
||||||
"Reverses the order of the elements in a given array or tuple and returns
|
"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."
|
a new array. If string or buffer is provided function returns array of chars reversed."
|
||||||
[t]
|
[t]
|
||||||
|
@ -26,6 +26,9 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "gc.h"
|
#include "gc.h"
|
||||||
|
#ifdef JANET_WINDOWS
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user