You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,14 +112,14 @@ flowchart TB
112
112
|**Part 2: Language Fundamentals (6–12)**| Variables and all data types (Int, Float, Bool, String, Arrays, Maps), map indexing, type conversions, built-in functions, exercises |
113
113
|**Part 3: Control Flow (13–17)**| If/else, while and for loops, pattern matching, decision-making patterns |
114
114
|**Part 4: Functions (18–22)**| Definition and calling, parameters vs arguments, lambdas, recursion, scope and best practices |
115
-
|**Part 5: Power Features (23–28)**| 25+ built-in functions, engine operations (22 Zig NIFs), Python integration, performance |
115
+
|**Part 5: Power Features (23–28)**| 25+ built-in functions, pipe operator (`\|>`), engine operations (22 Zig NIFs), Python integration, performance |
116
116
|**Part 6: Real-World Projects (29–35)**| Data pipeline, AI text analysis, LLM integration, workflow automation |
117
117
|**Part 7: Mastery (36–40)**| Best practices, performance tips, debugging guide, patterns and anti-patterns |
**Key features:** Progressive learning, 20+ complete examples, 4 real projects, exercises with solutions, visual aids, error-handling focus, AI/automation emphasis.
121
121
122
-
**Guide stats:** 40+ pages · 20+ code examples · 4 projects · 6 exercises per chapter · 25+ built-in functions · 22 engine ops · modulo, map indexing, type conversions · full grammar reference.
122
+
**Guide stats:** 40+ pages · 20+ code examples · 4 projects · 6 exercises per chapter · 25+ built-in functions · 22 engine ops · pipe operator, modulo, map indexing, type conversions · full grammar reference.
123
123
124
124
**PDF:** A PDF copy is available at [docs/Zixir Language complete guide.pdf](docs/Zixir%20Language%20complete%20guide.pdf) (same path as the guide, .pdf for download). Website: [zixir-lang.github.io/Zixir/Zixir%20Language%20complete%20guide.pdf](https://zixir-lang.github.io/Zixir/Zixir%20Language%20complete%20guide.pdf). To rebuild locally: **Node** — `npx md-to-pdf "docs/Zixir Language complete guide.md"` (output is already named with spaces); **or****pandoc** — `./scripts/build-guide-pdf.sh` (Unix) or `.\scripts\build-guide-pdf.ps1` (Windows; requires [pandoc](https://pandoc.org) and LaTeX). To enable automatic PDF build on push: create `.github/workflows/build-guide-pdf.yml` from [scripts/build-guide-pdf-workflow.yml](scripts/build-guide-pdf-workflow.yml) (skip the first 3 comment lines).
125
125
@@ -233,8 +233,8 @@ After Setup, run `mix zixir.run examples/hello.zixir`. Expected: `11.0`. For JIT
- ⚠️ **Loops:** While/for loops work but don't support variable accumulation across iterations (by design — Zixir is immutable). Use recursion or engine operations instead.
103
104
- ⚠️ **Python Methods:** Only module-level functions work (e.g., `math.sqrt`), not object methods (e.g., `str.lower`)
104
-
- ⚠️ **Pipe operator:**`|>` syntax is not yet functional
105
105
106
106
**Recommended Approach:**
107
+
- Use **pipe operator** (`|>`) to chain transformations cleanly
107
108
- Use **built-in functions** for common operations (`length`, `to_string`, `print`, `split`, `join`, etc.)
108
109
- Use **map indexing** for key-value access (`user["name"]`)
109
110
- Use **engine operations** for bulk data processing (fastest)
@@ -728,6 +729,7 @@ Just like in math, some operations happen before others:
728
729
6. Equality: ==, !=
729
730
7. Logical AND: &&
730
731
8. Logical OR: ||
732
+
9. Pipe: |> (lowest precedence)
731
733
```
732
734
733
735
```zixir
@@ -888,6 +890,56 @@ let bigger = max(5, 3) # 5
888
890
889
891
---
890
892
893
+
## 6c. Pipe Operator
894
+
895
+
The pipe operator `|>` passes the result of the left expression as the **first argument** to the function on the right. This lets you chain transformations in a readable, top-to-bottom style instead of nesting function calls.
896
+
897
+
### Basic Usage
898
+
899
+
```zixir
900
+
# Without pipe (nested, reads inside-out)
901
+
upper(trim(" hello "))
902
+
903
+
# With pipe (reads left-to-right)
904
+
" hello " |> trim() |> upper() # "HELLO"
905
+
```
906
+
907
+
### Piping into Functions with Arguments
908
+
909
+
When the right-side function takes additional arguments, the piped value becomes the first argument:
<li><strong>match</strong> — pattern matching on values</li>
@@ -192,10 +193,11 @@ <h3>How it runs</h3>
192
193
<pstyle="color: var(--zixir-text-muted); font-size: 0.95rem;">Source is parsed in Elixir into a Zixir AST. It can be <strong>interpreted</strong> (<code>Zixir.eval(source)</code> — engine calls run in Zig NIFs, python calls go to Python via a port) or <strong>compiled</strong> (<code>Zixir.Compiler.compile(source)</code> — type-checks, optimizes, emits Zig; then compile to a native binary or run JIT). Your code stays Zixir-only; the runtime is Elixir + Zig + Python.</p>
193
194
<divclass="landing-code" style="margin-top: 1rem;">let data = [1.0, 2.0, 3.0, 4.0, 5.0]
<pstyle="font-size: 0.85rem; color: var(--zixir-text-muted);">To rebuild the PDF locally: <code>npx md-to-pdf "docs/Zixir Language complete guide.md"</code> then keep the generated <code>Zixir Language complete guide.pdf</code>; or use <code>.\scripts\build-guide-pdf.ps1</code> (pandoc + LaTeX).</p>
0 commit comments