Rust und Racket
This commit is contained in:
+47
-48
@@ -81,46 +81,46 @@
|
||||
| `\mathtt{A}` | $\mathtt{A}$ | mono(A) |
|
||||
|
||||
## Arrows
|
||||
| LaTeX | Preview | Typst (Textual) | Typst (Shorthand) |
|
||||
| --------------------- | ------- | ----------------------- | ----------------- |
|
||||
| `\leftarrow` | $\leftarrow$ | arrow.l | <- |
|
||||
| `\gets` | $\gets$ | arrow.l | <- |
|
||||
| `\rightarrow` | $\rightarrow$ | arrow.r | -> |
|
||||
| `\to` | $\to$ | arrow.r | -> |
|
||||
| `\leftrightarrow` | $\leftrightarrow$ | arrow.l.r | <-> |
|
||||
| `\Leftarrow` | $\Leftarrow$ | arrow.l.double | |
|
||||
| `\Rightarrow` | $\Rightarrow$ | arrow.r.double | => |
|
||||
| `\Leftrightarrow` | $\Leftrightarrow$ | arrow.l.r.double | <=> |
|
||||
| `\mapsto` | $\mapsto$ | arrow.r.bar | |-> |
|
||||
| `\hookleftarrow` | $\hookleftarrow$ | arrow.l.hook | |
|
||||
| `\leftharpoonup` | $\leftharpoonup$ | harpoon.lt | |
|
||||
| `\leftharpoondown` | $\leftharpoondown$ | harpoon.lb | |
|
||||
| `\rightleftharpoons` | $\rightleftharpoons$ | harpoons.rtlb | |
|
||||
| `\longleftarrow` | $\longleftarrow$ | arrow.l.long | <-- |
|
||||
| `\longrightarrow` | $\longrightarrow$ | arrow.r.long | --> |
|
||||
| `\longleftrightarrow` | $\longleftrightarrow$ | arrow.l.r.long | <--> |
|
||||
| `\Longleftarrow` | $\Longleftarrow$ | arrow.l.double.long | <== |
|
||||
| `\Longrightarrow` | $\Longrightarrow$ | arrow.r.double.long | ==> |
|
||||
| `\Longleftrightarrow` | $\Longleftrightarrow$ | arrow.l.r.double.long | <==> |
|
||||
| `\longmapsto` | $\longmapsto$ | arrow.r.long.bar | |
|
||||
| `\hookrightarrow` | $\hookrightarrow$ | arrow.r.hook | |
|
||||
| `\rightharpoonup` | $\rightharpoonup$ | harpoon.rt | |
|
||||
| `\rightharpoondown` | $\rightharpoondown$ | harpoon.rb | |
|
||||
| `\iff` | $\iff$ | arrow.l.r.double.long | <==> |
|
||||
| `\implies` | $\implies$ | arrow.r.double.long | ==> |
|
||||
| `\uparrow` | $\uparrow$ | arrow.t | |
|
||||
| `\downarrow` | $\downarrow$ | arrow.b | |
|
||||
| `\updownarrow` | $\updownarrow$ | arrow.t.b | |
|
||||
| `\Uparrow` | $\Uparrow$ | arrow.t.double | |
|
||||
| `\Downarrow` | $\Downarrow$ | arrow.b.double | |
|
||||
| `\Updownarrow` | $\Updownarrow$ | arrow.t.b.double | |
|
||||
| `\nearrow` | $\nearrow$ | arrow.tr | |
|
||||
| `\searrow` | $\searrow$ | arrow.br | |
|
||||
| `\swarrow` | $\swarrow$ | arrow.bl | |
|
||||
| `\nwarrow` | $\nwarrow$ | arrow.tl | |
|
||||
| `\leadsto` | $\leadsto$ | arrow.r.squiggly | ~> |
|
||||
| `\leftleftarrows` | $\leftleftarrows$ | arrows.ll | |
|
||||
| `\rightrightarrows` | $\rightleftarrows$ | arrows.rr | |
|
||||
| LaTeX | Preview | Typst (Textual) | Typst (Shorthand) |
|
||||
| --------------------- | --------------------- | --------------------- | ----------------- |
|
||||
| `\leftarrow` | $\leftarrow$ | arrow.l | <- |
|
||||
| `\gets` | $\gets$ | arrow.l | <- |
|
||||
| `\rightarrow` | $\rightarrow$ | arrow.r | -> |
|
||||
| `\to` | $\to$ | arrow.r | -> |
|
||||
| `\leftrightarrow` | $\leftrightarrow$ | arrow.l.r | <-> |
|
||||
| `\Leftarrow` | $\Leftarrow$ | arrow.l.double | |
|
||||
| `\Rightarrow` | $\Rightarrow$ | arrow.r.double | => |
|
||||
| `\Leftrightarrow` | $\Leftrightarrow$ | arrow.l.r.double | <=> |
|
||||
| `\mapsto` | $\mapsto$ | arrow.r.bar | -> |
|
||||
| `\hookleftarrow` | $\hookleftarrow$ | arrow.l.hook | |
|
||||
| `\leftharpoonup` | $\leftharpoonup$ | harpoon.lt | |
|
||||
| `\leftharpoondown` | $\leftharpoondown$ | harpoon.lb | |
|
||||
| `\rightleftharpoons` | $\rightleftharpoons$ | harpoons.rtlb | |
|
||||
| `\longleftarrow` | $\longleftarrow$ | arrow.l.long | <-- |
|
||||
| `\longrightarrow` | $\longrightarrow$ | arrow.r.long | --> |
|
||||
| `\longleftrightarrow` | $\longleftrightarrow$ | arrow.l.r.long | <--> |
|
||||
| `\Longleftarrow` | $\Longleftarrow$ | arrow.l.double.long | <== |
|
||||
| `\Longrightarrow` | $\Longrightarrow$ | arrow.r.double.long | ==> |
|
||||
| `\Longleftrightarrow` | $\Longleftrightarrow$ | arrow.l.r.double.long | <==> |
|
||||
| `\longmapsto` | $\longmapsto$ | arrow.r.long.bar | |
|
||||
| `\hookrightarrow` | $\hookrightarrow$ | arrow.r.hook | |
|
||||
| `\rightharpoonup` | $\rightharpoonup$ | harpoon.rt | |
|
||||
| `\rightharpoondown` | $\rightharpoondown$ | harpoon.rb | |
|
||||
| `\iff` | $\iff$ | arrow.l.r.double.long | <==> |
|
||||
| `\implies` | $\implies$ | arrow.r.double.long | ==> |
|
||||
| `\uparrow` | $\uparrow$ | arrow.t | |
|
||||
| `\downarrow` | $\downarrow$ | arrow.b | |
|
||||
| `\updownarrow` | $\updownarrow$ | arrow.t.b | |
|
||||
| `\Uparrow` | $\Uparrow$ | arrow.t.double | |
|
||||
| `\Downarrow` | $\Downarrow$ | arrow.b.double | |
|
||||
| `\Updownarrow` | $\Updownarrow$ | arrow.t.b.double | |
|
||||
| `\nearrow` | $\nearrow$ | arrow.tr | |
|
||||
| `\searrow` | $\searrow$ | arrow.br | |
|
||||
| `\swarrow` | $\swarrow$ | arrow.bl | |
|
||||
| `\nwarrow` | $\nwarrow$ | arrow.tl | |
|
||||
| `\leadsto` | $\leadsto$ | arrow.r.squiggly | ~> |
|
||||
| `\leftleftarrows` | $\leftleftarrows$ | arrows.ll | |
|
||||
| `\rightrightarrows` | $\rightleftarrows$ | arrows.rr | |
|
||||
## Set and Elements
|
||||
|
||||
| LaTeX | Preview | Typst |
|
||||
@@ -145,10 +145,13 @@
|
||||
|
||||
## Verschiedene Symbole
|
||||
|
||||
| LaTeX | Preview | Typst (Textual) | Typst (Shorthand) |
|
||||
| ------ | ------- | --------------- | ----------------- |
|
||||
| `\Cap` | $\Cap$ | inter.double | |
|
||||
| `\Cup` | $\Cup$ | union.double | |
|
||||
| LaTeX | Preview | Typst (Textual) | Typst (Shorthand) |
|
||||
| -------- | -------- | --------------- | ----------------- |
|
||||
| `\Cap` | $\Cap$ | inter.double | |
|
||||
| `\Cup` | $\Cup$ | union.double | |
|
||||
| `\Join` | $\Join$ | join | |
|
||||
| `\aleph` | $\aleph$ | alef | |
|
||||
| | | | |
|
||||
|
||||
# Temp
|
||||
|
||||
@@ -156,10 +159,6 @@
|
||||
|
||||
| LaTeX | Preview | Typst (Textual) | Typst (Shorthand) |
|
||||
| -------------------- | ------- | ------------------ | ----------------- |
|
||||
| `\Cap` | ⋒ | `inter.double` | `` |
|
||||
| `\Cup` | ⋓ | `union.double` | `` |
|
||||
| `\Join` | ⋈ | `join` | `` |
|
||||
| `\aleph` | ℵ | `alef` | `` |
|
||||
| `\angle` | ∠ | `angle` | `` |
|
||||
| `\approx` | ≈ | `approx` | `` |
|
||||
| `\approxeq` | ≊ | `approx.eq` | `` |
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
```racket
|
||||
#lang racket
|
||||
|
||||
; https://dev.to/goober99/learn-racket-by-example-gui-programming-3epm
|
||||
|
||||
(require racket/gui/base)
|
||||
|
||||
; 1. Hauptfenster (Frame) erstellen
|
||||
(define frame (new frame% [label "Hallo Racket"]
|
||||
[width 300]
|
||||
[height 200]))
|
||||
|
||||
; 2. Einen Button zum Fenster hinzufügen
|
||||
(define btn (new button% [parent frame]
|
||||
[label "Klick mich"]
|
||||
[callback (lambda (b e)
|
||||
(printf "Button wurde geklickt!\n"))]))
|
||||
|
||||
; 3. Fenster sichtbar machen
|
||||
(send frame show #t)
|
||||
```
|
||||
@@ -12,30 +12,35 @@ https://serverdiscounter.com/blog/2026-01-26-regex-grundlagen
|
||||
|
||||
## Special Characters
|
||||
|
||||
| | |
|
||||
| -------- | ------------------------------------------------------------------------------- |
|
||||
| `\` | Escapet Sonderzeichen oder kennzeichnet eine spezielle Sequenz |
|
||||
| `.` | Entspricht einem beliebigen einzelnen Zeichen mit Ausnahme eines Zeilenumbruchs |
|
||||
| `^` | Matches the start of the string. |
|
||||
| `$` | Matches the end of the string |
|
||||
| `*` | Greedily matches 0 or more repetitions of the preceding RE. |
|
||||
| `*?` | Matches 0 or more repetitions of the preceding RE. |
|
||||
| `+` | Greedily matches 1 or more repetitions of the preceding RE. |
|
||||
| `+?` | Matches 1 or more repetitions of the preceding RE. |
|
||||
| `?` | Greedily matches 0 or 1 repetitions of the preceding RE. |
|
||||
| `??` | Matches 0 or 1 repetitions of the preceding RE. |
|
||||
| `A\|B` | Matches A, if A is unmatched then matches B, where A and B are arbitrary REs. |
|
||||
| `{m}` | Matches exactly m many repetitions of the previous RE. |
|
||||
| `{m,n}` | Greedily matches from m many to n many repetitions of the previous RE. |
|
||||
| `{m,n}?` | Matches m many to n many repetitions of the previous RE. |
|
||||
| | |
|
||||
| ---------- | ------------------------------------------------------------------------------- |
|
||||
| `\` | Escapet Sonderzeichen oder kennzeichnet eine spezielle Sequenz |
|
||||
| `.` | Entspricht einem beliebigen einzelnen Zeichen mit Ausnahme eines Zeilenumbruchs |
|
||||
| `^` | Matches the start of the string. |
|
||||
| `$` | Matches the end of the string |
|
||||
| `*` | Greedily matches 0 or more repetitions of the preceding RE. |
|
||||
| `*?` | Matches 0 or more repetitions of the preceding RE. |
|
||||
| `+` | Greedily matches 1 or more repetitions of the preceding RE. |
|
||||
| `+?` | Matches 1 or more repetitions of the preceding RE. |
|
||||
| `?` | Greedily matches 0 or 1 repetitions of the preceding RE. |
|
||||
| `??` | Matches 0 or 1 repetitions of the preceding RE. |
|
||||
| `A\|B` | Matches A, if A is unmatched then matches B, where A and B are arbitrary REs. |
|
||||
| `{m}` | Matches exactly m many repetitions of the previous RE. |
|
||||
| `{m,n}` | Greedily matches from m many to n many repetitions of the previous RE. |
|
||||
| `{m,n}?` | Matches m many to n many repetitions of the previous RE. |
|
||||
| `[...]` | Indicates a set of characters to match. |
|
||||
| `[amk]` | Matches 'a', 'm', or 'k'. |
|
||||
| [a-z] | Matches 'a' through 'z'. |
|
||||
| `[a-f0-7]` | Matches 'a' through 'f' or '0' through '7'. |
|
||||
| `[a\-z]` | Matches 'a', '-', or 'z'. |
|
||||
|
||||
|
||||
|
||||
[...] Indicates a set of characters to match.
|
||||
[amk] Matches 'a', 'm', or 'k'.
|
||||
[a-z] Matches 'a' through 'z'.
|
||||
[a-f0-7] Matches 'a' through 'f' or '0' through '7'.
|
||||
[a\-z] Matches 'a', '-', or 'z'.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[a-] Matches 'a' or '-'.
|
||||
[-a] Matches 'a' or '-'.
|
||||
[(+*)] Matches '(', '+', '*', or ')'. [] matches special characters literally.
|
||||
|
||||
@@ -8,7 +8,71 @@ In Rust verwenden wir das Makro `println!()`, um eine Ausgabe auf der Konsole au
|
||||
|
||||
Sehen wir uns das „Hello World!“-Programm in Rust an:
|
||||
|
||||
```fn main() {
|
||||
```rust
|
||||
fn main() {
|
||||
println!(„Hello World!“);
|
||||
}
|
||||
```
|
||||
## Kommentare
|
||||
|
||||
**Comments** sind Notizen, die man in den Code schreibt. Der compiler ignoriert sie vollständig – sie existieren nur, um Menschen beim Verständnis des Codes zu helfen.
|
||||
|
||||
Um einen einzeiligen Kommentar zu schreiben, verwendet man `//`. Alles nach `//` bis zum Ende der Zeile wird ignoriert:
|
||||
|
||||
```rust
|
||||
// Das ist ein Kommentarprintln!("Hello, world!");
|
||||
```
|
||||
|
||||
Ein Kommentar kann auch am Ende einer Zeile nach dem Code geschrieben werden:
|
||||
|
||||
```rust
|
||||
println!("Hello, world!"); // Dies gibt Hello, world! aus!
|
||||
```
|
||||
|
||||
Für Kommentare, die sich über mehrere Zeilen erstrecken, verwendet man `/*`, um zu beginnen, und `*/`, um zu enden:
|
||||
|
||||
```rust
|
||||
/* Dies ist ein mehrzeiliger Kommentar. Der Compiler ignoriert ihn vollständig. */println!("Welcome!");
|
||||
```
|
||||
|
||||
Kommentare können eine Codezeile auch vorübergehend **deaktivieren**, ohne sie zu löschen:
|
||||
|
||||
```rust
|
||||
// println!("This line will NOT run");println!("This line will run");
|
||||
```
|
||||
|
||||
**Hinweis:** Jeder mehrzeilige Kommentar, der mit `/*` beginnt, muss mit `*/` geschlossen werden, andernfalls behandelt der Compiler alles danach als Kommentar.
|
||||
|
||||
Grundlegende Programmstruktur
|
||||
|
||||
In Rust beginnt jedes ausführbare Programm mit der Funktion `main`. Diese Funktion ist der Einstiegspunkt des Programms und dort beginnt die Ausführung.
|
||||
|
||||
Die `function` `main` wird mit dem Schlüsselwort `fn`definiert, gefolgt von `main` und einem Klammerpaar `()`. Der auszuführende Code wird innerhalb geschweifter Klammern `{}` platziert.
|
||||
|
||||
Hier ist eine einfache Aufschlüsselung eines grundlegenden Rust-Programms:
|
||||
|
||||
```rust
|
||||
fn main() { // Hauptfunktion println!("Hello, Coddy!"); // Ausgabeanweisung}
|
||||
```
|
||||
|
||||
Wichtiger Hinweis: In Rust muss jede Anweisung mit einem Semikolon (`;`) enden. Das Semikolon ist obligatorisch und teilt Rust mit, dass du das Ende einer Anweisung erreicht hast.
|
||||
|
||||
Wenn du vergisst, ein Semikolon hinzuzufügen, führt dies zu einem Kompilierungsfehler. Beachte jedoch, dass Codeblöcke, die in geschweiften Klammern {} eingeschlossen sind (wie Funktionsdeklarationen), keine Semikolons benötigen.
|
||||
|
||||
## Grundlegende Programmstruktur
|
||||
|
||||
In Rust beginnt jedes ausführbare Programm mit der Funktion `main`. Diese Funktion ist der Einstiegspunkt des Programms und dort beginnt die Ausführung.
|
||||
|
||||
Die `function` `main` wird mit dem Schlüsselwort `fn`definiert, gefolgt von `main` und einem Klammerpaar `()`. Der auszuführende Code wird innerhalb geschweifter Klammern `{}` platziert.
|
||||
|
||||
Hier ist eine einfache Aufschlüsselung eines grundlegenden Rust-Programms:
|
||||
|
||||
```rust
|
||||
fn main() { // Hauptfunktion
|
||||
println!("Hello, Coddy!"); // Ausgabeanweisung
|
||||
}
|
||||
```
|
||||
|
||||
Wichtiger Hinweis: In Rust muss jede Anweisung mit einem Semikolon (`;`) enden. Das Semikolon ist obligatorisch und teilt Rust mit, dass du das Ende einer Anweisung erreicht hast.
|
||||
|
||||
Wenn du vergisst, ein Semikolon hinzuzufügen, führt dies zu einem Kompilierungsfehler. Beachte jedoch, dass Codeblöcke, die in geschweiften Klammern `{}` eingeschlossen sind (wie Funktionsdeklarationen), keine Semikolons benötigen.
|
||||
|
||||
Reference in New Issue
Block a user