Live data from Hacker News

Janet – a Lisp-like functional, imperative programming language

github.com

91–100 of 143 posts

Re: Janet – a Lisp-like functional, imperative programming language

#91
post #80
post #67

Earlier quoted context omitted.

Disclaimer: I've never used Janet, but I am pretty familiar with Clojure. In Clojure, there are lists, but the most common structure for sequential data is actually a vector [1], which works more-or-less as a slightly modified version of the Clojure version of a hashmap. Advantages of doing it this way is that you get log32 indexed lookup times (vs linear for lists), and you also get log32 [2] append-to-the-end seman…

Phil Bagwell's VList data structure seems really interesting as a way to avoid a bunch of the pitfalls of naive lists performance-wise - the paper's good fun and there seems to be an implementation in racket for anybody who wants to play with it.

Does any one have a copy of anything related to this?

Wikipedia had an article on it deleted, and I'm not getting much from the first few pages of google...

Re: Janet – a Lisp-like functional, imperative programming language

#92
post #78

Earlier quoted context omitted.

> I understand the guy referring to his car as his "girlfriend" and give it a women's name. I just can't feel the same about tech. Why do you assume programming langauges with female coded names are because the creator is viewing it as a girlfriend? Not all creators are heterosexual males (or otherwise oriented toward females as preferred or even acceptable romantic partners), and even those that are don’t necessaril…

> Why do you assume programming langauges with female coded names are because the creator is viewing it as a girlfriend? I am not assuming that. I was just comparing it to the situation with cars. > Not all creators are heterosexual males (or otherwise oriented toward females as preferred or even acceptable romantic partners), and even those that are don’t necessarily view women exclusively through the lens of romant…

> I am not assuming that

Well you did say: "this may be the nerd's way of immortalizing their sweetheart", which seems to me to strongly imply that your impression may be closer to assuming it than to not assuming it.

