GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

# Fizzbuzz up to command line argument [default 10 if absent] set 'at 0 set 'target (get args 0) if target { set 'target (to-int target) # ARGV is strings... } { set 'target 10 # No ARGV } set '=0 { = 0 (get args 0) } while {< at target} { set 'at (+ at 1) set 'three (=0 (% at 3)) set 'five (=0 (% at 5)) print (if three { if five { return "Fizzbuzz" } { return "Fizz" } } { if five { return "Buzz" } { return at } }) sp } print ln

Download link

https://files.mastodon.social/media_attachments/files/114/310/168/639/183/200/original/c806dbcab05c9a54.png

Notices where this attachment appears

  1. Embed this notice
    mcc (mcc@mastodon.social)'s status on Friday, 11-Apr-2025 03:06:42 JST mcc mcc
    in reply to

    So after a prelude containing reimplementations of if, while, int comparisons, and "noop", I am now ready to implement "fizzbuzz". I do not need an implementation of "fizzbuzz", I'm supposed to be doing AOC2024 day 6. But at least I know my helper routines work!

    Fizzbuzz source:

    https://github.com/mcclure/aoc2024/blob/6d12e9cf65158b5f511da8545d263f4ed1dcad99/06-01-guard/src/test-fizzbuzz.l0

    I was GOING to implement a `proc` that modified function code in-place to add local variable support, but debugging `while` took a lot out of me, so I think I will not do that for this project.

    In conversation about a month ago from mastodon.social permalink
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.