惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
小众软件
小众软件
S
SegmentFault 最新的问题
人人都是产品经理
人人都是产品经理
博客园 - 【当耐特】
博客园 - 三生石上(FineUI控件)
C
Check Point Blog
S
Schneier on Security
Microsoft Azure Blog
Microsoft Azure Blog
N
Netflix TechBlog - Medium
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
罗磊的独立博客
有赞技术团队
有赞技术团队
V
V2EX
Y
Y Combinator Blog
博客园 - 叶小钗
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
F
Fortinet All Blogs
W
WeLiveSecurity
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Stack Overflow Blog
Stack Overflow Blog
The Cloudflare Blog
S
Security @ Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog
MyScale Blog
MyScale Blog
Hugging Face - Blog
Hugging Face - Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
www.infosecurity-magazine.com
www.infosecurity-magazine.com
PCI Perspectives
PCI Perspectives
H
Heimdal Security Blog
Schneier on Security
Schneier on Security
Security Latest
Security Latest
AWS News Blog
AWS News Blog
月光博客
月光博客
Security Archives - TechRepublic
Security Archives - TechRepublic
Recent Announcements
Recent Announcements
Google DeepMind News
Google DeepMind News
博客园 - Franky
Cisco Talos Blog
Cisco Talos Blog
T
Threat Research - Cisco Blogs
M
MIT News - Artificial intelligence
T
Troy Hunt's Blog
N
News and Events Feed by Topic
Cloudbric
Cloudbric
Scott Helme
Scott Helme
云风的 BLOG
云风的 BLOG
Attack and Defense Labs
Attack and Defense Labs

Hacker News

