diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_BuiltIn.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_BuiltIn.res index 218aa673..c39ff118 100644 --- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_BuiltIn.res +++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_BuiltIn.res @@ -281,12 +281,12 @@ let callInternal = (call: functionCall, environment, reducer: ExpressionT.reduce | ("$_typeModifier_opaque_$", [EvRecord(typeRecord)]) => typeModifier_opaque_update(typeRecord) | ("$_typeOr_$", [EvArray(arr)]) => typeOr(EvArray(arr)) | ("$_typeFunction_$", [EvArray(arr)]) => typeFunction(arr) - | ("add", [EvArray(aValueArray), EvArray(bValueArray)]) => doAddArray(aValueArray, bValueArray) - | ("add", [EvString(aValueString), EvString(bValueString)]) => + | ("concat", [EvArray(aValueArray), EvArray(bValueArray)]) => doAddArray(aValueArray, bValueArray) + | ("concat", [EvString(aValueString), EvString(bValueString)]) => doAddString(aValueString, bValueString) | ("inspect", [value, EvString(label)]) => inspectLabel(value, label) | ("inspect", [value]) => inspect(value) - | ("keep", [EvArray(aValueArray), EvLambda(aLambdaValue)]) => + | ("filter", [EvArray(aValueArray), EvLambda(aLambdaValue)]) => doKeepArray(aValueArray, aLambdaValue) | ("map", [EvArray(aValueArray), EvLambda(aLambdaValue)]) => doMapArray(aValueArray, aLambdaValue) | ("mapSamples", [EvDistribution(SampleSet(dist)), EvLambda(aLambdaValue)]) => diff --git a/packages/website/docs/Api/DistPointSet.mdx b/packages/website/docs/Api/DistPointSet.md similarity index 100% rename from packages/website/docs/Api/DistPointSet.mdx rename to packages/website/docs/Api/DistPointSet.md diff --git a/packages/website/docs/Api/DistSampleSet.md b/packages/website/docs/Api/DistSampleSet.md new file mode 100644 index 00000000..b9a722d4 --- /dev/null +++ b/packages/website/docs/Api/DistSampleSet.md @@ -0,0 +1,67 @@ +--- +sidebar_position: 4 +title: Sample Set Distribution +--- + +### make +``` +SampleSet.make: (distribution) => sampleSet +SampleSet.make: (() => number) => sampleSet +SampleSet.make: (list) => sampleSet +``` + + + +### kde +``` +SampleSet.kde: (sampleSet) => pointSetDist +``` + + + +### toEmpiricalPdf +``` +SampleSet.toEmpiricalPdf: (sampleSet) => pointSetDist +``` + + + +### map +``` +SampleSet.map: (sampleSet, (number => number)) => sampleSet +``` + + + +### map2 +``` +SampleSet.map2: (sampleSet, sampleSet, ((number, number) => number)) => sampleSet +``` + + + +### map3 +``` +SampleSet.map3: (sampleSet, sampleSet, sampleSet, ((number, number, number) => number)) => sampleSet +``` + + + +### correlation +``` +SampleSet.correlation: (sampleSet, sampleSet) => number +``` + + + +### toInternalSampleArray +``` +SampleSet.toInternalSampleArray: (sampleSet) => list +``` +Gets the internal samples of a sampleSet distribution. This is separate from the sampleN() function, which would shuffle the samples. toInternalSampleArray() maintains order and length.Gets the internal samples of a sampleSet distribution. This is separate from the sampleN() function, which would shuffle the samples. toInternalSampleArray() maintains order and length. + + +**Examples** +``` +toInternalSampleArray(toSampleSet(normal(5,2))) +``` \ No newline at end of file diff --git a/packages/website/docs/Api/DistSampleSet.mdx b/packages/website/docs/Api/DistSampleSet.mdx deleted file mode 100644 index 282d5d64..00000000 --- a/packages/website/docs/Api/DistSampleSet.mdx +++ /dev/null @@ -1,67 +0,0 @@ ---- -sidebar_position: 4 -title: Sample Set Distribution ---- - -### make -```javascript -make: (distribution) => sampleSet -make: (() => number) => sampleSet -make: (list) => sampleSet -``` - - - -### kde -```javascript -kde: (sampleSet) => pointSetDist -``` - - - -### toEmpiricalPdf -```javascript -toEmpiricalPdf: (sampleSet) => pointSetDist -``` - - - -### map -```javascript -map: (sampleSet, (number => number)) => sampleSet -``` - - - -### map2 -```javascript -map2: (sampleSet, sampleSet, ((number, number) => number)) => sampleSet -``` - - - -### map3 -```javascript -map3: (sampleSet, sampleSet, sampleSet, ((number, number, number) => number)) => sampleSet -``` - - - -### correlation -```javascript -correlation: (sampleSet, sampleSet) => number -``` - - - -### toInternalSampleArray -```javascript -toInternalSampleArray: (sampleSet) => list -``` -Gets the internal samples of a sampleSet distribution. This is separate from the sampleN() function, which would shuffle the samples. toInternalSampleArray() maintains order and length. - - -**Examples** -```javascript -toInternalSampleArray(toSampleSet(normal(5,2))) -``` \ No newline at end of file diff --git a/packages/website/docs/Api/Duration.mdx b/packages/website/docs/Api/Duration.md similarity index 100% rename from packages/website/docs/Api/Duration.mdx rename to packages/website/docs/Api/Duration.md diff --git a/packages/website/docs/Api/List.md b/packages/website/docs/Api/List.md new file mode 100644 index 00000000..ef2e537e --- /dev/null +++ b/packages/website/docs/Api/List.md @@ -0,0 +1,179 @@ +--- +sidebar_position: 6 +title: List +--- + +## make +``` +List.make: (number, 'a) => list<'a> +List.make: (number, number => a) => list<'a> +List.make: (pointSetDist) => list +``` + + + +### toString +``` +List.toString: (list<'a>) => string +``` + + + +### length +``` +List.length: (list<'a>) => number +``` + + + +### get +``` +List.get: (list<'a>, number) => 'a +``` + + + +### find +``` +List.find: (list<'a>, 'a => bool) => 'a +``` + + + +### filter +``` +List.filter: (list<'a>, 'a => bool) => 'a +``` + + + +### set +``` +List.set: (list<'a>, number, 'a) => 'a +``` + + + +### shuffle +``` +List.shuffle: (list<'a>) => list<'a> +``` + + + +### reverse +``` +List.reverse: (list<'a>) => list<'a> +``` + + + +### range +``` +List.range: (low:number, high:number, increment?:number=1.0) => list +``` + + + +### zip +``` +List.zip: (list<'a>, list<'b>) => list> +``` + + + +### unzip +``` +List.unzip: (list>) => list, list<'b>> +``` + + + +### concat +``` +List.concat: (list<'a>, list<'b>) => list<'a|b> +``` + + + +### concatMany +``` +List.concatMany: (list>) => list<'a> +``` + + + +### slice +``` +List.slice: +``` + + + +### map +``` +List.map: (list<'a>, a => b) => list<'b> +``` + + + +### reduce +``` +List.reduce: +``` + + + +### reduceRight +``` +List.reduceRight: +``` + + + +### includes +``` +List.includes: (list<'a>, 'a => bool) => boolean +``` + + + +### every +``` +List.every: (list<'a>, 'a => bool) => boolean +``` + + + +### truncate +``` +List.truncate: (list<'a>, number) => list<'a> +``` + + + +### uniq +``` +List.uniq: (list<'a>) => list<'a> +``` + + + +### first +``` +List.first: (list<'a>) => 'a +``` + + + +### last +``` +List.last: (list<'a>) => 'a +``` + + + +### sort +``` +List.sort: (list<'a>) => list<'a> +``` \ No newline at end of file diff --git a/packages/website/docs/Api/List.mdx b/packages/website/docs/Api/List.mdx deleted file mode 100644 index 9fb5f326..00000000 --- a/packages/website/docs/Api/List.mdx +++ /dev/null @@ -1,176 +0,0 @@ ---- -sidebar_position: 6 -title: List ---- - -### make -```javascript -make: (number, 'a) => list<'a> (number, number => a) => list<'a> (pointSetDist) => list -``` - - - -### toString -```typescript -toString: (list<'a>) => string -``` - - - -### length -```typescript -length: (list<'a>) => number -``` - - - -### get -```typescript -get: (list<'a>, number) => 'a -``` - - - -### find -```typescript -find: (list<'a>, 'a => bool) => 'a -``` - - - -### filter -```typescript -filter: (list<'a>, 'a => bool) => 'a -``` - - - -### set -```typescript -set: (list<'a>, number, 'a) => 'a -``` - - - -### shuffle -```typescript -shuffle: (list<'a>) => list<'a> -``` - - - -### reverse -```typescript -reverse: (list<'a>) => list<'a> -``` - - - -### range -```typescript -range: (low:number, high:number, increment?:number=1.0) => list -``` - - - -### zip -```typescript -zip: (list<'a>, list<'b>) => list> -``` - - - -### unzip -```typescript -unzip: (list>) => list, list<'b>> -``` - - - -### concat -```typescript -concat: (list<'a>, list<'b>) => list<'a|b> -``` - - - -### concatMany -```typescript -concatMany: (list>) => list<'a> -``` - - - -### slice -```typescript -slice: -``` - - - -### map -```typescript -map: (list<'a>, a => b) => list<'b> -``` - - - -### reduce -```typescript -reduce: -``` - - -### reduceRight -```typescript -reduceRight: -``` - - - -### includes -```typescript -includes: (list<'a>, 'a => bool) => boolean -``` - - - -### every -```typescript -every: (list<'a>, 'a => bool) => boolean -``` - - - -### truncate -```typescript -truncate: (list<'a>, number) => list<'a> -``` - - - -### uniq -```typescript -uniq: (list<'a>) => list<'a> -``` - - - -### first -```typescript -first: (list<'a>) => 'a -``` - - - -### last -```typescript -last: (list<'a>) => 'a -``` - - - -### sort -```typescript -sort: (list<'a>) => list<'a> -``` \ No newline at end of file diff --git a/packages/website/docs/Api/Math.mdx b/packages/website/docs/Api/Math.md similarity index 100% rename from packages/website/docs/Api/Math.mdx rename to packages/website/docs/Api/Math.md diff --git a/packages/website/docs/Api/Number.mdx b/packages/website/docs/Api/Number.md similarity index 100% rename from packages/website/docs/Api/Number.mdx rename to packages/website/docs/Api/Number.md