A quick-reference guide for AI systems learning BechML - a friendly, higher-kinded, modular, functional scripting language.
BechML is a statically-typed functional programming language with:
- Higher-kinded types
| app [main!] { | |
| cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.20.0/X73hGh05nNTkDHU06FHC0YfFaQB1pimX7gncRcao5mU.tar.br", | |
| weaver: "https://github.com/smores56/weaver/releases/download/0.6.0/4GmRnyE7EFjzv6dDpebJoWWwXV285OMt4ntHIc6qvmY.tar.br", | |
| json: "https://github.com/lukewilliamboswell/roc-json/releases/download/0.13.0/RqendgZw5e1RsQa3kFhgtnMP8efWoqGRsAvubx4-zus.tar.br", | |
| } | |
| import cli.Arg exposing [Arg] | |
| import cli.Stdout | |
| import cli.File | |
| import cli.Utc |
| use Core.*; | |
| scale : int := 1000; | |
| xMin : int := Int.sub 0 2500; | |
| xMax : int := 1000; | |
| yMin : int := Int.sub 0 1750; | |
| yMax : int := 1750; | |
| size : int := 256; | |
| cellPx : int := 4; |
| use Core.*; | |
| scale : int := 1000; | |
| xMin : int := Int.sub 0 2500; | |
| xMax : int := 1000; | |
| yMin : int := Int.sub 0 1750; | |
| yMax : int := 1750; | |
| width : int := 80; |
| #!/usr/bin/env node | |
| // BechML runner using WASM module from bechml.github.io | |
| // Requires: Node.js, bechml.wasm and core/ in same directory as this script | |
| // Usage: node bechml-runner.mjs <source.bml> | |
| // Optional: BECHML_WASM_DIR env var overrides location of bechml.wasm and core/ | |
| import { readFileSync } from 'fs'; | |
| import { dirname, join } from 'path'; | |
| import { fileURLToPath } from 'url'; | |
| import { WASI } from 'wasi'; |
| -- Text Adventure Game in Unison | |
| -- A simple dungeon adventure | |
| -- Room identifiers | |
| unique type RoomId = Entrance | DarkHallway | TreasureRoom | |
| -- Command types | |
| unique type Command = North | South | East | West | Look | Help | Quit | Take | Inventory | Unknown | |
| -- Game state |
| Blob(id=1, object_id=b729333c959a35b355d0d1374622fdf7a2df773d, type=blob, filename=young.xls, content=Read value moment network peace summer war land. Difficult conference woman poor practice. | |
| Teacher his theory. Film study run staff. Plan voice large about go rather wrong., size=6637) | |
| Blob(id=2, object_id=63d44a371b25ab3234251bf220a5e0fb4976fff6, type=blob, filename=dream.js, content=Develop them car knowledge. Wear interesting something entire. | |
| Start different affect agree pick race building power. In foot white behind hard., size=6605) | |
| Blob(id=3, object_id=20ca5694a1122682123355aa11353694a88285b1, type=blob, filename=develop.tiff, content=Plan travel open seek watch question region. Go project take ground pretty. | |
| Miss cause detail perhaps. Hard plan car laugh bed improve the. Marriage remain discover charge cell kid., size=29753) | |
| Blob(id=4, object_id=c8dd610308d1511cfc81926ac4f71d7e87d43f4c, type=blob, filename=very.ods, content=Size technology on stage force well. Coach people various through safe. | |
| Leader |
| # Snowfakery recipe for Git's core data model | |
| # Generates: Objects (commits, trees, blobs, tags), References, Index entries, and Reflogs | |
| # ============================================ | |
| # OBJECTS | |
| # ============================================ | |
| # Blob - stores file contents | |
| - object: Blob | |
| count: 20 |
| from snowfakery.utils.randomized_range import random_range | |
| countries = ["Canada", "Mexico", "United States", "Japan", "China"] * 1_000_000 | |
| def shuffle_sequence(sequence): | |
| indexes = random_range(0, len(sequence)) | |
| for index in indexes: | |
| yield sequence[index] |
| <p>Plug-in coding conventions</p> | |
| <p>To ensure custom plug-ins work well with the core toolkit code and | |
| remain compatible with future releases, the DITA Open Toolkit project | |
| recommends that plug-ins use modern development practices and common | |
| coding patterns.</p> | |
| <p>Best practices</p> | |
| <p>Adhering to certain development practices will properly isolate your | |
| code from that of DITA Open Toolkit. This will make it easier to you to | |
| upgrade to new versions of DITA-OT when they are released.</p> | |
| <ul> |