tiflolinux.org - GNU Social
  • Login

Bienvenido

  • Public

    • Public
    • Network
    • Groups
    • Popular
    • People

Conversation

Notices

  1. Ludovic Courtès (civodul@toot.aquilenet.fr)'s status on Sunday, 19-Mar-2023 00:32:46 CET Ludovic Courtès Ludovic Courtès

    When you have a state machine (or an actor) and you’re threading its state in a named ‘let’ with many variables, writing those recursive calls can quickly become tedious.

    I came up with a pretty nice macro to help with that:
    https://git.savannah.gnu.org/cgit/shepherd.git/commit/?id=01db6552f9f70c4a5fff32831c04d75313fb57a4

    It can be thought of as a named ‘let’ with named arguments.

    #Scheme

    In conversation Sunday, 19-Mar-2023 00:32:46 CET from toot.aquilenet.fr permalink

    Attachments


    • Ludovic Courtès (civodul@toot.aquilenet.fr)'s status on Sunday, 19-Mar-2023 15:47:09 CET Ludovic Courtès Ludovic Courtès
      • Ekaitz Zárraga 👹

      @ekaitz_zarraga Probably the best way to study macros is to look at the result of macro expansion. You can do that in Emacs with Geiser or at the REPL, using the “,expand” or “,optimize” commands. Example:

      ,expand (false-if-exception whatever)

      In conversation Sunday, 19-Mar-2023 15:47:09 CET permalink
    • Ludovic Courtès (civodul@toot.aquilenet.fr)'s status on Sunday, 19-Mar-2023 18:41:35 CET Ludovic Courtès Ludovic Courtès
      • Ekaitz Zárraga 👹

      @ekaitz_zarraga In a nutshell, ‘syntax-rules’ macros list clauses; each clause has a pattern against which the input code is checked, and code to emit when the input code matches that pattern. It’s often referred to “macros by example”.

      In a way, it’s similar to a “sed -es/PATTERN/REPLACEMENT/” expression, where PATTERN can have sub-expressions and REPLACEMENT can have “backrefs”.

      In conversation Sunday, 19-Mar-2023 18:41:35 CET permalink

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

tiflolinux.org - GNU Social is a social network, courtesy of tiflolinux.org. It runs on GNU social, version 2.0.1-beta0, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All tiflolinux.org - GNU Social content and data are available under the Creative Commons Attribution 3.0 license.