Skip to content

Commit 5a250fd

Browse files
committed
Add quine.wybe sample
1 parent f3ed014 commit 5a250fd

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

samples/quine.wybe

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
## quine.wybe
2+
#
3+
# A Quine
4+
?listing = [
5+
"## quine.wybe",
6+
"#",
7+
"# A Quine",
8+
"?listing = [",
9+
"]",
10+
"?lines = listing^length",
11+
"for _ in 0..4; ?line in listing {",
12+
" !println line",
13+
"}",
14+
"for ?index in 0..lines; ?line in listing {",
15+
" ?quote = 34:char",
16+
" !print quote; !print line; !print quote",
17+
" if { index < lines - 1 ::",
18+
" !println ','",
19+
" | else ::",
20+
" !nl",
21+
" }",
22+
"}",
23+
"for ?i in 4..lines {",
24+
" if { ?line = listing[i] ::",
25+
" !println(line)",
26+
" }",
27+
"}"
28+
]
29+
?lines = listing^length
30+
for _ in 0..4; ?line in listing {
31+
!println line
32+
}
33+
for ?index in 0..lines; ?line in listing {
34+
?quote = 34:char
35+
!print quote; !print line; !print quote
36+
if { index < lines - 1 ::
37+
!println ','
38+
| else ::
39+
!nl
40+
}
41+
}
42+
for ?i in 4..lines {
43+
if { ?line = listing[i] ::
44+
!println(line)
45+
}
46+
}

0 commit comments

Comments
 (0)