mirror of
https://github.com/urbit/developers.urbit.org.git
synced 2024-08-17 01:30:31 +03:00
Merge pull request #387 from urbit/sigilante-less
Document +less in parsing tutorial.
This commit is contained in:
commit
ba63e44a7e
@ -274,6 +274,25 @@ One common scenario where `+cold` sees play is when writing [command line
|
||||
interface (CLI) apps](/guides/additional/cli-tutorial). We usher the
|
||||
reader there to find an example where `+cold` is used.
|
||||
|
||||
### [`+less`](/reference/hoon/stdlib/4f/#less)
|
||||
|
||||
`+less` builds a `rule` to exclude matches to its first argument. It is commonly
|
||||
used to filter out an undesired match.
|
||||
|
||||
```
|
||||
> (;~(less buc next) [[1 1] " "])
|
||||
[p=[p=1 q=2] q=[~ [p=' ' q=[p=[p=1 q=2] q=""]]]]
|
||||
|
||||
> (;~(less ace next) [[1 1] " "])
|
||||
[p=[p=1 q=1] q=~]
|
||||
```
|
||||
|
||||
Here we see that the first case refuses to parse `buc` `$` (which is not present), so
|
||||
the `ace` ` ` succeeds (via `+next` which matches any character).
|
||||
|
||||
The second case attempts to parse the excluded character `ace` ` ` and fails on the
|
||||
first character as it should.
|
||||
|
||||
### [`+knee`](/reference/hoon/stdlib/4f/#knee)
|
||||
|
||||
Another important function in the parser builder library is `+knee`, used for building
|
||||
|
Loading…
Reference in New Issue
Block a user