Squiggle Hub

mlao-pdx

Flattens a list repeatedly until only non-list elements remain.

NOTE: List.flatten drops nested lists that are empty. listDeepFlatten is no different.

Example

import 'hub:mlao-pdx/lib-common' as c

l = [1,2,[3,[4],[]],5,[]]

Create list of unique values by Name, or value if no name.

Lambda
·
Updated

Convert a value into a list, unless it is already a list.

Copy values for tags ["doc","numberFormat","hidden","name","startOpenState"] from tagSource to tagTarget.

See this discord chat

Example

import 'hub:mlao-pdx/lib-common' as c

@name('FooName')
@doc('FooDoc')

Return same dictionary with private attributes (_*) ommitted.

Collect values for tags ["doc","numberFormat","hidden","name","startOpenState"] and return as dictionary.

Use in combination with tagMerge to copy tag values from one object to another. See this discord chat

Example

import 'hub:mlao-pdx/lib-common' as c

@name('FooName')

A list of all dictionary keys that start with an underscore.

Example

import 'hub:mlao-pdx/lib-common' as c

d = {_yes: 'Private Attribute', no: 'Common Attribute'}
c.privateAttributes(d)

Return slice of a string, as if it was a list of single characters.

Set values for tags ["doc","numberFormat","hidden","name","startOpenState"], that are not yet present on the object, from given dictionary of tags.

Use in combination with tagGet to copy tag values from one object to another. See this discord chat

Example

import 'hub:mlao-pdx/lib-common' as c

@name('FooName')

Set values for tags ["doc","numberFormat","hidden","name","startOpenState"] from given dictionary of tags.

Use in combination with tagGet to copy tag values from one object to another. See this discord chat

Example

import 'hub:mlao-pdx/lib-common' as c

@name('FooName')

Cast values into a distribution, if reasonable.

Example

import 'hub:mlao-pdx/lib-common' as c

e = {
number: c.toDistribution(10),
list_of_numbers: c.toDistribution(List.upTo(1,20)),
distribution: c.toDistribution(10 to 100),

Flattens a list repeatedly until only non-list elements remain.

NOTE: List.flatten drops nested lists that are empty. listDeepFlatten is no different.

Example

import 'hub:mlao-pdx/lib-common' as c

l = [1,2,[3,[4],[]],5,[]]

Check if a list is a unnested list of Numbers.

Example

import 'hub:mlao-pdx/lib-common' as c

{
  yes: c.isListOf([1n,2%,3,4T],'Number'),
  yes: c.isListOf(['a', '3'],'String'),
  no: c.isListOfNumbers([1n,2%,'3',4T],'Number'),

Assertion allows embedding of propositions in the estimate that have a certain likelihood of being true or false.

Aliases assumption1, risk, and scope` have been provided for semantic purposes.

Resolve the four sets of assertions into a single True or False Bernoulli distribution.

  • every requires that each passed assertion MUST be true
  • none requires that each passed assertion MUST be false
  • some requires that any of the passed assertions could be true
  • someNot requires that any of the passed assertions could be false

Assertions that do not (yet) warrant their impact be woven into the estimate, but are important to document. These tend to be assertions with wide ranging impacts and should be named as statements of truth. Their chance is commonly 100%.

Adds items that desire to use the given item.

  • Prerequisites allow control of whether the component is truly desired.
  • Components is a list of items, where a single component is a list of and item and quantity.

Adds desired components to the given item.

  • Prerequisites allow control of whether the components are truly desired.
  • Components is a list of components, where a single component is a list of price and quantity.
Dist
·
Updated

Always asserts to false.