Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added two examples to Lib.Dict.shuffle function #1299

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions api-examples/function.HH.Lib.Dict.shuffle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```basic-usage.hack
$keys = vec['k1', 'k2', 'k3', 'k4', 'k5'];
$values = vec[1, 2, 3, 4, 5];
$shuffled = Dict\shuffle($keys, $values);
\print_r($shuffled);

$keys = vec['k1'];
$values = vec[1];
$shuffled = Dict\shuffle($keys, $values);
\print_r($shuffled);
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// WARNING: Contains some auto-generated boilerplate code, see:
// HHVM\UserDocumentation\MarkdownExt\ExtractedCodeBlocks\FilterBase::addBoilerplate

namespace HHVM\UserDocumentation\Api\Hsl\FunctionHHLibDictShuffle\BasicUsage;

use namespace HH\Lib\Dict;

<<__EntryPoint>>
async function _main(): Awaitable<void> {
\init_docs_autoloader();

$keys = vec['k1', 'k2', 'k3', 'k4', 'k5'];
$values = vec[1, 2, 3, 4, 5];
$shuffled = Dict\shuffle($keys, $values);
\print_r($shuffled);

$keys = vec['k1'];
$values = vec[1];
$shuffled = Dict\shuffle($keys, $values);
\print_r($shuffled);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Dict
(
[3] => k4
[2] => k3
[1] => k2
[0] => k1
[4] => k5
)
Dict
(
[0] => k1
)