Gerbil Scheme in Action

Gerbil Scheme in Action

Mark Watson
Buy on Leanpub

Table of Contents

Gerbil Scheme in Action

  • Preface
    • New Material Added in Latest Edition
    • A Comment on Licenses
    • Running Gerbil Scheme on macOS and Linux
    • History and Background to the Gerbil Scheme Project
    • Core Gerbil Toolkits Used in this Book: :std/net/request and :std/text/json
  • Setting Up Gerbil Scheme Development Environment
    • Verifying Your Installation with Hello World
    • The Gerbil Workflow: Modules, Packages, and Build Tools
    • Editor Setup
    • Gerbil for Schemers: Quick Language Primer
  • Introduction To Writing Command Line Utilities
    • Overview of the Command Line Utilities Project Structure and Build System
    • Simple Structure for Command Line Utilities
    • A More Flexible Structure for Command Line Utilities
    • Wrap Up for Writing Command Line Utilities in Gerbil Scheme and Notes On User Built Libraries
    • Optional Practice Problems
  • Web Scraping in Gerbil Scheme
    • What We Will Build
    • Why Regular Expressions and Not a Real Parser
    • Project Structure
    • The Library: webscrape.ss
    • The Test Program: test_webscrape.ss
    • Running the Test Driver
    • Interpreting the Output
    • Design Choices and Limitations
    • Wrap Up
    • Optional Practice Problems
  • Google Gemini API
    • Example Code
    • Example Output
    • Optional Practice Problems
  • Ollama
    • Example Code
    • Install Ollama and Pull a Model to Experiment With
    • Example Output
    • Tool/Function Calling with Ollama
    • Defining Tools: example_tools.ss
    • The Agent Loop: use_tools.ss
    • Tool Calling Example Output
    • Building Your Own Tools
    • Optional Practice Problems
  • OpenAI API
    • Example Code
    • Example Output
    • Optional Practice Problems
  • Inexpensive and Fast LLM Inference Using the Groq Service
    • Structure of Project and Build Instructions
    • groq_inference.ss Utility
    • Example script: gpt-oss-120b.ss
    • Optional Practice Problems
  • Building a Personal AI Assistant CLI with Gerbil Scheme
    • The Idea: Your Own AI Terminal Companion
    • Theory: Grounding, RAG, and the Context Window
    • Project Structure
    • The Cache Module
    • The Main REPL Module
    • Building and Running
    • Sample Session
    • Interpreting the Results
    • Wrap Up
    • Optional Practice Problems
  • AI-Driven Text Adventure Game in Gerbil Scheme
    • The Architecture of an LLM Game Master
    • Defining the Adventure World (story.txt)
    • Implementing the Game Loop (game.ss)
    • The Automated Smoke Test (test.ss)
    • Running the Game and Sample Session
    • Interpreting the Results
    • Wrap Up
    • Optional Practice Problems
  • Building an Autonomous LLM Coding Harness
    • The Architecture of an Agentic Harness
    • The Delimiter Scanner (parens.ss)
    • Generating Unified Diffs and Human Approval (approval.ss)
    • The Verification Gate (checker.ss)
    • Running the Coding Harness
    • Interpreting the Results
    • Wrap Up
    • Optional Practice Problems
  • A Simple In-Memory RDF Store and Query Language in Gerbil Scheme
    • Introduction to RDF and the Goal of This Chapter
    • Data Model: Triples and the Store
    • Parsing SPARQL Queries
    • Query Evaluation: Pattern Matching and Joining
    • Gerbil RDF Implementation
    • Running the Demo and Using the Code
    • Summary and Further Directions
    • Optional Practice Problems
  • Wikidata API Using SPARQL Queries
    • Example Code
    • Example Output
    • Optional Practice Problems
  • Code for Natural Language Processing (NLP)
    • Structure of Project and Build Instructions
    • Top Level Project Code
    • Other Source Files
    • Test Run
    • Building and Running the Command Line Tool
    • Optional Practice Problems
  • Command Line Applications For NLP
    • Re-using the NLP Library For a Command Line Utility to Identify Categories or Topics in Input Text
    • Using OpenAI’s GPT-5 model To Summarize Input Text
    • Optional Practice Problems
  • AutoContext: Hybrid Retrieval-Augmented Generation (RAG)
    • Theoretical Foundations of Hybrid Retrieval
    • Input Data Representation
    • Implementing BM25 Okapi in Gerbil Scheme
    • Implementing Vector-Space TF-IDF in Gerbil Scheme
    • Orchestrating the AutoContext Pipeline
    • Test Suite and Verification
    • Running the Code and Expected Output
    • Interpreting the Results
    • Wrap Up
    • Optional Practice Problems
  • Gerbil Scheme FFI Example Using the C Language Raptor RDF Library
    • Implementation of a FFI Bridge Library for Raptor
    • Test Code
    • Build System
    • Optional Practice Problems
  • Complete FFI Example: C Language Wrapper for Rasqal SPARQL Library and Sord RDF Datastore Library
    • Library Selection
    • Overview of the Project Structure and Build System
    • Implementation of the C Language Wrapper
    • A Gerbil Scheme Shim to Call The C Language Wrapper Code
    • Gerbil Scheme Main Program for this Example
    • Example Output
    • Optional Practice Problems
  • WebKit Applications - macOS Only
    • Architecture Overview
    • Prerequisites and Building
    • Project Structure
    • The C Shim
    • Gambit FFI Bindings
    • The Bridge: JS to Scheme Communication
    • High-Level API
    • Example 1: Hello World
    • Example 2: Counter App with Bridge
    • Example 3: Markdown File Viewer
    • The Build System
    • Comparing Common Lisp and Gerbil Versions
    • API Reference Summary
    • Key Takeaways
    • Optional Practice Problems
  • Symbolic Mathematics: Polynomial Differentiation and Integration
    • Theoretical Foundations
    • The Data Layer (data.ss)
    • Symbolic Differentiation (differentiation.ss)
    • Symbolic Integration (integration.ss)
    • Complete Test Suite (test.ss)
    • Running the Code and Expected Output
    • Interpreting the Results
    • Wrap Up
    • Optional Practice Problems
  • Probability: Bayesian and Frequentist Reasoning
    • Theoretical Foundations
    • The Bayesian Engine (bayes.ss)
    • Correlation Analysis (correlation.ss)
    • The Frequentist Toolkit (frequentist.ss)
    • The Medical Screening Example (medical.ss)
    • The Frequentist Trial Simulation (frequentist-demo.ss)
    • Running the Code and Expected Output
    • Interpreting the Results
    • Wrap Up
    • Optional Practice Problems
  • Gaussian Anomaly Detection
    • Theoretical Background
    • The Dataset
    • Project Structure
    • The Detector Module: detector.ss
    • The Demo Program: wisconsin_demo.ss
    • Running the Demo
    • Interpreting the Results
    • Wrap Up
    • Optional Practice Problems
  • K-means Clustering
    • Theoretical Background
    • The Dataset
    • Project Structure
    • The K-means Library: kmeans-lib.ss
    • The Demo Program: test.ss
    • Running the Demo
    • Interpreting the Results
    • Wrap Up
    • Optional Practice Problems
  • microGPT: A Complete Transformer and Autograd Engine from Scratch
    • Theoretical Foundations
    • Input Data Sample (names.txt)
    • Complete Source Code (microgpt.ss)
    • Running the Code and Expected Output
    • Interpreting the Results
    • Wrap Up
    • Optional Practice Problems
  • Reinforcement Learning: Value Iteration and Q-Learning
    • Theoretical Background
    • Project Structure
    • Example 1: Value Iteration on a 3×3 Grid World
    • Example 2: Q-Learning on FrozenLake
    • Wrap Up
    • Optional Practice Problems
  • Building a Chess Engine and AI Bot
    • Theoretical Background
    • Project Structure
    • The Engine Module: engine.ss
    • The AI Module: ai.ss
    • The CLI Module: cli.ss
    • The Perft Module: perft.ss
    • Running the Code
    • Interpreting the Output
    • Wrap Up
    • Optional Practice Problems
