ahdinosaur / rimu Goto Github PK
View Code? Open in Web Editor NEWTemplate language for structured data: functional YAML 🌱
Home Page: https://rimu.dev
License: Apache License 2.0
Template language for structured data: functional YAML 🌱
Home Page: https://rimu.dev
License: Apache License 2.0
Is your feature request related to a problem? Please describe.
You should be able to return a closure function.
Describe the solution you'd like
let
equals: (a) => (b) => a == b
in
equals(0)
- 0
Implementation details
At the moment, we return functions as values, without the environment they "close over". A function value should now have an environment attached, which will be used when evaluating.
Describe alternatives you've considered
Additional context
Describe the solution you'd like
Example:
switchAll
case x > 10
then "greater than ten"
case x > 20
then "greater than twenty"
Returns a list of all that match
TODO Checklist
rimu-parse
rimu-eval
examples
playground
docs
Describe alternatives you've considered
Additional context
Describe the solution you'd like
Example:
mapValues
object:
a: 1
b: 2
c: 3
each: (value, key) =>
value + 1
TODO Checklist
rimu-parse
rimu-eval
examples
playground
docs
Describe alternatives you've considered
Additional context
Describe the solution you'd like
Example:
switch
case os.name == "macos"
then "brew"
case os.name == "linux" && os.distribution == "debian"
then "apt"
Is not super important since nested if-then-else
if-then-else
if-then
works too.
TODO Checklist
rimu-parse
rimu-eval
examples
playground
docs
Describe alternatives you've considered
Additional context
Is your feature request related to a problem? Please describe.
With the current Rimu syntax, when you call a function as a block, you pass arguments to the function as a block list.
add
- 10
- 20
This is confusing in two ways:
-
's look like minus signs. The visual difference between the dash as a list marker and the dash for a unary negation operator is so small. More difference in the syntax highlighting will help, but still.Describe the solution you'd like
A new approach would be change how lists are handled.
A list is a bunch of blocks, one after another, on the same level of indentation.
(Or this becomes a new concept: a tuple. And list stays the same.)
So
add
10
20
(This is very similar to wisp)
Then the question becomes, what do we do when you want to have two separate lists, one after another?
In wisp, this is handled with the :
marker.
So
concat
:
"a"
"b"
"c"
:
"d"
"e"
"f"
???
Open questions
let
list:
- "a"
in list
let
list:
"a"
in list
I'm not sure yet, so for now will let the back brain have a think. Unless anyone else has thoughts.
How might this be added to Rimu?
What are possible alternatives?
Additional context
example input:
hello:
$if: true
world: 10
sup: "dude"
current error:
Compiler: Unexpected token
found end of input
i believe this is the issue: zesterer/chumsky#397 (comment)
Describe the solution you'd like
A design similar to:
(Draft documentation)
Rimu supports multi-line values with
>
and>"
>
A multi-line expression.
Identation is removed, newlines are removed.
story: > """Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Eleifend donec pretium vulputate sapien nec sagittis aliquam malesuada."""
"""
is the multi-line string character.
>"
A multi-line string.
Identation is removed. Newlines are preserved.
story: >" Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Eleifend donec pretium vulputate sapien nec sagittis aliquam malesuada.
Describe alternatives you've considered or related projects
Additional context
Is your feature request related to a problem? Please describe.
The Rimu standard library is incomplete.
Describe the solution you'd like
A core standard library based on: https://clojuredocs.org/quickref
This issue is to create other issues for the missing functions.
What are possible alternatives?
Additional context
let (a = 10, b = 20) { a + b }
let (
a = 10,
b = 20,
c = 40,
) {
a + b / c
}
OR
let a = 10, b = 20 { a + b }
let
a = 10,
b = 20,
c = 40,
{
a + b / c
}
$type: AptInstall
pkg: "vim"
$string: "vim"
fn add (a: Number, b: Number) => a + b
fn add (a: String, b: String) => a + b
fn add (a: List, b: List) => a + b
???
Describe the solution you'd like
A core standard library based on: https://clojuredocs.org/quickref
At the moment, a function body can only be a Rimu expression. But for a standard library, we need to be able to access things in Rust-land, such as the length of a list's vec.
TODO Checklist
Value
's Function
into an enum
Function::Rimu
Function::Rust
, where the enum references a Rust function.rimu-stdlib
crate
length
functionDescribe alternatives you've considered
Additional context
Describe the solution you'd like
Example:
filter
list:
- value: 10
- value: 20
- value: 30
each: (item) => item.value > 15
TODO Checklist
rimu-parse
rimu-eval
examples
playground
docs
Describe alternatives you've considered
Additional context
Is your feature request related to a problem? Please describe.
At the moment there's an overlap in how we use key:
.
Even though the two usages have different semantics (and different highlighting).
Describe the solution you'd like
Maybe instead of
message:
let
name: "Charlie"
in
"hello " + mood
We should do:
message:
let
name = "Charlie"
in
"hello " + mood
How might this be added to Rimu?
What are possible alternatives?
Or we keep the status quo.
Additional context
do we even want to coerce values into booleans when evaluating an if?
what if that was a type error?
Describe the solution you'd like
Example:
(x, y) => x + y
Or to within a block
$exec: (x, y) =>
a: x + y
b: x - y
Describe alternatives you've considered or related projects
Additional context
keen to replace rhai
with a tiny evaluator based on slac
also:
Number
so no more uints, ints, and floats: only big decimalsDescribe the solution you'd like
Example:
- type set
width: 10
color: 4
- type rotate
right: 18
- type move
forward: 50
Where each $type
identifier refers to a schema identifier.
TODO Checklist
rimu-parse
rimu-eval
examples
playground
docs
Describe alternatives you've considered
Additional context
Complex configs: [...] declarative package managers (Nix) [...] are complex enough to need functional config generation.
Hmm, but Nix already realizes this point, doesn't it? 👀
(i.e. there's no point in using Rimu within Nix, because you can already do everything within Nix)
https://www.reddit.com/r/rust/comments/17035r0/comment/k3jxyr5/
I think I'm trying to say something like "Rimu can do functional config generation like Nix". I'll think about how to say that better.
Describe the solution you'd like
A library to provide autocomplete functionality, whether for an LSP (Language Server Protocol) server or for the CodeMirror playground.
Describe alternatives you've considered or related projects
Additional context
Depends on: #22
Is your feature request related to a problem? Please describe.
Now with #42 done, each output value has a span to the corresponding Rimu code.
Describe the solution you'd like
When you click on an output item, the corresponding Rimu code is highlighted.
Something like https://lezer-playground.vercel.app/
Describe alternatives you've considered
Additional context
https://wryun.github.io/rjsone/
previously:
rimu --template ./path/to/template --context ./path/to/context > ./path/to/output
support YAML, TOML, and JSON.
Is your feature request related to a problem? Please describe.
Since Rimu is a template language, all the objects allocated during evaluation can be de-allocated after the result is returned (serialized). This means no need for a garbage collector and no need even for a standard heap allocator. Rimu may benefit from a bump / arena allocator.
Describe the solution you'd like
Investigate using bumpaloo
, or another bump / arena allocator.
Describe alternatives you've considered
Additional context
Inspired by this video: "(2009) Self and Self: Whys and Wherefores - David Unger"
e.g.
Value | Principle | Practice |
---|---|---|
Simplicity | Minimal concepts | Everything is data and functions (?) |
Accessibility |
...
Describe the solution you'd like
Example:
fn [a, b]
do a + b
TODO Checklist
rimu-parse
rimu-eval
examples
playground
docs
Describe alternatives you've considered
Additional context
Describe the bug
Playground fails with oom
error
To Reproduce
Steps to reproduce the behavior:
__rg__oom
Expected behavior
You can keep using the playground without error.
Device (please complete the following information):
Additional context
Describe the solution you'd like
A code formatter to automatically prettify code.
Opinions:
Describe alternatives you've considered or related projects
rustfmt
prettier
Additional context
Describe the solution you'd like
Eval should return spanned values.
Would be important for validating values against schemas and displaying good errors
Describe alternatives you've considered
Additional context
Operators:
$fn
$apply
but the question is: how do we "render" a Template::Function
if we return a Value
and there's no Value::Function
?
Describe the solution you'd like
A schema model to describe what structures and types are expected in a Rimu template.
We should just integrate with JSON-Schema, rather than making our own schema model from scratch.
Describe alternatives you've considered or related projects
Additional context
rimu-meta
(previously rimu-report
)rimu-ast
(block and expression ast)rimu-parse
(lexer and compiler, for both block and expr)rimu-format
)rimu-value
rimu-env
rimu-eval
(evaluator, for both block and expr)
env
?rimu
rimu-repl
rimu-cli
)Describe the solution you'd like
Example:
let
pkgs:
- "zsh"
- "vim"
in
map
list: pkgs
each: (pkg) =>
command: "apt install ${pkg}"
TODO Checklist
rimu-parse
rimu-eval
examples
playground
docs
Describe alternatives you've considered
Additional context
similar to lisps, so then predicate functions can be named like
string?("arst")
Hi!
Recently I did many Profile-Guided Optimization (PGO) benchmarks on multiple projects (including static analysis tools and compilers like Rustc, Clang, Clangd, Clang Tidy, and many others) - the results are available here. So that's why I think it's worth trying to apply PGO to Rimu.
I can suggest the following things to do:
Here are some examples of how PGO is already integrated into other projects' build scripts:
After PGO, I can suggest evaluating LLVM BOLT as an additional optimization step after PGO.
For the Rust projects, I recommend starting with cargo-pgo.
I understand that the project is in the earliest development stages so consider the issue like an idea for future improvements.
Keen to pay someone for a proper logo / icon / illustation of a Rimu, but not sure how.
Is there a better syntax for Rimu? Could we better combine YAML (data) and LISP (code-as-data)?
I see wisp and I wonder if there's something to use here.
One idea would be to only use :
when describing data, and the block operations become special syntax.
For example:
let
pkgs:
- "zsh"
- "vim"
in
map pkgs
each (pkg) =>
command: "apt install ${pkg}"
But even this example needs help.
I see a few "pure" directions: pure LISP code-as-data, pure functional everything-is-auto-curried, etc. And maybe something good lies down that path, but I don't want to be so pure that it's inaccessible to newbies.
inspired by StrictYaml
"strings"
12
also note: the Rust YAML serde parser doesn't support span information: dtolnay/serde-yaml#181. so is a potential reason to implement our own parser with chumsky
.
Describe the solution you'd like
If the data-driven integration tests fail, we should know exactly which test case caused the failure.
At the moment, one #[test]
runs multiple data tests, so it's hard to know what exactly went wrong.
We should improve this somewhat.
Design inspiration
build.rs
to build a test file based on their spec data. At first I was resistant, but maybe that is the best approach.Describe alternatives you've considered
The alternative is we write a re-usable test macro. Myabe that's better.
Additional context
A 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.