Calvin Rose
545df28d71
Add flycheck function to core.
...
Also make flychecking work with stdin out of the box.
2021-01-06 17:27:17 -06:00
Calvin Rose
16f80b78cf
Merge pull request #546 from pepe/doc-thread-new-loop
...
Update doc for thread/new and remove ws in loop's
2021-01-05 20:31:46 -06:00
Calvin Rose
147bcce01b
Merge pull request #549 from pyrmont/docs.string-find-all-typo
...
Fix typos in string/find-all documentation
2021-01-05 20:31:12 -06:00
Calvin Rose
f5877ac6d1
Revert makefile.
2021-01-05 20:29:50 -06:00
Calvin Rose
adc41e31f4
Address #547 - don't drop references.
...
Keep a separate stack for tagged references. May cause pegs to
use more memory but makes the backref and backmatch features much more
powerful.
Also disables the second stack if backref and backmatch are not used in the peg.
2021-01-05 20:27:15 -06:00
Michael Camilleri
2e555a930f
Fix typos in string/find-all documentation
2021-01-06 10:14:49 +09:00
Calvin Rose
bcba0c0279
Fix #548 - string/split bug.
...
Also update docstrings for string/find. The 'skipping'
behavior that was documented only applies to to string/replace-all.
2021-01-05 18:54:51 -06:00
Josef Pospíšil
c7f382add6
Update doc for thread/new and remove ws in loop's
2021-01-04 18:29:00 +01:00
Calvin Rose
665b1e68d5
Pluralize arity compile warning.
2021-01-03 20:15:51 -06:00
Calvin Rose
2ca9300bf7
Add sort tests.
2021-01-03 16:45:37 -06:00
Calvin Rose
81f62b246c
Merge pull request #545 from felixr/master
...
Revert my buggy hybrid sort
2021-01-03 16:39:23 -06:00
Calvin Rose
87badc71d2
Remove :generate verb from loop.
...
Instead, one case use `:in` as with otehr data structures.
2021-01-03 16:38:38 -06:00
Calvin Rose
e5242c67ff
Update changelog and documentation.
2021-01-03 16:30:43 -06:00
Calvin Rose
4355420994
Remove function eachy
.
...
Instead use `each`.
2021-01-03 16:19:23 -06:00
Calvin Rose
c357af02c2
Allow iterating over fibers with each and similar.
2021-01-03 16:17:36 -06:00
Felix Riedel
19576effbe
Revert "Tweak sort: use insertion sort for small arrays"
...
This reverts commit 0ea77cabfb
.
2021-01-03 20:09:50 +00:00
Calvin Rose
ecc6eb7497
Don't fail jpm if os/realpath fails.
2021-01-03 13:09:41 -06:00
Calvin Rose
d0ac318980
Don't print to stderr in Makefile to detect version. Fix #544
2021-01-03 12:59:16 -06:00
Calvin Rose
7b030fe70d
Fix some return issues.
2021-01-03 11:54:31 -06:00
Calvin Rose
115556fcf2
Merge branch 'ev_execute'
2021-01-03 11:48:00 -06:00
Calvin Rose
9760cf1f4e
Fix MSVC warning.
2021-01-03 11:47:29 -06:00
Calvin Rose
47bb7fd21b
Begin implementing async subproccesses for windows.
2021-01-03 11:21:44 -06:00
Calvin Rose
1c7ed8ca48
Use PostQueuedCompletionStatus for threaded calls on windows.
...
Ore efficient than using a self pipe.
2021-01-03 11:08:12 -06:00
Calvin Rose
6b268c5df4
find-index
now takes optional default.
2021-01-03 09:33:52 -06:00
Calvin Rose
62f783f1dc
Merge branch 'master' of github.com:janet-lang/janet
2021-01-03 09:26:31 -06:00
Calvin Rose
61c65f3df1
Fix valgrind warning.
2020-12-31 16:30:54 -06:00
Calvin Rose
05166b3673
Fix proc getter bug.
2020-12-31 16:23:20 -06:00
Calvin Rose
0a1c93b869
Add ev api for making threaded calls.
...
Easy way to make arbitrary functions in C async.
2020-12-31 16:12:42 -06:00
Calvin Rose
788f91a36f
Remove unneeded book keeping for sub processes.
...
Since we are not using signals we no longer need some bookkeeping.
2020-12-31 11:52:12 -06:00
Calvin Rose
c831ecf5d2
Working implementation of process waiting with threads.
...
Does not require all sorts of signal handling code
that is not thread-safe and can "steal processes".
However, there is a much simpler way to add this functionality
by creating a new stream and thread for each subprocess when it is
waited on. This is perhaps _slightly_ less efficient but oh so much
simpler, since we can reuse all of our concepts from streams and there
is no need to implement a whole system around the selfpipe.
2020-12-31 11:22:18 -06:00
Calvin Rose
9e42ee153c
Merge branch 'master' into HEAD
2020-12-30 12:19:13 -06:00
Calvin Rose
d457aa5951
Deprecate file/popen.
...
os/spawn is the prefered way of creating a subprocess and
communicating with it.
2020-12-30 10:22:45 -06:00
Calvin Rose
ab37ee6ebb
Add :all option to ev/read.
...
Brings ev/read more in line with file/read.
2020-12-29 20:37:59 -06:00
Calvin Rose
8655530b19
Rename predicates in module/paths
2020-12-29 19:52:26 -06:00
Calvin Rose
27b1f59aa9
Change Ctrl-C and move old behavior to Ctrl-Q
...
This lets Janet be a better unix citizen and lets Ctrl-C
raise an interrupt. Trying to make Janet behave superficially
like a shell by overriding Ctrl-C is not helpful.
2020-12-29 16:20:37 -06:00
Calvin Rose
cc2cc4db43
Merge pull request #541 from sogaiu/match-doc-formatting
...
Tweak match docstring
2020-12-29 13:10:35 -06:00
Calvin Rose
20bcd95279
Merge commit '0ea77cabfb30afc15433581f5888171c1f65aafd'
2020-12-28 12:20:21 -06:00
Calvin Rose
d7954be5e5
Update docstring for os/open.
2020-12-28 11:00:15 -06:00
Felix Riedel
0ea77cabfb
Tweak sort: use insertion sort for small arrays
2020-12-28 16:06:48 +00:00
Felix Riedel
0d46352ff4
Revert to better performing number hash.
2020-12-27 14:05:40 +00:00
sogaiu
ffa0d5fe45
Tweak match docstring
2020-12-27 13:42:22 +09:00
Calvin Rose
a2c837a99c
Merge remote-tracking branch 'felixr/master' into master
2020-12-26 20:06:34 -06:00
Calvin Rose
13d8d11011
Try new number hashing with frexp.
...
This may be a bit slower in some cases but generally should
have much better hashing for numbers.
2020-12-26 16:54:14 -06:00
Calvin Rose
2357b6162f
Update test-install target.
2020-12-26 15:42:13 -06:00
Calvin Rose
b4f242193d
Improve hash function for numbers.
2020-12-26 15:38:04 -06:00
Calvin Rose
7242ee0186
Merge pull request #540 from felixr/better-quicksort
...
Improve quicksort to avoid worst case performance on sorted input
2020-12-26 15:23:01 -06:00
Felix Riedel
3e742ffc4c
Improve quicksort to avoid worst case performance.
...
The current implementation will have quadratic behaviour for already
sorted arrays because it picks the last element as pivot. In an sorted
array this splits the array repeatedly into the biggest value and all
other values.
The implementation in this commit uses the *median of three* as pivot.
`janet -e "(sort (range 10000))"` to reproduce quadratic behaviour.
2020-12-26 19:18:17 +00:00
Felix Riedel
2ec12fe06f
Improve hashing of numbers
...
Using an integer hash (https://stackoverflow.com/a/12996028/60617 ) on
the number casted to int32 combined with lower bits of the number.
2020-12-26 13:09:11 +00:00
Felix Riedel
c76e0ae685
Use boost's way of combining hash values for arrays and kv pairs.
...
`seed ^= hash_value(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);`
from https://www.boost.org/doc/libs/1_35_0/doc/html/boost/hash_combine_id241013.html
The current way of combining hashes peforms poorly on hash values of
numbers. Changing the way hashes are combined canlead to a significant speed up:
```
time janet_new -e '(def tbl @{}) (loop [x :in (range 1000) y :in (range 1000)] (put tbl {0 x 1 y} true))'
3.77s user 0.08s system 99% cpu 3.843 total
time janet_orig -e '(def tbl @{}) (loop [x :in (range 1000) y :in (range 1000)] (put tbl {0 x 1 y} true))'
48.98s user 0.15s system 99% cpu 49.136 total
```
2020-12-26 13:05:03 +00:00
Calvin Rose
25ded775ad
Add array/clear.
...
Also improve map, find-index, and find to work on data structures
which do not defined length.
2020-12-18 12:37:58 -06:00