πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fj.lang.functional
Article #21

Re: q

#21
From: MAEDA Atusi/前田敦司
Date: Mon, 10 Feb 1997 00:00
39 lines
1573 bytes
θ‡ͺε·±γƒ•γ‚©γƒ­γƒΌγ§γ™οΌŽ

    mad> (defmacro handle (tag value handler)
    mad>   `(block #1=#:not-thrown
    mad>      (catch ,tag
    mad>        (return-from #1# ,value))
    mad>      ,handler))

    mad> (handle 'f
    mad>   ;; value
    mad>   (+ 1 ((lambda (g) (handle 'f
    mad>                             (funcall g 1)
    mad>                             1))
    mad>         #'(lambda (y) (throw 'f y))))
    mad>   ;; handler
    mad>   1)
    mad> => 2

γ“γ‚ŒοΌŒ

(defmacro handle (tag value handler)
  `(block #1=#:not-thrown
     (multiple-value-call ,handler
      (catch ,tag
       (return-from #1# ,value)))))

(handle 'f
  ;; value
  (+ 1 ((lambda (g) (handle 'f
                            (funcall g 1)
                            #'(lambda (x) x)))
        #'(lambda (y) (throw 'f y))))
  ;; handler
  #'(lambda (x) x))

γ¨γ—γŸζ–ΉγŒζ„Ÿγ˜ε‡Ίγ¦γΎγ™γ­οΌŽ

				前田敦司
Technical Details
Message-ID: <MAD.97Feb10104038@tanzanite.math.keio.ac.jp>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <AKAMA.97Jan9005151@siena.is.s.u-tokyo.ac.jp>

Show Full Headers
Complete Article Headers
X-Google-Language: Japanese,JIS
X-Google-Thread: f5c49,590ed48083e6216
X-Google-Attributes: gidf5c49,public
From: mad@math.keio.ac.jp (MAEDA Atusi/前田敦司)
Subject: Re: q
Date: 1997/02/10
Message-ID: <MAD.97Feb10104038@tanzanite.math.keio.ac.jp>
X-Deja-AN: 217691011
sender: news@sync.cs.keio.ac.jp
references: <AKAMA.97Jan9005151@siena.is.s.u-tokyo.ac.jp>
content-type: text/plain; charset=ISO-2022-JP
organization: Faculty of Sci. and Tech., Keio Univ., Yokohama, Japan.
mime-version: 1.0 (generated by tm-edit 7.66)
reply-to: mad@math.keio.ac.jp
newsgroups: fj.lang.functional