I saw a project a couple weeks back which allows writing and running Crystal methods inline inside a Ruby file. It’s a neat project, and I don’t want to take away from it but something in the README example looked off to me. require ‘crystalruby’ require ‘benchmark’ module Fibonnaci crystalize [n:

  • FizzyOrange@programming.dev
    link
    fedilink
    arrow-up
    5
    ·
    7 months ago

    It’s easy to make Fibonacci fast. And even so I wouldn’t count non-idiomatic code. The first version is clearly what you would write.

  • HParker@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    7 months ago

    Very cool that Ruby can get that much faster with relatively small changes. Even just the implicit return + array allocation tip is a useful one on its own.