mlajtos / l1 Goto Github PK
View Code? Open in Web Editor NEWL1: Tensor Studio — The playground for tensors
Home Page: https://mlajtos.github.io/L1/latest/
License: MIT License
L1: Tensor Studio — The playground for tensors
Home Page: https://mlajtos.github.io/L1/latest/
License: MIT License
To learn the language by examples.
In JS, you can use computed property name like this:
const key = "age"
const mu = {
[key]: 47
}
In L1, you should be able to do this via string interpolation:
key: "age"
mu: {
"$(key)": 47
}
This means that object should allow strings as prop keys, which is good since it will be closer to JSON.
Another way is using just parens, which looks really clean:
key: "age"
mu: {
(key): 47
}
How to define computed symbol key props...?
key: "age"
mu: {
(#(key)): 47 ; ugly
(# key): 47 ; hmm
#(key): 47 ; hmm2
(Symbol key): 47 ; via function call (compatible with "(# key)")
}
On Try APL there's a little cheat sheet with symbols. It would be nice to have something like that for L1 (::Self
is too long).
In JS, the string interpolation can be used only in the template literals:
const name = "World"
const greeting = `Hello ${name}`
In L1, the string interpolation is going to be available in normal strings:
name: "World"
greeting: "Hello $(name)"
Inside the parens can be any expression that should result in string. If the value of the expression is not a string, an error is produced.
As __repr__
in Python, but not a string representation, but visual representation. This is already working for the builtin types (Tensors, Objects, etc.), but it should be accesible from the language.
Paired with HTML literals it would be really nice. Example pulled from the future:
A: {
value: 23
#repr: (
<h1>{value}</h1>
)
}
This has a very low priority.
Pattern matching is an extremely powerful construct and should not be left out of the language.
However, this seems like a really complex feature that will take a long time to get right. Binding free variables looks like the major pain-point implementation-wise.
Good start point may be just multiway conditional – this is using bools as object keys, which is prohibited, and other non-existing stuff, but lets see...
someBool: ...
result: someBool ? {
(True): "Yup"
(False): "Nope"
}
someTensor: ...
result: someTensor ? {
([]): "Empty tensor"
(1): "One"
([1 2 3]): "Meh"
#default: "Something else"
}
someObject: ...
result: someObject ? {
({}): "Empty object"
...
}
This seems useless...
Patterns in Swift
Pattern matching in ReasonML
Amber
Scala
Haxe
Should use existing constructs as much as possible. However, switch operator with a list of cases will probably be insufficient.
Right now, L1 uses the same prototype chain mechanism as JS, i.e. objects in L1 are JS objects. This has a big limitation: only string and symbol keys for object values.
Solution: {}
in L1 should be Map()
.
Using keys with any type would be highly beneficial, e.g. ability to have a function as a key would probably be the most twisted thing possible.
Another useful feature would be to have an ability to create an object from a specified prototype:
Proto: {
prop: 23
}
Mu: {
#proto: Proto
prop2: prop + 24
}
I just wanted to do {+/ ⍵*2}
...
This is distracting. Also, you usually want to see previous results while writing the code.
Callable Tensors, i.e. tensor as a function, can be a multi-purpose mechanism for:
In Observable-based interpreter, every function takes a raw JS value and returns an Observable. This breaks composionality and it is a bad design choice.
This problem complicates/prevents implementation of following functions which were trivial in Promise-based interpreter:
Obviously, every function should receive and return an Observable.
Mouse.x * 10
should work right awaycombineLatest
should get two second-order Observables (?)Interpreter
should manipulate only second-order Observables (?)With ::Self
it barely responses to typing.
Browser: Firefox 62.0b13
Lists will be implemented as arrays in JS. However, immutable.
[expr, expr]
(expr, expr)
()
will clash with None (doesn't have to)
fn!
, fn()
(Length () = 0) = (Length ! = !)
, (1,2,3) -> Map (v => v + 1)
, () -> Map fn
, error: ! -> Map fn
(expr,)
is single-element listcomma
operator creates tuplescomma
operator is a bad part, so can be alteredA declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.