text stringlengths 19 585k | label stringclasses 2
values | category stringclasses 2
values | language stringclasses 14
values | repo stringclasses 932
values | sha stringlengths 40 40 |
|---|---|---|---|---|---|
@@ -0,0 +1,101 @@
+from __future__ import annotations
+
+import copy
+import json
+import os
+from dataclasses import dataclass, field
+from typing import Optional
+
+from cli_anything.joplin.core import project as project_mod
+
+
+@dataclass
+class Session:
+ project: Optional[dict] = None
+ project_path: Option... | bad | review | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
diff --git a/joplin/agent-harness/cli_anything/joplin/core/session.py b/joplin/agent-harness/cli_anything/joplin/core/session.py
new file mode 100644
index 000000000..9e3bed7f2
--- /dev/null
+++ b/joplin/agent-harness/cli_anything/joplin/core/session.py
@@ -0,0 +1,173 @@
+from __future__ import annotations
+
+import co... | good | review_fixed | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
@@ -0,0 +1,99 @@
+import json
+from pathlib import Path
+
+from cli_anything.joplin.utils.joplin_backend import BackendConfig, find_joplin, run_joplin_command, run_joplin_json
+
+
+def version_info(config: BackendConfig) -> dict:
+ try:
+ return run_joplin_command(["version"], config)
+ except RuntimeError... | bad | review | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
diff --git a/joplin/agent-harness/cli_anything/joplin/core/backend.py b/joplin/agent-harness/cli_anything/joplin/core/backend.py
new file mode 100644
index 000000000..c921b5f6f
--- /dev/null
+++ b/joplin/agent-harness/cli_anything/joplin/core/backend.py
@@ -0,0 +1,272 @@
+import json
+import os
+import subprocess
+from... | good | review_fixed | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
@@ -0,0 +1,109 @@
+import json
+import shutil
+import subprocess
+from dataclasses import dataclass
+from typing import Optional
+
+
+@dataclass
+class BackendConfig:
+ binary: str = "joplin"
+ profile: Optional[str] = None
+
+
+def find_joplin(binary: str = "joplin") -> str:
+ path = shutil.which(binary)
+ ... | bad | review | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
diff --git a/joplin/agent-harness/cli_anything/joplin/utils/joplin_backend.py b/joplin/agent-harness/cli_anything/joplin/utils/joplin_backend.py
new file mode 100644
index 000000000..1f21e5765
--- /dev/null
+++ b/joplin/agent-harness/cli_anything/joplin/utils/joplin_backend.py
@@ -0,0 +1,192 @@
+import json
+import shu... | good | review_fixed | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
@@ -0,0 +1,992 @@
+#!/usr/bin/env python3
+
+import json
+import os
+import shlex
+import sys
+from typing import Optional
+
+import click
+
+from cli_anything.joplin.core import attach as attach_mod
+from cli_anything.joplin.core import backend as backend_mod
+from cli_anything.joplin.core import config as config_mod
... | bad | review | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
diff --git a/joplin/agent-harness/cli_anything/joplin/joplin_cli.py b/joplin/agent-harness/cli_anything/joplin/joplin_cli.py
new file mode 100644
index 000000000..48fad89dc
--- /dev/null
+++ b/joplin/agent-harness/cli_anything/joplin/joplin_cli.py
@@ -0,0 +1,992 @@
+#!/usr/bin/env python3
+
+import json
+import os
+imp... | good | review_fixed | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
@@ -0,0 +1,148 @@
+import json
+import shutil
+import subprocess
+from dataclasses import dataclass
+from typing import Optional
+
+
+@dataclass
+class BackendConfig:
+ binary: str = "joplin"
+ profile: Optional[str] = None
+
+
+def find_joplin(binary: str = "joplin") -> str:
+ path = shutil.which(binary)
+ ... | bad | review | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
diff --git a/joplin/agent-harness/cli_anything/joplin/utils/joplin_backend.py b/joplin/agent-harness/cli_anything/joplin/utils/joplin_backend.py
new file mode 100644
index 000000000..1f21e5765
--- /dev/null
+++ b/joplin/agent-harness/cli_anything/joplin/utils/joplin_backend.py
@@ -0,0 +1,192 @@
+import json
+import shu... | good | review_fixed | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
@@ -0,0 +1,196 @@
+import json
+import os
+import subprocess
+from pathlib import Path
+
+from cli_anything.joplin.utils.joplin_backend import BackendConfig, find_joplin, run_joplin_command, run_joplin_json
+
+
+def _npm_global_root() -> Path | None:
+ """Best-effort lookup of npm's global ``node_modules`` directory... | bad | review | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
diff --git a/joplin/agent-harness/cli_anything/joplin/core/backend.py b/joplin/agent-harness/cli_anything/joplin/core/backend.py
new file mode 100644
index 000000000..c921b5f6f
--- /dev/null
+++ b/joplin/agent-harness/cli_anything/joplin/core/backend.py
@@ -0,0 +1,272 @@
+import json
+import os
+import subprocess
+from... | good | review_fixed | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
@@ -0,0 +1,70 @@
+from cli_anything.joplin.utils.joplin_backend import BackendConfig, run_joplin_command, run_joplin_json
+
+
+def list_notes(
+ config: BackendConfig,
+ pattern: str | None = None,
+ limit: int | None = None,
+ sort: str | None = None,
+ reverse: bool = False,
+ item_type: str | None ... | bad | review | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
diff --git a/joplin/agent-harness/cli_anything/joplin/core/notes.py b/joplin/agent-harness/cli_anything/joplin/core/notes.py
new file mode 100644
index 000000000..5d3a93e9c
--- /dev/null
+++ b/joplin/agent-harness/cli_anything/joplin/core/notes.py
@@ -0,0 +1,111 @@
+from cli_anything.joplin.utils.joplin_backend import ... | good | review_fixed | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
@@ -0,0 +1,40 @@
+from cli_anything.joplin.utils.joplin_backend import BackendConfig, run_joplin_command, run_joplin_json
+
+
+def list_notebooks(
+ config: BackendConfig,
+ limit: int | None = None,
+ sort: str | None = None,
+ reverse: bool = False,
+ long: bool = False,
+) -> dict:
+ args = ["ls", ... | bad | review | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
diff --git a/joplin/agent-harness/cli_anything/joplin/core/notebooks.py b/joplin/agent-harness/cli_anything/joplin/core/notebooks.py
new file mode 100644
index 000000000..d55dcc7b3
--- /dev/null
+++ b/joplin/agent-harness/cli_anything/joplin/core/notebooks.py
@@ -0,0 +1,55 @@
+from cli_anything.joplin.core.notes import... | good | review_fixed | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
@@ -0,0 +1,202 @@
+import json
+import os
+import subprocess
+from pathlib import Path
+
+from cli_anything.joplin.utils.joplin_backend import BackendConfig, find_joplin, run_joplin_command, run_joplin_json
+
+
+def _npm_global_root() -> Path | None:
+ """Best-effort lookup of npm's global ``node_modules`` directory... | bad | review | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
diff --git a/joplin/agent-harness/cli_anything/joplin/core/backend.py b/joplin/agent-harness/cli_anything/joplin/core/backend.py
new file mode 100644
index 000000000..c921b5f6f
--- /dev/null
+++ b/joplin/agent-harness/cli_anything/joplin/core/backend.py
@@ -0,0 +1,272 @@
+import json
+import os
+import subprocess
+from... | good | review_fixed | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
@@ -0,0 +1,202 @@
+import json
+import os
+import subprocess
+from pathlib import Path
+
+from cli_anything.joplin.utils.joplin_backend import BackendConfig, find_joplin, run_joplin_command, run_joplin_json
+
+
+def _npm_global_root() -> Path | None:
+ """Best-effort lookup of npm's global ``node_modules`` directory... | bad | review | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
diff --git a/joplin/agent-harness/cli_anything/joplin/core/backend.py b/joplin/agent-harness/cli_anything/joplin/core/backend.py
new file mode 100644
index 000000000..c921b5f6f
--- /dev/null
+++ b/joplin/agent-harness/cli_anything/joplin/core/backend.py
@@ -0,0 +1,272 @@
+import json
+import os
+import subprocess
+from... | good | review_fixed | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
@@ -0,0 +1,109 @@
+from __future__ import annotations
+
+import copy
+import json
+import os
+from dataclasses import dataclass, field
+from typing import Optional
+
+from cli_anything.joplin.core import project as project_mod
+
+
+@dataclass
+class Session:
+ project: Optional[dict] = None
+ project_path: Option... | bad | review | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
diff --git a/joplin/agent-harness/cli_anything/joplin/core/session.py b/joplin/agent-harness/cli_anything/joplin/core/session.py
new file mode 100644
index 000000000..9e3bed7f2
--- /dev/null
+++ b/joplin/agent-harness/cli_anything/joplin/core/session.py
@@ -0,0 +1,173 @@
+from __future__ import annotations
+
+import co... | good | review_fixed | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
@@ -0,0 +1,175 @@
+import json
+import shutil
+import subprocess
+from dataclasses import dataclass
+from typing import Optional
+
+
+@dataclass
+class BackendConfig:
+ binary: str = "joplin"
+ profile: Optional[str] = None
+
+
+def find_joplin(binary: str = "joplin") -> str:
+ path = shutil.which(binary)
+ ... | bad | review | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
diff --git a/joplin/agent-harness/cli_anything/joplin/utils/joplin_backend.py b/joplin/agent-harness/cli_anything/joplin/utils/joplin_backend.py
new file mode 100644
index 000000000..1f21e5765
--- /dev/null
+++ b/joplin/agent-harness/cli_anything/joplin/utils/joplin_backend.py
@@ -0,0 +1,192 @@
+import json
+import shu... | good | review_fixed | python | HKUDS/CLI-Anything | 190bd89dc4a9d402ace862f4d20d23a798eb93cb |
@@ -0,0 +1,105 @@
+"""Custom column management — wraps calibredb custom_columns, add/remove/set_custom."""
+
+from cli_anything.calibre.utils.calibre_backend import (
+ run_calibredb,
+ find_calibredb,
+)
+
+# Valid data types for custom columns
+VALID_DATATYPES = {
+ "rating", "text", "comments", "datetime", ... | bad | review | python | HKUDS/CLI-Anything | 5a86319189a34ab681f8df2492edfa2028b9c7af |
diff --git a/calibre/agent-harness/cli_anything/calibre/core/custom.py b/calibre/agent-harness/cli_anything/calibre/core/custom.py
new file mode 100644
index 0000000000..b2f752493f
--- /dev/null
+++ b/calibre/agent-harness/cli_anything/calibre/core/custom.py
@@ -0,0 +1,113 @@
+"""Custom column management — wraps calibr... | good | review_fixed | python | HKUDS/CLI-Anything | 5a86319189a34ab681f8df2492edfa2028b9c7af |
@@ -0,0 +1,168 @@
+"""Format management — wraps calibredb add_format, remove_format + ebook-convert."""
+
+import os
+import shutil
+from pathlib import Path
+
+from cli_anything.calibre.utils.calibre_backend import (
+ run_calibredb,
+ run_ebook_convert,
+ find_calibredb,
+ find_ebook_convert,
+)
+
+
+def ... | bad | review | python | HKUDS/CLI-Anything | 5a86319189a34ab681f8df2492edfa2028b9c7af |
diff --git a/calibre/agent-harness/cli_anything/calibre/core/formats.py b/calibre/agent-harness/cli_anything/calibre/core/formats.py
new file mode 100644
index 0000000000..f5ff962ffd
--- /dev/null
+++ b/calibre/agent-harness/cli_anything/calibre/core/formats.py
@@ -0,0 +1,167 @@
+"""Format management — wraps calibredb ... | good | review_fixed | python | HKUDS/CLI-Anything | 5a86319189a34ab681f8df2492edfa2028b9c7af |
@@ -0,0 +1,375 @@
+"""Export pipeline — wraps calibredb export and supports catalog generation."""
+
+import os
+import re
+import zipfile
+from pathlib import Path
+from xml.etree import ElementTree as ET
+
+from cli_anything.calibre.utils.calibre_backend import (
+ run_calibredb,
+ run_ebook_convert,
+ find_... | bad | review | python | HKUDS/CLI-Anything | 5a86319189a34ab681f8df2492edfa2028b9c7af |
diff --git a/calibre/agent-harness/cli_anything/calibre/core/export.py b/calibre/agent-harness/cli_anything/calibre/core/export.py
new file mode 100644
index 0000000000..e4b27659c9
--- /dev/null
+++ b/calibre/agent-harness/cli_anything/calibre/core/export.py
@@ -0,0 +1,377 @@
+"""Export pipeline — wraps calibredb expor... | good | review_fixed | python | HKUDS/CLI-Anything | 5a86319189a34ab681f8df2492edfa2028b9c7af |
@@ -1067,6 +1074,7 @@ cli-anything/
├── 🌐 browser/agent-harness/ # Browser CLI (DOMShell MCP, new)
├── 📄 libreoffice/agent-harness/ # LibreOffice CLI (158 tests)
├── 📚 zotero/agent-harness/ # Zotero CLI (new, write import support)
+├── 📖 calibre/agent-harness/ # Calibre C... | bad | review | HKUDS/CLI-Anything | 5a86319189a34ab681f8df2492edfa2028b9c7af | |
diff --git a/README.md b/README.md
index be163b5055..38f1d253e0 100644
--- a/README.md
+++ b/README.md
@@ -880,6 +880,13 @@ Each application received complete, production-ready CLI interfaces — not demo
<td align="center">✅ <a href="zotero/agent-harness/">New</a></td>
</tr>
<tr>
+<td align="center"><strong>📖 <a hre... | good | review_fixed | HKUDS/CLI-Anything | 5a86319189a34ab681f8df2492edfa2028b9c7af | |
@@ -12,7 +12,7 @@
setup(
name="cli-anything-obsidian",
- version="1.0.0",
+ version="1.1.0", | bad | review | python | HKUDS/CLI-Anything | e79f1f3e69b5e784532180e9dbaf3dabf58c5a2b |
diff --git a/obsidian/agent-harness/setup.py b/obsidian/agent-harness/setup.py
index bf252a2682..1988a87c27 100644
--- a/obsidian/agent-harness/setup.py
+++ b/obsidian/agent-harness/setup.py
@@ -12,7 +12,7 @@
setup(
name="cli-anything-obsidian",
- version="1.0.0",
+ version="1.1.0",
author="Doruk Ozg... | good | review_fixed | python | HKUDS/CLI-Anything | e79f1f3e69b5e784532180e9dbaf3dabf58c5a2b |
@@ -501,6 +503,18 @@ async def connect_single_server(name: str, cfg) -> tuple[str, AsyncExitStack | N
await server_stack.aclose()
return name, None
+ if transport_type in {"sse", "streamableHttp"}:
+ ok, error = validate_url_target(cfg.url) | bad | review | python | HKUDS/nanobot | 90601400a1c335de55993950cb481ea66c8d2b76 |
diff --git a/nanobot/agent/tools/mcp.py b/nanobot/agent/tools/mcp.py
index 59a41127eab..181c4e9f8a9 100644
--- a/nanobot/agent/tools/mcp.py
+++ b/nanobot/agent/tools/mcp.py
@@ -21,6 +21,7 @@
RUNTIME_CONTROL_MCP_RELOAD,
InboundMessage,
)
+from nanobot.security.network import validate_url_target
# Transient... | good | review_fixed | python | HKUDS/nanobot | 90601400a1c335de55993950cb481ea66c8d2b76 |
@@ -0,0 +1,74 @@
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace HandyControl.Controls
+{
+ public class MenuItemAttach
+ {
+ public static readonly DependencyProperty GroupNameProperty =
+ DependencyProperty.RegisterAttached("GroupName", typeof(string), ... | bad | review | csharp | HandyOrg/HandyControl | 60b359ec208f94c041c592dc2b7509d8fcdb27be |
diff --git a/src/Shared/HandyControl_Shared/Controls/Attach/MenuItemAttach.cs b/src/Shared/HandyControl_Shared/Controls/Attach/MenuItemAttach.cs
new file mode 100644
index 000000000..1ae818468
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Controls/Attach/MenuItemAttach.cs
@@ -0,0 +1,62 @@
+using System.Linq;
+usi... | good | review_fixed | csharp | HandyOrg/HandyControl | 60b359ec208f94c041c592dc2b7509d8fcdb27be |
@@ -44,7 +44,7 @@ You can bundle multiple values into a single value using a tuple or a struct.
```py
# With a tuple
-def tuple_fst(x):
+def tuple_fst(x: Any) -> Any: | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/FEATURES.md b/FEATURES.md
index 8f72a2bd..ce60841f 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -8,9 +8,8 @@ To see some more complex examples programs, check out the [examples](examples/)
### Basic features
We can start with a basic program that adds the numbers 3 and 2.
-
```py
-def main:
+def main... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -53,22 +53,22 @@ def tuple_fst(x):
# With an object (similar to what other languages call a struct, a class or a record)
object Pair { fst, snd } | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/FEATURES.md b/FEATURES.md
index 8f72a2bd..ce60841f 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -8,9 +8,8 @@ To see some more complex examples programs, check out the [examples](examples/)
### Basic features
We can start with a basic program that adds the numbers 3 and 2.
-
```py
-def main:
+def main... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -53,22 +53,22 @@ def tuple_fst(x):
# With an object (similar to what other languages call a struct, a class or a record)
object Pair { fst, snd }
-def Pair/fst(x):
+def Pair/fst(x: Pair) -> Any: | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/FEATURES.md b/FEATURES.md
index 8f72a2bd..ce60841f 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -8,9 +8,8 @@ To see some more complex examples programs, check out the [examples](examples/)
### Basic features
We can start with a basic program that adds the numbers 3 and 2.
-
```py
-def main:
+def main... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -53,22 +53,22 @@ def tuple_fst(x):
# With an object (similar to what other languages call a struct, a class or a record)
object Pair { fst, snd }
-def Pair/fst(x):
+def Pair/fst(x: Pair) -> Any:
match x:
case Pair:
return x.fst
# We can also access the fields of an object after we `open` it.
-d... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/FEATURES.md b/FEATURES.md
index 8f72a2bd..ce60841f 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -8,9 +8,8 @@ To see some more complex examples programs, check out the [examples](examples/)
### Basic features
We can start with a basic program that adds the numbers 3 and 2.
-
```py
-def main:
+def main... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -10,7 +10,7 @@ To see some more complex examples programs, check out the [examples](examples/)
We can start with a basic program that adds the numbers 3 and 2.
| bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/FEATURES.md b/FEATURES.md
index 8f72a2bd..ce60841f 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -8,9 +8,8 @@ To see some more complex examples programs, check out the [examples](examples/)
### Basic features
We can start with a basic program that adds the numbers 3 and 2.
-
```py
-def main:
+def main... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -53,22 +53,22 @@ def tuple_fst(x):
# With an object (similar to what other languages call a struct, a class or a record)
object Pair { fst, snd }
-def Pair/fst(x):
+def Pair/fst(x: Pair) -> Any:
match x:
case Pair:
return x.fst
# We can also access the fields of an object after we `open` it.
-d... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/FEATURES.md b/FEATURES.md
index 8f72a2bd..ce60841f 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -8,9 +8,8 @@ To see some more complex examples programs, check out the [examples](examples/)
### Basic features
We can start with a basic program that adds the numbers 3 and 2.
-
```py
-def main:
+def main... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -53,22 +53,22 @@ def tuple_fst(x):
# With an object (similar to what other languages call a struct, a class or a record)
object Pair { fst, snd }
-def Pair/fst(x):
+def Pair/fst(x: Pair) -> Any:
match x:
case Pair:
return x.fst
# We can also access the fields of an object after we `open` it.
-d... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/FEATURES.md b/FEATURES.md
index 8f72a2bd..ce60841f 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -8,9 +8,8 @@ To see some more complex examples programs, check out the [examples](examples/)
### Basic features
We can start with a basic program that adds the numbers 3 and 2.
-
```py
-def main:
+def main... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -110,7 +110,7 @@ This allows us to easily create and consume these recursive data structures with
`bend` is a pure recursive loop that is very useful for generating data structures.
```py
-def MyTree.sum(x):
+def MyTree.sum(x: MyTree) -> u24: | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/FEATURES.md b/FEATURES.md
index 8f72a2bd..ce60841f 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -8,9 +8,8 @@ To see some more complex examples programs, check out the [examples](examples/)
### Basic features
We can start with a basic program that adds the numbers 3 and 2.
-
```py
-def main:
+def main... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -201,21 +201,21 @@ To use a variable twice without duplicating it, you can use a `use` statement.
It inlines clones of some value in the statements that follow it.
```py
-def foo(x):
- use result = bar(1, x)
+def foo(x: Any) -> (Any, Any): | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/FEATURES.md b/FEATURES.md
index 8f72a2bd..ce60841f 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -8,9 +8,8 @@ To see some more complex examples programs, check out the [examples](examples/)
### Basic features
We can start with a basic program that adds the numbers 3 and 2.
-
```py
-def main:
+def main... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -227,15 +227,12 @@ If your recursive function is not based on pattern matching syntax (like `if`, `
```py
# A scott-encoded list folding function
# Writing it like this will cause an infinite loop.
-def scott_list.add(xs, add):
- xs(
- λxs.head xs.tail: λc n: (c (xs.head + add) scott_list.sum(xs.tail, add)),
... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/FEATURES.md b/FEATURES.md
index 8f72a2bd..ce60841f 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -8,9 +8,8 @@ To see some more complex examples programs, check out the [examples](examples/)
### Basic features
We can start with a basic program that adds the numbers 3 and 2.
-
```py
-def main:
+def main... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -227,15 +227,12 @@ If your recursive function is not based on pattern matching syntax (like `if`, `
```py
# A scott-encoded list folding function
# Writing it like this will cause an infinite loop.
-def scott_list.add(xs, add):
- xs(
- λxs.head xs.tail: λc n: (c (xs.head + add) scott_list.sum(xs.tail, add)),
... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/FEATURES.md b/FEATURES.md
index 8f72a2bd..ce60841f 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -8,9 +8,8 @@ To see some more complex examples programs, check out the [examples](examples/)
### Basic features
We can start with a basic program that adds the numbers 3 and 2.
-
```py
-def main:
+def main... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -266,28 +263,35 @@ Floating point numbers must have the decimal point `.` and can optionally take a
The three number types are fundamentally different.
If you mix two numbers of different types HVM will interpret the binary representation of one of them incorrectly, leading to incorrect results. Which number is in... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/FEATURES.md b/FEATURES.md
index 8f72a2bd..ce60841f 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -8,9 +8,8 @@ To see some more complex examples programs, check out the [examples](examples/)
### Basic features
We can start with a basic program that adds the numbers 3 and 2.
-
```py
-def main:
+def main... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -386,15 +381,15 @@ type Bool:
True
False
-def is_odd(x):
+def is_odd(x: u24) -> Bool:
switch x:
case 0:
return Bool/False
case _:
return is_even(x-1)
(is_even n) = switch n { | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/FEATURES.md b/FEATURES.md
index 8f72a2bd..ce60841f 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -8,9 +8,8 @@ To see some more complex examples programs, check out the [examples](examples/)
### Basic features
We can start with a basic program that adds the numbers 3 and 2.
-
```py
-def main:
+def main... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -78,19 +78,28 @@ and recursion play an important role. This is how its `"Hello, world!"` looks:
def main():
return "Hello, world!"
```
-
+To run the program above, type:
+```
+bend run-rs main.bend
+```
Wait - there is something strange there. Why `return`, not `print`? Well, _for
-now_ (you'll read these word... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/GUIDE.md b/GUIDE.md
index ea89b25c..f048b9b4 100644
--- a/GUIDE.md
+++ b/GUIDE.md
@@ -78,19 +78,28 @@ and recursion play an important role. This is how its `"Hello, world!"` looks:
def main():
return "Hello, world!"
```
-
+To run the program above, type:
+```
+bend run-rs main.bend
+```
Wait - there ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -299,13 +314,13 @@ def parity(x):
... because that would mutate the `result` variable. Instead, we should write: | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/GUIDE.md b/GUIDE.md
index ea89b25c..f048b9b4 100644
--- a/GUIDE.md
+++ b/GUIDE.md
@@ -78,19 +78,28 @@ and recursion play an important role. This is how its `"Hello, world!"` looks:
def main():
return "Hello, world!"
```
-
+To run the program above, type:
+```
+bend run-rs main.bend
+```
Wait - there ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -411,8 +426,9 @@ def enum(tree):
return ![tree.left(idx * 2 + 0), tree.right(idx * 2 + 1)]
case Tree/Leaf:
return !(idx, tree.value)
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@VER PRA TIPAR ESSA FUNÇÃO QUE NÃO TA FUNCIONANDO@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/GUIDE.md b/GUIDE.md
index ea89b25c..f048b9b4 100644
--- a/GUIDE.md
+++ b/GUIDE.md
@@ -78,19 +78,28 @@ and recursion play an important role. This is how its `"Hello, world!"` looks:
def main():
return "Hello, world!"
```
-
+To run the program above, type:
+```
+bend run-rs main.bend
+```
Wait - there ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -411,8 +426,9 @@ def enum(tree):
return ![tree.left(idx * 2 + 0), tree.right(idx * 2 + 1)]
case Tree/Leaf:
return !(idx, tree.value)
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@VER PRA TIPAR ESSA FUNÇÃO QUE NÃO TA FUNCIONANDO@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-def main:
+def... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/GUIDE.md b/GUIDE.md
index ea89b25c..f048b9b4 100644
--- a/GUIDE.md
+++ b/GUIDE.md
@@ -78,19 +78,28 @@ and recursion play an important role. This is how its `"Hello, world!"` looks:
def main():
return "Hello, world!"
```
-
+To run the program above, type:
+```
+bend run-rs main.bend
+```
Wait - there ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -434,11 +450,11 @@ it is really liberating, and will let you write better algorithms. As an
exercise, use `fold` to implement a "reverse" algorithm for lists:
```python
-def reverse(list):
+def reverse(list: List) -> List: | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/GUIDE.md b/GUIDE.md
index ea89b25c..f048b9b4 100644
--- a/GUIDE.md
+++ b/GUIDE.md
@@ -78,19 +78,28 @@ and recursion play an important role. This is how its `"Hello, world!"` looks:
def main():
return "Hello, world!"
```
-
+To run the program above, type:
+```
+bend run-rs main.bend
+```
Wait - there ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -434,11 +450,11 @@ it is really liberating, and will let you write better algorithms. As an
exercise, use `fold` to implement a "reverse" algorithm for lists:
```python
-def reverse(list):
+def reverse(list: List) -> List:
# exercise
?
-def main:
+def main() -> List: | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/GUIDE.md b/GUIDE.md
index ea89b25c..f048b9b4 100644
--- a/GUIDE.md
+++ b/GUIDE.md
@@ -78,19 +78,28 @@ and recursion play an important role. This is how its `"Hello, world!"` looks:
def main():
return "Hello, world!"
```
-
+To run the program above, type:
+```
+bend run-rs main.bend
+```
Wait - there ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -575,14 +591,15 @@ unlike the former one, they will run in parallel. And that's why `bend` and
example, to add numbers in parallel, we can write:
```python
-def main():
+def main() -> u24:
bend d = 0, i = 0:
when d < 28:
sum = fork(d+1, i*2+0) + fork(d+1, i*2+1)
else:
sum = i
return... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/GUIDE.md b/GUIDE.md
index ea89b25c..f048b9b4 100644
--- a/GUIDE.md
+++ b/GUIDE.md
@@ -78,19 +78,28 @@ and recursion play an important role. This is how its `"Hello, world!"` looks:
def main():
return "Hello, world!"
```
-
+To run the program above, type:
+```
+bend run-rs main.bend
+```
Wait - there ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -655,29 +672,32 @@ implemented as a series of _immutable tree rotations_, with pattern-matching and
recursion. Don't bother trying to understand it, but, here's the code:
```python
-def gen(d, x):
+def gen(d: u24, x: u24) -> Any:
switch d:
case 0:
return x
case _:
return (gen(d-1, x * ... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/GUIDE.md b/GUIDE.md
index ea89b25c..f048b9b4 100644
--- a/GUIDE.md
+++ b/GUIDE.md
@@ -78,19 +78,28 @@ and recursion play an important role. This is how its `"Hello, world!"` looks:
def main():
return "Hello, world!"
```
-
+To run the program above, type:
+```
+bend run-rs main.bend
+```
Wait - there ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -104,26 +117,34 @@ List/concat([1, 2], [4, 5])
#### List/filter
-Filters a list based on a predicate function.
-
```python
+#{
+ Filters a list based on a predicate function.
+#}
List/filter(xs: List(T), pred: T -> Bool) -> List(T)
```
#### List/split_once
+```python
+#{
Splits a list into two lists a... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/builtins.md b/docs/builtins.md
index ee6f4c17..4ab66dcc 100644
--- a/docs/builtins.md
+++ b/docs/builtins.md
@@ -7,7 +7,9 @@
## String
```python
-type String = (Cons head ~tail) | (Nil)
+type String:
+ Nil
+ Cons { head: u24, ~tail: String }
```
- **Nil**: Represents an empty string.
@@ -25,... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -178,14 +205,12 @@ maybe = Maybe/Some(Nat/Succ(Nat/Zero))
## Maybe functions
### Maybe/unwrap
-Maybe has a builtin function that returns the value inside the `Maybe` if it is `Some`, and returns `unreachable()` if it is `None`.
+Returns the value inside the `Maybe` if it is `Some`, and returns `unreachable()` if... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/builtins.md b/docs/builtins.md
index ee6f4c17..4ab66dcc 100644
--- a/docs/builtins.md
+++ b/docs/builtins.md
@@ -7,7 +7,9 @@
## String
```python
-type String = (Cons head ~tail) | (Nil)
+type String:
+ Nil
+ Cons { head: u24, ~tail: String }
```
- **Nil**: Represents an empty string.
@@ -25,... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -229,31 +255,22 @@ Here, `map` must be the name of the `Map` variable, and the keys inside `[]` can
### Map/empty
-Initializes an empty map.
-
```python
+#{
+ Initializes an empty map.
+#}
Map/empty = Map/Leaf
```
### Map/get
-Retrieves a `value` from the `map` based on the `key`.
-Returns a tuple wit... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/builtins.md b/docs/builtins.md
index ee6f4c17..4ab66dcc 100644
--- a/docs/builtins.md
+++ b/docs/builtins.md
@@ -7,7 +7,9 @@
## String
```python
-type String = (Cons head ~tail) | (Nil)
+type String:
+ Nil
+ Cons { head: u24, ~tail: String }
```
- **Nil**: Represents an empty string.
@@ -25,... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -359,26 +355,12 @@ x[0] @= lambda y: String/concat(y, " and mapped")
### Map/contains
-Checks if a `map` contains a given `key` and returns 0 or 1 as a `u24` number and the `map` unchanged.
-```python
-def Map/contains (map: Map(T), key: u24) -> (u24, Map(T)):
- match map:
- case Map/Leaf:
- return (0,... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/builtins.md b/docs/builtins.md
index ee6f4c17..4ab66dcc 100644
--- a/docs/builtins.md
+++ b/docs/builtins.md
@@ -7,7 +7,9 @@
## String
```python
-type String = (Cons head ~tail) | (Nil)
+type String:
+ Nil
+ Cons { head: u24, ~tail: String }
```
- **Nil**: Represents an empty string.
@@ -25,... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -591,23 +590,23 @@ You can read more on how to implement these libraries in the [Dynamically linked
#### IO/DyLib/open
```py
-def IO/DyLib/open(path: String, lazy: u24) -> u24
+#{
+ Loads a dynamic library file.
+#}
+def IO/DyLib/open(path: String, lazy: u24) -> IO(Result(u24, String))
```
-
-Loads a dynamic l... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/builtins.md b/docs/builtins.md
index ee6f4c17..4ab66dcc 100644
--- a/docs/builtins.md
+++ b/docs/builtins.md
@@ -7,7 +7,9 @@
## String
```python
-type String = (Cons head ~tail) | (Nil)
+type String:
+ Nil
+ Cons { head: u24, ~tail: String }
```
- **Nil**: Represents an empty string.
@@ -25,... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -629,220 +628,293 @@ Closes a previously open library.
### to_f24
```py
-def to_f24(x: any number) -> f24
-```
-
-Casts any native number to an f24.
+#{
+ Casts an u24 number to an f24.
+#}
+hvm u24/to_f24 -> (u24 -> f24) | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/builtins.md b/docs/builtins.md
index ee6f4c17..4ab66dcc 100644
--- a/docs/builtins.md
+++ b/docs/builtins.md
@@ -7,7 +7,9 @@
## String
```python
-type String = (Cons head ~tail) | (Nil)
+type String:
+ Nil
+ Cons { head: u24, ~tail: String }
```
- **Nil**: Represents an empty string.
@@ -25,... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -629,220 +628,293 @@ Closes a previously open library.
### to_f24
```py
-def to_f24(x: any number) -> f24
-```
-
-Casts any native number to an f24.
+#{
+ Casts an u24 number to an f24.
+#}
+hvm u24/to_f24 -> (u24 -> f24)
+#{
+ Casts an i24 number to an f24.
+#}
+hvm i24/to_f24 -> (i24 -> f24)
+```
### to_u... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/builtins.md b/docs/builtins.md
index ee6f4c17..4ab66dcc 100644
--- a/docs/builtins.md
+++ b/docs/builtins.md
@@ -7,7 +7,9 @@
## String
```python
-type String = (Cons head ~tail) | (Nil)
+type String:
+ Nil
+ Cons { head: u24, ~tail: String }
```
- **Nil**: Represents an empty string.
@@ -25,... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -35,11 +35,13 @@ def main(x, y):
> bend run <path> +5 +3
{+2 -2}
-# Calling with three argument
-# In this case, the third argument doesn't change anything
-# due to the underlying interaction rules.
-# If this were a variant of simply-typed lambda-calculus
-# it wouldn't be well-typed.
+#{ | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/cli-arguments.md b/docs/cli-arguments.md
index c72f64e2..a6a58798 100644
--- a/docs/cli-arguments.md
+++ b/docs/cli-arguments.md
@@ -34,8 +34,7 @@ def main(x, y):
# Calling with two argument
> bend run <path> +5 +3
{+2 -2}
-
-# Calling with three argument
+# Calling with three arguments
# In this ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -12,6 +12,7 @@
| `-Oinline` `-Ono-inline` | Disabled | [inline](#inline) |
| `-Ocheck-net-size` `-Ono-check-net-size` | Disabled | [check-net-size](#check-net-size) |
| `-Oadt-scott` `-Oadt-nu... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/compiler-options.md b/docs/compiler-options.md
index 71d817b6..2c4b42c7 100644
--- a/docs/compiler-options.md
+++ b/docs/compiler-options.md
@@ -12,7 +12,7 @@
| `-Oinline` `-Ono-inline` | Disabled | [inline](#inline) |
| `-... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -259,3 +260,13 @@ Option/None/tag = 1
Pattern-matching with `match` and `fold` is generated according to the encoding.
Note: IO is **only** available with `-Oadt-num-scott`.
+
+## Type Checking
+
+Type checking is enabled by default and verifies that the types are all declared correctly. | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/compiler-options.md b/docs/compiler-options.md
index 71d817b6..2c4b42c7 100644
--- a/docs/compiler-options.md
+++ b/docs/compiler-options.md
@@ -12,7 +12,7 @@
| `-Oinline` `-Ono-inline` | Disabled | [inline](#inline) |
| `-... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.