mirror of
https://github.com/ParkerTenBroeck/coroutines.git
synced 2026-06-07 05:08:51 -04:00
started cleaning up and organizing code
This commit is contained in:
parent
70920b14a8
commit
06defb5944
6 changed files with 531 additions and 522 deletions
74
src/Examples.java
Normal file
74
src/Examples.java
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
import generator.Gen;
|
||||
|
||||
public class Examples {
|
||||
// public static Gen<String, Void> parse(String str){
|
||||
// for(var gen = parse(str); gen.next() instanceof Gen.Yield(var item);){
|
||||
//
|
||||
// }
|
||||
// return Gen.ret();
|
||||
// }
|
||||
|
||||
// public static Gen<String, Void> parse(String str){
|
||||
// {
|
||||
// String meow = "10";
|
||||
// meow += "11";
|
||||
// Gen.yield(meow);
|
||||
// Gen.yield(meow);
|
||||
// Gen.yield(meow);
|
||||
// Gen.yield(meow);
|
||||
// }
|
||||
// for(var split : str.split(" ")){
|
||||
// Gen.yield(split);
|
||||
// }
|
||||
// {
|
||||
// var str2 = str;
|
||||
// while(str2.length()>10){
|
||||
// var len = str2.length();
|
||||
// Gen.yield(len+" length");
|
||||
// str2 = str2.substring(1);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// while(str.length()>10){
|
||||
// var len = str.length();
|
||||
// Gen.yield(len+" length");
|
||||
// str = str.substring(1);
|
||||
// }
|
||||
// return Gen.ret();
|
||||
// }
|
||||
|
||||
// public static Gen<String, Void> gen(int times, double mul) {
|
||||
// mul -= 0.5;
|
||||
// for (int i = 0; i < times; i ++) {
|
||||
// Gen.yield("iteration number: " + i*mul);
|
||||
// }
|
||||
// return Gen.ret();
|
||||
// }
|
||||
// public static Gen<String, Void> gen(int times, double mul) {
|
||||
// mul -= 0.5;
|
||||
// for (int i = 0; i < times; i++) {
|
||||
// Gen.yield("iteration number: " + i*mul);
|
||||
// }
|
||||
// return Gen.ret();
|
||||
// }
|
||||
|
||||
// public static Gen<String, Void> gen() {
|
||||
// Gen.yield("1");
|
||||
// Gen.yield("2");
|
||||
// Gen.yield("3");
|
||||
// Gen.yield("4");
|
||||
// return Gen.ret();
|
||||
// }
|
||||
|
||||
// public static <T> Gen<T, Void>test(T val){
|
||||
// Gen.yield(val);
|
||||
// return Gen.ret();
|
||||
// }
|
||||
|
||||
public static Gen<Double, Void> test(double[] nyas){
|
||||
for(var d : nyas){
|
||||
Gen.yield(d);
|
||||
}
|
||||
return Gen.ret();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue