-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
361 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react' | ||
|
||
import * as Doc from 'components/ui/Doc' | ||
|
||
type Props = { | ||
children: JSX.Element[] | ||
} | ||
|
||
export const MemoryTable: React.FC<Props> = ({ children }: Props) => { | ||
return ( | ||
<table className="table-auto mb-4"> | ||
<thead> | ||
<tr> | ||
<Doc.TH colSpan={2}>Memory</Doc.TH> | ||
</tr> | ||
<tr> | ||
<Doc.TH> | ||
<code>@</code> | ||
</Doc.TH> | ||
<Doc.TH>Value</Doc.TH> | ||
</tr> | ||
</thead> | ||
<tbody>{children}</tbody> | ||
</table> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react' | ||
|
||
type Props = { | ||
href: string | ||
} | ||
|
||
export const PlaygroundLink: React.FC<Props> = ({ href }: Props) => ( | ||
<a | ||
href={href} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
className="text-blue-500 py-2 hover:underline" | ||
> | ||
Reproduce in playground. | ||
</a> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react' | ||
|
||
import * as Doc from 'components/ui/Doc' | ||
|
||
type Props = { | ||
title: string | ||
children: JSX.Element[] | ||
} | ||
|
||
export const RefsTable: React.FC<Props> = ({ title, children }: Props) => { | ||
return ( | ||
<table className="table-auto mb-4"> | ||
<thead> | ||
<tr> | ||
<Doc.TH colSpan={3}>{title}</Doc.TH> | ||
</tr> | ||
<tr> | ||
<Doc.TH></Doc.TH> | ||
<Doc.TH>Parameter</Doc.TH> | ||
<Doc.TH>Value</Doc.TH> | ||
</tr> | ||
</thead> | ||
<tbody>{children}</tbody> | ||
</table> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react' | ||
|
||
type Props = { | ||
children: JSX.Element[] | ||
} | ||
|
||
export const TableLayout: React.FC<Props> = ({ children }: Props) => { | ||
return ( | ||
<div className="flex flex-row space-x-16 items-start py-4">{children}</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export { MemoryTable } from './MemoryTable' | ||
export { RefsTable } from './RefsTable' | ||
export { TableLayout } from './TableLayout' | ||
export { PlaygroundLink } from './PlaygroundLink' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,70 @@ | ||
--- | ||
shortDescription: Appends an element to the end of an array. | ||
invokeRefs: '[0] | [1]' | ||
outputRefs: '[2]' | ||
invokeRefs: 'array | element' | ||
fallthroughBranch: 'array' | ||
--- | ||
|
||
## Description | ||
# Description | ||
|
||
Appends an element to the end of an array. | ||
|
||
## Syntax | ||
# Syntax | ||
|
||
`array_append<T>([0]: Array<T>, [1]: T) -> ([2]: Array<T>)` | ||
``` | ||
array_append<T>([array]: Array<T>, [element]: T) -> ([array]: Array<T>) | ||
``` | ||
|
||
## Invoke Refs | ||
# Invoke Refs | ||
|
||
| Name | Description | Type | | ||
| :---: | :-------------------- | :--------: | | ||
| `[0]` | The array to update | `Array<T>` | | ||
| `[1]` | The element to append | `T` | | ||
- `[array]`: the array to update (`Array<T>`). | ||
- `[element]`: the element to insert (`T`). | ||
|
||
## Output Refs | ||
# Output Refs | ||
|
||
| Name | Description | Type | | ||
| :---: | :---------------- | :--------: | | ||
| `[2]` | The updated array | `Array<T>` | | ||
- `[array]`: the updated array (`Array<T>`). | ||
|
||
## Example | ||
# Examples | ||
|
||
`array_append<u8>([1], [2]) -> ([3]);` | ||
Append the value `42` to the end of an array. | ||
|
||
``` | ||
array_append<u8>([1], [2]) -> ([3]) | ||
``` | ||
|
||
<TableLayout> | ||
<MemoryTable> | ||
<Line> | ||
<Cell>145</Cell> | ||
<Cell>1</Cell> | ||
</Line> | ||
<Line> | ||
<Cell>149</Cell> | ||
<Cell>4</Cell> | ||
</Line> | ||
<Line> | ||
<Cell>150</Cell> | ||
<Cell>42</Cell> | ||
</Line> | ||
</MemoryTable> | ||
|
||
<RefsTable title="Invoke Refs"> | ||
<Line> | ||
<Cell>`array`</Cell> | ||
<Cell>[1]</Cell> | ||
<Cell>`@145, @149`</Cell> | ||
</Line> | ||
<Line> | ||
<Cell>`element`</Cell> | ||
<Cell>[2]</Cell> | ||
<Cell>42</Cell> | ||
</Line> | ||
</RefsTable> | ||
|
||
<RefsTable title="Output Refs"> | ||
<Line> | ||
<Cell>`array`</Cell> | ||
<Cell>[3]</Cell> | ||
<Cell>`@145, @150`</Cell> | ||
</Line> | ||
</RefsTable> | ||
</TableLayout> |
Oops, something went wrong.