YAPC::EU 2018 Glasgow Update!
This commit is contained in:
parent
22f33d4004
commit
4e2d22a71d
1170 changed files with 15042 additions and 3047 deletions
|
|
@ -2,24 +2,21 @@ import system'routines.
|
|||
import extensions.
|
||||
import extensions'text.
|
||||
|
||||
randomBrackets =
|
||||
{
|
||||
new : aLength
|
||||
[
|
||||
if (0 == aLength)
|
||||
[ ^emptyLiteral ];
|
||||
[
|
||||
var aBrackets :=
|
||||
Array new(aLength); populate(:i)($91)
|
||||
+
|
||||
Array new(aLength); populate(:i)($93).
|
||||
randomBrackets(len)
|
||||
[
|
||||
if (0 == len)
|
||||
[ ^emptyLiteral ];
|
||||
[
|
||||
var aBrackets :=
|
||||
Array new(len); populate(:i)($91)
|
||||
+
|
||||
Array new(len); populate(:i)($93).
|
||||
|
||||
aBrackets := aBrackets randomize:(aLength * 2).
|
||||
aBrackets := aBrackets randomize(len * 2).
|
||||
|
||||
^ aBrackets summarize:(StringWriter new); toLiteral
|
||||
]
|
||||
]
|
||||
}.
|
||||
^ aBrackets summarize(StringWriter new); toLiteral
|
||||
]
|
||||
]
|
||||
|
||||
extension op
|
||||
{
|
||||
|
|
@ -33,14 +30,14 @@ extension op
|
|||
]
|
||||
}
|
||||
|
||||
public program =
|
||||
public program
|
||||
[
|
||||
0 to:9 do(:aLength)
|
||||
0 to:9 do(:len)
|
||||
[
|
||||
var anStr := randomBrackets new:aLength.
|
||||
var str:= randomBrackets(len).
|
||||
|
||||
console printLine("""",anStr,"""",anStr isBalanced; iif(" is balanced"," is not balanced"))
|
||||
console printLine("""",str,"""",str isBalanced; iif(" is balanced"," is not balanced"))
|
||||
].
|
||||
|
||||
console readChar
|
||||
].
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue