monyet.cc
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Destide to Programmer Humor@lemmy.mlEnglish • 13 days ago

Infallible Code

lemmy.ml

message-square
165
fedilink
460

Infallible Code

lemmy.ml

Destide to Programmer Humor@lemmy.mlEnglish • 13 days ago
message-square
165
fedilink
  • @myotheraccount@lemmy.world
    link
    fedilink
    113•13 days ago

    ftfy

    bool IsEven(int number) {
      return !IsOdd(number);
    }
    
    bool IsOdd(int number) {
      return !IsEven(number);
    }
    
    • @balsoft@lemmy.ml
      link
      fedilink
      15•
      edit-2
      12 days ago

      You kid, but Idris2 documentation literally proposes almost this exact impl: https://idris2.readthedocs.io/en/latest/tutorial/typesfuns.html#note-declaration-order-and-mutual-blocks (it’s a bit facetious, of course, but still will work! the actual impl in the language is a lot more boring: https://github.com/idris-lang/Idris2/blob/main/libs/base/Data/Integral.idr)

      • @myotheraccount@lemmy.world
        link
        fedilink
        4•12 days ago

        I hadn’t seen Idris2. Thank you for providing me with a new rabbit hole!

        • @balsoft@lemmy.ml
          link
          fedilink
          3•12 days ago

          I’m glad to tell more people about it. It’s really quite amazing (I could write a somewhat complex algorithm and prove some properties about it in a couple afternoons, despite limited formal verification experience) and I’m sure that in 20 odd years the ideas behind it will make it into mainstream languages, just as with ML/Haskell.

Programmer Humor@lemmy.ml

!programmerhumor@lemmy.ml

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmerhumor@lemmy.ml

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
  • 17 users / day
  • 692 users / week
  • 2.76K users / month
  • 9.05K users / 6 months
  • 37.4K subscribers
  • 1.82K Posts
  • 39.1K Comments
  • Modlog
  • mods:
  • @AgreeableLandscape@lemmy.ml
  • @cat_programmer@lemmy.ml
  • BE: 0.19.3
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org