Live data from Hacker News

Why Fennel?

fennel-lang.org

141–150 of 174 posts

Re: Why Fennel?

#141

Earlier quoted context omitted.

If only there was an editor which could act as an interpreter for Lisp directly ...

I understand it's improved, but Emacs was always too slow for me. Additionally, in my workflow I open my editor across many many terminals, the startup time alone prevented this. With emacsclient it was faster, but I specifically DON'T want to have a window that shows all my other open files.

> I specifically DON'T want to have a window that shows all my other open files.

There are multiple different ways of separating project/workspace/etc. contexts in Emacs - tab-bar mode, persp.el, etc.

Re: Why Fennel?

#142

Earlier quoted context omitted.

Now you're living life large with jetbrains and making the big bucks !

Nope. Neovim. And even there some of the "distros" got on my nerves. I guess at one point I'll just learn Neovim's API and make my own blend like everyone else. NOT looking forward to it. But I suppose there's no other way. I still view Neovim as a huge improvement over Emacs though.

> I still view Neovim as a huge improvement

Neovim unlike Emacs is an editor. Emacs is not a mere code editor, not an IDE, text-processor, or web-browser. Emacs first and foremost is a Lisp REPL, with a built-in text-editor. Without deeply understanding that aspect one can never truly appreciate the incredible power it grants you.

Do you use your editor to read and annotate pdfs? Or watch videos? Or manage the library of your ebooks? Or track your expenses? Or control project management like Jira? Or keep your knowledge base and note-taking? Or interact with LLMs? Or explore APIs like Postman? Or keep your spaced repetition flash cards like Anki? Or use it for chat over platforms like Telegram and Slack? Or find and read RFCs and manpages? Or to perform web-search, search through your browser history, Wikipedia. Do you have etymology lookup, thesaurus, dictionaries, translation? Or to order pizza? Or measure distances between coordinates on a map? Automate things based on solar calendar or moon phases? Manage all your configs, aka dotfiles? OCR images with text? List, browse and code review Pull Requests, etc., etc.

In what sense exactly is Neovim/VSCode/IntelliJ/whatever is a "huge improvement", please tell us?

Re: Why Fennel?

#143
post #94

I do not understand the appeal of LISPy languages. I get that the parser is simple and elegant, but I believe the developer (of the compiler in this case) should serve the convenience of the user, not the other way around. Writing code like this is cumbersome and unnecessarily symbol heavy, and reading it isn't really nice as well. I'd rather have the language add that extra complexity into the parser than have me st…

