The Janet Language

Use Cases

Janet makes a good system scripting language, or a language to embed in other programs. Janet also can be used for rapid prototyping, dynamic systems, and other domains
where dynamic languages shine. Implemented mostly in standard C99, Janet runs on Windows, Linux and macOS.
The few features that are not standard C (dynamic library loading, compiler specific optimizations),
are fairly straightforward. Janet can be easily ported to new platforms. While Janet is embeddable, it comes with a bit more out of the box than many other such easily embeddable languages
such as threading, networking, an event loop, subprocess handling, regex-like library called PEG, and more.

Features

  • Minimal setup – one binary and you are good to go!
  • Builtin support for threads, networking, and an event loop
  • First class closures
  • Garbage collection
  • First class green threads (continuations)
  • Mutable and immutable arrays (array/tuple)
  • Mutable and immutable hashtables (table/struct)
  • Mutable and immutable strings (buffer/string)
  • Macros
  • Tail call optimization
  • Direct interop with C via abstract types and C functions
  • Dynamically load C libraries
  • Lexical scoping
  • REPL and interactive debugger
  • Parsing Expression Grammars built in to the core library
  • 500+ functions and macros in the core library
  • Export your projects to standalone executables with a companion build tool, jpm
  • Add to a project with just janet.c and janet.h

Code Example

(defn sum3
  "Solve the 3SUM problem in O(n^2) time."
  [s]
  (def tab @{})
  (def solutions @{})
  (def len (length s))
  (for k 0 len
    (put tab (s k) k))
  (for i 0 len
    (for j 0 len
      (def k (get tab (- 0 (s i) (s j))))
      (when (and k (not= k i) (not= k j) (not= i j))
        (put solutions {i true j true k true} true))))
  (map keys (keys solutions)))

(let [arr @[2 4 1 3 8 7 -3 -1 12 -5 -8]]
  (printf "3sum of %j: " arr)
  (printf "%j" (sum3 arr)))

Try It

Usage

A REPL is launched when the janet binary is invoked with no arguments. Pass the -h flag
to display the usage information. Individual scripts can be run with janet myscript.janet

If you are looking to explore, you can print a list of all available macros, functions, and constants
by entering the command all-bindings into the REPL.

$ janet
Janet 1.17.0-local linux/x64 - '(doc)' for help
repl:1:> (+ 1 2 3)
6
repl:2:> (print "Hello, World!")
Hello, World!
nil
repl:3:> (os/exit)
$ janet -h
usage: janet [options] script args...
Options are:
  -h : Show this help
  -v : Print the version string
  -s : Use raw stdin instead of getline like functionality
  -e code : Execute a string of janet
  -E code arguments... : Evaluate  an expression as a short-fn with arguments
  -d : Set the debug flag in the REPL
  -r : Enter the REPL after running all scripts
  -R : Disables loading profile.janet when JANET_PROFILE is present
  -p : Keep on executing if there is a top-level error (persistent)
  -q : Hide logo (quiet)
  -k : Compile scripts but do not execute (flycheck)
  -m syspath : Set system path for loading global modules
  -c source output : Compile janet source code into an image
  -n : Disable ANSI color output in the REPL
  -l lib : Import a module before processing more arguments
  -w level : Set the lint warning level - default is "normal"
  -x level : Set the lint error level - default is "none"
  -- : Stop handling options

Modules and Libraries

See some auxiliary projects on GitHub. Here is a short list of libraries
for Janet to help you get started with some interesting stuff. See the Janet Package Listing
for a more complete list. Packages in the listing can be installed via jpm install pkg-name.

  • Circlet – An HTTP server for Janet
  • Joy Web Framework – Framework for web development in Janet
  • JSON – A JSON parser and encoder
  • SQLite3 – Bindings to SQLite
  • WebView – Spawn a browser window for creating HTML+CSS UIs on any platform
  • Jaylib – Bindings to Raylib for 2d and 3d game development
  • JHydro – Cryptography for Janet
  • JanetUI – Bindings to libui

For editor support:

Feel free to ask questions and join discussion on the Janet Gitter Channel.
Gitter provides matrix and IRC bridges as well for users who prefer those.

Other Gitter Rooms

  • help:
    For getting help with specific problems in the Janet language.
  • website:
    For discussion and help related to this website and documentation.

Forum

We use GitHub Discussions as our forum, which is more suited to long-form discussion than Gitter.

Janet Docs

For help, you can also check out Janet Docs for Janet documentation with user-provided examples. Feel free to contribute your own examples here to help fellow programmers.

