Write a gate that takes some integer n and returns (n - 1). You may not use dec
from the Hoon stdlib, and you may not look at the code for dec
in hoon.hoon. You're under the honor system.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|% | |
:: | |
:: +permission: main permission model | |
:: | |
+$ permission | |
$% [%white (set @p)] | |
[%black (set @p)] | |
== | |
:: | |
:: +channel: main abstraction for a message bus |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Pareto Experiment</title> | |
<script type="text/javascript" src="pareto.js"></script> | |
</head> | |
<body> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|% | |
++ newlist {what/@ next/(unit newlist)} | |
-- | |
|= [x=@ y=@ z=(unit newlist)] | |
^- (unit newlist) | |
?~ z | |
?: (lte x y) | |
$(x x, y (dec y), z [~ [what=y next=~]]) | |
~ | |
?: (lte x y) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fetch = require('node-fetch'); | |
function authenticate(code, success) { | |
fetch(`http://localhost:8080/~/auth.json`).then(res => res.json()) | |
.then((json) => { | |
let payload = { | |
method: "PUT", | |
body: JSON.stringify({ | |
ship: json.ship, | |
code: code, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/+ mylib :: import | |
=, mylib :: alias to the subject (don't have to type mylib anymore) | |
|= a=@ | |
^- [@ [@ @]] | |
(goldbach a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|% | |
++ new-prime | |
|= n=@ | |
^- @ | |
%- inner-prime [n 2] | |
++ inner-prime | |
|= a=[n=@ i=@] :: sample (input mold) | |
^- @ :: return mold | |
=+ upper=(div n.a 2) :: define a variable as the upper limit of variables to check = n/2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/+ mylib :: import | |
=, mylib :: alias to the subject (don't have to type mylib anymore) | |
|= a=@ | |
^- @ | |
(new-fac a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|% | |
++ new-dec | |
|= a/@ | |
^- @ | |
?: (lte a 0) :: | |
0 | |
?: (lte a 1) | |
0 | |
%- inner-dec :+(a 1 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/+ mylib :: import | |
=, mylib :: alias to the subject (don't have to type mylib anymore) | |
|= [a=@ b=@] | |
^- @ | |
(new-add a b) |