正在发声 | 中文Lemmy社区
  • 社群
  • 发帖
  • 创建社群
  • heart
    支持Lemmy
  • search
    搜索
  • 登录
  • 注册
Destide@feddit.uk 发于 Programmer Humor@lemmy.mlEnglish · 1 年前

Infallible Code

lemmy.ml

message-square
149
link
fedilink
460

Infallible Code

lemmy.ml

Destide@feddit.uk 发于 Programmer Humor@lemmy.mlEnglish · 1 年前
message-square
149
link
fedilink
  • myotheraccount@lemmy.world
    link
    fedilink
    arrow-up
    115
    ·
    1 年前

    ftfy

    bool IsEven(int number) {
      return !IsOdd(number);
    }
    
    bool IsOdd(int number) {
      return !IsEven(number);
    }
    
    • balsoft@lemmy.ml
      link
      fedilink
      arrow-up
      15
      ·
      1 年前

      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
        arrow-up
        4
        ·
        1 年前

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

        • balsoft@lemmy.ml
          link
          fedilink
          arrow-up
          3
          ·
          1 年前

          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

从外站实例订阅

发帖
您尚未登录。但是您可以使用 Lemmy 或 Mastodon 等其他联邦宇宙帐户进行订阅。为此,请将以下内容粘贴到您所在实例的搜索框中:[email protected]

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.
可见性: 公开
globe

该社群可以联合到其他实例,并允许其它实例的用户发贴/评论。

  • 17 用户 / 日
  • 525 用户 / 周
  • 857 用户 / 月
  • 3.97K 用户 / 6 月
  • 1 本站订阅者
  • 44.3K 订阅者
  • 1.47K 条帖子
  • 15.3K 评论
  • 管理记录
  • 社群管理:
  • cat_programmer@lemmy.ml
  • BE: 0.19.21
  • 管理记录
  • 条款
  • 实例
  • 文档
  • 代码
  • join-lemmy.org