Remix.run Logo
veqq 6 days ago

It's not a Scheme at all! It doesn't have cons cells after all. It's a Clojure-like (maps everywhere, collection api, immutable data structures) with 1mb executable and [servers](http://janetdocs.org/) running under 10mb of ram.

Fibers are very interesting, even used for error handling. I've not wrapped my head around PEGs yet.

bjoli 6 days ago | parent | next [-]

That makes sense. I have always thought about what I would do if I could make a "modern scheme". A lot would be taken from clojure but definitely not everything. Cons cells would stay, but the star of the show would be immutable vectors based on rrb trees or maybe finger trees (efficient concatenation, insertion in the middle etc), HAMTs , concurrentML (like guile-fibers) and a nice looping facility (like my own goof-loop[1]) and restricted mutation. Syntax-case and syntax-parse from racket. An extensible pattern matcher (like the one found in racket).

I would also make strings immutable, maybe like Guile's cow-strings, maybe blobs-with-cursors.

Definitely just copy Guile's delimited continuations.

I think I would just ignore most of r7rs, since I don't think it improves things for the progrmmer.

bjoli 6 days ago | parent | next [-]

[1] https://rikspucko.koketteriet.se/bjoli/goof-loop

shawn_w 5 days ago | parent | prev [-]

Racket has almost all of that.

bjoli 5 days ago | parent [-]

I am no fan of racket's for loops. It is frustrating, because it fells like an almost-goosd looping facility.

I do use racket, but for scripts I prefer guile. Guile-fibers is a lot neater than the racket parallelism situation, for example. And I can usually find the code responsible for what IAM trying to achieve in the implementation. I never became friends with racket. I remember trying to fix a bug, but I never found what I was looking for.

Getting superficially familiar with the guile codebase takes about an hour.

Then again, I am a classical musician and not a programmer.

shawn_w 5 days ago | parent [-]

Racket's for loops declare in their name what they're intended to return (if anything). Personally that's way more readable and preferable to, say, Common Lisp loop or iterate where you have to hunt through the body for clues. Plus it's easy to create new ones when desired.

I don't see fibers in the guile manual, just heavy weight threads. Is that a third party library? (The lack of a package manager to easily install such things is an issue with most Schemes; only chicken and chibi have anything like Racket's)

bjoli 5 days ago | parent [-]

I wrote this, which I find more usable than racket's loops: https://rikspucko.koketteriet.se/bjoli/goof-loop

It does not use mutation, and should produce just as efficient code as the racket loops. It is also extensible (and easily portable to racket!). It is written almost exclusively in syntax-rules.

Guile fibers can be found here: https://codeberg.org/fibers/fibers

girvo 6 days ago | parent | prev | next [-]

PEGs (even outside Janet) are amazing and what I reach for all the time :) definitely one of those tools that’s worth learning!

natrys 6 days ago | parent | next [-]

Yep peg.el[1] is now built-into Emacs since 30.1 (which is how I came to know of it, but actually the library seems much older) and it makes certain things much simpler and faster to do than before (once you figure out its quirks).

[1] https://github.com/emacs-mirror/emacs/blob/master/lisp/progm...

bmn__ 5 days ago | parent | prev [-]

> PEGs (even outside Janet) are amazing […] worth learning!

Actually, the opposite is the case. https://news.ycombinator.com/item?id=32316375

HN readers, don't fall into this trap and waste your time.

girvo 4 days ago | parent [-]

Ah yes, I, the non-python programmer, find PEGs useful and good because of checks notes Guido, somehow? What a ridiculous comment.

ggm 6 days ago | parent | prev | next [-]

If a language lacks cons can it truly be held to be a lisp or has heresy taken over?

tkrn 6 days ago | parent | next [-]

Although I'm a recovering sexp addict I must confess that I fail to see what makes the cons cell so important to those purer in their faith?

To me the homoiconity of Lisp is mainly about code-as-data, the exact nature of the data doesn't matter to me that much as long as it's a first class citizen and enclosed in nicely balanced parenthesis (though sadly here Janet seems to have fallen to the temptations of the curly braces, and thus, is indeed heresy).

throwaway328 6 days ago | parent | next [-]

I chuckled at "recovering sexp addict". What possible risk is there in over-indulging in sexp?! I simply don't see it.

Speaking of unconventional lisps, I enjoyed this recently:

https://github.com/vygr/ChrysaLisp/blob/master/docs/lisp/lis...

from Chris Hinsley, author of the (very) cool Chrysalisp operating system. Same author who wrote this in 1995:

http://www.uruk.org/emu/Taos.html

gorjusborg 6 days ago | parent | prev [-]

I am a heretic, but I agree that it seems the power of code as data can exist outside a linked list.

I will not give up my curly braces or square brackets.

exe34 6 days ago | parent | prev [-]

It's got Lots of Indented Silly Parentheses.

worthless-trash 6 days ago | parent | prev [-]

Thank you for janetdocs.org , I hated having the missing functions from janetdocs.com

veqq 5 days ago | parent [-]

Do you have any suggestions or things to improve on? I'd like to know how others use it!

worthless-trash 5 days ago | parent [-]

I have an emacs function that opens up the page to its examples use on the web, which can be useful directly from emacs itself.

I'd also like to be able to open up each example up on to the playground with the docs above it. (Currently you can just open the example in the playground) no docs right above it.

I did see a json file containing all site data at one point, I did think about using this as a data source for an llm to 'janet' correctly (because at the moment, they do not). This could be displayed/noted more prominently.

None of these are 'must have', just nice to have.