Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revise for fixed wet gates #382

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 4 additions & 18 deletions content/guides/core/hoon-school/Q-func.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,30 +114,16 @@ q=15
120
```

### Exercise: Calculate a Factorial

- Use `++reel` to produce a gate which calculates the factorial of a number.


## Aside on Wet Gates

If you've already encountered [wet gates](/guides/core/hoon-school/R-metals) and how they handle their sample, you may eventually circle back around to attempting to write statements which curry a wet gate. For instance, here is an attempt to curry `++reel` which itself takes a gate (in this case `++add`) as an argument:
If you've already encountered [wet gates](/guides/core/hoon-school/R-metals) and how they handle their sample, you may eventually circle back around to attempting to write statements which curry a wet gate. For instance, here we curry `++reel` which itself takes a gate (in this case `++add`) as an argument:

```hoon
> ((curr reel add) `(list @)`[1 2 3 4 ~])
mull-grow
-find.i.a
dojo: hoon expression failed
10
```

Unfortunately, `++cury` and `++curr` don't work with wet gates, and you'll see a `mull-grow` error.

One solution is to “dry out” the wet gate using [`++bake`](/reference/hoon/stdlib/2b#bake):
### Exercise: Calculate a Factorial

```hoon
> ((curr (bake reel ,[(list @) _add]) add) `(list @)`[1 2 3 4 ~])
10
```
- Use `++reel` to produce a gate which calculates the factorial of a number.


## Classic Operations
Expand Down