Introducing Claude Opus 4.7 Qwen Studio The Future of Everything is Lies, I Guess: Where Do We Go From Here? GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis Moving a large-scale metrics pipeline from StatsD to OpenTelemetry / Prometheus GitHub - Nightmare-Eclipse/RedSun: The Red Sun vulnerability repository GitHub - SethPyle376/hiraeth: Local AWS emulator focused on fast integration testing, with SQS support, SQLite-backed state, and a debug-friendly web UI. GitHub - macOS26/Agent: Any AI, replaces Claude Code, Cursor, OpenClaw. Over 18 LLM providers (Claude, OpenAI, Gemini, Ollama, Zai, HF, Qwen) wired into a native Mac app that writes code, builds Xcode projects, bumps versions, manages git, automates Safari, use AppleScript, JS or Accessibility, extend Agent! w/ MCP Servers, run tasks from your iPhone via Messages. YouTube now lets you turn off Shorts I Made a Terminal Pager Burgers | マクドナルド公式 Commands — HackerNews CLI documentation ChatGPT for Excel PiCore - Raspberry Pi Port of Tiny Core Linux Live Nation illegally monopolized ticketing market, jury finds Google Broke Its Promise to Me. Now ICE Has My Data. Founding Engineer at Adaptional | Y Combinator CRISPR takes important step toward silencing Down syndrome’s extra chromosome GitHub - saffron-health/libretto: The AI toolkit for building reliable browser automations US v. Heppner (S.D.N.Y. 2026) no attorney-client privilege for AI chats [pdf] Unexpected €54k billing spike in 13 hours: Firebase browser key without API restrictions used for Gemini requests Retrofitting JIT Compilers into C Interpreters IPv6 – Google The Accursèd Alphabetical Clock Cybersecurity Looks Like Proof of Work Now Fragments: April 14 Cal.com Goes Closed Source: Why AI Security Is Forcing Our Decision | Cal.com - Scheduling Software for Online Bookings Laravel raised money and now injects ads directly into your agent When moving fast, talking is the first thing to break Too much Discussion of the XOR swap trick – Heather Cafe Introduction to Spherical Harmonics for Graphics Programmers The Grand Line Building a Z-Machine in the worst possible language High-Level Rust: Getting 80% of the Benefits with 20% of the Pain GitHub - duguyue100/midnight-captain: Inspired by Midnight Commander, tailored to my taste. How to build a `git diff` driver · Jamie Tanna | Software Engineer Center for Responsible, Decentralized Intelligence at Berkeley The Local Universe’s Expansion Rate Is Clearer Than Ever, but Still Doesn’t Add Up - A new synthesis of astronomical measurements confirms a persistent mismatch that could point to physics beyond current models The air throughout our homes is infused with microplastics. But there are things you can do to breathe less of them The disturbing white paper Red Hat is trying to erase from the internet – OSnews The Future of Everything is Lies, I Guess: Annoyances ‘Abhorrent’: the inside story of the Polymarket gamblers betting millions on war Productive procrastination — Max van IJsselmuiden maps, territory and LMs 447 Terabytes per Square Centimetre at Zero Retention Energy: Non-Volatile Memory at the Atomic Scale on Fluorographane Show HN: Pardonned.com – A searchable database of US Pardons 20 Years on AWS and Never Not My Job The Seasons are Wrong Artemis II crew splashes down near San Diego after historic moon mission We gave an AI a 3 year retail lease in SF and asked it to make a profit | Andon Labs How a dancer with ALS used brainwaves to perform live On filing the corners off my MacBooks Installing every* Firefox extension OpenClaw’s memory is unreliable, and you don’t know when it will break Steve Blank Nowhere Is Safe Chimpanzees in Uganda locked in vicious 'civil war', say researchers watgo - a WebAssembly Toolkit for Go linux/Documentation/process/coding-assistants.rst at master · torvalds/linux GitHub - callumlocke/json-formatter: Makes JSON easy to read. Founding Product Engineer at Bild AI | Y Combinator A compelling title that is cryptic enough to get you to take action on it GitHub - Keychron/Keychron-Keyboards-Hardware-Design: Industrial design files for Keychron keyboards and mice. 100+ models with CAD assets in STEP, DXF, DWG, and PDF. Source-available, with commercial use allowed for original compatible accessories within the license terms. [ANNOUNCE] WireGuardNT v0.11 and WireGuard for Windows v0.6 Released 1D-Chess Helium Is Hard to Replace Cooperative Vectors Introduction | Evolve Keeping a Postgres queue healthy — PlanetScale Our response to the Axios developer tool compromise Do Americans read print books, e-books or audiobooks more? The Zettelkasten Method in Obsidian: A Practical Setup Guide Artemis II Is Competency Porn and We Are Starving For It WeakC4 Flight Viz — Cockpit View A Mexican surveillance giant you’ve never heard of is now watching the U.S. border Surelock: Deadlock-Free Mutexes for Rust RISC-V 101 – what is it and what does it mean for Canonical? | Ubuntu The Problem That Built an Industry How Much Linear Memory Access Is Enough? | Solidean Investigating Split Locks on x86-64 Simplest hash functions Sybilproof reputation mechanisms (2005) [pdf] What is a property? How Complex is my Code? Static code analysis in Kotlin — tools overview Toffoli gates are all you need PGLite evangelism dcmake: a new CMake debugger UI Clojure on Fennel part one: Persistent Data Structures Fragments: April 2 Python Release Python install manager 26.1 The Life and Death of the Book Review - Liberties Introducing Database Traffic Control — PlanetScale Bitcoin miners are losing $19,000 on every BTC produced as difficulty drops 7.8% God sleeps in the minerals Building slogbox Apple Silicon and Virtual Machines: Beating the 2 VM Limit Who was “Not Even Wrong” first? Pokemon Evolution Vs Darwinian Evolution The APL Programming Language Source Code
GitHub - glojurelang/glojure: Clojure interpreter hosted on Go, with extensible interop support.
dnlo · 2026-06-18 · via Hacker News

example workflow

Try it in your browser!

Gopher image

Gopher image derived from @egonelbre, licensed under Creative Commons 1.0 Attributions license.

Glojure is an interpreter for Clojure, hosted on Go. Glojure provides easy access to Go libraries, similar to how Clojure provides easy access to Java frameworks.

Glojure is in early development; expect bugs, missing features, and limited performance. Backwards compatibility is not guaranteed until a v1 release. That said, it is used successfully in hobby projects and runs a significant subset of the (transformed) core Clojure library.