Read More
Erasmo Mcnaught

Latest

The Truth About Red Light Therapy Masks, According to a Dermatologist

You don't have permission to access "http://www.medpagetoday.com/popmedicine/cultureclinic/120805" on this server. Reference #18.9751c317.1776352333.14d1e5c https://errors.edgesuite.net/18.9751c317.1776352333.14d1e5c

Do Stabilisation Admissions Support Eating Disorder Care?

TOPLINE: Among children and young individuals (aged 0-18 years) admitted for medical stabilisation of restrictive eating disorders, more than half continued their recovery through outpatient care; however, a notable proportion were medically unstable on admission, and many required nutritional support. METHODOLOGY: Researchers conducted a retrospective cohort analysis to evaluate outcomes of medical stabilisation admissions in

‘Not your parents’ cannabis:’ Legalization lights up innovation—but not clinical research

🛡️ Just a quick check We’re checking your connection to prevent automated abuse

NFL Analyst Raises Red Flags Over Arvell Reese’s Fit As Edge Rusher on PFSN’s Football Debate Club

As the 2026 NFL Draft approaches, few defensive prospects have generated as much intrigue as Ohio State’s Arvell Reese. Widely viewed as one of the most talented defenders in the class, Reese’s versatility has made him a standout on scouting boards. However, with that versatility comes an ongoing debate about how he projects at the

Newsletter

Don't miss

The Truth About Red Light Therapy Masks, According to a Dermatologist

You don't have permission to access "http://www.medpagetoday.com/popmedicine/cultureclinic/120805" on this server. Reference #18.9751c317.1776352333.14d1e5c https://errors.edgesuite.net/18.9751c317.1776352333.14d1e5c

Do Stabilisation Admissions Support Eating Disorder Care?

TOPLINE: Among children and young individuals (aged 0-18 years) admitted for medical stabilisation of restrictive eating disorders, more than half continued their recovery through outpatient care; however, a notable proportion were medically unstable on admission, and many required nutritional support. METHODOLOGY: Researchers conducted a retrospective cohort analysis to evaluate outcomes of medical stabilisation admissions in

‘Not your parents’ cannabis:’ Legalization lights up innovation—but not clinical research

🛡️ Just a quick check We’re checking your connection to prevent automated abuse

NFL Analyst Raises Red Flags Over Arvell Reese’s Fit As Edge Rusher on PFSN’s Football Debate Club

As the 2026 NFL Draft approaches, few defensive prospects have generated as much intrigue as Ohio State’s Arvell Reese. Widely viewed as one of the most talented defenders in the class, Reese’s versatility has made him a standout on scouting boards. However, with that versatility comes an ongoing debate about how he projects at the

Athena launches FabOrchestrator, an agentic AI platform for manufacturing execution systems

In short: Athena Technology Solutions, a Fremont-based MES integrator with roughly 120 employees, has launched FabOrchestrator, an agentic AI platform for manufacturing that automates reporting, support tickets, system modelling, and code generation for semiconductor and electronics factories. Built in partnership with Bangalore-based LLM at Scale.AI, it layers LLM capabilities on top of the Siemens Opcenter

SoE necessary but not sufficient, business leaders say

PE­TER CHRISTO­PHER Se­nior Mul­ti­me­dia Re­porter pe­ter.christo­pher@guardian.co.tt Heavy hand­ed but nec­es­sary giv­en the state of crime in T&T. This was a com­mon as­sess­ment from var­i­ous busi­ness groups when asked for their per­spec­tive on the lat­est de­c­la­ra­tion of a state of emer­gency in the coun­try. The T&T Cham­ber of In­dus­try and Com­merce, in a re­leased is­sued yes­ter­day

The Big Business of Carolyn Bessette-Kennedy

Can a nine-episode limited series really impact an entire season of shopping trends? Today brands are experiencing—and chasing—the “Carolyn Bessette-Kennedy effect” as a result of Ryan Murphy’s Love Story. And in many cases, it’s more pervasive than they could have prepared for. The FX series, based on the relationship between John F. Kennedy Jr. and

‘Mind Your Own Business’: Kamal Haasan Rebukes Trump Over ‘Permission’ To Buy Russian Oil

Updated 8 March 2026 at 18:20 IST Actor and Rajya Sabha MP Kamal Haasan has hit out at US President Donald Trump after America announced that it has given India temporary "permission" to buy Russian oil amid global supply disruptions caused by the Middle East conflict. 'Mind Your Own Business': Kamal Haasan Rebukes Trump Over