mirror of
https://github.com/janet-lang/janet
synced 2024-12-25 07:50:27 +00:00
find-index
now takes optional default.
This commit is contained in:
parent
62f783f1dc
commit
6b268c5df4
@ -2,12 +2,15 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## Unreleased - ???
|
||||
- Add `dflt` argument to find-index.
|
||||
- Add `:all` keyword to `ev/read` and `net/read` to make them more like `file/read`. However, we
|
||||
do not provide any `:line` option as that requires buffering.
|
||||
- Change repl behavior to make Ctrl-C raise SIGINT on posix. The old behavior for Ctrl-C,
|
||||
to clear the current line buffer, has been moved to Ctrl-Q.
|
||||
- Importing modules that start with `/` is now the only way to import from project root.
|
||||
Before, this would import from / on disk.
|
||||
Before, this would import from / on disk. Previous imports that did not start with `.` or `/`
|
||||
are now unambiguously importing from the syspath, instead of checking both the syspath and
|
||||
the project root. This is backwards incompatible and dependencies should be updated for this.
|
||||
- Change hash function for numbers.
|
||||
- Improve error handling of `dofile`.
|
||||
|
||||
|
@ -1026,10 +1026,10 @@
|
||||
(error "expected 1 to 3 arguments to range")))
|
||||
|
||||
(defn find-index
|
||||
`Find the index of indexed type for which pred is true. Returns nil if not found.`
|
||||
[pred ind]
|
||||
`Find the index of indexed type for which pred is true. Returns dflt if not found.`
|
||||
[pred ind &opt dflt]
|
||||
(var k nil)
|
||||
(var ret nil)
|
||||
(var ret dflt)
|
||||
(while true
|
||||
(set k (next ind k))
|
||||
(if (= k nil) (break))
|
||||
|
Loading…
Reference in New Issue
Block a user