unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Thien-Thi Nguyen <ttn@gnu.org>
To: guile-user@gnu.org
Subject: shunt
Date: Mon, 29 May 2017 09:47:00 +0200	[thread overview]
Message-ID: <87wp90w1e3.fsf@zigzag> (raw)

[-- Attachment #1: Type: text/plain, Size: 1597 bytes --]


In SGF Utils[0], i use ‘shunt’:

 (define-macro (shunt proc-names . otherwise)
   `(lambda (command . args)
      (apply (case command
               ,@(map (lambda (name)
                        `((,name) ,name))
                      proc-names)
               (else
                ,(if (null? otherwise)
                     '(error "bad command:" command)
                     `(lambda args
                        ,(car otherwise)))))
             args)))

to delegate commands to a closure's set of internal procedures.
Is something similar already included w/ Guile?

___________________________
[0] http://www.gnuvola.org/software/sgf-utils/

    $ cd .../sgf-utils/src && grep -nHF -e shunt  *.scm
    base.scm:27:  #:export (catch-one FE shunt fs fop<-))
    base.scm:41:(define-macro (shunt proc-names . otherwise)
    base.scm:42:  ;; (put 'shunt 'scheme-indent-function 1)
    gnugo.scm:54: ((base) #:select (shunt fs))
    gnugo.scm:173:    (shunt (set-board-size!
    render.scm:27: ((base) #:select (FE fs shunt))
    render.scm:106:    (shunt (h1)
    render.scm:209:    (shunt (try))))
    render.scm:910:    (define I (shunt (clear!
    sgfv.scm:85: ((base) #:select (FE shunt fs fop<-))
    sgfv.scm:312:    (shunt (at forw! back! vary!

-- 
Thien-Thi Nguyen -----------------------------------------------
 (defun responsep (query)
   (pcase (context query)
     (`(technical ,ml) (correctp ml))
     ...))                              748E A0E8 1CB8 A748 9BFA
--------------------------------------- 6CE4 6703 2224 4C80 7502


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

                 reply	other threads:[~2017-05-29  7:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wp90w1e3.fsf@zigzag \
    --to=ttn@gnu.org \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).