BarChart [0 1 2 3 4 5]
LineChart [0 1 2 3 4 5]
ScatterPlot [0 0, 1 1, 2 2, 3 3]
or [0 1 2 3, 0 1 2 3]
BarChart [0 1 2, 3 4 5]
Chart { ... }
:: #L1.#myNotebook.#rev111.functionOfInterest
#L1
object will do the loading (maybe different name?)a: [1 2 3], c: a[0] ; c = 1 :D
source: [1 2, 3 4], indices: [0 0, 1 1], result: source(indices) ; result = [1 4]
@
can stay for matmul, yay!)#render
(because of that “Can I create AI in HTML?” meme)
```L1
; mu: {
; #render: props => (
; <div>
; {props.name}
; {props.surname}
; </div>
; )
; }
mu: {
#state: {
name: “John”
surname: “Doe”
}
#render: props => (
{
tag: “div”
content: {
child1: {
tag: “span”
content: props.name
}
child2: {
tag: “span”
content: props.surname
}
}
}
)
#call: a => #render #state
}hu: mu!
## Random
* ::Self should be ::RTFM
* allow ! and () as a lambda argument?
* :: with expression
* eliminates cognitive friction
* empty string as a key
* (as a shorthand for #valueOf or #return?)
* user cannot use it before naming it – good
* is forced to have only one non-named prop – good
## Bugs
* rendering an <Issue /> is leaking because Monaco does not notify DOMNode removal
* report issue in Monaco GitHub?
# Open questions
## How to mutate an existing object?
1. Is it even necessary?
1. Should it be allowed?
1. When is it a good idea?
What about this?
```L1
Counter: {
i: 0
increaseBy: x => {
i: i + x
increaseBy: x => { ; can't just ::increaseBy because of the wrong closure
i: i + x
}
}
}
Counter: Counter.increaseBy 7
Counter: Counter.increaseBy 2
Counter: Counter.increaseBy 1 ; does not scale
; also, if Counter is shared, it won't work
One route may be having an explicit state object inside the normal object. State object could be mutated. However, there also needs to be a way to access parent/super/prototype object somehow…
Counter: {
#state: {
i: 0
}
increaseBy: x => {
#state.i: #state.i + x
}
}
mu1: Counter.increaseBy 3
mu2: Counter.increaseBy 3
Another approach:
Counter: {
#state: {
i: 0
; internal fn
; #call: newState => ()
}
increaseBy: x => #state {
i: #state.i + x
}
}
mu1: Counter.increaseBy 3
mu2: Counter.increaseBy 3
:: Counter.#state.i
So far, there should be a way to modify super/proto object. But then L1 cease to be pure. Object should not be changed directly from outside by force. But it should be able to change itself when asked nicely.
a: {
b: 22
}
; a.b: 23
a: a.#mutate {
b: 23
}
; looks really awful