Skip to content

Conversation

primo-ppcg
Copy link
Contributor

Related: #1279

  • Add lengthable?
(lengthable? x)

Check if x is a bytes, indexed, or dictionary.
  • Speed up keys, values, and pairs, while allowing non-lengthable types
  • Allow non-lengthable types for reverse
  • Minor speed improvement for reverse!
  • Updates some docstrings missed in previous PRs

@sogaiu
Copy link
Contributor

sogaiu commented Sep 1, 2023

Various tests didn't turn up anything here 👍

Some manual trials:

$ ./build/janet
Janet 1.30.0-4cb1f616 linux/x64/gcc - '(doc)' for help

repl:1:> (lengthable? :a)
true

repl:2:> (lengthable? "a")
true

repl:3:> (lengthable? 1)
false

repl:4:> (lengthable? [:x :y])
true

repl:5:> (lengthable? (peg/compile '':a))
false

repl:6:> (lengthable? {:x 1})
true

@bakpakin bakpakin merged commit 51c0cf9 into janet-lang:master Sep 1, 2023
@primo-ppcg primo-ppcg deleted the lengthable branch September 2, 2023 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants