combinators.random: fix a couple of usage examples in casep and casep*

db4
Keita Haga 2011-02-20 03:38:54 +09:00
parent 5a71a0d671
commit 70d06dc4c7
1 changed files with 24 additions and 16 deletions

View File

@ -32,17 +32,21 @@ HELP: casep
{ $examples { $examples
"The following two forms will output 1 with 0.2 probability, 2 with 0.3 probability and 3 with 0.5 probability" "The following two forms will output 1 with 0.2 probability, 2 with 0.3 probability and 3 with 0.5 probability"
{ $code { $code
"USING: combinators.random ;" "USING: combinators.random prettyprint ;"
"{ { 0.2 [ 1 ] }" "{"
" { 0.2 [ 1 ] }"
" { 0.3 [ 2 ] }" " { 0.3 [ 2 ] }"
" { 0.5 [ 3 ] } } casep ." " { 0.5 [ 3 ] }"
"} casep ."
} }
$nl $nl
{ $code { $code
"USING: combinators.random ;" "USING: combinators.random prettyprint ;"
"{ { 0.2 [ 1 ] }" "{"
" { 0.2 [ 1 ] }"
" { 0.3 [ 2 ] }" " { 0.3 [ 2 ] }"
" { [ 3 ] } } casep ." " [ 3 ]"
"} casep ."
} }
} }
@ -62,17 +66,21 @@ HELP: casep*
{ $examples { $examples
"The following two forms will output 1 with 0.5 probability, 2 with 0.25 probability and 3 with 0.25 probability" "The following two forms will output 1 with 0.5 probability, 2 with 0.25 probability and 3 with 0.25 probability"
{ $code { $code
"USING: combinators.random ;" "USING: combinators.random prettyprint ;"
"{ { 0.5 [ 1 ] }" "{"
" { 0.5 [ 1 ] }"
" { 0.5 [ 2 ] }" " { 0.5 [ 2 ] }"
" { 1 [ 3 ] } } casep* ." " { 1 [ 3 ] }"
"} casep* ."
} }
$nl $nl
{ $code { $code
"USING: combinators.random ;" "USING: combinators.random prettyprint ;"
"{ { 0.5 [ 1 ] }" "{"
" { 0.5 [ 1 ] }"
" { 0.5 [ 2 ] }" " { 0.5 [ 2 ] }"
" { [ 3 ] } } casep* ." " [ 3 ]"
"} casep* ."
} }
} }