Gerbil Scheme in Action/Overview

Gerbil Scheme in Action

Course overview

26 chapters
Begin reading
Download
The Book

Gerbil Scheme in Action26 chapters

Begin ›
  1. Preface

  2. Setting Up Gerbil Scheme Development Environment

  3. Introduction To Writing Command Line Utilities

  4. Web Scraping in Gerbil Scheme

  5. Google Gemini API

  6. Ollama

  7. OpenAI API

  8. Inexpensive and Fast LLM Inference Using the Groq Service

  9. Building a Personal AI Assistant CLI with Gerbil Scheme

  10. AI-Driven Text Adventure Game in Gerbil Scheme

  11. Building an Autonomous LLM Coding Harness

  12. A Simple In-Memory RDF Store and Query Language in Gerbil Scheme

  13. Wikidata API Using SPARQL Queries

  14. Code for Natural Language Processing (NLP)

  15. Command Line Applications For NLP

  16. AutoContext: Hybrid Retrieval-Augmented Generation (RAG)

  17. Gerbil Scheme FFI Example Using the C Language Raptor RDF Library

  18. Complete FFI Example: C Language Wrapper for Rasqal SPARQL Library and Sord RDF Datastore Library

  19. WebKit Applications - macOS Only

  20. Symbolic Mathematics: Polynomial Differentiation and Integration

  21. Probability: Bayesian and Frequentist Reasoning

  22. Gaussian Anomaly Detection

  23. K-means Clustering

  24. microGPT: A Complete Transformer and Autograd Engine from Scratch

  25. Reinforcement Learning: Value Iteration and Q-Learning

  26. Building a Chess Engine and AI Bot