Felix Riedel
0ea77cabfb
Tweak sort: use insertion sort for small arrays
2020-12-28 16:06:48 +00:00
Calvin Rose
b4f242193d
Improve hash function for numbers.
2020-12-26 15:38:04 -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
Calvin Rose
a55354357c
Make dofile error if source file errors.
...
This should make dofile a bit easier to use.
It also means that import properly raises errors when
things go bad.
2020-12-14 08:23:06 -06:00
Calvin Rose
6020106000
Address #529
2020-12-11 19:21:54 -06:00
Calvin Rose
945cbcfad6
Tail recursive match implementation.
...
This implementation uses multiple passes on patterns
to remove the need for a sentinel value to check if there was a match.
This also re-uses extracted subpatterns for complicated patterns.
2020-12-10 08:35:34 -06:00
Calvin Rose
cd09b696b5
Add :preload loader.
2020-12-06 21:06:17 -06:00
Calvin Rose
0f16f21677
Make builds deterministic again.
...
Also prevent marshal from creating multiple copies of
a function - (marshal function pointer before function def pointer).
2020-12-06 16:32:23 -06:00
Calvin Rose
7e1d095996
Merge pull request #522 from pyrmont/docs.keep-docstring
...
Clarify description of keep
2020-12-05 14:31:58 -06:00
Calvin Rose
9d23192614
Add ev/deadline and ev/with-deadline.
...
This should be more useful than timeouts in real-world
use cases. The deadline system is based on fibers and is target
to much more coarse-grained (and therfor reliable) timeouts than things
like ev/sleep and timeout arguments.
2020-12-05 10:32:34 -06:00
Michael Camilleri
7c1a52ae65
Use 'different from' in preference to 'different to'
2020-12-05 16:43:44 +09:00
Michael Camilleri
9aa1b9c740
Clarify description of keep
2020-12-05 16:02:36 +09:00
Calvin Rose
b402e0671a
Merge pull request #514 from uvtc/patch-2
...
boot.janet, fix possible typo
2020-12-04 17:40:46 -06:00
Calvin Rose
8144f83b66
Merge pull request #516 from uvtc/patch-4
...
doc for identity
2020-12-04 17:40:31 -06:00
Calvin Rose
cd2a55e268
Merge pull request #513 from uvtc/patch-1
...
boot.janet, cond doc
2020-12-04 17:38:02 -06:00
Calvin Rose
f92b5d69c8
Merge pull request #515 from uvtc/patch-3
...
C-style (hyphenate)
2020-12-04 17:37:24 -06:00
John Gabriele
51d6a13510
Update src/boot/boot.janet
...
Co-authored-by: Michael Camilleri <mike@inqk.net>
2020-11-29 14:31:01 -05:00
John Gabriele
7b4eeecd9f
Update src/boot/boot.janet
...
Co-authored-by: Michael Camilleri <mike@inqk.net>
2020-11-29 14:30:48 -05:00
John Gabriele
82eff7e082
Update src/boot/boot.janet
...
Agreed. That's more clear.
Co-authored-by: Michael Camilleri <mike@inqk.net>
2020-11-29 14:30:26 -05:00
John Gabriele
b922e36071
Update src/boot/boot.janet
...
Co-authored-by: Michael Camilleri <mike@inqk.net>
2020-11-29 14:18:19 -05:00
John Gabriele
7c75aeaad2
Update src/boot/boot.janet
...
Co-authored-by: Michael Camilleri <mike@inqk.net>
2020-11-29 14:17:38 -05:00
John Gabriele
2db9323671
Update src/boot/boot.janet
...
Co-authored-by: Michael Camilleri <mike@inqk.net>
2020-11-29 14:17:23 -05:00
John Gabriele
31ae93de19
Update src/boot/boot.janet
...
Co-authored-by: Michael Camilleri <mike@inqk.net>
2020-11-29 14:17:12 -05:00
John Gabriele
a81e9f23f0
Update src/boot/boot.janet
...
Co-authored-by: Michael Camilleri <mike@inqk.net>
2020-11-29 14:16:55 -05:00
John Gabriele
59f09a4386
Update src/boot/boot.janet
...
omit needless word
Co-authored-by: Michael Camilleri <mike@inqk.net>
2020-11-29 14:15:55 -05:00
John Gabriele
53400ecac1
boot.janet, compare*, light formatting
...
Since those represent code, they should get backticks.
2020-11-28 14:41:42 -05:00
John Gabriele
1b8928a8ec
doc for identity
...
This function only takes one argument anyway, and errors if you try to pass more.
2020-11-28 14:35:17 -05:00
John Gabriele
e706494893
C-style
2020-11-28 14:29:13 -05:00
John Gabriele
894aea7ce7
boot.janet, fix possible typo
...
Possible typo?
2020-11-28 14:25:10 -05:00
John Gabriele
87167a21c9
boot.janet, cond doc
...
Arranged this way seems to make more sense.
2020-11-28 14:18:35 -05:00
Calvin Rose
56a915b5b1
Long strings now autoindent contents - doc-format is simpler.
...
No need to try and auto detect the base indentation - it is 0.
This will be taken care of by the parser.
2020-11-28 10:04:25 -06:00
Calvin Rose
21a6017547
typo
2020-11-27 12:27:44 -06:00
Calvin Rose
fb0859dfe6
Merge remote-tracking branch 'pyrmont/feature.markdown-docstrings' into longstring-autoindent
2020-11-27 12:13:45 -06:00
Calvin Rose
dadd6037bb
Merge branch 'master' into longstring-autoindent
2020-11-27 10:40:10 -06:00
Michael Camilleri
6f3eff3258
Add example docstring
2020-11-27 18:29:41 +09:00
Michael Camilleri
02224d5aa9
Fix bugs in parsing logic
2020-11-27 18:28:58 +09:00
Calvin Rose
bfd2845077
Add merge-module to core.
...
This is a little utility used for manually importing modules.
It is responsible for taking the output of dofile, run-context, or
require and merging into another environment as if import was called.
2020-11-27 00:16:54 -06:00
Michael Camilleri
ba2e0489e6
Add initial implementation of docstring formatter
2020-11-27 15:07:38 +09:00
Calvin Rose
6c43489fb2
Fix #508 - nil fiber environment.
...
run-context did not handle a nil environment well, so that was fixed
and ev/call inherits the environment when creating the fiber.
2020-11-26 19:04:45 -06:00
Calvin Rose
adc3066dc8
Update doc-format and boot.janet docstrings.
...
Make doc-format respect leading indents, increase the default format
width to better accommodate markdown formatted documentation. We still
need to support single line style doc strings, such as those used
for most c functions which can be a single line of much longer than
80 or 120 characters.
Consecutive whitespace internal to lines is not preserved, though.
2020-11-26 14:58:36 -06:00
Calvin Rose
7fd2da1096
Add code in parser to automatically indent long strings.
...
Leading spaces are stripped based on the column index of the first
backtick character in the first delimiter. If there are
characters that are not newline or space before that column in the
string, then the behavior is the same as the old behvaior - no
re-indentation is performed.
2020-11-26 13:20:58 -06:00
Calvin Rose
451340e4c0
Update docstrings in boot.janet ( #506 )
...
Elaborate on usage of reduce and accumulate.
2020-11-26 10:34:51 -06:00
Calvin Rose
fbe658a724
Merge pull request #503 from sogaiu/boot-janet-docstring-tweaks
...
Tweak docstrings in boot.janet
2020-11-16 17:03:54 -06:00
Calvin Rose
760e4e3d68
Add upscope special form.
...
Upscope is similar to do, but does not introduce a new lexical scope.
2020-11-16 16:41:27 -06:00
Calvin Rose
9ec5689d6b
Don't use gcroot/unroot for tracking IO operations.
...
This could have bad effects in higher load situations, and
duplicates code. It is better to keep a dedicated list of
scheduled IO operations which can be efficiently added and
removed from. It also provides and easy way to enumerate
scheduled IO operations.
2020-11-16 09:30:04 -06:00
sogaiu
c8b72431a3
Some more
2020-11-16 16:13:28 +09:00
sogaiu
0eb913fb9a
A couple more tweaks
2020-11-16 14:14:51 +09:00
sogaiu
fce27cb2e8
Tweak docstrings in boot.janet
2020-11-16 14:03:26 +09:00
Calvin Rose
dcf8ba0edb
Update CHANGELOG.md
2020-11-15 15:35:50 -06:00
Calvin Rose
3ab2ae130b
Address #495 Add :read and :parser to run-context.
2020-11-15 15:26:16 -06:00