### Clone, Build, and Verify Smelter Demos Source: https://github.com/abacusnoir/smelter/blob/master/examples/showcase/README.md Provides instructions to clone the Smelter repository, build the project, and verify all demos. This is a comprehensive setup guide for users wanting to run the examples locally. ```bash git clone https://github.com/abacusnoir/smelter cd smelter make build ./test/verify-demos.sh ``` -------------------------------- ### README Markdown for Homebrew Installation Source: https://github.com/abacusnoir/smelter/blob/master/responses/homebrew-tap-setup-2025-10-11.md Markdown snippet for including Homebrew and direct installation instructions in a project's README file. It provides clear, copy-pasteable commands for users. ```markdown ## Installation ### Homebrew (macOS/Linux) ```bash brew tap abacusnoir/smelter brew install smelter ``` ### Quick Install Script ```bash curl -fsSL https://raw.githubusercontent.com/abacusnoir/smelter/master/scripts/install.sh | bash ``` ``` -------------------------------- ### Verify Smelter Installation Source: https://github.com/abacusnoir/smelter/blob/master/responses/homebrew-tap-setup-2025-10-11.md Commands to verify the successful installation of Smelter, including checking the binary path, version information, and executing a simple command. ```bash which smt smt --version smt eval '(+ 2 3)' ``` -------------------------------- ### Smelter CLI Functionality Examples Source: https://github.com/abacusnoir/smelter/blob/master/responses/cli-binary-entry-point-fix-summary.md Demonstrates the correct usage and expected output for various Smelter CLI commands after the fix. This includes evaluating expressions, running scripts, starting the REPL, and handling unknown commands. Note the documented limitation for '--help' and '--version' flags. ```bash # Shows Smelter help (not SBCL help) ./smt # Evaluates expressions correctly ./smt eval '5' # Runs Coalton scripts ./smt run script.coal # Starts interactive REPL ./smt repl # Shows proper error messages for unknown commands ./smt unknown # Known Limitation: Still shows SBCL help ./smt --help ./smt --version ``` -------------------------------- ### Smelter Launch Example: Hello World Source: https://github.com/abacusnoir/smelter/blob/master/docs/launch-ready-achievement.md A basic 'Hello World' example for Smelter, demonstrating string concatenation and printing to the console. It includes explicit type declarations and uses standard library I/O functions. ```coal #!/usr/bin/env smt run (declare greet (String -> String)) (define (greet name) (<> "Hello from " (<> name "!"))) (define main (progn (smelter.stdlib.io:io-println (greet "Smelter")) (smelter.stdlib.io:io-println "Type-safe scripting with Coalton"))) ``` -------------------------------- ### Homebrew Installation Log Snippet Source: https://github.com/abacusnoir/smelter/blob/master/responses/homebrew-ci-verification-2025-10-11.md This log output shows the steps involved in tapping the Smelter repository and installing the Smelter binary using Homebrew. It confirms that the 'brew tap' and 'brew install' commands are functioning as expected within the CI environment. ```bash ==> Tapping abacusnoir/smelter Cloning into '/opt/homebrew/Library/Taps/abacusnoir/homebrew-smelter'... Tapped 1 formula (14 files, 10.1KB). ==> Downloading https://github.com/abacusnoir/smelter/releases/download/v0.1.7/smt-darwin-arm64.tar.gz ==> Installing smelter from abacusnoir/smelter 🍺 /opt/homebrew/Cellar/smelter/0.1.7: 4 files, 20.0MB, built in 2 seconds ``` -------------------------------- ### Verify Showcase Examples Locally Source: https://github.com/abacusnoir/smelter/blob/master/responses/ci-verification-summary-2025-10-13.md This snippet shows the summary output of locally testing all 6 showcase examples for the Smelter project using the './test/verify-demos.sh' script. It confirms that all examples passed. ```shell === SUMMARY === Total demos: 6 Passed: 6 Failed: 0 ✅ All demos verified successfully! ``` -------------------------------- ### Hello World Examples (Coalton) Source: https://github.com/abacusnoir/smelter/blob/master/structure.txt Multiple 'Hello, World!' examples written in Coalton. These serve as introductory snippets for the Coalton language and Smelter's integration. ```coalton ;; Placeholder for hello.coal content ;; This file is expected to contain a basic Coalton 'Hello, World!' example. ``` ```coalton ;; Placeholder for pure-hello.coal content ;; This file is expected to contain a pure Coalton 'Hello, World!' example. ``` -------------------------------- ### Run Smelter Demos Source: https://github.com/abacusnoir/smelter/blob/master/examples/showcase/README.md Demonstrates how to run Smelter demos using the 'smt run' command and verify all demos with a provided script. This is the primary way to interact with and test the showcase examples. ```bash # Run any demo ./smt run examples/showcase/config-validator.coal # Verify all demos work ./test/verify-demos.sh ``` -------------------------------- ### Testing Smelter Adapters with SMT Eval Source: https://github.com/abacusnoir/smelter/blob/master/docs/smelter-adapter-implementation.md This snippet demonstrates how to test individual Smelter adapters using the `smt eval` command. It shows examples for testing HTTP GET requests, JSON parsing, file writing, process execution, and CLI argument parsing, verifying the functionality of each adapter. ```shell # Test HTTP Adapter smt eval '(use smelter/adapters/http) (http-get "https://httpbin.org/get")' # Test JSON Adapter smt eval '(use smelter/adapters/json) (parse-json "{\"test\": true}")' # Test File System Adapter smt eval '(use smelter/adapters/fs) (write-file "/tmp/test" "hello")' # Test Process Execution Adapter smt eval '(use smelter/adapters/process) (run-process "echo test")' # Test CLI Parsing Adapter smt eval '(use smelter/adapters/cli) (parse-args specs args)' # Run Full Example smt run examples/github-stats.coal --username torvalds ``` -------------------------------- ### Smelter Launch Example: Double and Triple Functions Source: https://github.com/abacusnoir/smelter/blob/master/docs/launch-ready-achievement.md Defines and demonstrates simple functions to double and triple an integer. This example showcases basic arithmetic operations and the use of `show-int` for output. ```coal (declare double (Integer -> Integer)) (define (double n) (* n 2)) (declare triple (Integer -> Integer)) (define (triple n) (* n 3)) (define main (progn (smelter.stdlib.io:io-print "double(21) = ") (smelter.stdlib.io:io-println (smelter.stdlib.io:show-int (double 21))) (smelter.stdlib.io:io-print "triple(14) = ") (smelter.stdlib.io:io-println (smelter.stdlib.io:show-int (triple 14))))) ``` -------------------------------- ### Smelter Launch Example: Factorial Calculation Source: https://github.com/abacusnoir/smelter/blob/master/docs/launch-ready-achievement.md Computes the factorial of a non-negative integer recursively. This example demonstrates recursion, base cases, and the use of `show-int` for displaying the result. ```coal (declare factorial (Integer -> Integer)) (define (factorial n) (if (== n 0) 1 (* n (factorial (- n 1))))) (define main (progn (smelter.stdlib.io:io-print "5! = ") (smelter.stdlib.io:io-println (smelter.stdlib.io:show-int (factorial 5))))) ``` -------------------------------- ### Verify Homebrew Installation and Basic Functionality Source: https://github.com/abacusnoir/smelter/blob/master/responses/ci-verification-summary-2025-10-13.md This snippet demonstrates the successful verification of installing the 'smelter' package via Homebrew on macOS. It includes tapping the formula, installing the package, and verifying the installed version and basic command execution. ```shell ✓ Wait for release assets to propagate (60s) ✓ Tap and install via Homebrew ==> Tapping abacusnoir/smelter Tapped 1 formula (14 files, 10.7KB). ==> Installing smelter from abacusnoir/smelter 🍺 /opt/homebrew/Cellar/smelter/0.1.7: 4 files, 20.0MB, built in 2 seconds ✓ Test Homebrew installation smt --version → Smelter 0.1.0, Coalton 0.8.0, SBCL 2.5.8 smt eval '(+ 2 3)' → 5 ✓ Cleanup (uninstall + untap) ``` -------------------------------- ### Smelter Launch Example: Fibonacci Sequence Source: https://github.com/abacusnoir/smelter/blob/master/docs/launch-ready-achievement.md Calculates the nth Fibonacci number recursively. This example showcases function definition, recursion, conditional logic, and the use of `show-int` for output. ```coal (declare fib (Integer -> Integer)) (define (fib n) (if (<= n 1) n (+ (fib (- n 1)) (fib (- n 2))))) (define main (progn (smelter.stdlib.io:io-print "fib(10) = ") (smelter.stdlib.io:io-println (smelter.stdlib.io:show-int (fib 10))))) ``` -------------------------------- ### API Client Example (Smelt) Source: https://github.com/abacusnoir/smelter/blob/master/structure.txt An example demonstrating how to use the API client functionality within the Smelter project, written in the Smelt language. It shows interaction with external services. ```smelt ;; Placeholder for api-client.smt content ;; This file is expected to contain Smelt code for an API client example. ``` -------------------------------- ### Verify Homebrew Installation with Smelter CLI Source: https://github.com/abacusnoir/smelter/blob/master/responses/homebrew-ci-verification-2025-10-11.md This snippet demonstrates how to verify a Homebrew installation of the Smelter CLI by checking its version and executing a simple command. It's a crucial step in ensuring the CI test correctly validates the installed binary. ```bash $ brew reinstall smelter ==> Reinstalling abacusnoir/smelter/smelter 🍺 /opt/homebrew/Cellar/smelter/0.1.7: 4 files, 20.0MB, built in 1 second $ smt eval '(+ 2 3)' 5 ✅ Homebrew installation verified ``` -------------------------------- ### Working Demo Example (Coalton) Source: https://github.com/abacusnoir/smelter/blob/master/structure.txt This Coalton example provides a working demonstration of Smelter's capabilities. It likely showcases a practical use case or feature. ```coalton ;; Placeholder for working-demo.coal content ;; This file is expected to contain a working demo in Coalton. ``` ```coalton ;; Placeholder for working-hello.coal content ;; This file is expected to contain a working 'Hello, World!' example in Coalton. ``` -------------------------------- ### GitHub Stats Example (Coalton) Source: https://github.com/abacusnoir/smelter/blob/master/structure.txt This Coalton example likely fetches and displays statistics from GitHub. It demonstrates how Smelter can interact with external APIs and process data. ```coalton ;; Placeholder for github-stats.coal content ;; This file is expected to contain Coalton code for fetching GitHub stats. ``` -------------------------------- ### Coalton HTTP GET Request Example Source: https://github.com/abacusnoir/smelter/blob/master/docs/http-json-adapters.md An example of how to perform an HTTP GET request using the Smelter HTTP adapter and handle the response, including success and various error conditions. ```coalton (define (fetch-data url) (let ((response (smelter/http:http-get url))) (match response ((Ok data) (println data)) ((Err (smelter/http:NetworkError msg)) (println (concat "Network error: " msg))) ((Err (smelter/http:HttpStatus code msg)) (println (concat "HTTP " (concat (into code) (concat ": " msg))))) ((Err smelter/http:TimeoutError) (println "Request timed out"))))) ``` -------------------------------- ### Alternative Smelter Direct Installation Source: https://github.com/abacusnoir/smelter/blob/master/responses/homebrew-tap-setup-2025-10-11.md A command to install Smelter directly using a curl script. This provides an alternative installation method if Homebrew is not preferred or available. ```bash curl -fsSL https://raw.githubusercontent.com/abacusnoir/smelter/master/scripts/install.sh | bash ``` -------------------------------- ### Install Smelter CLI Source: https://github.com/abacusnoir/smelter/blob/master/README.md Installs the Smelter command-line interface using a curl script. This is the recommended method for quick setup. ```bash curl -fsSL https://raw.githubusercontent.com/abacusnoir/smelter/master/install.sh | bash ``` -------------------------------- ### Simple Coalton Example Source: https://github.com/abacusnoir/smelter/blob/master/structure.txt A straightforward example in Coalton, likely illustrating basic syntax and operations. It serves as a starting point for learning Coalton. ```coalton ;; Placeholder for simple.coal content ;; This file is expected to contain a simple Coalton example. ``` -------------------------------- ### Install Smelter using Homebrew Source: https://github.com/abacusnoir/smelter/blob/master/homebrew-smelter/README.md Installs the Smelter scripting language using the abacusnoir/smelter Homebrew tap. This is the primary method for getting Smelter onto your system. ```bash brew tap abacusnoir/smelter brew install smelter ``` -------------------------------- ### Lisp Hello World Demo (Typical) Source: https://github.com/abacusnoir/smelter/blob/master/responses/2025-10-03-showcase-demos-complete.md A basic 'Hello World' program written in Lisp, representing a typical, syntax-focused demo. This serves as a contrast to the showcase demos. ```lisp ;; hello.coal (define main (println "Hello World")) ``` -------------------------------- ### Check SBCL Installation Source: https://github.com/abacusnoir/smelter/blob/master/docs/troubleshooting.md Verify that the Steel Bank Common Lisp (SBCL) compiler is installed and accessible. SBCL is a core dependency for building and running Smelter. ```bash sbcl --version ``` -------------------------------- ### HN Launch Post Structure Example (Markdown) Source: https://github.com/abacusnoir/smelter/blob/master/docs/showcase-demos-achievement.md This markdown snippet outlines the structure for a 'Show HN' post, integrating Smelter's value proposition and demo examples to attract user interest and highlight its benefits for common developer problems. ```markdown Show HN: Smelter - Type-safe scripting that just works Tired of: - Bash scripts failing at line 47? - Python configs breaking in production? - Null pointer exceptions at 3am? I built Smelter: ML-style type inference for shell scripts. Example - config validation with compile-time guarantees: [paste config-validator.coal - 19 lines] More examples that solve YOUR daily pain: - Type-safe build scripts (no undefined variables!) - Data pipelines that can't fail at runtime - Error handling you can't forget 43ms startup, 9.3MB binary, zero dependencies. Try it: ./test/verify-demos.sh GitHub: [link] ``` -------------------------------- ### Get Smelter Help Information Source: https://github.com/abacusnoir/smelter/blob/master/docs/troubleshooting.md Display the help message for the Smelter command-line interface. This provides an overview of available commands and options. ```bash ./smt --help ``` -------------------------------- ### Build System Integration with Makefile Targets Source: https://github.com/abacusnoir/smelter/blob/master/docs/smelter-adapter-implementation.md This section outlines the build system integration for Smelter adapters, including dependency management via Quicklisp, build scripts located in `build/build-adapters.lisp`, and Makefile targets for managing dependencies, building adapters, and testing. ```makefile # Makefile Targets for Smelter Adapters install-deps: # Command to install Quicklisp dependencies build-adapters: # Command to build the adapters test-adapters: # Command to test the adapters ``` -------------------------------- ### Smelter Script Shebang Source: https://github.com/abacusnoir/smelter/blob/master/docs/troubleshooting.md Ensure that Coalton scripts start with the correct shebang line to be executed directly by the Smelter runtime. This specifies the interpreter to use. ```bash #!/usr/bin/env smt run ``` -------------------------------- ### Smelter Process Adapter Verification Commands (Bash) Source: https://github.com/abacusnoir/smelter/blob/master/responses/process-adapter-session-summary-2025-10-01.md Provides bash commands to build, test, and verify the Smelter Process adapter. Includes an example of evaluating a process execution within Smelter's REPL. ```bash # Build make build # Test process adapter ./test/test-process-simple.sh # Example usage ./smt eval '(match (smelter/adapters/process:run "echo hello") ((Ok (smelter/adapters/process:ProcessResult stdout _ _)) stdout) ((Err _) "error"))' # Output: hello ``` -------------------------------- ### Verify Smelter Version Source: https://github.com/abacusnoir/smelter/blob/master/docs/troubleshooting.md Check the installed Smelter version to ensure you are running a compatible release. This is crucial for resolving issues related to specific bugs or features. ```bash ./smt --version ``` -------------------------------- ### Run Smelter Showcase Demo Source: https://github.com/abacusnoir/smelter/blob/master/CLAUDE.md Demonstrates how to execute a specific showcase demo script using the Smelter runtime. This command allows users to test individual examples and verify their functionality. ```bash ./smt run examples/showcase/config-validator.coal ``` -------------------------------- ### Clean and Rebuild Smelter Source: https://github.com/abacusnoir/smelter/blob/master/docs/troubleshooting.md Perform a clean build of Smelter, including dependency installation. This is a common solution for build failures, missing dependencies, or package not found errors. ```bash make clean make deps make build ``` -------------------------------- ### Create and Run a Filesystem Script in Smelter Source: https://github.com/abacusnoir/smelter/blob/master/responses/filesystem-adapter-implementation-complete.md This example demonstrates how to create a simple Smelter script that uses the filesystem adapter to write to a file and then read from it. It showcases basic file I/O operations and error handling using Coalton's Result type. ```bash # Create and run a filesystem script echo '(coalton-toplevel (define main (match (smelter/adapters/fs:write-file "/tmp/hello.txt" "Hello from Smelter!") ((Ok _) (smelter/adapters/fs:read-file "/tmp/hello.txt")) ((Err e) (Err e)))))' > hello-fs.coal ./smt run hello-fs.coal ``` -------------------------------- ### Install Smelter Script Source: https://github.com/abacusnoir/smelter/blob/master/responses/session-state-v0.1.7.md Command to install Smelter using curl to download and pipe the install script to bash. This script installs Smelter to `~/.local/bin` by default, avoiding the need for sudo. ```bash curl -fsSL https://github.com/abacusnoir/smelter/releases/latest/download/install.sh | bash ``` -------------------------------- ### Coalton Fibonacci Example with Clean Syntax Source: https://github.com/abacusnoir/smelter/blob/master/responses/readme-refresh.md Demonstrates the 'fibonacci' example in Coalton using the clean syntax with `define main`. This replaces older syntax styles and complex list operations with simpler, tail-recursive implementations. ```coalton define main: Int -> Int def fibonacci (n : Int) -> Int if n <= 1 then n else fibonacci (n - 1) + fibonacci (n - 2) def fib-fast (n : Int) -> Int let go (a : Int) (b : Int) (count : Int) -> Int if count = 0 then a else go b (a + b) (count - 1) go 0 1 n main = fib-fast 10 ``` -------------------------------- ### Coalton Pure Hello Example with Fixed Show Function Source: https://github.com/abacusnoir/smelter/blob/master/responses/readme-refresh.md Illustrates the 'pure-hello' example in Coalton, fixing the `show` function calls to use the specific `smelter.stdlib.io:show-int` for correct integer display. This ensures the script runs as intended. ```coalton define main: Unit -> Unit def main () -> Unit io-println "Hello, " io-println (smelter.stdlib.io:show-int 123) ``` -------------------------------- ### Smelt Command Line Execution Source: https://github.com/abacusnoir/smelter/blob/master/blogposts/blogpost-functions-draft.md Shows how to execute a Smelt script from the command line. This example demonstrates running the `composition.smt` file and displays the expected output, illustrating the results of the function composition. ```bash $ smelter run composition.smt === Direct transformation === 144 === Step by step === Start with: 5 After add-one: 6 After double: 12 After square: 144 ``` -------------------------------- ### Build Smelter from Source using Make Source: https://context7.com/abacusnoir/smelter/llms.txt Provides build commands for installing Smelter from source using Make. It covers cloning the repository, installing dependencies, building the binary, running tests, and installation. ```bash # Clone repository git clone https://github.com/abacusnoir/smelter.git cd smelter # Install dependencies (Quicklisp and Coalton) make deps # Build the binary make build # Run comprehensive tests (112+ test cases) make test-all # Install to /usr/local/bin make install # Quick development cycle make dev # Create release archive make release ``` -------------------------------- ### Coalton Working Example Source: https://github.com/abacusnoir/smelter/blob/master/responses/session-state-v0.1.7.md A simple Coalton script demonstrating the use of `println` and `show` functions, which are now supported due to the clean syntax implementation. This example shows basic arithmetic and output. ```coalton #!/usr/bin/env smt run (declare add (Integer -> Integer -> Integer)) (define (add x y) (+ x y)) (define main (println (show (add 2 3)))) ``` -------------------------------- ### Smelter Rosetta Example (Type Inference) Source: https://github.com/abacusnoir/smelter/blob/master/examples/showcase/README.md Presents Smelter's ML-style type inference, offering both type safety and developer productivity. This example addresses the common challenge of choosing between these two aspects in programming. ```bash ./smt run examples/showcase/rosetta.coal ``` -------------------------------- ### Smelter Launch Examples: Fibonacci, Factorial, FizzBuzz, Hello-Advanced Source: https://github.com/abacusnoir/smelter/blob/master/responses/launch-readiness-complete.md Four new working examples (`fibonacci.coal`, `factorial.coal`, `fizzbuzz.coal`, `hello-advanced.coal`) have been created in the `examples/launch/` directory. These demonstrate recursion, arithmetic, pattern matching, string operations, and function composition, showcasing Smelter's capabilities. ```coal # fibonacci.coal # Demonstrates recursion and numeric output def fib(n: Integer) -> Integer: if n <= 1: n else: fib(n - 1) + fib(n - 2) println("Fibonacci sequence:") let result = fib(10) println(result) println("fib(10) = " + show-int(result)) ``` ```coal # factorial.coal # Type-safe factorial function demonstrating arithmetic def factorial(n: Integer) -> Integer: if n == 0: 1 else: n * factorial(n - 1) println("Factorial demonstration:") let fact5 = factorial(5) println("5! = " + show-int(fact5)) let fact10 = factorial(10) println("10! = " + show-int(fact10)) ``` ```coal # fizzbuzz.coal # Classic programming challenge using pattern matching and nested ifs for i in range(1, 101): match (i % 3, i % 5): (0, 0) -> println("FizzBuzz") (0, _) -> println("Fizz") (_, 0) -> println("Buzz") _ -> println(show-int(i)) ``` ```coal # hello-advanced.coal # Demonstrates string operations and function composition def greet(name: String) -> String: "Hello, " + name + "!" def emphasize(message: String) -> String: message + " 😊" def compose(f, g): fn(x) => f(g(x)) let welcome_message = compose(emphasize, greet)("Smelter User") println(welcome_message) ``` -------------------------------- ### Basic Functionality Verification with Smelter CLI Source: https://github.com/abacusnoir/smelter/blob/master/responses/build-time-bootstrapping-final-implementation.md Demonstrates the verification of basic arithmetic and ADT constructor functionality using the Smelter command-line interface (`./smt eval`). This confirms that the core evaluation and construction mechanisms are operational after the build process. ```bash ./smt eval '(+ 1 2)' ./smt eval '(Ok 1)' ``` -------------------------------- ### Smelter CLI Setup - Lisp Source: https://github.com/abacusnoir/smelter/blob/master/responses/comprehensive-cleanup-complete.md Contains the core logic for the Smelter command-line interface. It simplifies environment setup by performing basic verification of the Coalton runtime. This replaces extensive error messaging and runtime verification calls previously present. ```lisp ;; src/cli.lisp (in-package #:coalton-user) (defun setup-coalton-environment () ;; Simplified verification: Check if Coalton is loaded and functional. ;; Previously included extensive checks and error messages. (when (find-package :coalton) ;; Basic check (format t "Coalton environment set up successfully.~%"))) (defun main () (setup-coalton-environment) (let ((args (cdr sb-ext:*posix-argv*))) (if (equal args "eval") (progn (format t "Enter Lisp expression to evaluate: ") (finish-output) (let ((input (read-line))) (format t "Result: ~a~%" (eval (read-from-string input))))) (format t "Smelter CLI v0.1.0~%Coalton v0.8.0~%SBCL v2.5.5~%")))) ;; Ensure main is called when the script is executed (main) ```