I tried fennel for a game jam and honestly was pretty disappointed. The way lisp languages are pitched here, I thought I was in for a mind opening experience, but instead the end experience was pretty much identical to lua in ever meaningful way, the only differences felt surface level (I.e. using closures, and parentheses). I'm forever indebt to lisp for giving JS it's saving graces (closures and FN as first class c…

> The way lisp languages are pitched here, I thought I was in for a mind opening experience

Have you used a Lisp with a connected REPL? Not the one that you have to type instructions into - the one that allows you to send any expression at point, with virtually zero ceremony to it, basically letting you evaluate any part of the program on the fly? And that REPL can be even remote - at work we use one running in a kubernetes cluster, we can change our APIs and experiment without not only redeploying things, we don't even have to save our changes. Can you imagine being able to try your code without saving, linting, linking, compiling, deploying - all that on the fly? It is truly mind-opening experience. It's so fucking nice, it's like playing a video game. I do understand why it's appealing to build actual video games that way.

Using a Lisp without structural editing tools and without a REPL is like having a Ferrari without a working engine - you'd have to pedal it to move around, it's ridiculous.

Re: Why Fennel?

#144
post #77

Earlier quoted context omitted.

Let's be real in most situations it doesn't matter. One "statement" per line is bog standard. Whether that statement is surrounded by parens or ended in a semicolon isn't impactful for reading. LISP is only better when you add source code transformation (which is way easier with its source code looking like the transformed code). But then you introduce "everyone can write their own syntax" which is good and bad given…

> One "statement" per line is bog standard This isn't really true. Most non-Lisp languages I work in, like JS or Ruby or Python, have things like long_expression =\n long_other_expression, or long_expression\n.another_long_expression\n.another_long_expression.

And if most of your code looks like that you are making a mistake.

"Sometimes I need multiple lines" is fine, exceptions happen.

But again I ask, visually are those lines super different?

Ditto for things like for loops which have multiple statements in a line.

Re: Why Fennel?

#145
post #75

Earlier quoted context omitted.

It's obvious to anyone who is familiar with both. (f x y) vs f(x, y); Note the extra comma and semicolon. The only place this breaks down is for simple arithmetic expressions like (+ a b) vs a + b, which is trivial enough to ignore (and also goes back in favor of Lisp when you start having more operands).

How would you write this in Lisp without introducing a bunch of parens? `if (0 I’m not a Lisp hater, but there’s a reason people make this criticism. I think most people find the infix version easier to read.

I've been working on this for TXR Lisp. The next, release 300, will support infix.

The core expression in your example expression will parse as you have written it. Except we have to add ifx:

  1> (ifx (if (0 
Though it doesn't work since it's not a complete example with defined variables, we can quote it and expand it to see what the expansion looks like, which answers your question of how you write it one underlying Lisp:

  1> (expand '(ifx (if (0 
The ifx macro deosn't have to be used for every expression. Inside ifx, infix expressions are detected at any nesting depth. You can put it around an entire file:

  (ifx
    (defstruct user ()
      id name)

    (defun add (x y) (x + y))

    ...)
Autodetection of infix add some complexity and overhead to the code walking process that expands macros (not to mention that it's newly introduced) so we wouldn't want to have it globally enabled everywhere, all the time.

It's a compromise; infix syntax in the context of Lisp is just something we can support for a specific benefit in specific use case scenarios. It's mainly for our colleagues who find it a barrier not to be able to use infix.

In this particular infix implementation, a full infix expression not contained inside another infix expression is still parenthesized (because it is a compound form, represented as a list). You can see from the following large exmaple that it still looks like LIsp; it is a compromise.

I took an example FFT routine from the book Numerical Recipes in C and transliterated it, to get a feel for what it's like to write a realistic numerical routine that contains imperative programming "warts" like using assignments to initialize variables and such:

  (defun fft (data nn isign)
    (ifx
      (let (n nmax m j istep i
            wtemp wpr wpi wr wi theta
            tempr tempi)
        (n := nn  i)
            (swap (data[j]) (data[i]))
            (swap (data[j + 1]) (data[i + 1])))
          (m := nn)
          (while (m >= 2 && j > m)
            (j -= m)
            (m >>= 1))
          (j += m))
        (nmax := 2)
        (while (n > nmax)
          (istep := nmax 
It was very easy to transliterate the C code into the above, because of the infix. The remaining outer parentheses are trivial.

A smaller example is a quadratic roots calculation, from the test suite. This one has the ifx outside the defun:

  (ifx
    (defun quadratic-roots (a b c)
      (let ((d (sqrt b * b - 4 * a * c)))
        (list ((- b + d) / 2 * a)
              ((- b - d) / 2 * a)))))
sqrt is a function, but treated as a prefix operator with a low precedence so parentheses are not required.

Re: Why Fennel?

#146
post #94

I do not understand the appeal of LISPy languages. I get that the parser is simple and elegant, but I believe the developer (of the compiler in this case) should serve the convenience of the user, not the other way around. Writing code like this is cumbersome and unnecessarily symbol heavy, and reading it isn't really nice as well. I'd rather have the language add that extra complexity into the parser than have me st…

I tried fennel for a game jam and honestly was pretty disappointed. The way lisp languages are pitched here, I thought I was in for a mind opening experience, but instead the end experience was pretty much identical to lua in ever meaningful way, the only differences felt surface level (I.e. using closures, and parentheses). I'm forever indebt to lisp for giving JS it's saving graces (closures and FN as first class c…

[deleted]

Re: Why Fennel?

#147

Earlier quoted context omitted.

Nope. Neovim. And even there some of the "distros" got on my nerves. I guess at one point I'll just learn Neovim's API and make my own blend like everyone else. NOT looking forward to it. But I suppose there's no other way. I still view Neovim as a huge improvement over Emacs though.

> I still view Neovim as a huge improvement Neovim unlike Emacs is an editor. Emacs is not a mere code editor, not an IDE, text-processor, or web-browser. Emacs first and foremost is a Lisp REPL, with a built-in text-editor. Without deeply understanding that aspect one can never truly appreciate the incredible power it grants you. Do you use your editor to read and annotate pdfs? Or watch videos? Or manage the librar…

Well you kind of answered yourself. After limping with Emacs for 19-ish years, during most of which I never made the serious effort you alluded to, I finally admitted I just don't have and don't want to have the mindset that's deemed necessary to make full use of Emacs.

All of my professional experience, which is at this point substantial (though of course I make no claims that quality stems from quantity!), has showed me that smaller specialized tools always perform better -- in every meaning of the word.

To me Neovim wins because it's extremely snappy, it has no visual noise, and doesn't show me a warning from a random plugin down there in the command bar almost every minute (something which Emacs apparently will always do). And is configurable in a way I find intuitive. I never cared about all the directories where I am supposed to install my own Elisp files, and I still don't. I want a plugin manager and I want to issue commands to it: install, update, delete. Neovim's Lazy and Mason do exactly what I expect.

I was never, in almost two decades, able to look at how Emacs does things and think to myself "oh but of course it will work like that".

So no, I haven't used Emacs for anything except coding. And I don't intend to use Neovim for anything else as well (with the possible exception of lazygit integration, that one works great). Though I am also working towards having everything except my web browsers be in the terminal.

Again, many will say "skill issue" or "it's just not for you" (the smarter ones). Which, again again, I never denied. But I don't plan to mince words and I am tired of the (to me) unjustified praise for Emacs. It absolutely is not, not just for everyone, but not for most even, IMO.

If you have tamed it and find it intuitive, I am sure it empowers you. I never got to that point and I regret trying to fit in for such an extremely long time. But oh well, we live and learn. We live for sure. :)

Re: Why Fennel?

#148
post #84

Earlier quoted context omitted.

>> as it mainly applies to Lisp-like languages that uses parentheses heavily. This is so wrong. Lisp does not use parentheses heavily. It doesent even use more parens than any C like language. I just dont understand the fixation with parentheses. The power of lisps comes from the fact that everything is an expression. Someone can correct me if I am wrong, since I only have experience with functional lisp Clojure, but…

I just don't understand the fixation with REPL. How do you use it? It sounds like you write code as black box then run it in REPL to see what it does because you don't understand it by yourself.

> I just don't understand the fixation with REPL

Perhaps because maybe you just haven't used one? I'm not talking about "a REPL" in langs like Python, where you typically have to type stuff into it. Lisp REPLs allow evaluating code directly in the source buffer, by sending it into the REPL. That REPL can be remote. Like seriously remote - NASA once did it on a spacecraft 150 million miles away from Earth. We run ours in a kubernetes cluster. Lisp REPL allows you to evaluate specific expressions, functions, or regions directly from where you are. Without saving, linting, linking, compiling, etc.

> because you don't understand it by yourself.

REPL is not about "understanding your code", it's about interactive development and exploration - it allows you to test your ideas and assumptions in real-time. Imagine being able to send http request, pull some good chunk of data, and then sort it, group it, slice it, dice it, filter it, visualize it - do whatever you want to do with it, directly from your editor. It's incredibly empowering and extremely liberating.

The only downsides - after getting used to that, using non-lispy languages sucks all the joy out of programming and you also have to explain to people what it is like.

It's like moving to an island where people have never discovered salt, pepper, and other spices, and though their cuisine looks beautiful - you just can't describe to them what they all are missing. Some even may say - "Hey, I've tried pepper once - but I don't understand your fixation with it" and you'd be like: "have you ever tried putting it into your food?"

Re: Why Fennel?

#149

Earlier quoted context omitted.

I have set it up 50 times and it crapped the bed every time. Before anyone yells "skill issue!", I'll say that if any plugin author can make the editor crap the bed, then the editor is not good. There are degrees to freedom. Complete freedom in such environments is a liability, not an asset. Say hi to the others in the ivory tower. And remind them not to do selective omissions in their supposed counter-arguments to "…

Hey... could you write about one or two of the worst offenses? I consider myself an emacs/elisp power user, yet somehow (M)ELPA seems pretty doinked out-of-the-box on a stock Debian nox-emacs install. I just thought it was me.

My apologies, but I no longer remember. I only remember my huge annoyance that almost anything I did, even successful, led to some warnings or unnecessary notifications in the command bar. Always some noise there. Not to mention the occasional actual failure in a plugin leading to huge stacktraces and leaving me with a partially working editor that kind of still works but not quite.

My brain mercifully deleted all details. At one point I really had enough (and waiting for 19 years for an editor to get better is IMO having an angelic patience that Emacs did not deserve) and just moved on and forgot all about it.

Re: Why Fennel?

#150
post #94

Earlier quoted context omitted.

I tried fennel for a game jam and honestly was pretty disappointed. The way lisp languages are pitched here, I thought I was in for a mind opening experience, but instead the end experience was pretty much identical to lua in ever meaningful way, the only differences felt surface level (I.e. using closures, and parentheses). I'm forever indebt to lisp for giving JS it's saving graces (closures and FN as first class c…

Fennel isn't a "real" Lisp. It's more of an aesthetic layer on top of Lua than anything else. Try learning Scheme.

Give me a break. What's not "real" about it? It's homoiconic, it supports connecting to a REPL, it has macros, first-class functions and proper lexical scoping. What else do you want, Guy Steele personally sending you an emoji whenever you install it?
Post reply on HN