Note that unlike most other Go implementations of Clojure, Glojure is a "hosted" language - a term used to describe languages that are implemented in terms of a host language (in this case, Go). This means that all Go values can be used as Glojure values and vice versa.

Prerequisites

Before you get started with Glojure, make sure you have installed and have knowledge of Go (version 1.19 or higher).

Installation

Glojure is currently available from source for all platforms where Go can run, and it requires at least go 1.24.

Install it with the go install command:

$ go install github.com/glojurelang/glojure/cmd/glj@latest

After installation, you can start the REPL (Read-Eval-Print-Loop) with the glj command:

$ glj
user=> (println "Hello, world!")
Hello, world!
nil
user=>

Usage

Glojure can be used in two ways: as a standalone command-line tool (glj) or embedded within Go applications.

Using the glj Command

The glj command provides a traditional Clojure development experience:

Show the help:

Show the version:

$ glj --version
glojure v0.3.0

Start a REPL (interactive session):

user=> *glojure-version*
{:major 0, :minor 3, :incremental 0, :qualifier nil}
$ glj
user=> (+ 1 2 3)
6
user=> (println "Hello from Glojure!")
Hello from Glojure!
nil

REPL Features

The interactive REPL includes:

  • Vi and emacs editing modes -- vi is the default; configure via ~/.inputrc
  • Multiline editing -- incomplete expressions continue on the next line with auto-indent
  • Tab completion -- symbols, namespaces, and aliases with descriptive labels
  • Smart indentation -- Tab inserts 2 spaces; Backspace removes a full indent level
  • Persistent history -- saved to ~/.glj_history across sessions
  • Bracketed paste -- paste blocks of code instantly
  • Job control -- Ctrl+Z suspends, fg resumes cleanly
  • Interrupt -- Ctrl+C cancels input or interrupts evaluation

Evaluate expressions:

$ glj -e '(println "Hello, World!")'
Hello, World!
$ glj -e '(apply + (range 3 10))'
42
$ glj -e '
(defn factorial [n] (if (<= n 1) 1 (* n (factorial (dec n)))))
(factorial 5)'
120

Run a Clojure script:

;; hello.glj
(println "Hello," (first *command-line-args*))
$ glj hello.glj World
Hello, World

Create executable programs:

;; server.glj
(ns example.server)

(defn echo-handler
  [w r]
  (io.Copy w (.Body r))
  nil)

(net:http.Handle "/" (net:http.HandlerFunc echo-handler))
(println "Server starting on :8080...")
(net:http.ListenAndServe ":8080" nil)
$ glj server.glj
Server starting on :8080...

Embedding Glojure in Go Applications

You can also embed Glojure as a scripting language within your Go applications. This is useful when you want to:

  • Add scriptable configuration to your Go application
  • Allow users to extend your application with Clojure plugins
  • Mix Go's performance with Clojure's expressiveness
  • Control the execution environment (custom I/O, sandboxing)

Basic embedding example:

package main

import (
    "fmt"
    _ "github.com/glojurelang/glojure/pkg/glj"  // Initialize Glojure
    "github.com/glojurelang/glojure/pkg/runtime"
)

func main() {
    // Evaluate Clojure code
    result := runtime.ReadEval(`
        (defn factorial [n]
          (if (<= n 1)
            1
            (* n (factorial (dec n)))))
        (factorial 5)
    `)
    fmt.Printf("5! = %v\n", result) // 5! = 120
}

Calling Go from Clojure and vice versa:

package main

import (
    "fmt"
    "github.com/glojurelang/glojure/pkg/glj"
    "github.com/glojurelang/glojure/pkg/runtime"
)

// Define a Go function
func greet(name string) string {
    return fmt.Sprintf("Hello, %s from Go!", name)
}