I have no horse in this race (I'm not the one who replied to your original comment), but it did seem like you were assuming something awful close to what you are denying.

Re: Janet – a Lisp-like functional, imperative programming language

#93
post #11

I am a happy though very new Janet user. I started migrating my existing workflow optimization scripts (e.g. Git wrappers) to--and writing new ones--in Janet as of a few months ago. I used to use Perl but I switched to Janet as it is a much simpler language and VM, and being a Lisp is ~infinitely extensible. Janet has os/ and file/ packages, as well as a PEG system which mostly stand in for the best features of Perl.…

I've played with the idea of converting my bash path scripts to Janet, but haven't had the time yet. Have you experienced any downsides of using it for your optimization scripts?

I would say that if you're interested, go for it.

My complaints about Janet are not too big. I feel like there are many ways to do some things, and they are all basically the same. Most of this excessive flexibility is inherited from Clojure.

1. It's never clear whether I need `cond` or can get by with `case` until I've waffled around a bit

2. I don't know whether to choose `if`, `and`, or `when`, for conditionals, because there are many times when all three would work. Also, if the condition expression is trivially negated (e.g. change '=' to '!=') then even `or` would work, making 4 choices.

3. It's hard to choose between `->` vs. manually-nested expressions.

EDIT: formatting

Re: Janet – a Lisp-like functional, imperative programming language

#94

Earlier quoted context omitted.

Functional doesn't really have a consistent definition, and you end up always with "yeah but"s in any discussion e.g. haskell isn't functional because C ffi and unsafePerformIO. Point being, its very hard to say "X is or is not functional", as there isn't an objective consideration. (FYI, I love Haskell and use it daily and write it professionally)

This language has mutable strings. This is in some sense the opposite of functional style.

So for me the primary qualifier is “are functions first class”; then “can functions be defined like data” (lambda); then “does it have a rich library of functionality that allows one to program functionally with it”; then “Is fp style idiomatic” ; then probably “does it have a good method to control mutability”; then “does it control side effects”

There may be some other examples in there. Personally I like things with controlled side effects. But it’s just my preferred set of trade offs.

Anyway I mean its just tough to be dogmatic about it. I get what you’re saying but why is that the dividing line?

Re: Janet – a Lisp-like functional, imperative programming language

#95
post #21

Earlier quoted context omitted.

I wrote a few websites with it, notably: https://github.com/swlkr/janetdocs I also scraped together a large web framework and a small one: https://github.com/joy-framework/joy https://github.com/swlkr/osprey

Because swlkr is a bit modest, I’ll take this opportunity to point out his Janet twitch streams on his behalf. Definitely check them out! (google for “twitch swlkr”)

haha thanks for the shout out!

I’m currently working on ruby stuff on stream but maybe I won’t be able to stay away from Janet for long

Re: Janet – a Lisp-like functional, imperative programming language

#96
post #80

Earlier quoted context omitted.

Phil Bagwell's VList data structure seems really interesting as a way to avoid a bunch of the pitfalls of naive lists performance-wise - the paper's good fun and there seems to be an implementation in racket for anybody who wants to play with it.

Does any one have a copy of anything related to this? Wikipedia had an article on it deleted, and I'm not getting much from the first few pages of google...

Racket implementation: https://docs.racket-lang.org/functional-data-structures/VLis...

There's a copy I made of the original paper here: http://trout.me.uk/lisp/

Re: Janet – a Lisp-like functional, imperative programming language

#97
post #11

I am a happy though very new Janet user. I started migrating my existing workflow optimization scripts (e.g. Git wrappers) to--and writing new ones--in Janet as of a few months ago. I used to use Perl but I switched to Janet as it is a much simpler language and VM, and being a Lisp is ~infinitely extensible. Janet has os/ and file/ packages, as well as a PEG system which mostly stand in for the best features of Perl.…

Have you perchance tried Gerbil as well?

Re: Janet – a Lisp-like functional, imperative programming language

#98

Earlier quoted context omitted.

Not named after a woman (or rather, named after not-a-woman): https://github.com/janet-lang/janet#why-is-it-called-janet

>not-a-woman given that the character of the show in question is an archetypal secretary arguing it's not a woman is a fairly big stretch. Not only is it a woman, it's a woman embodying a female stereotype, (in line with the purpose of the language, being an easy helper), and the 60s art deco woman's magazine style logo

Can’t decide if “if it looks like a female secretary then it’s a woman” is progressive or backwards.

Re: Janet – a Lisp-like functional, imperative programming language

#99

This looks really interesting, going to check this out later today. Anyone using Janet for anything that would care to comment on their experience?

I've been writing about my first impressions of the language here: https://ianthehenry.com/posts/janet-game/ Not a whole lot of content yet, but I plan to keep going with it. I am pretty firmly in the Haskell/OCaml "let me program with types" camp for most development, but it's a great to have a little scripting language to reach for instead of bash or Python or Perl. Using Janet (coming from Python) reminds me a bit…

Your writing style is really enjoyable, I binged the 3 posts and really enjoyed, especially the macros post

Re: Janet – a Lisp-like functional, imperative programming language

#100
post #93

Earlier quoted context omitted.

I've played with the idea of converting my bash path scripts to Janet, but haven't had the time yet. Have you experienced any downsides of using it for your optimization scripts?

I would say that if you're interested, go for it. My complaints about Janet are not too big. I feel like there are many ways to do some things, and they are all basically the same. Most of this excessive flexibility is inherited from Clojure. 1. It's never clear whether I need `cond` or can get by with `case` until I've waffled around a bit 2. I don't know whether to choose `if`, `and`, or `when`, for conditionals, b…

I'm pretty experienced with Clojure and here are my takes on those:

1. The Janet docs suggest `cond` as a replacement for if-if-else-else chains in other languages and `case` for `switch`-`case` blocks. That's a pretty good rule, although maybe you've already encountered that explanation? My main rule of thumb is that if the important value is "enum-y", representing a particular kind of thing or state, try `case`. If not, use `cond`. Neither Janet nor Clojure have enums (although you might be able to hack them in through macros or interop), so keywords usually serve that role.

2. I would prefer `when` to `if` because it's usually clearer what's going on. I usually don't use `and` in place of `if`. The trivial negation problem is an issue in basically any programming language that has `and`, `or`, and `not`, but it does add more options. Whether to use `and` or the equivalent `or`, I think your first instinct is often best.

3. I tend to favor threading macros (`->` and `->>`) when something is three or more functions nested and manually nested expressions for the rest.

For a total beginner, I would actually suggest forgetting about the more specialized options until you're comfortable. In other words, just use `cond`, `if`, and manual nesting. (Obviously still use `and` within the branches of `cond` or `if`.)

Post reply on HN