Skip to content

Instantly share code, notes, and snippets.

Here is some information about Claude and Anthropic’s products in case the person asks:
This iteration of Claude is part of the Claude 4 model family. The Claude 4 family currently consists of Claude Opus 4.1, 4 and Claude Sonnet 4. Claude Sonnet 4 is a smart, efficient model for everyday use. Claude Opus 4.1 is a powerful, large model for complex challenges. Claude Opus 4.5 is the smartest model and the best model in the world for coding, agents, and computer use.
If the person asks, Claude can tell them about the following products which allow them to access Claude. Claude is accessible via this web-based, mobile, or desktop chat interface.
Claude is accessible via an API and developer platform. The person can access Claude by using the API with the model string “claude-opus-4-20250514” for Claude Opus 4, or “claude-sonnet-4-5” for Claude Sonnet 4.5. Claude is accessible via Claude Code, a command line tool for agentic coding. Claude Code lets developers delegate coding tasks to Claude directly from their t
@happyfellow-one
happyfellow-one / rpn.lean
Last active October 11, 2026 18:44
RPN calculator in Lean
import Mathlib
inductive Operation | add | sub | mul | div
deriving DecidableEq
def Operation.parse (input : String) : Option Operation :=
match input with
| "+" => .some .add | "-" => .some .sub
| "*" => .some .mul | "/" => .some .div
| _ => .none
@happyfellow-one
happyfellow-one / rpn.lean
Created November 21, 2025 10:13
RPN challenge
def calc_rpn (program : List String) (stack : List Int) : List Int :=
match program, stack with
| "+" :: rest, op1 :: op2 :: stack => calc_rpn rest ((op2 + op1) :: stack)
| "-" :: rest, op1 :: op2 :: stack => calc_rpn rest ((op2 - op1) :: stack)
| "*" :: rest, op1 :: op2 :: stack => calc_rpn rest ((op2 * op1) :: stack)
| "/" :: rest, op1 :: op2 :: stack => calc_rpn rest ((op2 / op1) :: stack)
| another :: rest, stack => calc_rpn rest (another.toNat! :: stack)
| [], stack => stack
def rpn (program : String) : Option Int :=
open Core
(* First version: the type of diffs is a function from an enumeration
of all record fields to a potential difference. It's a GADT type,
which allows us to return correclty typed results.
All thanks to ppx_typed_fields! *)
type order = {
id: int;
@happyfellow-one
happyfellow-one / diffs.ml
Created February 1, 2025 12:49
Record diffs
type order = {
id: int;
name: string;
price: int;
is_quote: bool;
items: string list;
}
type 'a diff = Same | Different of { left: 'a; right: 'a }
open Core
type ('result, 'input, 'output) gen =
| Done of 'result
| Input of ('input -> ('result, 'input, 'output) gen)
| Output of ('output * ('result, 'input, 'output) gen)
let rec gen_bind x f =
match x with
| Done x -> f x