⚡ It's alive!

 _____                _    _
     |  ___| __ __ _ _ __ | | _(_) ___
     | |_ | '__/ _` | '_ \| |/ / |/ _ \
     |  _|| | | (_| | | | |   <| |  __/
     |_|  |_|  \__,_|_| |_|_|\_\_|\___| 

The Frankie Language

A procedural programming language lovingly stitched together from Ruby, Python, R, and Fortran. Zero dependencies. Proudly monstrous.

Ruby syntax Python semantics R statistics Fortran power
Get Started → ▶ Try it in your browser Download v1.22.3 Go to the Docs ★ Star on GitHub

▼ scroll

What it can do

Everything you need.
Nothing you don't.

Proudly procedural — functions, data, loops, logic. No classes, no self, no inheritance. Runs on Python 3.10+ with zero external dependencies.

🧊

Language Freeze v1.22

v1.22.0 was the last feature release for a while — Blag is writing The Book of Frankie against this exact version. Bug fixes and doc corrections continue; new syntax and stdlib features are on hold.

🔁

Labeled Loops v1.22

loop :outer do … loop do … break :outer end end — break :name / next :name escape or continue a specific loop from anywhere nested inside it. Works on loop, while, until, and for.

🧮

Math Intrinsics v1.22

FORTRAN's classic built-ins, batteries included: sin, cos, atan2, exp, log(x, base), factorial, gcd, lcm, plus PI and E constants.

➕

Complex Numbers v1.22

complex_new(3, 4) prints as 3+4i and runs on Python's native complex type underneath — +, -, *, /, ** all work for free. Plus complex_abs / complex_conj.

🔢

Matrix Math v1.22

A matrix is just a vector of vectors — +, -, /, %, ** now recurse through nested vectors at any depth. Plus matrix_identity, matrix_transpose, matrix_scale, and a real row·column matrix_multiply.

📦

file_read_base64 v1.21

Binary-safe file reads, Base64-encoded — file_read is text-mode and would corrupt real image/audio/zip bytes. What load_image uses internally.

🔊

synth_play — WebAudio Synth v1.21

synth_play(g, freq:, wave:, dur:, gain:) — a real oscillator tone in every connected browser on frankiecanvas, the terminal bell here. game_beep is now a thin wrapper over it.

🖼️

Image Sprites v1.21

load_image(path) + draw_image(g, x, y, image, w:, h:) — real decoded PNG/JPEG/GIF sprites on frankiecanvas, a ▒ placeholder block on frankiegame (a terminal can't show real pixels).

🎮

frankiegame Engine v1.20

A terminal game engine: fixed-timestep loop, raw arrow keys, double-buffered ANSI rendering, sprites, collision. Snake in ~80 lines — and your test suite can play it headless.

🕹️

frankiecanvas Engine v1.20

The SAME game API on an HTML5 canvas — served by Frankie's web server, streamed over WebSockets. Every browser tab is a player: multiplayer Pong costs zero extra code.

🔬

Type Annotations v1.19

def area(r: Float) -> Float — optional, zero runtime cost, checked by frankiec check and live in your editor. Un-annotated code is untouched.

👣

Stepping Debugger v1.19

frankiec run --debug breaks at line one; (fkdb) now steps with s/n, shows the stack, and evaluates any expression in the paused scope.

📊

Test Coverage v1.19

frankiec test --coverage — per-file percentages and missing lines mapped to .fk source. The LSP shows uncovered lines as hints in your editor.

🩻

Language Server v1.18

frankiec lsp — live diagnostics, completion and hover docs in VS Code, Neovim, Helix, Zed… anything that speaks LSP. Pure Python stdlib, zero dependencies.

🚢

frankiec bundle v1.18

Ship your program as ONE self-contained .py — stdlib inlined, requires/imports/stitches pre-compiled. python3 app.py runs anywhere, no Frankie needed.

🔌

WebSockets v1.18

app.websocket("/ws/:room") do |ws| … end on the built-in server plus a ws_connect client — hand-rolled RFC 6455, zero deps.

🐞

breakpoint v1.18

Pause into a scoped debug REPL: inspect vars, evaluate any Frankie expression against the paused scope, then c to resume. Skips politely in CI.

🎯

enum + benchmark v1.18

enum Status(pending, active, done) for named symbolic values. benchmark "label" do … end times a block and returns the milliseconds.

🔒

Lockfile + Project Tooling v1.18

stitch.lock pins installs by sha256 (verify / update). frankiec check . and fmt --check . sweep whole projects — CI in one line.

📦

import "x" as y v1.17

Namespaced modules: import "lib/geometry" as geo then geo.circle_area(5), geo.PI. require still merges into your scope for quick scripts.

🚨

error TypeName v1.17

User-defined error types with Ruby-style rescue: raise ValidationError, "bad email" … rescue ValidationError => e. Typed raises auto-declare.

🩺

Static Analysis v1.17

frankiec check now catches undefined variables, typo'd functions, wrong argument counts and unused locals — before the program runs. --strict for CI.

🔢

First-class Ranges v1.17

1..10 prints as 1..10, converts with .to_vec, strides with .step(3), and matches membership in case/when 90..100.

⚡

parallel_map + TCP Sockets v1.17

Thread-pool map for I/O-bound work: parallel_map(urls, workers: 8) do |u| http_get(u) end. Plus tcp_connect / tcp_listen / tcp_serve — zero deps.

🧪

Test Groups + Stubs v1.17

test "name", tags: ["slow"] do … end with frankiec test --filter / --tag. stub("http_get", ->(u) { fake }) for side-effect-free tests. Plus frankiec stitch install.

🐚

shell() + dotenv() v1.16

shell("git log") returns {stdout, stderr, exit_code, ok}. dotenv() loads .env files into the environment — zero deps, pure Python stdlib.

🔁

loop do...end + ||= v1.16

Infinite loops that exit only via break — cleaner than while true. Nil-coalescing assign config ||= load_defaults() — Ruby-compatible.

🔄

transform_values + transform_keys v1.16

Map over hash values or keys with a block. prices.transform_values do |v| v * 2 end. Essential for data transformation pipelines.

🔍

String#scan + Hash#deep_merge v1.16

Extract all regex matches as an array: "alice@x.com bob@y.org".scan(/[\w.]+@[\w.]+/). Recursively merge nested configs with deep_merge.

📧

frankiemail — SMTP Email v1.16

send_mail(to:, subject:, body:, smtp:, user:, pass:) — send plain-text or HTML email via any SMTP provider. Zero dependencies, uses Python's smtplib.

🖥️

frankiecli + frankiecache v1.16

Structured CLI parsing: cli_parse(argv()) returns args, flags, options, subcommand. In-memory TTL cache: cache_set("key", val, ttl: 300) / cache_get("key"). Both zero deps.

❓

Ternary Operator v1.15

score >= 90 ? "A" : "B" — right-associative, works in any expression: assignments, interpolation, arguments. No more single-expression if/end blocks.

🎯

Keyword Default Params v1.15

def connect(host, port: 5432, ssl: true) — Ruby-style name: default syntax in def. Mixed positional and keyword defaults in the same signature.

💥

Splat Multi-Assign v1.15

a, b, *rest = [1,2,3,4,5] and first, *mid, last = vec — capture remaining elements anywhere in a destructuring assignment.

🔒

const + fn.(args) v1.15

Explicit const PI = 3.14 constant keyword. Lambda call fn.(args) now works everywhere — store, pass, and call lambdas freely.

🔑

frankieauth + frankieratelimit v1.15

HTTP Basic Auth and HMAC Bearer tokens via frankieauth stitch. In-memory sliding-window rate limiting via frankieratelimit. Zero dependencies.

🛠️

frankiec check + frankiec new v1.15

Lint without running — CI-ready frankiec check file.fk exits 1 on errors. Full project scaffold with frankiec new myapp — runs and tests pass out of the box.

🌐

Async Routes + Middleware Stack v1.14

app.get_async for non-blocking handlers. app.use do |req, next_fn| for chainable auth, logging, and rate-limiting. Real web apps, real patterns.

⚡

spawn { } + timeout(n) { } v1.14

Fire-and-forget background blocks. Kill slow operations before they hang your server. Zero threading boilerplate, zero dependencies.

🎨

frankietemplate — Mustache Templates v1.14

Mustache-compatible engine as a stitch. {{ var }}, sections, partials, inverted blocks. render_file("./views/index.html", data). Zero dependencies, pure .fk.

🍪

frankiecookie + Static Files v1.14

HMAC-signed cookies via Python's hmac stdlib — tamper-proof, zero deps. app.static("./public") serves a directory in one line.

🗂️

Hash Destructuring + Shape Matching v1.14

{name, age} = user pulls keys into variables. case user when {role: "admin"} matches on hash shape. Data manipulation finally feels natural.

🧵

frankiestring v2 + Vector block fixes v1.13.1

Rewritten string stitch with pad_left, pad_right, truncate, slugify, word_wrap, indent_lines. Plus .sum do, .flat_map do multi-line blocks now work correctly.

🧪

assert_approx_eq + run_tests() v1.13.1

Float comparison in tests with configurable delta (default 0.001). run_tests() is now a public stdlib function — callable from any .fk file, not just frankiec test.

🍪

Web Session Helper + fmt Idempotency v1.13.1

Cookie-backed session(req, resp) — read, mutate, .save(). Zero server state. frankiec fmt now preserves blank lines, expands long hashes, and is safe for pre-commit hooks.

🧵

stitch "name" — Package System v1.13

Zero-dependency, zero-registry packages. Drop a .fk file in ./stitches/ and stitch it in. Resolves locally then ~/.frankie/stitches/. No lockfile, no network.

❓

def even?(n) — Predicate Names v1.13

? in user-defined function names now works. Write valid?, palindrome? just like Ruby. Compiled transparently to _q in generated Python.

🔄

.gsub block + .map_hash + round() v1.12

Transform each regex match with a block. Map a hash to a new hash in one step. Round to N decimal places. Three long-overdue stdlib additions.

🛠️

frankiec watch + friendlier errors v1.12

Re-run on save. repl --no-banner for scripts. rescue FileNotFoundError now works. Type errors speak Frankie, not Python internals.

↩️

Implicit Return + Inline if v1.11

Last expression returned automatically. grade = if score >= 90 then "A" else "B" end. The ergonomics new users expect from day one.

✳️

String & Vector * + Heredoc v1.10

"ha" * 3 → "hahaha". Heredoc <<~TEXT with auto indent-stripping and full interpolation.

📋

Record Types v1.9

record Point(x, y) — named data objects. Every hash method and iterator works instantly.

λ

Lambdas ->(x) { } v1.8

Store and pass functions as first-class values. Default params, closures, higher-order functions.

🛡️

Nil Safety &.

x&.method returns nil instead of crashing. Chains short-circuit at the first nil.

📊

R-style Statistics

Built-in mean, stdev, median, variance. Pipe operator |> for clean data pipelines.

🌐

Built-in Web Server

Sinatra-style routing. Path params, JSON bodies, filters, custom 404 — zero external deps.

🗄️

SQLite + HTTP + JSON + CSV

All stdlib, all zero-dependency. db_open, http_get, json_read, csv_write.

🧪

frankiec test

Built-in test runner. assert_eq, assert_match, assert_raises_typed. Live ✓/✗, exits 1 on failure.

Try it now

Run Frankie in your browser.
No install required.

This is the real Frankie compiler and standard library, running inside your tab through WebAssembly. Pick an example or write your own — your code never leaves your machine.

Python loads on your first run (~7 MB, then cached)
main.fk
Input (stdin) — one line per input() call
Output

    

Runs in a sandboxed Web Worker; a program that runs longer than 20 s is stopped. Anything that needs the outside world — network, sockets, web servers, spawn threads, terminal games, files that outlive the tab — only works in a real install. Install Frankie for the full thing.

The language

Familiar. Expressive.
A little monstrous.

v1.22.fk v1.22
# Matrix math — nested vectors, real element-wise math
m1 = [[1, 2], [3, 4]]
m2 = [[5, 6], [7, 8]]
puts m1 + m2                     # [[6, 8], [10, 12]]
puts matrix_multiply(m1, m2)    # real row·column multiply
puts matrix_transpose([[1,2,3],[4,5,6]])
# Complex numbers — Python's complex type underneath
c1 = complex_new(3, 4)
puts c1 + complex_new(1, 2)     # (4+6i)
puts complex_abs(c1)             # 5.0  (3-4-5 triangle)
# Math intrinsics — FORTRAN's classic built-ins
puts sin(0), cos(0), atan2(1, 1)
puts factorial(5), gcd(12, 18), lcm(4, 6)
# Labeled loops — break/next a specific loop by name
loop :outer do
  loop do
    break :outer if condition_met?()
  end
end
# 🧊 v1.22 is the last feature release — The Book of Frankie
v1.21.fk v1.21
# Real image sprites on frankiecanvas, ▒ placeholder in frankiegame
stitch "frankiecanvas"
sprite = load_image("zombie.png")
draw_image(g, 4, 2, sprite, w: 3, h: 3)
# WebAudio synth tones — a real oscillator in every browser tab
synth_play(g, freq: 220, wave: "sawtooth", dur: 0.2, gain: 0.08)
game_beep(g)  # thin wrapper over synth_play — unchanged behavior
# Binary-safe reads — file_read is text-mode and corrupts real bytes
raw = file_read_base64("sprite.png")
puts raw.length
nil_safety.fk v1.7
# &. — nil-safe navigation operator
user    = {name: "Alice", age: 30}
missing = nil
puts user["name"]&.upcase      # ALICE
puts missing&.upcase           # nil
puts missing&.upcase&.reverse  # nil
def greet(name)
  display = name&.upcase
  if display == nil
    puts "Hello, stranger!"
  else
    puts "Hello, #{display}!"
  end
end
greet("bob")  # Hello, BOB!
greet(nil)   # Hello, stranger!
stats.fk
# R-style stats + pipe operator
data = [23, 45, 12, 67, 34, 89]
puts mean(data)    # 45.0
puts stdev(data)   # 27.9
puts median(data)  # 39.5
data |> sum |> puts  # 270
top3 = data.sort_by do |x| -x end.take(3)
puts top3  # [89, 67, 45]
# Iterators
words = ["banana", "fig", "cherry"]
long = words.select do |w| w.length > 4 end
puts long  # [banana, cherry]
[1,2,3,4,5,6].each do |n|
  next if n % 2 == 0
  break if n > 5
  puts n  # 1 3 5
end
lambdas.fk v1.8
# Lambdas — first-class functions
double = ->(x) { x * 2 }
add    = ->(a, b) { a + b }
puts double.call(7)      # 14
puts add.call(3, 4)      # 7
def apply(fn, val)
  return fn.call(val)
end
puts apply(double, 9)    # 18
# Hash merge | and group_by
cfg = {color: "blue"} | {color: "red", size: "md"}
puts cfg["color"]        # red
nums = [1,2,3,4,5,6]
by_p = nums.group_by do |n|
  n % 2 == 0 ? "even" : "odd"
end
puts by_p["even"]        # [2, 4, 6]
[1,2,3,4].each_slice(2) do |s| puts s end
records.fk v1.9
# record — lightweight named data objects
record Point(x, y)
record Employee(name, dept, salary)
p1  = Point(3, 4)
emp = Employee("Alice", "Eng", 95000)
puts p1           # Point(x: 3, y: 4)
puts emp["dept"]   # Eng
# dig — safe nested access
cfg = {db: {host: "localhost", port: 5432}}
puts cfg.dig("db", "host")    # localhost
puts cfg.dig("db", "missing") # nil
# zip() standalone + .env auto-load
zip(["a","b"], [1,2]).each do |p|
  puts "#{p[0]}:#{p[1]}"
end
# frankiec fmt / docs / readline REPL
db = env("DB_PATH", "app.db")
puts db
v1.18.fk v1.18
# WebSockets on the built-in server
app.websocket("/ws/:room") do |ws|
  ws.send("welcome to #{ws.params["room"]}")
end
# enum + benchmark + set ops
enum Status(pending, active, done)
ms = benchmark "crunch" do
  heavy_work()
end
puts [1, 2].union([2, 3])
# pause into a debug REPL
breakpoint
# then ship it:
#   frankiec bundle app.fk -o app.py
v1.17.fk v1.17
# import — namespaced modules
import "lib/geometry" as geo
puts geo.circle_area(5)
# error — typed exceptions
error ValidationError
begin
  raise ValidationError, "bad email"
rescue ValidationError => e
  puts "Invalid: #{e}"
end
# ranges + parallel_map
puts (1..10).step(3)
pages = parallel_map(urls, workers: 8) do |u|
  http_get(u)
end
v1.16.2.fk v1.16.2
# shell() — run OS commands
r = shell("git log --oneline -3")
puts r["stdout"] if r["ok"]
# dotenv() — load .env file
dotenv()
puts env("DATABASE_URL")
# loop do...end + ||=
cache ||= {}
i = 0
loop do
  i += 1
  break if i >= 5
end
# transform_values / scan / deep_merge
doubled = {a: 1, b: 2}.transform_values do |v| v * 2 end
emails  = "hi@x.com bye@y.org".scan(/[\w.]+@[\w.]+/)
cfg     = {db: {host: "localhost"}}.deep_merge({db: {port: 5432}})
# frankiemail — SMTP email
stitch "frankiemail"
send_mail(to: "blag@example.com", subject: "Done!", body: "Script finished.")
# frankiecli — argument parsing
stitch "frankiecli"
cli  = cli_parse(argv())
name = cli_get(cli, "name", "World")
v1.15.fk v1.15
# Ternary operator
grade = score >= 90 ? "A" : score >= 70 ? "B" : "C"
# Keyword default parameters
def connect(host, port: 5432, ssl: true)
  puts "#{host}:#{port} ssl=#{ssl}"
end
# Splat multi-assign
first, *mid, last = [1, 2, 3, 4, 5]
# const keyword
const MAX = 100
# Lambda call syntax everywhere
double = ->(x) { x * 2 }
puts double.(6)
# frankieauth stitch
stitch "frankieauth"
app.use do |req, next_fn|
  if not basic_auth?(req, "admin", env("PASS"))
    halt(401, "Unauthorized")
  end
  next_fn.(req)
end
# frankiec check — CI lint
# $ frankiec check app.fk   → exit 0 or 1
# frankiec new myapp        → full scaffold
v1.14.fk v1.14
# Hash destructuring
user = {name: "Alice", role: "admin", age: 30}
{name, role} = user
puts "#{name} is a #{role}"
# Shape pattern matching
case user
when {role: "admin"}
  puts green("Admin access granted")
when {role: "moderator"}
  puts yellow("Moderator tools")
end
# Mustache templates
stitch "frankietemplate"
html = render_file("./views/index.html", {title: "Home", user: user})
# spawn — fire and forget
spawn do
  send_welcome_email(user["email"])
end
# Middleware
app.use do |req, next_fn|
  puts "→ #{req.method} #{req.path}"
  next_fn.(req)
end
v1.13.1.fk v1.13.1
# frankiestring v2 — clean string helpers
stitch "frankiestring"
puts pad_left("42", 6, "0")              # "000042"
puts slugify("Hello World!")           # "hello-world"
puts word_wrap("The quick brown fox", 12)
# .sum do — projected sum in one step
cart = [{price: 0.99, qty: 4}, {price: 2.49, qty: 2}]
total = cart.sum do |item|
  item["price"] * item["qty"]
end
puts total   # 8.94
# assert_approx_eq — float testing
assert_approx_eq(sqrt(2.0), 1.4142, 0.0001, "sqrt(2)")
run_tests()
# Cookie-backed session — no server state
s = session(req, resp)
s["count"] = (s["count"] or 0) + 1
s.save()
v1.13.fk v1.13
# stitch — drop a .fk file in ./stitches/ and load it by name
stitch "frankieforms"
stitch "frankietable"
stitch "frankiecolor"
# Form validation
rules = {email: [{rule: "required"}, {rule: "email"}]}
puts valid?({email: "alice@example.com"}, rules)  # true
# ASCII tables
rows = [{name: "Alice", score: 95}, {name: "Bob", score: 87}]
puts table(rows)
# Terminal colors
puts red("Error!")
puts green("Done!")
puts success("All tests passed")
# ? in function names — now works
def even?(n)
  n % 2 == 0
end
puts even?(4)   # true
v1.12.fk v1.12
# .gsub with block — transform each match
puts "hello world".gsub(/[aeiou]/) do |m| m.upcase end
# hEllO wOrld
# .map_hash — transform a hash into a new hash
prices = {apple: 1.20, banana: 0.50}
puts prices.map_hash do |k, v| [k, v * 2] end
# round(x, n) — finally
puts round(3.14159, 2)   # 3.14
# .product — cartesian product
puts [1,2].product([3,4])   # [[1,3],[1,4],[2,3],[2,4]]
# rescue FileNotFoundError now actually works
begin
  file_read("missing.txt")
rescue FileNotFoundError e
  puts "Caught: #{e}"
end
# frankiec watch main.fk   ← re-run on save
# frankiec repl --no-banner ← headless REPL
v1.11.fk v1.11
# Implicit return — no 'return' needed
def double(x)
  x * 2
end
puts double(7)   # 14
# Inline if expression
grade = if score >= 90 then "A" else "B" end
# String .replace() and .format(hash)
puts "hello world".replace("world", "Frankie")
puts "Hi, {name}!".format({name: "Alice"})
# .zip_with — pair-wise transform
puts [1,2,3].zip_with([10,20,30]) do |a, b|
  a + b
end   # [11, 22, 33]
# Multiple return values
def minmax(v)
  [min(v), max(v)]
end
lo, hi = minmax([3,1,4,1,5,9])
v1.10.fk v1.10
# String & vector * repetition
puts "ha" * 3           # hahaha
puts [0] * 5            # [0, 0, 0, 0, 0]
# Heredoc <<~ strips indent + interpolates
v = "1.10"
sql = <<~SQL
  SELECT * FROM users
  WHERE version = '#{v}'
SQL
puts sql
# times() standalone + map_with_index
times(3) do |i| puts "tick #{i}" end
puts ["a","b","c"].map_with_index do |v, i|
  "#{i}:#{v}"
end
# pp + encode/decode
pp({host: "localhost", port: 3000})
puts "hi".encode  # [104, 105]
tooling.fk v1.9
## Distance between two points.
## @param p1  A Point record
## @param p2  A Point record
## @return    Float distance
def distance(p1, p2)
  dx = p1["x"] - p2["x"]
  dy = p1["y"] - p2["y"]
  return sqrt(dx*dx + dy*dy)
end
# frankiec docs generates Markdown
# frankiec fmt --write myfile.fk
# frankiec fmt --check  (CI mode)
# frankiec --help / frankiec run --help
# Named rescue without variable:
begin
  x = 1 // 0
rescue ZeroDivisionError
  puts "caught"
end

Web server

Build APIs in Frankie.
No framework required.

Sinatra-inspired routing built into the language. Define routes with blocks, handle JSON, path params, filters and custom 404s — all zero external dependencies.

webapp.fk
app = web_app()
app.get("/") do |req|
  html_response("<h1>Hello from Frankie! 🧟</h1>")
end
app.get("/greet/:name") do |req|
  name = req.params["name"]
  response("Hello, #{name}!")
end
app.get("/api/status") do |req|
  json_response({status: "ok", version: "1.8"})
end
store = {notes: []}
app.post("/notes") do |req|
  data = req.json
  if data == nil
    return halt(400, "Expected JSON")
  end
  note = {id: length(store["notes"]) + 1, text: data["text"]}
  store["notes"].push(note)
  json_response(note, 201)
end
app.not_found do |req|
  halt(404, "No route for #{req.path}")
end
app.run(3000)  # 🧟 Frankie web server running on http://0.0.0.0:3000
Response helpers: response(body)   html_response(html)   json_response(data)   redirect(url)   halt(status, body)

The family resemblance

One program,
five languages.

The same program — read a list of numbers, compute stats, find outliers, print a report — written in Frankie and each of its four donor languages. Spot what Frankie borrows from each one.

Frankie
Ruby
Python
R
Fortran
stats_report.fk
# Frankie — stats report
# Syntax from Ruby · semantics from Python · stats from R · // from Fortran
data = [12, 45, 7, 83, 29, 56, 14, 91, 38, 62]
avg    = mean(data)
sd     = stdev(data)
lo, hi = min(data), max(data)
puts "── Stats Report ──────────────────"
puts "Count : #{data.length}"
puts "Mean  : #{round(avg, 2)}"
puts "Stdev : #{round(sd, 2)}"
puts "Range : #{lo} – #{hi}"
puts ""
# Outliers: more than 1 stdev from mean (Ruby-style block · R-style stdev)
outliers = data.select do |x|
  abs(x - avg) > sd
end
puts "Outliers (±1σ): #{outliers}"
puts ""
# Histogram buckets using integer division (Fortran heritage: //)
buckets = data.each_with_object({}) do |x, h|
  key = ((x // 20) * 20).to_s + "s"
  cur = h[key]
  h[key] = (if cur == nil then 0 else cur end) + 1
end
buckets.each do |k, v|
  puts "  #{k.rjust(4)} │ #{"█" * v} #{v}"
end
do…end blocks from Ruby · mean / stdev / abs from R · // integer division from Fortran · hash as dict from Python · #{} interpolation from Ruby · select / each_with_object from Ruby
stats_report.rb
# Ruby — stats report
data = [12, 45, 7, 83, 29, 56, 14, 91, 38, 62]
avg = data.sum.to_f / data.length
sd  = Math.sqrt(data.sum { |x| (x - avg) ** 2 } / data.length)
lo, hi = data.min, data.max
puts "── Stats Report ──────────────────"
puts "Count : #{data.length}"
puts "Mean  : #{avg.round(2)}"
puts "Stdev : #{sd.round(2)}"
puts "Range : #{lo} – #{hi}"
puts ""
# Outliers: more than 1 stdev from mean
outliers = data.select { |x| (x - avg).abs > sd }
puts "Outliers (±1σ): #{outliers}"
puts ""
# Histogram buckets
buckets = data.each_with_object(Hash.new(0)) do |x, h|
  key = "#{(x / 20) * 20}s"
  h[key] += 1
end
buckets.each do |k, v|
  puts "  #{k.rjust(4)} │ #{"█" * v} #{v}"
end
Frankie borrows from Ruby: do…end blocks · #{} interpolation · select / each_with_object · .min / .max / .sum · destructuring assignment · puts
stats_report.py
# Python — stats report
import math
data = [12, 45, 7, 83, 29, 56, 14, 91, 38, 62]
avg = sum(data) / len(data)
sd  = math.sqrt(sum((x - avg) ** 2 for x in data) / len(data))
lo, hi = min(data), max(data)
print("── Stats Report ──────────────────")
print(f"Count : {len(data)}")
print(f"Mean  : {round(avg, 2)}")
print(f"Stdev : {round(sd, 2)}")
print(f"Range : {lo} – {hi}")
print("")
# Outliers: more than 1 stdev from mean
outliers = [x for x in data if abs(x - avg) > sd]
print(f"Outliers (±1σ): {outliers}")
print("")
# Histogram buckets
buckets = {}
for x in data:
    key = f"{(x // 20) * 20}s"
    buckets[key] = buckets.get(key, 0) + 1
for k, v in buckets.items():
    print(f"  {k:>4} │ {'█' * v} {v}")
Frankie borrows from Python: clean execution model · dict as hash · list as vector · zero-dependency philosophy · round() / abs() / min() / max() · f-string → #{} interpolation
stats_report.R
# R — stats report
data <- c(12, 45, 7, 83, 29, 56, 14, 91, 38, 62)
avg <- mean(data)
sd  <- sd(data)
lo  <- min(data)
hi  <- max(data)
cat("── Stats Report ──────────────────\n")
cat(sprintf("Count : %d\n", length(data)))
cat(sprintf("Mean  : %.2f\n", avg))
cat(sprintf("Stdev : %.2f\n", sd))
cat(sprintf("Range : %d – %d\n\n", lo, hi))
# Outliers: more than 1 stdev from mean (vectorised — no loop needed)
outliers <- data[abs(data - avg) > sd]
cat("Outliers (±1σ):", outliers, "\n\n")
# Histogram buckets using integer division
keys    <- paste0((data %/% 20) * 20, "s")
buckets <- table(keys)
for (k in names(buckets)) {
  v <- buckets[[k]]
  cat(sprintf("  %4s │ %s %d\n", k, strrep("█", v), v))
}
Frankie borrows from R: mean() / stdev() / min() / max() · vectors as first-class values · seq() / linspace() · pipe operator |> · statistical mindset · abs() on collections
stats_report.f90
! Fortran 90 — stats report
program stats_report
  implicit none
  integer, parameter :: n = 10
  real    :: data(n) = [12,45,7,83,29,56,14,91,38,62]
  real    :: avg, sd, lo, hi, diff
  integer :: i, bucket, counts(5)
  avg = sum(data) / n
  sd  = sqrt(sum((data - avg)**2) / n)
  lo  = minval(data)
  hi  = maxval(data)
  print *, "── Stats Report ──────────────────"
  print '("Count : ",I0)', n
  print '("Mean  : ",F6.2)', avg
  print '("Stdev : ",F6.2)', sd
  print '("Range : ",F0.0," – ",F0.0)', lo, hi
  print *, ""
  print *, "Outliers (±1σ):"
  do i = 1, n
    diff = abs(data(i) - avg)
    if (diff > sd) print *, "  ", int(data(i))
  end do
  print *, ""
  ! Histogram buckets with integer division (//)
  counts = 0
  do i = 1, n
    bucket = (int(data(i)) / 20) + 1
    if (bucket <= 5) counts(bucket) = counts(bucket) + 1
  end do
  do i = 1, 5
    print '("  ",I2,"0s │ ",A," ",I0)', (i-1)*2, &
      repeat("█", counts(i)), counts(i)
  end do
end program stats_report
Frankie borrows from Fortran: // integer division · ** exponentiation · do…while loop structure · numeric pragmatism · sum() / sqrt() on arrays · computational heritage · matrix & complex-number math (v1.22)

Built with Frankie

Real projects,
one file each.

Complete, playable programs from the repo — each one a single .fk file you can read in one sitting, run with one command, and ship as one self-contained .py with frankiec bundle. Find them in examples/projects/.

🧟 zombie_chat/main.fk ~150 lines
# Multi-room chat: the server AND its web UI in one file.
# Open two browser tabs, pick two names, talk to yourself.
enum Event(joined, left, message, roster)
app.get("/") do |req|
  html_response(<<~HTML)   # the whole UI lives here
  ...
HTML
end
app.websocket("/ws/:room") do |ws|
  nick = ws.recv()          # first message = your name
  broadcast(members, {type: Event.joined, nick: nick})
  loop do
    text = ws.recv()
    break if text == nil
    broadcast(members, {type: Event.message, nick: nick, text: text})
  end
end
# frankiec run main.fk   →   http://localhost:4000/#graveyard
⚡ word_reanimator/main.fk multiplayer
# Multiplayer hangman — every miss stitches another part
# onto the zombie. Six misses and the word stays dead.
enum Phase(playing, reanimated, dead)
def apply_guess(game, letter)
  return game if game["guessed"].include?(letter)
  game["guessed"] = game["guessed"].union([letter])
  unless game["word"].chars.include?(letter)
    game["misses"] += 1
  end
  game
end
# shared state, broadcast to every player after each move
game["phase"] = Phase.reanimated unless masked_word(game).include?("_")
# frankiec run main.fk   →   http://localhost:4001/#morgue
# frankiec bundle main.fk -o word_reanimator.py  →  ship ONE file
💰 frankie_ledger/main.fk stitches + SQLite
# Terminal expense tracker: SQLite, stitches, R-style stats.
#   ledger add 12.50 lunch tacos al pastor
#   ledger report
stitch "frankiecli"     # pinned in stitch.lock
stitch "frankietable"
stitch "frankiecolor"
db = db_open(env("LEDGER_DB", "ledger.db"))
# bar chart = string repetition doing data viz
bar = "█" * max(1, to_int(32 * t / biggest))
puts "#{cat.ljust(12)} #{money(t).rjust(10)}  #{green(bar)}"
# R-donor stats + outliers: 3× the median raises an eyebrow
puts "mean: #{mean(a)}  median: #{median(a)}  stdev: #{stdev(a)}"
weird = rows.select do |r| r["amount"] > 3 * median(a) end
# frankiec bundle main.fk -o ledger.py  →  a real CLI tool, one file
🎮 snake · zombie_invaders · pong v1.20
# Three games, one engine API. The stitch picks the renderer.
stitch "frankiegame"      # 🐍 Snake — terminal, ~80 lines
stitch "frankiecanvas"    # 🧟 Invaders + 🏓 Pong — browser
on_key(g, "left") do |game|
  game["px"] -= 1
end
on_tick(g) do |game|
  clear(game)
  draw(game, game["px"], 10, "🧟")
end
# 🏓 pong: every browser tab is a player
on_player_key(g) do |game, player, key|
  move_paddle(game, player, key)
end
# frankiec new --game mygame  →  playable starter in one command

The donors

Stitched from four
legendary languages.

Ruby
  • do…end syntax
  • if / unless
  • String interpolation
  • begin / rescue
  • Iterators & blocks
  • Postfix conditions
Python
  • Clean semantics
  • Dict / list model
  • Execution model
  • Rich data types
  • Standard library
  • Zero-dep philosophy
R
  • Vectors
  • Pipe operator |>
  • mean / stdev / median
  • seq / linspace
  • Vectorised arithmetic
  • Statistical mindset
Fortran
  • do…while loops
  • Integer division //
  • Exponentiation **
  • Matrix & complex math
  • Math intrinsics + labeled loops
  • Computational roots

Get started

Up and running
in 30 seconds.

Requirements: Python 3.10+. That's it.

01
# Clone the repo
git clone https://github.com/atejada/Frankie && cd Frankie
02
# Install (creates bin/frankiec)
python3 install.py
export PATH="/path/to/Frankie/bin:$PATH"
03
# Run a program, launch the REPL, or run your tests
frankiec run examples/hello.fk
frankiec repl
frankiec test
VersionHighlightsStatus
v1.22.3🔧 frankiec fmt keeps comments and parentheses; stitch doc comments restored. 🌐 Browser Playground — try Frankie with nothing to install. No language changes.Latest
v1.22.2Bug fixes found while writing The Book of Frankie: app.static root-mount fall-through, keyword-shaped identifier assignment, Homebrew tagStable
v1.22.0🧊 Language freeze — The Book of Frankie. Matrix math (real element-wise arithmetic on nested vectors + matrix_multiply/transpose/scale/identity), complex numbers (complex_new, printed as 3+4i), math intrinsics (sin/cos/atan2/exp/log/factorial/gcd/lcm, PI, E), labeled loops (loop :name / break :name / next :name)Stable
v1.21.0load_image / draw_image — real PNG/JPEG/GIF sprites on frankiecanvas, ▒ placeholder on frankiegame. synth_play — real WebAudio oscillator tones, terminal bell fallback. file_read_base64 for binary-safe readsStable
v1.20.0frankiegame terminal engine, frankiecanvas browser engine (same API, multiplayer via on_player_key), terminal primitives (term_raw/term_key/term_render), frankiec new --game, showcase games: Snake, Zombie Invaders, PongStable
v1.19.0gradual type annotations, stepping debugger (run --debug, s/n/stack), test --coverage + LSP hints, wss:// + TLS tcp, UDP sockets, stitch install from URL, docs --html, showcase projects (Zombie Chat, Word Reanimator, Frankie Ledger)Stable
v1.18.0frankiec lsp (Language Server), frankiec bundle (one-file ship), WebSockets, breakpoint debug REPL, enum, benchmark, set ops, numeric underscores + 1e6, stitch.lock verify/update, check/fmt on directoriesStable
v1.17.0import "x" as y namespaces, error types + rescue =>, first-class ranges, record dot access, static analysis in check, accurate cross-file tracebacks, parallel_map, TCP sockets, test groups/--filter/--tag, stub/unstub, stitch installer, REPL => echo + helpStable
v1.16.2shell(), dotenv(), loop do...end, ||=, Hash#transform_values/keys, String#scan, Hash#deep_merge, frankiemail, frankiecli, frankiecacheStable
v1.15ternary operator, keyword default params, splat multi-assign, const keyword, fn.(args) everywhere, json_encode, base64/hmac public, String#format, path helpers, date arithmetic, frankieauth, frankieratelimit, frankiec check/newStable
v1.14spawn/timeout, async routes, middleware, static files, frankietemplate, frankiecookie, hash destructuring, shape pattern matching, scaffold stitchesStable
v1.13.1frankiestring v2, .sum do / .flat_map do fixes, assert_approx_eq, run_tests() public, session(req,resp), fmt blank lines + idempotencyStable
v1.13stitch keyword, frankieforms/frankietable/frankiecolor/frankiepager/frankieconfig/frankiestring, ? in function namesStable
v1.12gsub block, map_hash, round(), .product, .chars docs, FileNotFoundError fix, assert_match/nil, frankiec watch, repl --no-banner, friendlier errorsStable
v1.11Implicit return, inline if expression, .replace(), .format(hash), .zip_with, multi-line REPL history, boxed check errorsStable
v1.10String/vector *, heredoc <<~, times(), flatten(depth), map_with_index, pp, encode/decode, exit codes, --helpStable
v1.9Records, dig, zip(), frankiec fmt, frankiec docs, readline REPL, .env loaderOld
v1.8Lambdas ->(x) { }, hash merge |, group_by, each_slice, each_consStable
v1.7Nil safety &., string templates, file system ops, assert_raises_typedOld
v1.6Compound assign +=/-=/*= etc., typed rescue, .find/.detect, frankiec testOld
v1.5next / break, constants, randomness, sort_by, sleep, unzipOld
v1.4Built-in web server, routes, JSON API, filters, custom 404Old
v1.3JSON, CSV, DateTime, HTTP client, project scaffoldingOld
v1.2SQLite built-in, transactions, multi-file with requireOld
v1.1Rich iterators, REPL, case/when, destructuringOld
v1.0Initial release — core language, stdlib, error handlingOld