functional programming kicks ass

functional programming kicks ass

POSIWID: The Purpose Of A System Is What It Does Shirt $21.68

Unattended Children Pitbull Club Shirt $21.68

POSIWID: The Purpose Of A System Is What It Does Shirt $21.68

  1. 4 weeks ago
    Anonymous

    >Common Lisp
    Common Lisp is barely functional, it supports first-class functions, but you have to do that weird #' thing. It doesn't even require tail call recursion and many implementations don't have it. Even fricking javascript mandates tail call recursion, and it has first class functions too, and they're arguable used more often.

    • 4 weeks ago
      Anonymous

      i use clojure at work but im really tired of it. every time i use common lisp its a nice breath of fresh air. conditions beat try/catch any day. struct access emits efficient machine code whereas in clojure you reflect almost all the time and pray that HotSpot does something magical (it usually doesn't. JITs rarely re-optimize after program startup), and this gets reflected in editor tooling all the time. autocomplete is instant in SLIME, but in CIDER, you easily wait half a second, which is simply unacceptable latency for me. also for whatever reason the Clojure ecosystem recently decided to create their own shitty version of Apache Ant (tools.deps, tools.build, ...) and now every project has ad-hoc Makefiles^W^W Babashka scripts that thinly wrap ad-hoc functions written in the dark invoking tools.build. (Leiningen was so much more consistent but nobody uses it anymore and most of the cool Clojure 1.12 features are hard-coded with deps.edn in mind)

      >muh namespaces nooo!
      you're a homosexual whose never completed a program in any lisp. nobody with actual experience cares about this distinction.
      >It doesn't even require tail call recursion and many implementations don't have it.
      all of the popular implementations (SBCL, CCL, ECL, Clasp, Allegro CL, LispWorks, ...) support it, moron.
      >Even fricking javascript mandates tail call recursion,
      ironically, only Safari's JS engine actually implements this. most JS implementations break the standard

      • 4 weeks ago
        Anonymous

        >Clojure ecosystem recently decided to create their own shitty version of Apache Ant (tools.deps, tools.build, ...) and now every project has ad-hoc Makefiles^W^W Babashka scripts that thinly wrap ad-hoc functions written in the dark invoking tools.build. (Leiningen was so much more consistent but nobody uses it anymore and most of the cool Clojure 1.12 features are hard-coded with deps.edn in mind)

        At first they be like, Clojure is minimal, user will come up with their own build/dependency system ! And thus Leiningen was born

        15 years later, they decided to come up with their on build system

        • 4 weeks ago
          Anonymous

          the worst part about clojure is how the community cargo cults shit Rich says in his talks. every single time someone in the clojure community dislikes some library or tool, they always say "X is easy, but not simple! Y is simple!" it's cringeworthy

          • 4 weeks ago
            Anonymous

            >X is easy, but not simple! Y is simple!"

            Typical example would be Leiningen vs deps.
            With leiningen I don't need to write a build script, it covers 99% of use cases and it has plugins to do weird stuffs such as OSGI with a nice profile system.
            Of course when doing more complicated stuff, you'll probably have to build your own leiningen profiles.

            Deps is not as easy but it is easy in that you can program your own needs. You can see that right away with the dependency strings:

            >[clojusc/osgi "1.9.0.3-SNAPSHOT"]
            vs
            >clojusc/osgi {:mvn/version "1.9.0.3-SNAPSHOT"}

            But it really becomes a sad party when you have to run shit at the command line. You end up dumping your command in your code files because otherwise you won't remember them. Meanwhile with leiningen you just have to peek at the project.clj profiles.

            Sad.

      • 4 weeks ago
        Anonymous

        >reflection
        Skill issue. Turn in reflection warnings and use type hints if you use field access, or just use maps.
        If you use records with keywords for access it creates a method lookup site that will save the efficient access path
        Idk what's your problem with auto complete it works fast on every machine I used

        • 4 weeks ago
          Anonymous

          >Skill issue.
          until you transitively pull in java deps that use reflection... which is literally anything that deals with JSON or XML since they all pull in Jackson, Xerces, ... also some clojure contribs (like data.xml, tools.namespace, tools.reader, ...) end up reflecting in some parts of their implementation. You're also ignoring the fact that Clojure boxes everything into an Object, long, or double (by design of the compiler). Type hints do little more than emit a checkcast instruction in bytecode, which itself has non-trivial cost when doing it thousands of times.

          >If you use records with keywords for access it creates a method lookup site that will save the efficient access path
          thats the worst reason to use records and is a common beginner mistake (alongside wanting to use protocols for everything), since other programming languages, unlike Clojure, heavily rely on polymorphism for reusable code. it's also very easy for records to lose their type; just run any general map operation on them
          (defrecord Rec [a b])
          (type (merge {} (Rec. 1 2*~~ ;=> clojure.lang.PersistentArrayMap

          also other gotchas like the fact records break REPL-driven development and require you to transitively reload any namespaces using an old definition of a record

          >Idk what's your problem with auto complete it works fast on every machine I used
          if "fast" to you means waiting more than 200ms then sure. but the contrast is night and day whenever I use literally any other language, not just Common Lisp

          • 4 weeks ago
            Anonymous

            >if "fast" to you means waiting more than 200ms then sure. but the contrast is night and day whenever I use literally any other language, not just Common Lisp
            NTA but when I toyed around with CIDER I didn't notice any lag at all, and it's usually something I'm autistic about. The only annoyance I had was the usual eternal JVM startup.

          • 4 weeks ago
            Anonymous

            on my end its a noticeable difference, to the point where I never autocomplete some keywords since its faster to type them than wait for the autocomplete

          • 4 weeks ago
            Anonymous

            Just checked and there's only a short lag on the first completion, after that it's nice and snappy even with different prompts and company enabled.

          • 4 weeks ago
            Anonymous

            In the sense of dispatching on types at runtime, you're right, neither Clojure or Java ecosystem are immune from that, although the JIT compiler does help here for mono and bi morphic call sites.
            This is the sort of performance consideration you rarely have to make in most code, however. I know because I DO sometimes look for those cases and how to optimize them.
            The more limited type system is annoying, I won't argue that, but I don't know how different that is from other lisps, at least for CL without optimizations. I do find that I miss int and char, but not often and my use cases aren't common.
            I know checked casts aren't free, but won't they also get compiled away in most cases?
            For records, like I said, just use maps, unless you need fast access. I'm good with Just Maps. Although if we're talking performance one merge and you're SOL

            on my end its a noticeable difference, to the point where I never autocomplete some keywords since its faster to type them than wait for the autocomplete

            That's odd, is that first time auto completing ? CIDER has some lazy loading where code doesn't get initialized until the first time something gets evaluated. It's funny, start a repl and just send 1 and see what happens. Doesn't happen the second time.
            Overall I don't mind paying the start up cost

      • 4 weeks ago
        Anonymous

        Is Clojure/Babashka really that shit? i'm desesperate for a half decent script lang that's easy to deploys and somewhat works on Windoze.

        • 4 weeks ago
          Anonymous

          Clojure has some major flaws (i.e. no TCO) but it's still a decent language. Anon is comparing it to CL, which is a little unfair.

          • 4 weeks ago
            Anonymous

            I mean i amn't picky, i'm working on integrating a no-name SaaS with some shitty attorney firms' systems running on a house of cards powerwd by IIS, anything that's better than Powershell or Python is welcomed.

        • 4 weeks ago
          Anonymous

          >Clojure
          Clojure is shit or not shit depending on what you need. Since you want simple deployment, I think modern Java as a whole is pretty much out since nobody runs JREs anymore and, in the case of Windoze, you will need to be comfortable using jlink and jpackage to create a distributable, self-contained EXE. Outside of servers your company controls, long gone are the days of simply dropping a JAR file to somewhere in /opt.

          >Babashka
          Babashka is just a Clojure interpreter (SCI) running in a GraalVM native image. You get the benefits of AoT-compiled native binaries. However, the binaries are pretty huge since they must include huge chunks of the Java universe. (e.g. the babashka docker image is 35 MiB despite building on alpine). In addition, since there is no JVM in a native binary, you cannot rely on reflection, classloaders, etc. which makes interop with Java (and most Clojure libraries) pretty tough. There are some workarounds for this (e.g. pods) but again, using libraries that are not already bundled in Babashka requires you to thoroughly grasp how the JVM and native images work.

          Also note there is Nbb (node babashka), which is much nicer to run and do interop in simply because there is no native binary (everything runs through Node.js). But ClojureScript tooling also kinda sucks compared to Clojure. Also many Node.js libraries use async APIs but SCI doesnt support core.async, so you quickly end up in promise hell.

          I mean i amn't picky, i'm working on integrating a no-name SaaS with some shitty attorney firms' systems running on a house of cards powerwd by IIS, anything that's better than Powershell or Python is welcomed.

          >i'm working on integrating a no-name SaaS with some shitty attorney firms' systems
          Ironically, I used to work for a Clojure shop that sold some due diligence software for law firms specializing in M&A's... We offered cloud and on-prem versions of the software. I haven't worked there for three years at this point, but they're scared by GPT-4 since that has huge potential to compete with their NLP stuff

          Since I'm hitting the 2k character limit I'll have to stop here, but list some specific requirements and I will answer.

          • 4 weeks ago
            Anonymous

            Frankly what i need is fairly simple
            >Make network requests to some endpoints and retrieve a big list of user submitted documents
            >Parse the response body and filter out out separate lists of documents per category and department
            >Specific subset of these documents should be set up to be scanned with the SaaS thingie, i assume to deal with some goverment compliance
            >The rest should be laid out inside a tidy AD setup so each department can make use of them
            >Aditionally sometimes departments update those documents and can optionally request them to be submitted to the SaaS service
            That's the high level understanding i have of the whole thing. My alleged boss is currently involved in some corruption scandal so i can't ask anyone else for deeper details, not like if i care really. Is a low frizz, low pay job and. Might jump to something better once i get over the DevOps treadmill.

          • 4 weeks ago
            Anonymous

            >>Make network requests to some endpoints and retrieve a big list of user submitted documents
            out out separate lists of documents per category and department
            subset of these documents should be set up to be scanned
            Any "modern" programming language should be suitable for this. To be honest, I'd use Clojure only because I already write Clojure every day and I'm familiar with the ecosystem. If I were in your shoes, the first thing I'd do is see exactly which services I'm fetching from, see if they have Swagger/OpenAPI docs (if they do, then use https://github.com/oliyh/martian to automatically generate a client and focus strictly on business logic). Afterwards, it sounds like the business logic is mostly map munging, using group-by with a predicate that identifies which department a document belongs to, and then sending these off somewhere.

            I am not sure how exactly you expect your script(?) to handle update requests from other people, so I can't comment exactly on that. But what I can say, as a general principle, is that your actual logic (i.e. ignoring the ceremony to fetch and post data) will almost certainly be a bunch of pure functions composed together, so once you have the sorting stuff figured out, it shouldn't be hard to simply merge updated data.

            Again, since I am assuming you are simply writing a script, I recommend looking at https://github.com/l3nz/cli-matic which allows you to parse command-line arguments in a compact, data-driven way

            In the sense of dispatching on types at runtime, you're right, neither Clojure or Java ecosystem are immune from that, although the JIT compiler does help here for mono and bi morphic call sites.
            This is the sort of performance consideration you rarely have to make in most code, however. I know because I DO sometimes look for those cases and how to optimize them.
            The more limited type system is annoying, I won't argue that, but I don't know how different that is from other lisps, at least for CL without optimizations. I do find that I miss int and char, but not often and my use cases aren't common.
            I know checked casts aren't free, but won't they also get compiled away in most cases?
            For records, like I said, just use maps, unless you need fast access. I'm good with Just Maps. Although if we're talking performance one merge and you're SOL
            [...]
            That's odd, is that first time auto completing ? CIDER has some lazy loading where code doesn't get initialized until the first time something gets evaluated. It's funny, start a repl and just send 1 and see what happens. Doesn't happen the second time.
            Overall I don't mind paying the start up cost

            >The more limited type system is annoying, I won't argue that, but I don't know how different that is from other lisps
            In my experience, CL implementations like SBCL offer full-fledged static typing and provide various benefits: catching errors at compile-time, efficient machine code, etc. Racket also has Typed Racket, which is fairly usable. No idea about other lisps.

            In the sense of dispatching on types at runtime, you're right, neither Clojure or Java ecosystem are immune from that, although the JIT compiler does help here for mono and bi morphic call sites.
            This is the sort of performance consideration you rarely have to make in most code, however. I know because I DO sometimes look for those cases and how to optimize them.
            The more limited type system is annoying, I won't argue that, but I don't know how different that is from other lisps, at least for CL without optimizations. I do find that I miss int and char, but not often and my use cases aren't common.
            I know checked casts aren't free, but won't they also get compiled away in most cases?
            For records, like I said, just use maps, unless you need fast access. I'm good with Just Maps. Although if we're talking performance one merge and you're SOL
            [...]
            That's odd, is that first time auto completing ? CIDER has some lazy loading where code doesn't get initialized until the first time something gets evaluated. It's funny, start a repl and just send 1 and see what happens. Doesn't happen the second time.
            Overall I don't mind paying the start up cost

            JVM with C2 disabled, it'll probably be faster (at the cost of startup time) if I don't do this.

          • 4 weeks ago
            Anonymous

            Thanks for the comprehensive response, anon, and true, i could do this even in Powershell but i find it fairly annoying and hard to read, prefer to treat it like Bash, as a glorified orchestator (i don't have grievances against .NET thoughever, if F# was alive i'd use that) Not sure how Babashka works with Clojure libraries but it still should be fairly easy to sneak them in. Whatever it takes except tard-handling Python venv and pathlib frickery on Windoze.

            >babashka
            Crap. scala-cli is better. Scala tooling includes the OS library which is godlike https://github.com/com-lihaoyi/os-lib

            How does this thing work? Is a Scala interpreter that can also act like a build tool? I don't get it.

      • 4 weeks ago
        Anonymous

        >Clojure
        Clojure is shit or not shit depending on what you need. Since you want simple deployment, I think modern Java as a whole is pretty much out since nobody runs JREs anymore and, in the case of Windoze, you will need to be comfortable using jlink and jpackage to create a distributable, self-contained EXE. Outside of servers your company controls, long gone are the days of simply dropping a JAR file to somewhere in /opt.

        >Babashka
        Babashka is just a Clojure interpreter (SCI) running in a GraalVM native image. You get the benefits of AoT-compiled native binaries. However, the binaries are pretty huge since they must include huge chunks of the Java universe. (e.g. the babashka docker image is 35 MiB despite building on alpine). In addition, since there is no JVM in a native binary, you cannot rely on reflection, classloaders, etc. which makes interop with Java (and most Clojure libraries) pretty tough. There are some workarounds for this (e.g. pods) but again, using libraries that are not already bundled in Babashka requires you to thoroughly grasp how the JVM and native images work.

        Also note there is Nbb (node babashka), which is much nicer to run and do interop in simply because there is no native binary (everything runs through Node.js). But ClojureScript tooling also kinda sucks compared to Clojure. Also many Node.js libraries use async APIs but SCI doesnt support core.async, so you quickly end up in promise hell.

        [...]
        >i'm working on integrating a no-name SaaS with some shitty attorney firms' systems
        Ironically, I used to work for a Clojure shop that sold some due diligence software for law firms specializing in M&A's... We offered cloud and on-prem versions of the software. I haven't worked there for three years at this point, but they're scared by GPT-4 since that has huge potential to compete with their NLP stuff

        Since I'm hitting the 2k character limit I'll have to stop here, but list some specific requirements and I will answer.

        >m200 enjoyer
        >Actually uses Lisp at work an praises CL
        >Post pertinent and extensive replies
        I like you anon

    • 4 weeks ago
      Anonymous

      (lovesp me lisp) => T
      My favorite is CL since it's what I learned on, I just wish it was more popular. It's always sad looking for a library for something and not finding one, or finding an incomplete/abandoned one, or an old one that no longer builds/works, or one that has 0 documentation.

      >and many implementations don't have it
      every implementation that matters has it though. Also I feel like lisp really lends itself to a functional style, not sure why but seeing imperative lisp feels off somehow.

      Clojure and CL but no racket? gay. Frick you OP I'm extremely mad and pissed

      racket is really nice too. i haven't used it much but ive used the gui and graphing packages and i liked them a lot. they were easy to use, everything worked, everything looked good, there's good documentation, literal heaven. not even python has gui/graphing libraries this good.

      • 4 weeks ago
        Anonymous

        What specific libraries are you looking for and haven't found a satisfactory project?

    • 4 weeks ago
      Anonymous

      A historical cruft.
      Lisp-2 is probably the grandfather of functional programming but really things like Python are more functional-programming like today.

      No reason not to put Scheme in there instead though.

  2. 4 weeks ago
    Anonymous

    Clojure and CL but no racket? gay. Frick you OP I'm extremely mad and pissed

  3. 4 weeks ago
    Anonymous

    wheres F#, still it gets way too little attention

    • 4 weeks ago
      Anonymous

      exactly because it doesn't get attention
      from the community or from its developers

    • 4 weeks ago
      Anonymous

      Frick off Nutella

      Can somebody spoonfeed me good books on functional programming

      Haskell purple book, original SICP

  4. 4 weeks ago
    Anonymous

    Can somebody spoonfeed me good books on functional programming

    • 4 weeks ago
      Anonymous

      There is no need to read a book on functional programming. Just read the wikipedia article on it, then read the wikipedia articles on recursion and first-class functions, and you're pretty much good to go.
      If you're doing Haskell you might want to look up a bit about it's type system and monads, but it's nowhere near complicated enough to justify wasting time reading a book.

      (lovesp me lisp) => T
      My favorite is CL since it's what I learned on, I just wish it was more popular. It's always sad looking for a library for something and not finding one, or finding an incomplete/abandoned one, or an old one that no longer builds/works, or one that has 0 documentation.

      >and many implementations don't have it
      every implementation that matters has it though. Also I feel like lisp really lends itself to a functional style, not sure why but seeing imperative lisp feels off somehow.
      [...]
      racket is really nice too. i haven't used it much but ive used the gui and graphing packages and i liked them a lot. they were easy to use, everything worked, everything looked good, there's good documentation, literal heaven. not even python has gui/graphing libraries this good.

      Vast majority of lisp code is imperative.

    • 4 weeks ago
      Anonymous

      Depends on the language?

  5. 4 weeks ago
    Anonymous
  6. 4 weeks ago
    Anonymous

    you're a massive curried gay

  7. 4 weeks ago
    sage

    Object Oriented programming kicks ass

  8. 4 weeks ago
    Anonymous

    C++26 is going to have reflection.
    C++ is a functional language.
    Stay mad, nerds.

  9. 4 weeks ago
    Anonymous

    I cant grasp functional programming

  10. 4 weeks ago
    Anonymous

    what about ocaml

    • 4 weeks ago
      Anonymous

      Fun fact: software devs using OCaml make on average the most money, and it's not even close.

  11. 4 weeks ago
    Anonymous

    morons, just use Scala. Scala 3 is comfy and scala-cli is the official runner now https://scala-cli.virtuslab.org/

  12. 4 weeks ago
    Anonymous

    >common lisp
    C# or Java are literally more functional than this meme language piece of shit lmao
    >Clojure
    meme language like all LISPs
    >Haskell
    meme
    >Erlang
    meme
    >Scala
    only non meme language

    • 4 weeks ago
      Anonymous

      >C# or Java are literally more functional than this meme language piece of shit lmao
      kek this is actually true

  13. 4 weeks ago
    Anonymous

    yes, it does

    • 4 weeks ago
      Anonymous

      hi xah

  14. 4 weeks ago
    Anonymous

    Since this is a new thread, I'll try asking my question here again for more insights:
    What functional language should I use if I want to make an open source server that handles different services, like serving pages made in a custom Markup language for a client to render (kinda like PlayOnlineViewer with .pml files), a chat service, a contact service, mail service, file downloading, authentication....
    Which of one would be best suited for the task?

    • 4 weeks ago
      Anonymous

      Elixir. Really nice parallelism support and I love how you're easily able to destructure binary data.

  15. 4 weeks ago
    Anonymous

    learning haskell for my final project in programming languages class. i still prefer imperative for most projects but it is indeed frickin awesome

  16. 4 weeks ago
    Anonymous

    >babashka
    Crap. scala-cli is better. Scala tooling includes the OS library which is godlike https://github.com/com-lihaoyi/os-lib

    • 4 weeks ago
      Anonymous

      Doesn't this need to download the JDK first to execute scripts? Interesting otherwise.

  17. 4 weeks ago
    Anonymous

    Lisp is the most powerful programming language

    • 4 weeks ago
      Anonymous

      Your mom has the most powerful hole for Nuh dick (her butthole)

      • 4 weeks ago
        Anonymous

        Your mom give me free (as in freedom) sex everyday, cuckboy.

    • 4 weeks ago
      Anonymous

      Hello, RMS.
      https://stallman.org/stallman-computing.html#lisp

  18. 4 weeks ago
    Anonymous

    Unemployed thread

    • 4 weeks ago
      Anonymous

      i use both emac and lisp at my job, cope and seethe sexplet

    • 4 weeks ago
      Anonymous

      I feel bad for any zoomer who misses out because of this meme. Imagine thinking you have to subject yourself to vsc*de to pay rent.

  19. 4 weeks ago
    Anonymous

    functional programming applies kick to ass

Your email address will not be published. Required fields are marked *