Skip to content
  • Categories
  • Recent
  • Tags
  • All Topics
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Caint logo. It's just text.
  1. Home
  2. Programmer Humor
  3. When people encounter Lisp syntax for the first time
Welcome to Caint!

Issues? Post in Comments & Feedback
You can now view, reply, and favourite posts from the Fediverse. You can click here or click on the on the navigation bar on the left.

When people encounter Lisp syntax for the first time

Scheduled Pinned Locked Moved Programmer Humor
programmerhumor
22 Posts 17 Posters 1 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A abbadon420@sh.itjust.works

    Where does that notation work?

    D This user is from outside of this forum
    D This user is from outside of this forum
    decq@lemmy.world
    wrote last edited by
    #3

    In c style languages, Java, c++, rust, etc.

    A 1 Reply Last reply
    5
    • A abbadon420@sh.itjust.works

      Where does that notation work?

      F This user is from outside of this forum
      F This user is from outside of this forum
      felsiq
      wrote last edited by
      #4

      Lisp uses it, with the fun extra part that operators are just normal functions - so instead of foo(bar) you get (foo bar), or for operators 1+1+2 becomes (+ 1 1 2). It’s a really fun language even just for being different than most, I def recommend playing around with it if you’re looking for something new.

      B M 2 Replies Last reply
      25
      • cm0002@lemmy.worldC cm0002@lemmy.world
        This post did not contain any content.
        B This user is from outside of this forum
        B This user is from outside of this forum
        bodilessgaze@sh.itjust.works
        wrote last edited by
        #5

        What about the M-expression version (f[x])?

        F 1 Reply Last reply
        2
        • D decq@lemmy.world

          In c style languages, Java, c++, rust, etc.

          A This user is from outside of this forum
          A This user is from outside of this forum
          aubeynarf@lemmynsfw.com
          wrote last edited by
          #6

          surely you mean Algol style languages?

          D 1 Reply Last reply
          6
          • A aubeynarf@lemmynsfw.com

            surely you mean Algol style languages?

            D This user is from outside of this forum
            D This user is from outside of this forum
            decq@lemmy.world
            wrote last edited by
            #7

            I did, but I couldn’t remember it. so thanks!

            1 Reply Last reply
            4
            • F felsiq

              Lisp uses it, with the fun extra part that operators are just normal functions - so instead of foo(bar) you get (foo bar), or for operators 1+1+2 becomes (+ 1 1 2). It’s a really fun language even just for being different than most, I def recommend playing around with it if you’re looking for something new.

              B This user is from outside of this forum
              B This user is from outside of this forum
              bennyinc@feddit.org
              wrote last edited by
              #8

              The fun part comes from using it without syntax highlighting, so you can regularly play „find the missing paranthesis“.

              F anunusualrelic@lemmy.worldA 2 Replies Last reply
              23
              • B bennyinc@feddit.org

                The fun part comes from using it without syntax highlighting, so you can regularly play „find the missing paranthesis“.

                F This user is from outside of this forum
                F This user is from outside of this forum
                felsiq
                wrote last edited by
                #9

                My lisp days were back in my “IDEs are bloat” phase so that’s the only way I ever interacted with it lmao

                1 Reply Last reply
                16
                • A abbadon420@sh.itjust.works

                  Where does that notation work?

                  P This user is from outside of this forum
                  P This user is from outside of this forum
                  palordrolap
                  wrote last edited by
                  #10

                  (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.

                  1 Reply Last reply
                  5
                  • B bodilessgaze@sh.itjust.works

                    What about the M-expression version (f[x])?

                    F This user is from outside of this forum
                    F This user is from outside of this forum
                    Frezik
                    wrote last edited by
                    #11

                    AFAIK, the only language that ever implemented M-expressions was Logo.

                    1 Reply Last reply
                    2
                    • cm0002@lemmy.worldC cm0002@lemmy.world
                      This post did not contain any content.
                      H This user is from outside of this forum
                      H This user is from outside of this forum
                      hyperfocussurfer@lemmy.dbzer0.com
                      wrote last edited by
                      #12

                      WDYM “the 1st time”?

                      1 Reply Last reply
                      5
                      • F felsiq

                        Lisp uses it, with the fun extra part that operators are just normal functions - so instead of foo(bar) you get (foo bar), or for operators 1+1+2 becomes (+ 1 1 2). It’s a really fun language even just for being different than most, I def recommend playing around with it if you’re looking for something new.

                        M This user is from outside of this forum
                        M This user is from outside of this forum
                        Mika
                        wrote last edited by
                        #13

                        The most interesting part about Lisp is homoiconicity:

                        (+ 1 1 2) is literally a list with symbol “+” and 3 numbers.

                        Which allows to build the most powerful macro possible, manipulating code (with data as a tree-like structures) and changing it into whatever else at compile time.

                        Now if only there was any good use for macros, this would be the best language 🙃

                        R 1 Reply Last reply
                        9
                        • cm0002@lemmy.worldC cm0002@lemmy.world
                          This post did not contain any content.
                          exuE This user is from outside of this forum
                          exuE This user is from outside of this forum
                          exu
                          wrote last edited by
                          #14

                          Does that make Lisp a language with significant white space?

                          1 Reply Last reply
                          5
                          • M Mika

                            The most interesting part about Lisp is homoiconicity:

                            (+ 1 1 2) is literally a list with symbol “+” and 3 numbers.

                            Which allows to build the most powerful macro possible, manipulating code (with data as a tree-like structures) and changing it into whatever else at compile time.

                            Now if only there was any good use for macros, this would be the best language 🙃

                            R This user is from outside of this forum
                            R This user is from outside of this forum
                            recallmadness@lemmy.nz
                            wrote last edited by
                            #15

                            Threading is a great case for a macro.

                            (-> x (* 2) (/ 3) (- 1))

                            Is the same as (- (/ (* x 2) 3) 1)

                            M 1 Reply Last reply
                            5
                            • C This user is from outside of this forum
                              C This user is from outside of this forum
                              canadaplus@lemmy.sdf.org
                              wrote last edited by
                              #16

                              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?

                              P 1 Reply Last reply
                              1
                              • R recallmadness@lemmy.nz

                                Threading is a great case for a macro.

                                (-> x (* 2) (/ 3) (- 1))

                                Is the same as (- (/ (* x 2) 3) 1)

                                M This user is from outside of this forum
                                M This user is from outside of this forum
                                Mika
                                wrote last edited by
                                #17

                                Sure it’s not like it has no uses, but it’s something languages have built-in as syntax sugar or operators, and you rarely need to built your own macro for anything.

                                Jerkface (any/all)J 1 Reply Last reply
                                0
                                • B bennyinc@feddit.org

                                  The fun part comes from using it without syntax highlighting, so you can regularly play „find the missing paranthesis“.

                                  anunusualrelic@lemmy.worldA This user is from outside of this forum
                                  anunusualrelic@lemmy.worldA This user is from outside of this forum
                                  anunusualrelic@lemmy.world
                                  wrote last edited by
                                  #18

                                  Editing lisp with ed is the best way to learn it.

                                  1 Reply Last reply
                                  2
                                  • M Mika

                                    Sure it’s not like it has no uses, but it’s something languages have built-in as syntax sugar or operators, and you rarely need to built your own macro for anything.

                                    Jerkface (any/all)J This user is from outside of this forum
                                    Jerkface (any/all)J This user is from outside of this forum
                                    Jerkface (any/all)
                                    wrote last edited by
                                    #19

                                    Have you ever used a domain specific language? My intuition says, “no.”

                                    1 Reply Last reply
                                    1
                                    • dan@upvote.auD This user is from outside of this forum
                                      dan@upvote.auD This user is from outside of this forum
                                      dan@upvote.au
                                      wrote last edited by
                                      #20

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

                                      Did sub calls normally have parentheses in BASIC?

                                      P 1 Reply Last reply
                                      1
                                      • dan@upvote.auD dan@upvote.au

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

                                        Did sub calls normally have parentheses in BASIC?

                                        P This user is from outside of this forum
                                        P This user is from outside of this forum
                                        palordrolap
                                        wrote last edited by
                                        #21

                                        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.

                                        1 Reply Last reply
                                        0
                                        • C canadaplus@lemmy.sdf.org

                                          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?

                                          P This user is from outside of this forum
                                          P This user is from outside of this forum
                                          palordrolap
                                          wrote last edited by
                                          #22

                                          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.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • All Topics
                                          • Popular
                                          • World
                                          • Users
                                          • Groups