Merge pull request #1128 from yosoyubik/qeu-fix

bug fix in +nap:to
This commit is contained in:
ixv 2019-04-01 13:44:13 -07:00 committed by GitHub
commit f4ddbc9139
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 138 additions and 3 deletions

64
README.md Normal file
View File

@ -0,0 +1,64 @@
# Arvo
A clean-slate operating system.
## Usage
To run Arvo, you'll need [Urbit](https://github.com/urbit/urbit/). To install Urbit and run Arvo please follow the instructions in the [getting started docs](https://urbit.org/docs/getting-started/). You'll be on the live network in a few minutes.
If you're doing development on Arvo, keep reading.
## Documentation
Find Arvo's documentation [on urbit.org](https://urbit.org/docs/learn/arvo/).
## Development
To boot a fake ship from your development files, run `urbit` with the following arguments:
```
urbit -F zod -A /path/to/arvo -c fakezod
```
Mount Arvo's filesystem allows you to update its contents through Unix. To do so, run `|mount` in dojo. It is most common to `|mount /=home=`.
To create a custom pill (bootstrapping object) from the files loaded into the home desk, run `.my/pill +solid`. Your pill will appear in `/path/to/fakezod/.urb/put/my.pill`.
To boot a fake ship with a custom pill, use the `-B` flag:
```
urbit -F zod -A /path/to/arvo -B /path/to.pill -c fakezod
```
To run all tests in `/tests`, run `+test` in dojo. `+test /some/path` would only run all tests in `/tests/some/path`.
## Contributing
Contributions of any form are more than welcome! If something doesn't seem right, and there is no issue about it yet, feel free to open one.
If you're looking to make code contributions, a good place to start might be the [good contributor issues](https://github.com/urbit/arvo/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+contributor+issue%22).
## Maintainers
Most parts of Arvo have dedicated maintainers.
* `/sys/hoon`: @pilfer-pandex (~pilfer-pandex)
* `/sys/zuse`: @pilfer-pandex (~pilfer-pandex)
* `/sys/arvo`: @jtobin (~nidsut-tomdun)
* `/sys/vane/ames`: @belisarius222 (~rovnys-ricfer) & @joemfb (~master-morzod)
* `/sys/vane/behn`: @belisarius222 (~rovnys-ricfer)
* `/sys/vane/clay`: @philipcmonk (~wicdev-wisryt)
* `/sys/vane/dill`: @bernardodelaplaz (~rigdyn-sondur)
* `/sys/vane/eyre`: @eglaysher (~littel-ponnys)
* `/sys/vane/ford`: @belisarius222 (~rovnys-ricfer) & @eglaysher (~littel-ponnys)
* `/sys/vane/gall`: @jtobin (~nidsut-tomdun)
* `/sys/vane/jael`: @fang- (~palfun-foslup) & @joemfb (~master-morzod)
* `/app/acme`: @joemfb (~master-morzod)
* `/app/dns`: @joemfb (~master-morzod)
* `/app/hall`: @fang- (~palfun-foslup)
* `/app/talk`: @fang- (~palfun-foslup)
* `/lib/test`: @eglaysher (~littel-ponnys)
## Contact
We are using our new UI, Landscape, to run a few experimental cities. If you have an Azimuth point, please send us your planet name at [support@urbit.org](mailto:support@urbit.org) to request access.

19
mar/md.hoon Normal file
View File

@ -0,0 +1,19 @@
::
:::: /hoon/md/mar
::
/? 310
::
=, format
=, mimes:html
|_ txt/wain
::
++ grab :: convert from
|%
++ mime |=({p/mite:eyre q/octs:eyre} (to-wain q.q))
++ noun wain :: clam from %noun
--
++ grow
|%
++ mime [/text/plain (as-octs (of-wain txt))]
--
--

View File

@ -1875,9 +1875,10 @@
::
++ nap :: removes head
?> ?=(^ a)
?: =(~ l.a) r.a
=+ b=get(a l.a)
bal(a ^+(a [p.b q.b r.a]))
?~ a ~
=+ b=get
?~ q.b ~
bal(a ^+(a [n=n.q.b l=l.q.b r=r.q.b]))
::
++ put :: insert new tail
|* b/*

51
tests/sys/hoon/qeu.hoon Normal file
View File

@ -0,0 +1,51 @@
:: test a fix for a bug in +nap:to affecting three-item queues.
::
:: (see https://github.com/urbit/arvo/issues/1100 for details)
::
:: the test creates several queues from known lists and recursively
:: unqueues the top, comparing it with the current element of the list.
::
/+ *test
::
=/ descending ~[7 6 5 4 3 2 1]
=/ ascending ~[1 2 3 4 5 6 7]
=/ unsorted ~[1 6 3 5 7 2 4]
=/ duplicates ~[1 1 7 4 6 9 4]
::
=>
|%
++ unqueue
|= [queue=(qeu @) test=(list @)]
^- tang
%- zing
|- ^- (list tang)
?~ test ~
?~ queue ~
:_ $(queue ~(nap to queue), test t.test)
%+ expect-eq
!> (need ~(top to queue))
!> i.test
--
::
|%
::
++ test-descending-sorted-list ^- tang
::
=+ queue=(~(gas to `(qeu @)`~) descending)
(unqueue [queue descending])
::
++ test-ascending-sorted-list ^- tang
::
=+ queue=(~(gas to `(qeu @)`~) ascending)
(unqueue [queue ascending])
::
++ test-unsorted-list ^- tang
::
=+ queue=(~(gas to `(qeu @)`~) unsorted)
(unqueue [queue unsorted])
::
++ test-duplicates-list ^- tang
::
=+ queue=(~(gas to `(qeu @)`~) duplicates)
(unqueue [queue duplicates])
--