Liking cljdoc? Tell your friends :D

meme-clj — M-expressions for Clojure

CI Clojure License

M-expressions were McCarthy's original intended syntax for Lisp (1960). S-expressions were meant to be internal representation only — but they stuck. meme picks up where McCarthy left off: one rule that makes nesting self-evident, while preserving Clojure's semantics exactly.

The rule — head outside the parens: f(x y) => (f x y)

Quote and backtick' quotes the next meme form: 'f(x) is (quote (f x)). ` uses meme syntax inside for macro templates: `if(~test do(~@body))

Everything else is Clojure.

;; examples/stars.meme — bb meme run examples/stars.meme
require('[cheshire.core :as json])

defn(stars [owner repo]
  let(
    [
      url   str("https://api.github.com/repos/" owner "/" repo)
      resp  slurp(url)
      data  json/parse-string(resp true)
      count :stargazers_count(data)
    ]

    println(str(owner "/" repo ": " count " ⭐"))))

stars("beme-lang" "meme-clj")

Installation

Add to deps.edn:

io.github.beme-lang/meme-clj {:mvn/version "0.5.0-alpha"}

Or clone and use directly:

git clone https://github.com/beme-lang/meme-clj.git
cd meme-clj

All namespaces live under meme.alpha to signal that the API is pre-1.0 and may change. When the API stabilizes, namespaces will move to meme.

Getting Started

Run a .meme file:

$ bb meme run hello.meme                                # Babashka
$ clojure -T:meme run :file '"hello.meme"'              # Clojure JVM
Hello, world!

Interactive REPL:

$ bb meme repl                                          # Babashka
user=> +(1 2)
3
user=> map(inc [1 2 3])
(2 3 4)

Convert between meme and Clojure (direction detected from extension):

$ bb meme convert hello.meme                            # .meme → Clojure
$ bb meme convert hello.clj                             # .clj → meme
$ clojure -T:meme convert :file '"hello.meme"'          # Clojure JVM

Format .meme files (normalize syntax via pprint):

$ bb meme format hello.meme                             # in-place
$ bb meme format src/                                   # directory, recursive

Requires Babashka or Clojure.

Editor Support

EditorRepositoryFeatures
Zedzed-memeSyntax highlighting, brackets, indentation, symbol outline
VS Codevscode-memeSyntax highlighting, brackets, indentation, folding

Tree-sitter grammar: tree-sitter-meme

Documentation

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close