list of byte encoded as JS Uint8Array + demo more readable
This commit is contained in:
parent
574651ccb7
commit
3d08485a08
6 changed files with 102 additions and 37 deletions
|
|
@ -1,14 +1,17 @@
|
|||
import {Int, Bool, Double} from "../primitives/symbols.js";
|
||||
import {Int, Bool, Double, Byte} from "../primitives/symbols.js";
|
||||
import { makeListModule } from "../structures/list_common.js";
|
||||
import { makeProductType } from "../structures/product.js";
|
||||
import { makeSumType } from "../structures/sum.js";
|
||||
import { getListType, prodType, sumType } from "../type_registry.js";
|
||||
|
||||
const ListOfInt = getListType(Int);
|
||||
const ListOfIntModule = makeListModule(Int);
|
||||
const ListOfDouble = getListType(Double);
|
||||
const ListOfDoubleModule = makeListModule(Double);
|
||||
|
||||
const ListOfListOfInt = getListType(ListOfInt);
|
||||
const ListOfListOfIntModule = makeListModule(ListOfInt);
|
||||
const ListOfListOfDouble = getListType(ListOfDouble);
|
||||
const ListOfListOfDoubleModule = makeListModule(ListOfDouble);
|
||||
|
||||
const ListOfByte = getListType(Byte);
|
||||
const ListOfByteModule = makeListModule(Byte);
|
||||
|
||||
export const ModuleValues = [
|
||||
{i: 0n, t: Int},
|
||||
|
|
@ -16,12 +19,15 @@ export const ModuleValues = [
|
|||
{i: false, t: Bool},
|
||||
{i: 3.14159265359, t: Double},
|
||||
|
||||
{i: {l:[42n, 43n]} , t: ListOfInt},
|
||||
{i: {l:[{l:[42n, 43n]}, {l:[999n]}]}, t: ListOfListOfInt},
|
||||
{i: {l:[4.2, 7.6]} , t: ListOfDouble},
|
||||
{i: {l:[{l:[4.2, 7.6]}, {l:[4.3]}]}, t: ListOfListOfDouble},
|
||||
|
||||
{i: new Uint8Array([1,2,3]), t: ListOfByte},
|
||||
|
||||
// i'm lazy
|
||||
...ListOfIntModule,
|
||||
...ListOfListOfIntModule,
|
||||
...ListOfDoubleModule,
|
||||
...ListOfListOfDoubleModule,
|
||||
...ListOfByteModule,
|
||||
|
||||
|
||||
...makeProductType(Int, Bool),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue