Skip to content

Commit 720cb28

Browse files
committed
Merge branch 'v0.2-beta' into 'main'
v0.2.52-beta See merge request mech-lang/mech!134
2 parents c452b25 + a01e3c8 commit 720cb28

File tree

40 files changed

+1611
-430
lines changed

40 files changed

+1611
-430
lines changed

Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
22
name = "mech"
3-
version = "0.2.51"
3+
version = "0.2.52"
44
authors = ["Corey Montella <[email protected]>"]
55
description = "Mech is a reactive programming language for building robots, games, and animations."
6-
documentation = "https://mech-lang.org/docs"
6+
documentation = "https://docs.mech-lang.org"
77
homepage = "https://mech-lang.org"
88
repository = "https://github.com/mech-lang/mech"
99
keywords = ["mech", "language", "programming", "dataflow", "runtime"]
@@ -64,9 +64,9 @@ VectorD = []
6464
MatrixD = []
6565

6666
[dependencies]
67-
mech-core = "0.2.51"
68-
mech-syntax = "0.2.51"
69-
mech-interpreter = "0.2.51"
67+
mech-core = "0.2.52"
68+
mech-syntax = "0.2.52"
69+
mech-interpreter = "0.2.52"
7070

7171
clap = {version = "4.5.40", features = ["cargo"]}
7272
colored = "3.0.0"
@@ -124,13 +124,13 @@ mech-interpreter = { path = 'src/interpreter'}
124124
#mech-logic = { path = '../machines/logic' }
125125

126126
[patch.'https://gitlab.com/mech-lang/core']
127-
mech-core = { path = 'src/core', version = '0.2.51' }
127+
mech-core = { path = 'src/core', version = '0.2.52' }
128128

129129
[patch.'https://gitlab.com/mech-lang/syntax']
130-
mech-syntax = { path = 'src/syntax', version = '0.2.51' }
130+
mech-syntax = { path = 'src/syntax', version = '0.2.52' }
131131

132132
[patch.'https://gitlab.com/mech-lang/interpreter']
133-
mech-interpreter = { path = 'src/interpreter', version = '0.2.51' }
133+
mech-interpreter = { path = 'src/interpreter', version = '0.2.52' }
134134

135135
#[patch.'https://gitlab.com/mech-lang/wasm']
136136
#mech-wasm = { path = 'src/wasm', version = '0.2.44' }

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ cargo install mech
3232

3333
## 📚 Documentation
3434

35-
New to Mech? Start with [Learn Mech in Fifteen Minutes](https://gitlab.com/mech-lang/docs/-/raw/v0.2-beta/III.guides/MechFifteen.mec).
35+
New to Mech? Start with [Learn Mech in Fifteen Minutes](https://docs.mech-lang.org/III.guides/mech-in-fifteen-minutes.html).
3636

37-
Comprehensive documentation is available at [docs.mech-lang.org](https://docs.mech-lang.org) and open-sourced on [GitHub](https://github.com/mech-lang/docs).
37+
Comprehensive documentation is available at [docs.mech-lang.org](https://docs.mech-lang.org) and open-sourced on [GitHub](https://github.com/mech-lang/mech/tree/main/docs).
3838

3939
## 🪐 Community
4040

docs/I.getting-started/install.mec

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ Download and Install Mech
66

77
The easiest way to install Mech is to use the installer provided for your platform. The installer includes the `mech` command-line tool, which is a standalone executable that includes everything you need to get started with Mech.
88

9-
- **Windows** - [x86-64](https://github.com/mech-lang/mech/releases/download/v0.2.51-beta/mech-installer-v0.2.51-beta-win-x86-64.exe)
9+
- **Windows** - [x86-64](https://github.com/mech-lang/mech/releases/download/v0.2.52-beta/mech-installer-v0.2.52-beta-win-x86-64.exe)
1010

1111
Right now, the installer is only available for Windows, but we are working on providing installers for other platforms in the future.
1212

1313

1414
(1.1) Desktop App
1515

16-
We're experimenting with a Tauri-based app for Mech as well, which is kind of like Electron but Rust's version; it uses the system's webview to render the UI, which makes it much more lightweight and efficient. Right now all it does is wrap the Mech REPL, and it works, but it's not clear if this is the right direction for the project. If you want to try it out, you can [download the Mech Tauri app for Windows](https://github.com/mech-lang/mech/releases/download/v0.2.51-beta/mech-app_0.2.51_x86-64-setup.exe).
16+
We're experimenting with a Tauri-based app for Mech as well, which is kind of like Electron but Rust's version; it uses the system's webview to render the UI, which makes it much more lightweight and efficient. Right now all it does is wrap the Mech REPL, and it works, but it's not clear if this is the right direction for the project. If you want to try it out, you can [download the Mech Tauri app for Windows](https://github.com/mech-lang/mech/releases/download/v0.2.52-beta/mech-app_0.2.52_x86-64-setup.exe).
1717

1818

1919
2. Binary
@@ -25,10 +25,10 @@ Precompiled binaries are available for the following platforms:
2525

2626
| OS | Architecture |
2727
| ---------- | ------------------------------------------------------------------------------------------------------------ |
28-
| **Wndows** | [x86-64](https://github.com/mech-lang/mech/releases/download/v0.2.51-beta/mech-v0.2.51-beta-win-x86-64.7z) |
29-
| **Linux** | [x86-64](https://github.com/mech-lang/mech/releases/download/v0.2.51-beta/mech-v0.2.51-beta-win-x86-64.7z) |
30-
| **macOS** | [aarch64](https://github.com/mech-lang/mech/releases/download/v0.2.51-beta/mech-v0.2.51-beta-mac-aarch64.zip) |
31-
| **Web** | [wasm](https://github.com/mech-lang/mech/releases/download/v0.2.51-beta/mech_wasm_bg.wasm.br) |
28+
| **Wndows** | [x86-64](https://github.com/mech-lang/mech/releases/download/v0.2.52-beta/mech-v0.2.52-beta-win-x86-64.7z) |
29+
| **Linux** | [x86-64](https://github.com/mech-lang/mech/releases/download/v0.2.52-beta/mech-v0.2.52-beta-win-x86-64.7z) |
30+
| **macOS** | [aarch64](https://github.com/mech-lang/mech/releases/download/v0.2.52-beta/mech-v0.2.52-beta-mac-aarch64.zip) |
31+
| **Web** | [wasm](https://github.com/mech-lang/mech/releases/download/v0.2.52-beta/mech_wasm_bg.wasm.br) |
3232

3333
You can find previous releases and release notes at [/mech-lang/mech/releases](https://github.com/mech-lang/mech/releases).
3434

docs/II.reference/matrix.mec

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,33 @@ Row vectors and column vectors are special cases of matrices:
9393
<[T]:_,1> -- A dynamic column vector with an unspecified number of elements
9494
```
9595

96+
(2.1) Conversion
97+
98+
You can convert a matrix to another kind using a kind annotation. For example:
99+
100+
```mech:ex71
101+
m := [1 2 3]
102+
v<[u8]> := m -- Converts `[f64]` to `[u8]`
103+
```
104+
105+
You can also convert a vector of numbers into a vector of strings:
106+
107+
```mech:ex72
108+
v := [1 2 3]
109+
s<[string]> := v -- Converts `[f64]` to `[string]`
110+
```
111+
112+
(2.2) Reshape
113+
114+
You can reshape a matrix to a different size as long as the total number of elements remains the same. For example, you can reshape a 2x3 matrix into a 3x2 matrix:
115+
116+
```mech:ex81
117+
m := [1 2 3 4 5 6]
118+
v<[f64]:3,2> := m -- Reshapes the matrix to a 3x2 matrix
119+
```
120+
121+
This will also convert the matrix elements to `u8` from `f64`.
122+
96123
3. Construction
97124
-------------------------------------------------------------------------------
98125

@@ -286,23 +313,6 @@ m1 ** m2 -- Multiplies the two matrices
286313
The transpose of a matrix is obtained by swapping its rows and columns. This can be done using the `grave` operator:
287314

288315
```mech:ex63
289-
m := [1 2 3; 4 5 6]
290-
m ** m'
291-
```
292-
293-
7. Conversion
294-
-------------------------------------------------------------------------------
295-
296-
You can convert a matrix to another kind using a kind annotation. For example:
297-
298-
```mech:ex71
299-
m := [1 2 3]
300-
v<[u8]> := m -- Converts `[f64]` to `[u8]`
316+
m := [1 2 3 4 5 6]
317+
m'
301318
```
302-
303-
You can also convert a vector of numbers into a vector of strings:
304-
305-
```mech:ex72
306-
v := [1 2 3]
307-
s<[string]> := v -- Converts `[f64]` to `[string]`
308-
```

docs/II.reference/table.mec

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,36 @@ Tables can be constructed of vectors, matrices, or records.
9696

9797
(3.2) From a matrix
9898

99+
You can create a table from a matrix using a kind annotation, as long as the kinds of the table columns are compatible with the matrix kind. For example, if you have a matrix of kind `f64`, you can create a table with columns of kind `f64`:
100+
101+
For example:
102+
103+
```mech:ex3
104+
x := [1 2; 3 4];
105+
a<|foo<f64>,bar<f64>|> := x
106+
```
107+
This creates a table `a` with two columns, `foo` and `bar`, both of kind `f64`, and two rows corresponding to the rows of the matrix `x`.
108+
109+
The matrix `[a.foo a.bar]` is identical to the original matrix `x`.
110+
111+
It's possible to convert a matrix of one kind to a table of different kinded columns, as long as the conversion is valid. For example, you can convert a matrix of `f64` to a table with `u8` columns:
112+
113+
```mech:ex3
114+
b<|foo<u8>,bar<i8>|> := x
115+
```
116+
99117
(3.3) From records
100118

101119
4. Accessing Elements
102120
-------------------------------------------------------------------------------
103121

104122
Consider the table:
105123

106-
a:=| x<f32> y<bool> |
107-
| 1.2 true |
124+
a:=| x<f64> y<bool> |
125+
| 1.6 true |
108126
| 1.3 false |
127+
| 2.7 false |
128+
| 1.5 true |
109129

110130
(4.1) Access a Column
111131

@@ -115,7 +135,7 @@ Use dot indexing to access columns. For example {{a.x;}}. The kind of the result
115135
a.x -- Select column `x`, which has kind `[f32]`
116136
```
117137

118-
(4.2) Access Elements
138+
(4.2) Access an Element
119139

120140
You can access an individual element in a table column by specifying the row index on the selected column:
121141

@@ -130,7 +150,35 @@ Table columns are just vectors, so they support the same indexing operations as
130150
You can access a record in a table by specifying the row index on the table itself:
131151

132152
```mech
133-
a{1} -- Select the first record in the table, which has kind `record`
153+
a{1} -- Select the first record in the table, returns a `record`
154+
```
155+
156+
(4.4) Access Several Records
157+
158+
You can access a range of records by using a vector as an index:
159+
160+
```mech
161+
a{2..=3} -- Select records 2 through 3, returns a `table`
162+
```
163+
164+
It's possible to select the same row multiple times:
165+
166+
```mech
167+
a{[1 1 2 2]} -- Select records 1 and 2 twice
168+
```
169+
170+
(4.5) Filter Records
171+
172+
You can filter records using logical indexing. For example, to select records where `y` is `true`:
173+
174+
```mech
175+
a{a.y} -- Select records where `y` is `true`
176+
```
177+
178+
Or to filter records where `x` is greater than `1.5`:
179+
180+
```mech
181+
a{a.x > 1.5} -- Select records where `x` is greater than `1.5`
134182
```
135183

136184
5. Heterogeneous Columns

docs/II.reference/values.mec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ A symbolic constant, often used for tags or enums.
5555

5656
(1.5.1) Kind
5757

58-
The kind of an atom is itself. For example, the atom {`A} has the kind:
58+
The kind of an atom is itself. For example, the atom {{`A;}} has the kind:
5959

6060
<`A>
6161

@@ -87,11 +87,11 @@ Represents an empty value, placeholder, or the absence of a value.
8787

8888
- **Enum** - enumeration of named values
8989
- **Map** - key-value store
90-
- **Matrix** - ND array of values
90+
- **[Matrix](/II.reference/matrix.html)** - ND array of values
9191
- **Record** - collection of named values
9292
- **Set** - unordered collection of unique values
9393
- **Tuple** - ordered collection of values
94-
- **Table** - collection of Records
94+
- **[Table](/II.reference/table.html)** - collection of Records
9595

9696
3. Kinds
9797
-------------------------------------------------------------------------------
@@ -162,7 +162,7 @@ Kinds compose into more complex kinds based on the data structures they represen
162162
| Record | `{T1,T2,..}` | {{<{x<u8>,y<string>}>;}} |
163163
| Map | `{K:V}` | {{<{string:i32}>;}} |
164164
| Table | `|arg1<T1>,arg2<T2>,..|:N` | {{<|x<u8>,y<string>|:3>;}} |
165-
| Tuple | `(T1,T2,T3)` | {{<(u8,string,bool)>;}} |
165+
| Tuple | `(T1,T2,...)` | {{<(u8,string,bool)>;}} |
166166
| Enum | `enum` | {{<enum>;}} |
167167

168168
(3.3) Custom Kinds

docs/index.mec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Mech Programming Language Documentation
6161

6262
docs/machine := {
6363
name: "docs"
64-
version: "v0.2.51"
64+
version: "v0.2.52"
6565
authors: ["Corey Montella"]
6666
machine-url: "https://gitlab.com/mech-lang/mech/docs"
6767
license: "Apache-2.0"}

include/style.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,6 +1061,14 @@ li p {
10611061
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
10621062
}
10631063

1064+
.mech-output-value .mech-table:last-child {
1065+
margin-bottom: 0;
1066+
}
1067+
1068+
.mech-code-block .mech-table:last-child {
1069+
margin-bottom: 0;
1070+
}
1071+
10641072
.mech-table th,
10651073
.mech-table td {
10661074
padding: 5px;

installer/mech-installer.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
33

44
#define MyAppName "Mech"
5-
#define MyAppVersion "0.2.51"
5+
#define MyAppVersion "0.2.52"
66
#define MyAppPublisher "Mech Labs"
77
#define MyAppURL "https://mech-lang.org"
88
#define MyAppExeName "mech.exe"

mech-app/src-tauri/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
22
name = "mech-app"
3-
version = "0.2.51"
3+
version = "0.2.52"
44
description = "Mech is a reactive programming language for building robots, games, and animations."
55
authors = ["Corey Montella <[email protected]>"]
6-
documentation = "https://mech-lang.org/docs"
6+
documentation = "https://docs.mech-lang.org"
77
homepage = "https://mech-lang.org"
88
repository = "https://github.com/mech-lang/mech"
99
keywords = ["mech", "language", "programming", "dataflow", "runtime"]
@@ -24,7 +24,7 @@ crate-type = ["staticlib", "cdylib", "rlib"]
2424
tauri-build = { version = "2.3.0", features = [] }
2525

2626
[dependencies]
27-
mech = "0.2.51"
27+
mech = "0.2.52"
2828
tauri = { version = "2.6.2", features = [] }
2929
tauri-plugin-opener = "2.4.0"
3030
serde = { version = "1.0.219", features = ["derive"] }

0 commit comments

Comments
 (0)