r/janetlang • u/Veqq • Jul 28 '25
Most Janet Discussion Happens on this Zulip
r/janetlang • u/Veqq • Jul 28 '25
r/janetlang • u/Gray_Jack_ • Jun 02 '21
I just released a new version of the JanetRS crate. A high level binding library to inter-op with Janet using Rust code. With it it's possible to embed Janet with your Rust project and to create Janet libraries using Rust.
In this release there was a bunch of types that where considered done for the time being, as in the exposed API is probably good to use, new methods for some types and some fixes.
New trait DeepEq for value by value comparison between Janet types on the Rust side
Redesign and expansion of the JanetAbstract API and IsJanetAbstract trait
API for interacting with the Janet Garbage Collector
Overall better docs (could use lots of improvements yet)
unsatable!! Opt-in Rust Nightly-only features: Expose Janet scratch memory API through Rust Allocator trait.
For full list of changes, check out the repository CHANGELOG file
If you want to test make a Janet library with it, here is a template to use as base, another good example is this library adding some more function to work with buffers and strings.
r/janetlang • u/dressupgeekout • Dec 30 '21
r/janetlang • u/torusJKL • Mar 23 '26
r/janetlang • u/Mental_Bumblebee7029 • 14d ago
r/janetlang • u/Gray_Jack_ • Sep 01 '21
I published a new version of JanetRS crate. A high level binding library to inter-op with Janet using Rust code. With it it's possible to embed Janet with your Rust project and to create Janet libraries using Rust.
In this release there was a a bunch of breaking changes, but all for a better design of the library and to support the new Janet feature, having source maps informations.
Possibility to define function arity in the #[janet_fn] to include arity checks
#[janet_fn] magically produces the source maps for you
The new macro declare_janet_mod! are able to use the source maps produced by #[janet_fn] attribute when declaring your Janet modules/libraries
Redesign some of the JanetEnvironment and JanetClient to receive definitions, variables and C functions to reduce amount of functions and support source maps
Support for JanetFile and JanetRng
For full list of changes, check out the repository CHANGELOG file
If you want to test make a Janet library with it, here is a template to use as base, another good example is this library adding some more function to work with buffers and strings.
r/janetlang • u/swlkrV2 • Feb 05 '21
r/janetlang • u/cruxdestruct • Dec 10 '20
r/janetlang • u/swlkrV2 • Sep 24 '20
r/janetlang • u/xenow • Apr 25 '20
r/janetlang • u/Veqq • Jun 30 '26
I mostly talk to people in the zulip, but some different/outside voices could be useful. This way we can make progress on those things. :)
r/janetlang • u/Veqq • Sep 19 '26
r/janetlang • u/Feisty_Bike_9614 • Jul 23 '26
Has anyone embedded Janet in rust ? I’m working on a prototype and would be interested in hearing your experience.
r/janetlang • u/abhin4v • Dec 13 '25
r/janetlang • u/abhin4v • Dec 05 '25
r/janetlang • u/SCjdoh • Oct 15 '23
Pretty new to coding. Heard Janet does functional and imperative so may be easier to grasp in the beginning than Clojure. Planning to learn Clojure anyway but curious if Janet may make it easier. Thoughts?
r/janetlang • u/jack-bloggs • May 05 '23
Hi, Just starting out with Janet and also using it as a teaching exercise and intro to lisp-likes for my ~13/14yo kids (and me actually).
We've just gone through translating some python code we wrote previously (sieve of Eratosthenes) to Janet, and I'd like thoughts on how Janet-idiomatic the new code is, what we could do differently, etc.
Also, the code has a big performance slowdown compared to python especially after the generator has run a while (say 100,000 primes), and I'd like advice on what kinds of things might speed it up. We did look into the source to look if there were any easy tweaks to the hash table (eg planning to add fibonacci hashing, but saw it was already being used). But a quick run with a profiler shows that most of the time is being spent in GC anyway.
Code:
(defn primes-sieve []
"
Prime numbers generator using sieve of Eratosthenes
Count upwards, building a 'sieve' of discovered primes, and discarding numbers that are
composites of primes already in the sieve.
Each entry in the sieve is a key pointing to a list of primes, where the key is
the 'next upcoming composite (multiple)' divisible by it's primes, eg { 45 @[3 5] }
For each number, check if it's one of the composites recorded in the sieve.
If it is, update the sieve with recalculated 'upcoming composite' entries for each prime
and delete the current entry.
If not, it must be a new prime; yield the number, and add an entry for it in the sieve.
"
(fiber/new (fn []
(yield 2) # the only even prime, yield it explicitly.
(let [sieve (table/new (math/pow 2 12))] # preallocating the sieve to ~= how many primes will be requested (at least) gives a big performance improvement
(loop [n :range [3 nil 2]] # only odd numbers
(if-let [current-composite (sieve n)]
(do
(each prime-factor current-composite
(let [next-composite-key (+ n (* 2 prime-factor))] # add 2*prime-factor, else composite would be even
(if-let [next-composite (sieve next-composite-key)]
(array/push next-composite prime-factor)
(put sieve next-composite-key @[prime-factor]))))
(put sieve n nil))
(do
(yield n)
(put sieve (* n n) @[n])) # next composite is n^2. Anything less is composite a smaller prime, already in the sieve
))))))