• palordrolap@fedia.io
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    (f x) works this way in Lisp - as in the joke - and Lisp descendants like Scheme. And then there’s Haskell which takes the whole thing a step further still.

    Also Perl, because Larry thought it would be fun(ctional). The external parentheses are technically optional in this case, but won’t break anything if included. Regular f(x) syntax is also supported there. (You could probably remake this meme with Python and Perl in first and second panels tbh.)

    And I know of at least one dialect of BASIC that allowed subroutine calls to lack their parentheses, so the same external parentheses thing would apply if that subroutine was a function.

    • CanadaPlus@lemmy.sdf.org
      link
      fedilink
      arrow-up
      0
      ·
      3 months ago

      And then there’s Haskell which takes the whole thing a step further still.

      Wait, what works in Haskell that doesn’t in Lisp, exactly? Are the spaces not just function composition?

      • palordrolap@fedia.io
        link
        fedilink
        arrow-up
        0
        ·
        3 months ago

        My mistake. I had somehow missed or forgotten that Lisp also supports currying, which is what I was thinking of as Haskell taking further. There might be other things regarding type declaration and such, but that’s a little beyond me to confirm or deny at the moment.

        • bitcrafter@programming.dev
          link
          fedilink
          arrow-up
          0
          ·
          3 months ago

          In Haskell, all functions are curried by default, so you can partially apply a function merely by applying it to fewer than the supported number of arguments.

          Also, it is worth noting that laziness-by-default in Haskell makes it so that you can use ordinary functions to define control structures, rather than needing to turn to metaprogramming like you do in Lisp.

        • KSP Atlas@sopuli.xyz
          link
          fedilink
          arrow-up
          0
          ·
          3 months ago

          In haskell, any function with a name made entirely out of symbols (like + or >>=) works as an infix operator (you can turn any function into an infix operator using backticks)

    • dan@upvote.au
      link
      fedilink
      arrow-up
      0
      ·
      3 months ago

      of at least one dialect of BASIC that allowed subroutine calls to lack their parentheses

      Did sub calls normally have parentheses in BASIC?

      • palordrolap@fedia.io
        link
        fedilink
        arrow-up
        0
        ·
        3 months ago

        Yes. Most early BASICs even required that any reference to a function name, in definition or calling, be preceded by an FN keyword as well as the parentheses.

        QBASIC, Visual BASIC and the related dialects of BASIC found in MS Office and LibreOffice all have slightly better syntax for defining and calling functions than the older BASICs, but they all still require parentheses on their subroutine parameter lists too.

        At best, you might be able to call a subroutine by name with no empty parentheses after it, but as soon as you need parameters, you’ll need parentheses around them.

        But like I say, there was at least one rare BASIC that didn’t need them, so I’m assuming there might have been others that I’m not aware of.