-
Notifications
You must be signed in to change notification settings - Fork 659
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP removing input files from examples
- Loading branch information
Showing
28 changed files
with
39 additions
and
200 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
# Leo Examples | ||
|
||
This directory includes the following Leo code examples: | ||
This directory includes the following Leo code including: | ||
|
||
1. Hello World -> Basic Sum of two u32 | ||
2. Groups -> Basic operations over groups | ||
3. Core -> Core functions over a field type | ||
4. Bubblesort -> Sorting algorithms over a tuple | ||
5. Import point -> Import code from another file | ||
6. Message -> Initialization of a struct | ||
7. Token -> Record example | ||
5. Message -> Initialization of a struct | ||
6. Token -> Record example | ||
|
||
along with many more. | ||
|
||
## Run Guide | ||
|
||
To run each program, run: | ||
```bash | ||
leo run main | ||
leo run main <inputs> | ||
``` | ||
This command will look in the input file inputs/*.in where should find a section [main] and use the variables as inputs to the program. | ||
|
||
## Execute Guide | ||
|
||
To execute each program call, run: | ||
```bash | ||
leo execute main <inputs> --endpoint <endpoint> | ||
``` | ||
leo execute main <inputs> | ||
``` |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,3 @@ | ||
// The program input for bubblesort_tuple/src/main.leo | ||
[bubble_sort] | ||
arr0: u32 = 13u32; | ||
arr1: u32 = 2u32; | ||
arr2: u32 = 4u32; | ||
arr3: u32 = 3u32; | ||
arr4: u32 = 5u32; | ||
arr5: u32 = 10u32; | ||
arr6: u32 = 7u32; | ||
arr7: u32 = 1u32; | ||
13u32 2u32 4u32 3u32 5u32 10u32 7u32 1u32 | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
// The program input for core/src/main.leo | ||
[main] | ||
public a: field = 1field; | ||
1field | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
// The program input for fibonacci/src/main.leo | ||
[fibonacci] | ||
public n: u8 = 63u8; | ||
63u8 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
// The program input for groups/src/main.leo | ||
// Leo will use provided string as the x coordinate and attempt to recover the y coordinate to form a group. | ||
[main] | ||
a: group = 1817767092074430972953743941103352519057913259183777531581123188265134806220group; | ||
1817767092074430972953743941103352519057913259183777531581123188265134806220group |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
// The program input for ntzdebruijn/src/main.leo | ||
[main] | ||
public x: u32 = 2147483648u32; | ||
2147483648u32 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
// The program input for ntzgaudet/src/main.leo | ||
[main] | ||
public x: u32 = 2147483648u32; | ||
2147483648u32 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
// The program input for ntzloops/src/main.leo | ||
[main] | ||
public x: u32 = 2147483648u32; | ||
2147483648u32 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
// The program input for ntzmasks/src/main.leo | ||
[main] | ||
public x: u32 = 1073741824u32; | ||
1073741824u32 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
// The program input for ntzreisers/src/main.leo | ||
[main] | ||
public x: u32 = 2147483648u32; | ||
2147483648u32 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
// The program input for nztseals/src/main.leo | ||
[main] | ||
public x: u32 = 2147483648u32; | ||
2147483648u32 |
4 changes: 1 addition & 3 deletions
4
examples/hackers-delight/ntzsearchtree/inputs/ntzsearchtree.in
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
// The program input for ntzsearchtree/src/main.leo | ||
[main] | ||
public z: u32 = 2147483648u32; | ||
2147483648u32 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
// The program input for ntzsmallvals/src/main.leo | ||
[main] | ||
public x: u32 = 2147483648u32; | ||
2147483648u32 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
// The program input for helloworld/src/main.leo | ||
[main] | ||
public a: u32 = 1u32; | ||
b: u32 = 2u32; // Input variable `b` is private by default. | ||
1u32 2u32 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
80u32 5u32 10u8 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1 @@ | ||
// The program input for interest/src/main.leo | ||
[fixed_iteration_interest] | ||
capital: u32 = 80u32; | ||
rate: u32 = 5u32; // 5% | ||
|
||
[bounded_iteration_interest] | ||
capital: u32 = 80u32; | ||
rate: u32 = 5u32; // 5% | ||
iterations: u8 = 10u8; | ||
80u32 5u32 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1 @@ | ||
// The program input for message/src/main.leo | ||
// To pass "m" into the "main" function we | ||
// 1. Define the "Message" type. | ||
// 2. Use brackets `{ }` to enclose the struct members. | ||
// 3. Define each struct member `name : value`. | ||
[main] | ||
m: Message = Message { first: 2field, second: 3field }; | ||
"{ first: 2field, second: 3field }" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau 100u64 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,5 @@ | ||
// The program input for simple_token/src/main.leo | ||
[mint] | ||
owner: address = aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau; | ||
amount: u64 = 100u64; | ||
|
||
[transfer] | ||
token: Token = Token { | ||
"{ | ||
owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau, | ||
amount: 100u64, | ||
_nonce: 0group, | ||
}; | ||
to: address = aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau; | ||
amount: u64 = 50u64; | ||
}" aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau 50u64 |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,6 @@ | ||
// The `new` function does not take any inputs. | ||
[new] | ||
|
||
// Inputs for the `make_move` function. | ||
// - `player` : A u8 representing the player making the move. 1 for player 1, 2 for player 2. | ||
// - `row` : A u8 representing the row to make the move in. | ||
// - `column` : A u8 representing the column to make the move in. | ||
// - `board` : A representation of the board state. | ||
[make_move] | ||
player: u8 = 1u8; | ||
row: u8 = 1u8; | ||
col: u8 = 1u8; | ||
board: Board = Board { | ||
1u8 1u8 1u8 "{ | ||
r1: Row { c1: 0u8, c2: 0u8, c3: 0u8 }, | ||
r2: Row { c1: 0u8, c2: 0u8, c3: 0u8 }, | ||
r3: Row { c1: 0u8, c2: 0u8, c3: 0u8 }, | ||
}; | ||
}" | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1 @@ | ||
// The program input for twoadicity/src/main.leo | ||
[main] | ||
// Here is a made-up example. | ||
// public a: field = 391995973843653359517682711560178397928211734490775552field; | ||
// (comes from: 2field.pow(41) * 178259130663561045147472537592047227885001field) | ||
|
||
// This example is (maxfield - 1). | ||
// The output for this can be seen in the Pratt certificate | ||
// for bls12-377-scalar-field-prime | ||
// as the number of factors of 2 in (bls12-377-scalar-field-prime - 1). | ||
public a: field = 8444461749428370424248824938781546531375899335154063827935233455917409239040field; | ||
8444461749428370424248824938781546531375899335154063827935233455917409239040field |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
"{ | ||
owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau, | ||
pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field, | ||
_nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group | ||
}" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2264670486490520844857553240576860973319410481267184439818180411609250173817field aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,5 @@ | ||
// The program input for vote/src/main.leo | ||
[propose] | ||
info: ProposalInfo = ProposalInfo { | ||
"{ | ||
title: 2077160157502449938194577302446444field, | ||
content: 1452374294790018907888397545906607852827800436field, | ||
proposer: aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2, | ||
}; | ||
|
||
[new_ticket] | ||
pid: field = 2264670486490520844857553240576860973319410481267184439818180411609250173817field; | ||
voter: address = aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau; | ||
|
||
[agree] | ||
ticket: Ticket = Ticket { | ||
owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau, | ||
pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field, | ||
_nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group | ||
}; | ||
|
||
[disagree] | ||
ticket: Ticket = Ticket { | ||
owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau, | ||
pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field, | ||
_nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group | ||
}; | ||
}" |
This file contains 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