func main() {
    // Make the Go function available to Clojure
    runtime.ReadEval(`(def greet-from-go nil)`) // placeholder
    greetVar := glj.Var("user", "greet-from-go")
    greetVar.SetRoot(greet)

    // Use it from Clojure
    result := runtime.ReadEval(`(greet-from-go "Clojure")`)
    fmt.Println(result) // "Hello, Clojure from Go!"

    // Call a Clojure function from Go
    runtime.ReadEval(`(defn add [x y] (+ x y))`)
    addFn := glj.Var("user", "add")
    sum := addFn.Invoke(10, 32)
    fmt.Printf("Sum: %v\n", sum) // Sum: 42
}

Accessing your own Go packages:

When embedding Glojure, you can also expose your own Go packages or additional standard library packages using the package map approach described in the Accessing additional Go packages section below. This allows embedded Clojure code to access any Go packages you choose to expose:

import (
    _ "github.com/glojurelang/glojure/pkg/glj"
    _ "your.app/gljimports" // Your generated package map
)

// Now Clojure code can access your exposed packages
runtime.ReadEval(`
    (your$package.YourFunction "arg")
    (another$package.Method)
`)

When to Use Each Approach

Use glj command for:

  • Writing standalone Clojure programs
  • Interactive development with the REPL
  • Running Clojure scripts
  • Evaluating expressions directly from the command line
  • Learning Clojure with Go interop

Embed Glojure for:

  • Adding scripting to an existing Go application
  • Building a platform that users extend with Clojure
  • Custom control over the Glojure execution environment
  • Mixing Go and Clojure in a single binary

Interop

Glojure ships with interop with many standard library packages out-of-the-box. Go package names are munged to avoid ambiguity with the use of / to refer to namespaced symbols; instances of / in package names are replaced with :. Here's a simple example:

user=> (println (fmt.Sprintf "A couple of HTTP methods: %v" [net:http.MethodGet net:http.MethodPost]))
A couple of HTTP methods: ["GET" "POST"]
nil

The following standard library packages are included by default:

  • bytes
  • context
  • errors
  • flag
  • fmt
  • io
  • io/fs
  • io/ioutil
  • math
  • math/big
  • math/rand
  • net/http
  • os
  • os/exec
  • os/signal
  • regexp
  • reflect
  • sort
  • strconv
  • strings
  • sync
  • sync/atomic
  • time
  • unicode

To expose additional packages, you must generate a "package map" and compile your own executable that imports both your package map and the Glojure API. See the section below for more details.

Expect improvements to both the availability of standard library packages and interop workflows.

Accessing additional Go packages

The gen-import-interop can be used to emit the contents of a .go file that will export a function that can be used to add the exports of additional packages to the Glojure package map.

$ go run github.com/glojurelang/glojure/cmd/gen-import-interop \
     -packages=:comma-separated-package-list: \
     > your/package/gljimports/my_package_map.go

Then, in your own program:

package main

import (
	// Add your packages' exports to the pkgmap.
	_ "your.package/gljimports"
)

// ...

Differences from Clojure

Numbers

Clojure Type Glojure Type Notes
long int64
double float64
float float32
byte byte Note that Go bytes are unsigned, whereas JVM bytes are signed.
short int16
int int Note that JVM ints are 32-bit, whereas Go ints are 32- or 64-bit depending on the platform.
char lang.Char The Glojure type is a tagged rune (type Char rune). JVM chars are 16-bit whereas Go runes are 32-bit.
BigInt *lang.BigInt The Glojure type wraps *big.Int.
BigDecimal *lang.BigDecimal The Glojure type wraps *big.Float.
Ratio *lang.Ratio The Glojure type wraps *big.Rat.
BigInteger *big.Int Native JVM BigInteger corresponds to *big.Int.

Comparisons to other Go ports of Clojure

Aspect Glojure Joker let-go
Hosted1 Yes No No
Extensible Go interop Yes No No
Concurrency Yes Yes (with GIL) Yes
Clojure tooling (e.g. linter) No Yes No
Execution Tree-walk interpreter Tree-walk interpreter Bytecode Interpreter

If you'd like to see another port in this table, or if you believe there is an error in it, please file an issue or open a pull request!

  1. What does it mean to be a hosted language? For Clojure on the JVM, it means that all Java values are also Clojure values, and vice versa. Glojure strives to maintain the same relationship with Go. ↩