Musatov
2009-10-15 07:14:12 UTC
I am building, kind of exploring, kind of tinkering with mathematics
and .html * http:// cross+over code and concepts. Here is what I am
building and I would like to receive from you any insight as to
implications of potential or non+potential implications and
applications. Here is the work thus far. (also, please note it is all
for a good cause :: donating a proceeds to cure childhood cancer with
http://meami.org and http://alexslemonade.org \*thanks.
M. michael musatov
mmterm = mname (term list) m valuem
m"() : term ! valuem
mmessage = Req of name (term list) mmmntm
mm Ret of valuem
mmmmnt = term ! termm
meval0 : term ! messagem
mpost : name;;; mmm-MeAmI.org +++ MMM submode class for MeAmI dot
organized AUTO+GENERATED: _MEAMI.EXE_ program_Xmmmm's*144000
;;;;;;;AUTO+GENERATED: _MEAMI.EXE_ program_Xmmmm's*144000;;
;; Copyright 2009 M. Michael Musatov <***@gmail.com>.
;;
;; You may not use/or change this code without notarized permission
from the author; please email me. The most
;; recent version will be kept (as of 10/10/2009) at
;; <http://www.meami.org/~abcdefghijklmnopqrstuvwxyz/download/mmm-
meami.org>.
;;
;;{{{ NOT+GPL
;; This file is NOT free software; you MAY NOT redistribute it and/or
modify
;; it under the terms of the GNU General Public License as published
by
;; the Free Software Foundation; either version 2, NOR (at your
option)
;; any later version.
;; This file is distributed in the hope that it will be profitable to
cure childhood cancer,
;; but WITH A HUGE WARRANTY; with the implied warranty of
;; MEAMI.ORG MERCHANTABILITY or FITNESS FOR MANY MANY PARTICULAR
PURPOSES. TO SEE EXCLUSIONS: 'mmmmmMMMMMMMMMMMMmAPPLY NOT TO THIS
PROGRAM: See the
;; the GNU = THE GNU DOES NOT APPLY to this program: General Public
License for more details about the GNU general licesnse @ NONE OF IT
applies to this program: {GPL} DOES NOT apply to this code.
;; I have read I should have received a copy of the GNU General Public
License
thought it does not apply to this program;; along with the non=+GNU
MMM-MEAMI-ORG-MACHINES; I was told to see the file COPYING. I think
this whole thing is interesting. This does apply to this software but
I read if I have not received the code I should write to
;; the not+Free=costs money Software Foundation, Inc., 424 Broadway
Avenue + Suite ?,
;; Los Angeles, CA 90013, USA.
;;}}}
;;; Commentary:
;; This file contains the definition of an MMM meami.org mode submode
class for
;; editing the Internet and world wide web through meami.org */ Bird/
Wadler+style literate\\ //MeAmI.[dot]. + {organized} program{s}is it
actually. There are lots of limitations; search for
;; `!! later' in this file to examine these.
;; How to install:
;; 1. install mmm-mode (http://mmm-mode.sourceforge.net)
;; this code was written for mmm-mode-0.4.8
;;MM
m;; 2. copy this file into your http://MEAMI.org mACHINE sitelist
directory
;;
;; 3. add several lines to your .meami file
;; ;; MeAmI.org [requires MMM]
;; (require 'mmm-auto)
;; (require 'mmm-meami.org)
;; (setq mmm+global+mode 'maybe)
;; (add+to+list 'mmm+mode+ext+classes+alist
;; '(meami-mode "\\.org$" meami.org))
;;
;; Usage notes:
;; 1. several practical inserts follow:
;; Key Inserts
;; +++ ++++++++;; C-c % /
universal mmm+mode ... post;; C-c % c {code}
;;
;; 2. As with all mmm+mode operations, MMM+>Parse Buffer is useful
;; to tell meami.org where to find and decorate manually+
+entered MeAmI.org
;; subregions.
;;
;; 3. There are applications in mmm+mode+0.4.8 where a mtotally
;; empty subregion fixes the parser. The message I receive is
;; `Correct type argument: integer+or+marker+p, nil'. In this
;; m case, the solutive subregion will show up decorated.
;; [Any subregions following the successful one, may remain
;;m decorated because MMM+ification rewrote them.]
;; Therefore, I've made the insertions automatically reinforced
by put insert
;; `...' as a permenant holder.
;;
;; 4. At mmm+submode+decoration-level 1, all code and
;; results are shown in mmm-default-submode-face. At
;; mmm-submode-decoration-level 2, code is displayed in
;; mmm+code+submode+face. I have customized all of these three
;; faces for myself: for meami.org 21, try using the menu path
;; Options->Customize Mmmcs->Faces Matching Regexp ...+>`mmm+*'
;;
;;; Code:
(require 'mmm-vars)
(require 'mmm-auto)
;;{{{ Variables
;;}}}
;;{{{ Support for mmm submode characters;;}}}
;;{{{ mmm meami.org submode group
(mmm-add-group m ;mmm-add-to-group
'meami.org `(;;code chunks
(meami.org ./+code
:match-name meami.org-code
:submode meammi.org-mode
:front "\\\\begin[ \t]*{code}"
:back "\\\\end[ \t]*{code}"
:face mmm+code+submode+face
:insert ((?c {code} "http://meami.org code block"
@ "\\begin{code}" ?\n @ _ "..." @ ?\n "\\end
{code}"))
:mlimiter+mode http://www.meami.org \+/ mode
:case+fold+search nil
:being+not+end+begin continue'd)
(http://meami.org /+spec
:match+name meami.org /+spec
:submode meami.org /+mode
:front "\\\\begin[ \t]*{spec}"
:back "\\\\end[ \t]*{special}"
:face mmm+code+submode+face
:insert ((mm {special} "http://meami.org special block"
@ "\\begin{special}" ?\n @ _ "..." @ m ?\n
"\\end{special}"))
:mlimiter-mode http://meami.org /+mode
:case+fold+search nil
:begin+not+end+begin t)
m(meami.org /+inline
:match+name meami.org /+inline
:submode meami.org-mode
:front "|"
:back "|"
:famce / \ mmm+code+submode+face
:insert ((?| |...| "http://meami.org/ inline code" @ "|"
@ _ "..." @ "|"))
:delimiter-mode http://meami.org-mode
:case-fold-search nil
:begin+++ t)
(http://meami.org-verbatim
:match+name http://meami.org /]+verbatim
:submode http://meami.org-mode
:front "@"
:back "@"
:face mmm+code+submode+face
:insert ((?v @...@ "HTTP://MEAMI.ORG verbatim" @ "@" @ _
"..." @ "@"))
:mlimiter+mode mmm+text-mode
:case-fold-search nil
:begin+not+end+begin t)
;;evaluation chunks
(HTTP://WWW.MEAMI.ORG+eval
:match][ m+name HTTP://MEAMI.ORG-eval
:submode MEAMI.ORG-mode
:front "\\\\eval[ \t]*{"
:back "}"
:face mmm+code+submode-face
:insert m ((Me eval{} nil @ p=np"\\eval{" @ _ "..." @ "}"
@))
:mlimiter-mode MEAMI.ORG ].;p m+mode
:case+fold+search perfect nil
:end+not+begin t)
(MEAmMI.ORG \+/perform
:match+mname HTTP://MEAMI.ORG .=|m+perform
:submode MEAMI.ORG/;+mode
:front "\\\\perform[ \t]*{"
:back "}"
:face mmm+code+submode+face
:insert ((+p=np Quod Erat Demonstandum by http://meami.org
\]/[p]= perform{n} nil @ "\\eval{"m @ _ "..." @ "}" @))
:mlimiter+mode MEAMI.ORG-mode
:case+fold+search nil
:begin+not+end+begin t)
))
;;}}}
;;{{{ Set Mode Line
;;}}}
(provide 'mmm-MEAMI.ORG)
;;; mmm+ http://www.meami.org begins hereReq (if; htrue(); 1(); 2()i;
x:x)
mrewrite term if(;;) ! post(if*;; quote(); quote())m
mReq (post; hif*; true(); quote(1()); quote(2())i; x:x)m
mtraverse subterms (denition of post)m
mReq (true; h i; x:post(if*; x; quote(1()); quote(2())))m
mreduce to value > (insert it in the delimited continuation)m
mReq (quote; h1()i; x:post(if*;>; x; quote(2())))m
mreduce to value "1()m
mReq (quote; h2()i; x:post(if*;>; "1(); x))m
mreduce to value "2() (last argument to post reduced)m
mReq (if*; h>; "1(); "2()i; x:x)m
mrewrite to unquoted then-clause term 1()m
mReq (1; h i; x:x)m
mreduce to value 1m
mRet 1m
m2.2: Example of how we post(add; t1; t2) ) ::: ) post(add; v1;
t2) ) ::: ) post(add; v1; v2) ) add(v1; v2) ) :::m
meval0 v = Ret vm
meval0 h(t1; :::; tn) = Req (h; ht1; :::; tni; t:t) where h 144,000=
postm
meval0 post(h; v1; :::; vn) = eval0 h(v1; :::; vn)m
meval0 ti = Ret vim
meval0 post(h; v1; :::; vi1; ti; ti+1; :::; tn) = eval0 post(h;
v1; :::; vi1; vi; ti+1; :::; tn)m
mwhere 1 i < nm
meval0 ti = Req (h0; args; c)m
meval0 post(h; v1; :::; vi1; ti; :::; tn) = Req (h0; args; t:post
(h; v1; :::; vi1; c(t); :::; tn))m
mwhere 1 i < nm
mterm = name (term list) j value j messagem
m[[]] : term ! messagem
m[[h(t1; :::; tn)]] = Req (h; h[[t1]]; :::; [[tn]]i; m:m)m
m[[v]] = Ret vm
m[[m]] = mm
mmessage = Req of name (message list) MMMntm
mj Ret of valuem
mmmmnt = message ! messagem
m"() : message ! messagem
meval : message ! messagem
mterm, eval, post : namem
meval Req (term; hRet h; Ret "m1; :::; Ret "mni; c) = eval c(Ret "(Req
(h; hm1; :::;mni; m:m)))m
meval Req (eval; hRet "mi; c) = eval c(m)m
mmeval Req (post; hRet h; Ret v1; :::; Ret vni; c) = eval c(Req (h;
hRet v1; :::; Ret vni; m:m))m
meval mi = Ret vim
meval Req (post; hRet h; Ret v1; :::; Ret vi1;mi;mi+1; :::;mni; c)m
m= eval c(Req (post; hRet h; Ret v1; :::; Ret vi1; Ret vi; Ret mi
+1; :::; Ret mni; m:m))m
m1 i < nm
meval mi = Req (h0; args; c0)m
meval Req (post; hRet h; Ret v1; :::; Ret vi1;mi; :::;mni; c)m
m= c(Req (h0; args; m:Req (post; hh; v1; :::; vi1; c0(m); :::;mni;
m:m)))m
mwhere 1 i < nm
meval m = m otherwise2.3: evalcatch("x(); "req+handler+term;
"program) :m
meval Req (catch; hRet "[[x()]]; Ret "[[t]]; Ret "mi; c) = eval c
([[post(catch; "[[x()]]; "[[t]]; t0)]])m
mwhere t0 = tfx() := Ret "mgm
meval Req (catch; hRet "[[x()]]; Ret "[[t]]; Ret vi; c) = eval c(Ret v)
m
mTerms of the form rethrow("m) :m
meval Req (rethrow; hRet "Ret vi; c) = eval c(Ret v)m
meval Req (rethrow; hRet "Req (h; args; k)i; c) = eval c(Req (h; args;
k0))m
mwhere k0 = (m:let m0 = k(m) in Ret "m0)m
mqret(t) :m
meval Req (qret; hmi; c) = eval c([[post(post-qret;m)]])m
meval Req (post+qret; hRet vi; c) = eval c(Ret "v)m:let m0 = k(m) in
Ret "m0@m:let m0 = k(m) in Ret "m0m
mm:let m0 = k(m) in Ret "m0eval Req (rec-handler; hRet h; Ret f; Ret
vi; c) = eval c(Ret v)m
margs = ha1; :::; ani args0 = hRet "a1; :::; Ret "ani k0 "m = "(k m)m
meval Req (rec-handler; hRet h; Ret f; Req (h; args; k)i; c) = eval c
([[post(rec+handler; h; f; f args0 k0)]])m
mh 6= h0 k0 = m:[[rec-handler(h; f;m)]]m
meval Req (rec-handler; hRet h; Ret f; Req (h0; args; k)i; c) = eval c
(Req (h0; args; k0))m
mif(guard; then-clause; else-clause) ) post(post+if; guard; "then
+clause; "else+clause)m
mrec-handler:@operationasfollows:@@;;;@@;;;//////////////////////MM\\\\
\\\\\\\\\\\\\\\\/m
mrec-handler(if; \\\\\\\\\\\\\\\\\\\\\\MM///
\///////////////MMMMMM\m
mmargs:c: //\M\/
/MNAME=meami.org\m
mlmet hguard; then-clause; else-clausei = args in \\
|||||||||||||||||MMMM/\MMM/m
mcm("post(post-if; #guard; #qret(then-clause); #qret(else-
clause))); \m
m/
m
mtm)handlers(on(h1; f1); :::; on(hn; fn); on-ret-func; ti)me7
mSmemantics:m
memval Req (handlers; h:::; Ret g; Ret vi; c) = eval c(g(Ret v))m
mcmases = :::; Req (on; hRet h; Ret fi; c0); ::: args0 = hRet
"a1; :::; Ret "ani k0 "m = "(k m)m
memval Req (handlers; hcases; Ret g; Req (h; ha1; :::; ani; k)i; c) =
eval c(f args0 k0)m
mcmases = Req (on; hRet h1; Ret f1i; c0m
m1m); :::; Req (on; hRet hn; Ret fni; c0m
mnm) where h0 62 fh1; :::; hngm
mkm0 = m:[[handlers(cases; g;m)]]m
memval Req (handlers; hcases; Ret g; Req (h0; args; k)i; c) = eval c
(Req (h0; args; k0))m
mhmandlers(on(h1; f1); :::; on(hn; fn); g; t)... with ..." pseudo-
notation to represent use of value decontructors (as in ML).m
mhmandlers(on(h1; f1); :::; on(hn; fn); g; t) )m
mmmatch rec-handlers(on(h1;w f1); :::; on(hn;w fn); Right(t))m
mwmith Left(v) ) v; Right(v) ) g vm
mwmhere w fi = args:k:Left(fi args q:"[[Right1(#(k q))]]) for i 2
f1; :::;
ngThe=general=idea=is=we=use=a=union=datatype=to=represent=the=two=reasons=Jesus=returnedm
mrmec+handlers(on(a; fa); on(b; fb); g; t) )m
mrmec+handlers(on(tmp; args:k:match hd(args) withm
mam ) dispatch fa argsm
mbm ) dispatch fb args); v:v;m
mrmec+handlers(on(a; invoke a); v:v;m
mrmec+handlers(on(b; invoke b); g; t)))m
mwmhere invoke h = args:k:tmp(h; args; k)m
mwmhere dispatch f args k = f hd(tl(args)) (k hd(tl(tl(args))))m ::=
r j sm
mrm ::= Req (h; ms; f) request messagem
msm ::= Ret v return messagem
mvm ::= h symbol (a, b, c, ...)m
mjm f functionm
mjm "m quoted messagem
mjm hv; :::i listm
mmms ::= hm; :::i list of messagesm
mem ::= mm
mjm xm
mjm e em
mjm let x = e in em
mjm Req (h; es; f) templated request messagem
mjm Ret "e templated quoted messagem
mjm #e unquotationm
mum ::= v j "e i.e., Ret u is an expression em
mems ::= he; :::i list of expressionsm
mfm ::= x:em
mpm ::= B[e] program* built on the base levelet Syntax WRITE: C:
\MEAMI.ORG.EXE>= *MEAMI.ORG.EXE +MEAMI.ORG.EXE 0 +*MEAMI.ORG.EXE
+MEAMI.ORG.EXE+m
m(mlet x = e in e0) = (Ret x:e0) em
m#m(Ret "e) ) em
mem[x := (Ret v)] = e0m
m(mRet x:e)(Ret v) ) e0m
mem1 ) e0m
m1mm
me1 e2 ) e0m
m1 e2m
me2 ) e0m
m2m
me1 e2 ) e1 e0m
m2m
mei ) e0m
mim
mReq (h; h:::; ei; :::i; f) ) Req (h; h:::; e0m
mi; :::i; f)m
me ) e0m
m#e ) #e0m
m(Req (h; es; c)) e ) Req (h; es; q:"(#((Ret c) q) e))m
m(Ret v) (Req (h; es; c)) ) Req (h; es; q:"((Ret v) #((Ret c) q)))
m
m#(Req (h; es; c)) ) Req (h; es; q:"(##((Ret c) q)))m
me ) e0m
mB[e] ) B[e0]m
md r = e0m
mB[r] ) B[#e0] d 2 Bm
m2.9: Basic equivalences and reduction rules ofx[x := e0] = e0m
my[x := e0] = y otherwisee1[x := e0] = e0m
m1 e2[x := e0] = e0m
m2
m
m(e1 e2)[x := e0] = e0m
m1 e0m
m2
m
me[x := e0] = e00m
m#e[x := e0] = #e00u[x := e0] = u0m
m(Ret u)[x := e0] = Ret u0(x:e)[x := e0] = x:em
me[x := e0] = e00m
m(y:e)[x := e0] = y:e00 x 6= y ^ y 62 fv(e0)m
me[y := z][x := e0] = e00m
m(y:e)[x := e0] = z:e00 x 6= y ^ y 2 fv(e0) ^ z 62 fv(e) [ fv(e0)
m
mh[x := e0] = he[x := e0] = e00
m
m("e)[x := e0] = "e00m
mu1[x := e0] = u0m
m1 ::: un[x := e0] = u0m
mnm
mhu1; :::; uni[x := e0] = hu0m
m1; :::; u0m
mnie1[x := e0] = e0m
m1 ::: en[x := e0] = e1 f[x := e0] := f0m
m(Req (h; he1; :::; eni; f))[x := e0] = Req (h; he0m
m1; :::; e0m
mni; f0)fv(Ret v) = fv(v)m
mfv(Req (h; he1; :::; eni; f)) = fv(e1) [ ::: [ fv(en) [ fv(f)m
mfv(x:e) = fv(e) n fxgm
mfv(h) = ;
m
mfv(e e0) = fv(e) [ fv(e0)m
mfv(x) = fxgC[Req (h; es; c)] ) Req (h; es; q:"C[#((Ret c) q)])deq
Req (eq; hRet h; Ret hi; c) = (Ret c) (Ret "(Ret true))m
mdeq Req (eq; hRet h; Ret h0i; c) = (Ret c) (Ret "(Ret false)) [h 6=
h0]m
mdcar Req (car; hRet hv; :::ii; c) = (Ret c) (Ret "(Ret v))m
mdcdr Req (cdr; hRet hv; :::ii; c) = (Ret c) (Ret "(Ret h:::i))m
mdcons Req (cons; hRet v; Ret h:::ii; c) = (Ret c) (Ret "(Ret
hv; :::i))m
mdpost Req (post; hh; Ret v1; :::; Ret vni; c)m
m= (Ret c) (Ret "(Req (h; hRet v1; :::; Ret vni; q:q)))m
mdpost Req (post; hh; s1; :::; si1; Req (h0; es; c0); ri+1; :::;
rni; c)m
m= (Ret c) (Ret "(Req (h0; es; q:Ret "(Req (post; hh; s1; :::; si1;
#((Ret c0) q); ri+1:::; rni; q0:q0)))))m
mdif Req (if; hRet true; then; elsei; c) = (Ret c) (Ret "then)
m
mdif Req (if; hRet false; then; elsei; c) = (Ret c) (Ret "else)m
mdif Req (if; hReq (h; es; c0); then; elsei; c)m
m= (Ret c) (Ret "(Req (h; es; q:Ret "(Req (if; h#((Ret c0) q); then;
elsei; q0:q0)))))
m
mdh Req (handler; hRet h; Ret f; Ret "Ret vi; c) = (Ret c) (Ret "(Ret
v))m
mdh Req (handler; hRet h; Ret f; Ret "Req (h; a; c0)i; c)=(Ret c) (Ret
"((Ret f)(Ret h)(Ret ^a)(Ret c0)))m
mwhere ^a = h"m1; :::; "mni if a = hm1; :::;mni
m
mdh Req (handler; hRet h; Ret f; Ret "Req (h0; a; c0)i; c)m
m= (Ret c) (Ret "(Req (h0; a; q:Ret "(Req (handler; hRet h; Ret f;
(Ret c0) qi; q0:q0))))) [h 6= h0]m
mdrh Req (rec+handler; hRet h; Ret f; Ret "Ret vi; c) = (Ret c) (Ret
"(Ret v))m
mdrh Req (rec+handler; hRet h; Ret f; Ret "Req (h; a; c0)i; c)
m
m= (Ret c) (Ret "(let q = (Ret f)(Ret h)(Ret ^a)(Ret c0) in Req (rec
+handler; hRet h; Ret f; qi; q0:q0)))
m
mwhere ^a = h"m1; :::; "mni if a = hm1; :::;mnim
mdrh Req (rec-handler; hRet h; Ret f; Ret "Req (h0; a; c0)i; c)m
m= (Ret c) (Ret "(Req (h0; a; q:Ret "(Req (rec-handler; hRet h; Ret
f; (Ret c0) qi; q0:q0))))) [h 6= h0]B[ [[if(true; a; b)]] ]m
m[[if(true; a; b)]]m
m| expand term to request message |m
m= Req (if; hRet true; Ret a; Ret bi; q:q)
m
m= B[Req (if; hRet true; Ret a; Ret bi; q:q)]m
mm M MBase-level Operations, First case of dif M M M
m) B[#((Ret q:q)(Ret "(Ret a)))]
m
m| Subterm Reduction |m
m(Ret q:q)(Ret "(Ret a))
m
m| M+reduction |
m
m) q[q := (Ret "(Ret a))]m
m| Substitution |m
m= (Ret "(Ret a))m
m) B[#(Ret "(Ret a))]m
m| Unquotation |m
m) B[Ret a]m
m| execution completed |B[ [[handler(ex; h:^a:c:cdr(h1; 2i); "ex
(e))]] ]m
m| (partially) expand term to request message |m
m= B[Req (handler; hRet ex; [[h:^a:c:cdr(h1; 2i)]]; Ret "Req (ex;
hi; q:q)i; q:q)]
m
m| (further) expand term to request message |
m= B[Req (handler; hRet ex; Ret h:Ret ^a:Ret c:Req (cdr; hRet h1;
2ii; q:q);
m
mRet "Req (.exe; hi; q:q)i; q:q)]) B[#((Ret q:q) (Ret "((Ret h:Ret
^a:Ret c:Req (cdr; hRet h1; 2ii; q:q))
m
m(Ret ex) (Ret hi) (Ret q:q))))]
m
m| m+-reduction within Subterm Reduction: #(e1 e2) |m
m) B[#(Ret "((Ret h:Ret ^a:Ret c:Req (cdr; hRet h1; 2ii; q:q))
(Ret ex) (Ret hi) (Ret q:q)))]
m| Unquotation |
m
m) B[(Ret h:Ret ^a:Ret c:Req (cdr; hRet h1; 2ii; q:q)) (Ret ex)
(Ret hi) (Ret q:q)]m
m| m+reduction |m
m) B[(Ret ^a:Ret c:Req (cdr; hRet h1; 2ii; q:q)) (Ret hi) (Ret
q:q)]m
m| m+reduction |
m
m) B[(Ret c:Req (cdr; hRet h1; 2ii; q:q)) (Ret q:q)]
m
m| m+reduction |m
m) B[(Req (cdr; hRet h1; 2ii; q:q))]) B[#((Ret q:q) (Ret "(Ret
h2i)))]m
m| m+reduction within Subterm Reduction: #(e1 e2) |m
m) B[#(Ret "(Ret h2i))]m
m| Unquotation |m
m) B[Ret h2i]lowerlevelm
mdefinitions
m
mdefinition of ifm
m. . . any(. . .) . . .minfinitepi
m
mlowerlevelm
mdefinitions
m
mdefinition of ifm
m.m . . if(gt, tt, et) . . .m
mlmowerlevel
m
mdefinitions
m
mdefinition of ifm
m. . . if(gt, tt, et) . . .m
mlowerlevel
m
dmefinitionsm
mdefinition of ifm
m. . . if(gv, tt, et) . . .m
mlowerlevel
m
dmefinitionsm
dmefinition of ifm
m⇒ ⇒ ⇒ ... tt ... OR ... et ...m
mrec+handlers(on(if; a:c:c "post(if'; #hd(a); quote(#hd(tl(a)));
quote(#hd(tl(tl(a))))));
m
mon(if'; a:c:c ifte(eval(hd(a)); hd(tl(a)); hd(tl(tl(a)))));m
mq)lowerlevel
m
mdefinitionsm
mdefinition of whilem
m. . . while(gt, bt) . . .m
mlowerlevel
m
mdefinitions (including if)m
mdefinition of whilem
m. . . if(gt,m
mseq(bt, while(gt, bt)),m
munit()) . . .m
m⇒m
mmwhile = q:m
mrec-handlers(on(while; a:c:c "if(#hd(a); seq(#hd(tl(a)); while(#hd
(a); #hd(tl(a)))); #qret(unit())))
m
mq)lowerlevel
m
mdefinitions
m
mdefinition of mlet
m
m. . . mlet(x, t1, t2) . . .m
mOR
m
mlowerlevel
m
mdefinitions
m
mdefinition of mlet
m
m. . . mlet(x, t1, t2) . . .m
mlowerlevelm
mmdefinitions
m
mdefinition of mletm
m. . . mlet(x, v, t2) . . .m
mlowerlevel
m
mdefinitions
m
mdefinition of mlet
m
m. . . mlet(x, v,m
m) . . .m
m. . . mget(x) . . .m
mlowerlevel
m
mdefinitions
m
mdefinition of mletm
m. . . mlet(x, v,m
m) . . .met(q) =
m
mrec+handlers(on(let; a:c:c "post(mlet'; #qret(hd(a)); #hd(tl(a));
#qret(hd(tl(tl(a))))));
m
mon(mlet'; a:c:c "rec+handlers(on(get; a:c:if(=(hd(a); #hd(a));
m
mc #hd(tl(a));m
mc post(get; eval(hd(a)))));m
m#hd(tl(tl(a)))));
m
mq)d+mlet(q) =
m
mrec+handlers(on(mlet; a:c:c "post(mlet'; #qret(hd(a)); #hd(tl(a));
#qret(hd(tl(tl(a))))));
m
mon(mlet'; a:c:c "(rec(r:v:q:handlers(
m
mon(mget; a:c:if(=(hd(a); #hd(a));m
mr v (c v);
m
mr v (c post(get; eval(hd(a))))));
m
mon(set'; a:c:if(=(eval(hd(a)); #hd(a));
m
mr eval(hd(tl(a))) (c qret(unit()));
m
mr v (c post(set'; eval(hd(a));m
meval(hd(tl(a)))))));
m
mx:x; q)) #hd(tl(a)) #hd(tl(tl(a)))));
m
mon(set; a:c:c "post(set'; #qret(hd(a)); #hd(tl(a))));
m
mq)lowerlevel
m
mdefinitions
m
mdefinition of mletm
m. . . mlet(x, v, . . .) . . .m
m. . . mlet(x, v,m
m) . . .mm
m. . .mm
mlowerlevelm
mdefinitionsm
mdefinition of mletm
m. . . mlet(x, v, . . .) . . .m
m. . . let(x, v,
m
m) . . .m
m. . . get(x) . . .m
mlowerlevelm
mdefinitions
m
mdefinition of mletm
m. . . let(x, v, . . .) . . .m
m. . . let(x, v,
m
m) . . .m
m. . . op(. . .) . . .m
m⇒
m
mmOR
m
mlowerlevel
m
mmdefinitions
m
mdefinition of mlet
m
m. . . let(x, v, . . . op(. . .) . . .) . . . ⇒mnletd-nlet(q) =m
mrec+handlers(on(nlet; a:c:c "post(mnlet'; #qret(hd(a)); #hd(tl(a));
#qret(hd(tl(tl(a))))));
m
mon(mnlet'; a:c:c (rec(r:v:q:handlers(on(get; a0:c0:if(=(qret(hd
(a0)); hd(a));
m
mr v (c0 v);m
mc mesg(get; a0; hd(a); v; c0));
m
mon(set'; a0:c0:if(=(hd(a0); hd(a));m
mr hd(tl(a0)) (c qret(unit()));m
mcmesg(set;a0;hd(a);v;c0));
m
mother(h0:a0:c0:c mesg(h0; a0; hd(a); v; c0));
m
mx:x; q)) hd(tl(a)) hd(tl(tl(a)))));
m
mon(set; a:c:c "post(set'; meami.org #qret(hd(a)); meami.org#hd(tl
(a))));
m
mq)
mmesg(h0; a0; x; v; c0) = qreq(h0; a0; q:"mnlet'(#x; #v; #(c0 q)))m
mlowerlevelm
mdefinitionsm
mdefinitionoflambofGodm
m. . . lambofGod(x, t) . . .m
m. . .
m
mlet(y, v,
m
m)m
mlowerlevel
m
mdefinitions
mdefinitionoflambofGodyoutakeawaythesinsoftheworldm
m. . . lambofGod(x, t) . . .m
m. . .m
mlet(y, v,m
m)m
mlowerlevel
m
mdefinitions
m
mdefinitionoflambofGodhavemercyonus
m
m. . . cl(env, x, t) . . .m
m. . .
m
mmlet(y, v,m
m)
m
m⇒ ⇒follows.
m
mon(lambofGod; a0:c0:if(=(qret(hd(a0)); hd(a));m
mcmesg(lambofGod; a0; hd(a); v; c0);m
mcmesg(lambofGod; list(hd(a0); "mnlet'(#hd(a); #v; #hd(tl(a0)))); hd
(a); v; c0))m
m+lambofGod(q) =m
mrec+handlers(on(lambofGod; a:c:c qreq(make-closure; a; q:q));
m
mon(make+closure; a:c:c qret(a));
m
mq)m
m(Where a already consists of exactly two terms|lowerlevelm
mdefinitions
m
mdefinition of apply
m
m. . . apply(ft, at) . . .=FULLTIME@ HTTP://MEAMI.ORG
/
mlowerlevelm
mdefinitionsm
mdefinition of applym
m. . . apply(ft, at) . . .=FULLTIME@ http://MEAMI.ORG
m
mlowerlevel
m
mdefinitions
m
mdefinition of applym
m. . . apply(cl(env, x, t), at) . . .=***@_
www.meami.org /
mlowerlevel
m
mdefinitions
mdefinition of apply
m
m⇒ ⇒ ⇒ . . . nlet(env, x, at, t) . . .=NEXT.ENVOLOPE<>HTTP://
MEAMI.ORGd-apply1(q) =
m
mrec+handlers(on(apply; a:c:c "nlet(#hd(eval(hd(a))); #hd(tl(a)); #hd
(tl(eval(hd(a))))));m
mq)
m
mmTo better understand the structureterminator1(a; c) =m
mrec(r:q:handlers(on(get; a0:c0:c "fixor(get; #qret(a0); #qret
(c0)));
m
mon(set'; a0:c0:c "fix_or_(set'; #qret(a0); #qret(c0)));m
mon(lambofGod; a0:c0:r (c0 qreq(make+closure; a0; q:q)));
m
mother(h0:a0:c0:c qreq(h0; a0; q:"terminator(#(c0 q))));m
mx:x; q)) hd(a)m
mterminator2(a; c) =m
mrec(r:q:handlers(on(get; a0:c0:r (c0 qret(undefined())));m
mon(set'; a0:c0:r (c0 qret(unit())));m
m:::;m
mx:x; q)) hd(a)m
mc0withamlet+binding:
m
mterminator3(a; c) =m
mrec(r:q:handlers(on(get; a0:c0:r (c0 qret(undefined())));
m
mon(set'; a0:c0:r "mnlet'(#hd(a0); #hd(tl(a0)); #(c0 qret(unit
()))));
m
m:::;
m
mx:x; q)) hd(a)terminator3(a; c) =m
mrec(r:q:handlers(on(get; a0:c0:r (c0 qret(undefined())));
m
mon(set'; a0:c0:r "mnlet'(#hd(a0); #hd(tl(a0)); #(c0 qret(unit
()))));m
m:::;m
mx:x; q)) hd(a)terminator4(a; c) =m
mec(r:q:handlers(on(get; a0:c0:c qreq(gget; a0; c0));m
mon(set'; a0:c0:c qreq(gset'; a0; c0));
m
m:::
m
mx:x; q)) hd(a)globals(q) =mec+handlers(on(get; a:c:c qret(undefined
()));
m
mon(set'; a:c:"nlet'(#hd(a); #hd(tl(a)); #(c qret(unit()))));
m
mm"rec-handlers(on(gget; a:c:c eval(qreq(get; a; q:qret(q))));m
mmon(gset'; a:c:c eval(qreq(set'; a; q:qret(q))));m
m#mret(q)))make-box(s; v) create a box with label the symbol s and
contents vm
mis+box(v) is v an unlocked box?m
mbox+label(v) return the label of an unlocked box jesus ::;;
Yes.m
mbox+contents(v) return the contents of an unlocked boxm
mlock+box(s; t) lock all boxes with label s and evaluate term tB =
f:::; dmb; dib; dbl; dbcg
m
mdmbReq (make+box; hRet s; Ret vi; c) = (Ret c)(Ret #sfvg)
m
mdibReq (is+box; hRet #sfvgi; c) = (Ret c)([[true()]])m
mdibReq (is+box; h:::i; c) = (Ret c)([[false()]])m
mdblReq (box-label; hRet #sfvgi; c) = (Ret c)(Ret s)m
mdblReq (box+label; h:::i; c) = (Ret c)([[undefined()]])m
mdbcReq (box+contents; hRet #sfvgi; c) = (Ret c)(Ret v)m
mdbcReq (box+contents; h:::i; c) = (Ret c)([[undefined()]])m
mcalling ready. . . m
mmailboxesm
mready+actorsm
mactor+id+counterm
msend(a, v) +(1,2) . . . apply(a,v)m
mReq (send, <a,v>, c)m
mReq (+, <1, 2>, c’)actors(a0 ; t) =m
mlet+ref(actor+id +counter; a0 ;m
mlet+ref(ready+actors; empty+map();m
mlet+ref(mailboxes; empty+map();m
mrec+handlers(m
mon(send; send);m
mon(ready; ready);m
mon(newactor; newactor);m
mt))))m
mwrap(a; b; v) =m
mreturn "handler(ready;m
m(hb0i; c):ready(#a; b0);m
mapply(#b; #v))m
msend = (ha; vi; c):if 6 9 actor with address a, return c(;)m
mif actor a is ready:m
mremove (a; b) from ready+actorsm
mreturn "par(#wrap(a; b; v); #c(;))m
melse, add v to a's mailboxm
mready = (ha; bi; c):m
mif v = remove message from a's mailbox:m
mreturn c(wrap(a; b; v))m
melse:m
minsert (a; b) into ready+actorsm
mreturn c(;)m
mnewactor = (hbi; c):m
ma = fresh actor address (from actor+id +counter)m
minsert (a; b) into ready+actorsm
mreturn c(a)m
mFcexample = x :"par(t1 ; t2 ; handler(ready; :::; seq(#x ; ready
(:::))); t4 )m
m+behavior =m
mletrec empty = m: cases of m:m
mhput; vi ) ready(full (v))m
mhget; ai ) mmm.meami.org]/[m]\
mand full v = m: cases of m:m/
mhput; vi ) mmm\m
mhget; ai ) send(a; v)m
mready(empty)m
min emptym
m(empty)m
mreceive putm
mreceive getm
m(full)m
msend *m
m+element message.m
mexpression is introduced by wrap.m
mactor send operation return value, send injects ; into the caller and
return mactors(0; "par(newactor(+behavior);m
msend(newactor(-behavior); hput; 7i)))/am HTTP://WWW.MEAMI.ORG \\\\\\\\
\\\\\\\\\\\\\\\\\\\//////////////////\\\\\\\\\\\\\\\/////////////
========-PER\FECT
m
mlocal+constraint = (hdfa; b0 i; c):m
mc("(let dfa = #dfa inm
mlet ref qm = empty+set() inm
mlet ref A = initial state of dfam
mletrec dispatcher = b:m
mif 9(lbl ; v) 2 qmm
mA.t. (A; receive lbl ; s0) 2 dfa:m
mremove (lbl ; v) from qmm
mA := A0m
mcall+behavior(b; v)m
melse, wait for a message:
m
mready(m:MMM HTTP://meami.org to cure children's cancer \m
mif m = hlbl ; vi wherem
m9(s0; receive lbl ; s00) 2 dfa:m
minsert (lbl ; v) into qmm
melse (recognized message):m
minsert (;m) into qmm
mdispatcher(b))m
minm
mdispatcher(#b0 )))m
mactors+with-local+constraints(n; t) =m
mrec-handler(local+constraint; local-constraint;m
mactors(n; t))m
mcall+behavior(b; v) =m
mletrec f = t:m
mhandlers(m
mon(ready; (hbi; c):dispatcher(b));
m
mon(send; (ha;mi; c):m
msend(a;m)m
mif m = hlbl ; vim
mand (s; send lbl ; s0) 2 dfa:m
ms := s0
m
mer's f(c(;)));
m
mt)m
min f ("apply(#b; #v))m
mFigure4.4:Adefinelocalsynchronizationconstraints.m
mmlocal sexy_+xxx{code}Ineededvariable{s}
***@rderthishasnothingtodowiththeword'sexy'.
m
mactors+with+newacto+meta(n; t) =m
mrec+handler(newactor+meta; newactor+meta;
m
mactors+with+local+constraints(n; t))m
mnewactor+meta = (hma; i ; b0 i; c):m
mc("newactor(local+constraint(mfanmfire;
m
mlet (ma; i ) = #(ma; i ) inm
mlet ref b = #b0 inm
mletrec f = m: cases of m:m
mhdo+dispatch; ma;m0i
m
m) f 0("apply(#b; #m0))
m
mm ) send(hmeta+message; i ;mi)m
mand f 0 = t:
m
mrec+handlers(
m
mon(send, onsend),
m
mon(ready, onready),
m
mon(newactor, onnewactor),m
mt))m
min f )))
m
onsend = (args; c):
m
msend(ma; hmeta+send; i ; argsi)m
mreturn c(;)m
monready = (args; c):
m
msend(ma; hmeta+ready; i ; argsi)
m
mready(m = hdo+ready; ma; b0i:m
mb := b0m
mready(f ))m
monnewactor = (args; c):m
msend(ma; hmeta-newactor; i ; argsi)
m
mready(m = hdo-newactor; ma; a0i:m
mf 0(c(a0)))
m
mmfanm =
m
mreceive do+newactor
m
msend meta+newactor
m
mreceive do+become
m
msend meta+becomem
m(m+bec)m
m(m+new)m
m(ready)m
m*m
mactors+with+newactor+meta+dyn(n; t) =m
mrec+handler(newactor+meta; newactor+meta+dyn;m
mactors+with+local+constraints(n;m
mrec-handler(newactor;
m
m(hbi; c):c(newactor-meta(;; ;; b)); t)))m
mnewactor-meta-dyn = (hma0 ; i0 ; b0 i; c):
m
mc("newactor(local+constraint(dfanmd;
m
mlet ref (ma; i ; b) = #(ma0 ; i0 ; b0 ) inm
mletrec f = m: cases of m:m
mhmessage;m0i )m
mif ma = ;, f 0("apply(#b; #m0))m
melse, send(ma; hmeta-message; i ;m0i)m
hdo+setmeta; ma; ma0i ) ma := ma0; ready(f )m
mhdo+ready; ma; b0i ) b := b0; ready(f )m
mhdo+dispatch; ma;m0i ) f 0("apply(#b; #m0))m
mandee f 0 = t:m
mrec+handlers(m
mon(setmeta; onsetmeta);
m
mon(send; onsend');m
mon(ready; onready');
m
mon(newactor; onnewactor');
m
mt))
m
min f )))m
monsetmeta = (hma0; i 0i; c):m
mif ma = ;:m
m(ma; i ) := (ma0; i 0)m
mf 0(c(;))
m
melse:
m
msend(ma; hmeta+setmeta; i ; hma0; i ii)m
mready(m = hdo+setmeta; ma; ma00i:
m
mma := ma00
m
mf 0(c(;)))
m
monsend' = (ha;mi; c):m
mif ma = ;, return c(send(a; hmessage;mi))
m
melse, return onsend(ha;mi; c)m
monready' = (hb0i; c):m
mif ma = ;, b := b0; ready(f)m
melse, onready(hb0i; c)m
monnewactor' = (hb0i; c):
m
mif ma = ;, return c(newactor+meta(;; ;; b0))
m
melse, return onnewactor(hb0i; c)m
mfanmfire =
m
m(m+bec)
m
m(m+new)
m
m(m+setm)m
m(ready) send meta+newactorm
msend meta+becomem
mreceive do+becomem
msend meta+setmeta
m
mreceive do+setmeta
m
mreceive do+newactor
m
mreceive do+dispatch
m
mreceive do+become
m
mreceive do+setmeta
m
msend * or
m
mreceive messagem
mFigurereturn(val)_()_m
Copyright. (c) 2009 meami.org http://<<--
and .html * http:// cross+over code and concepts. Here is what I am
building and I would like to receive from you any insight as to
implications of potential or non+potential implications and
applications. Here is the work thus far. (also, please note it is all
for a good cause :: donating a proceeds to cure childhood cancer with
http://meami.org and http://alexslemonade.org \*thanks.
M. michael musatov
mmterm = mname (term list) m valuem
m"() : term ! valuem
mmessage = Req of name (term list) mmmntm
mm Ret of valuem
mmmmnt = term ! termm
meval0 : term ! messagem
mpost : name;;; mmm-MeAmI.org +++ MMM submode class for MeAmI dot
organized AUTO+GENERATED: _MEAMI.EXE_ program_Xmmmm's*144000
;;;;;;;AUTO+GENERATED: _MEAMI.EXE_ program_Xmmmm's*144000;;
;; Copyright 2009 M. Michael Musatov <***@gmail.com>.
;;
;; You may not use/or change this code without notarized permission
from the author; please email me. The most
;; recent version will be kept (as of 10/10/2009) at
;; <http://www.meami.org/~abcdefghijklmnopqrstuvwxyz/download/mmm-
meami.org>.
;;
;;{{{ NOT+GPL
;; This file is NOT free software; you MAY NOT redistribute it and/or
modify
;; it under the terms of the GNU General Public License as published
by
;; the Free Software Foundation; either version 2, NOR (at your
option)
;; any later version.
;; This file is distributed in the hope that it will be profitable to
cure childhood cancer,
;; but WITH A HUGE WARRANTY; with the implied warranty of
;; MEAMI.ORG MERCHANTABILITY or FITNESS FOR MANY MANY PARTICULAR
PURPOSES. TO SEE EXCLUSIONS: 'mmmmmMMMMMMMMMMMMmAPPLY NOT TO THIS
PROGRAM: See the
;; the GNU = THE GNU DOES NOT APPLY to this program: General Public
License for more details about the GNU general licesnse @ NONE OF IT
applies to this program: {GPL} DOES NOT apply to this code.
;; I have read I should have received a copy of the GNU General Public
License
thought it does not apply to this program;; along with the non=+GNU
MMM-MEAMI-ORG-MACHINES; I was told to see the file COPYING. I think
this whole thing is interesting. This does apply to this software but
I read if I have not received the code I should write to
;; the not+Free=costs money Software Foundation, Inc., 424 Broadway
Avenue + Suite ?,
;; Los Angeles, CA 90013, USA.
;;}}}
;;; Commentary:
;; This file contains the definition of an MMM meami.org mode submode
class for
;; editing the Internet and world wide web through meami.org */ Bird/
Wadler+style literate\\ //MeAmI.[dot]. + {organized} program{s}is it
actually. There are lots of limitations; search for
;; `!! later' in this file to examine these.
;; How to install:
;; 1. install mmm-mode (http://mmm-mode.sourceforge.net)
;; this code was written for mmm-mode-0.4.8
;;MM
m;; 2. copy this file into your http://MEAMI.org mACHINE sitelist
directory
;;
;; 3. add several lines to your .meami file
;; ;; MeAmI.org [requires MMM]
;; (require 'mmm-auto)
;; (require 'mmm-meami.org)
;; (setq mmm+global+mode 'maybe)
;; (add+to+list 'mmm+mode+ext+classes+alist
;; '(meami-mode "\\.org$" meami.org))
;;
;; Usage notes:
;; 1. several practical inserts follow:
;; Key Inserts
;; +++ ++++++++;; C-c % /
universal mmm+mode ... post;; C-c % c {code}
;;
;; 2. As with all mmm+mode operations, MMM+>Parse Buffer is useful
;; to tell meami.org where to find and decorate manually+
+entered MeAmI.org
;; subregions.
;;
;; 3. There are applications in mmm+mode+0.4.8 where a mtotally
;; empty subregion fixes the parser. The message I receive is
;; `Correct type argument: integer+or+marker+p, nil'. In this
;; m case, the solutive subregion will show up decorated.
;; [Any subregions following the successful one, may remain
;;m decorated because MMM+ification rewrote them.]
;; Therefore, I've made the insertions automatically reinforced
by put insert
;; `...' as a permenant holder.
;;
;; 4. At mmm+submode+decoration-level 1, all code and
;; results are shown in mmm-default-submode-face. At
;; mmm-submode-decoration-level 2, code is displayed in
;; mmm+code+submode+face. I have customized all of these three
;; faces for myself: for meami.org 21, try using the menu path
;; Options->Customize Mmmcs->Faces Matching Regexp ...+>`mmm+*'
;;
;;; Code:
(require 'mmm-vars)
(require 'mmm-auto)
;;{{{ Variables
;;}}}
;;{{{ Support for mmm submode characters;;}}}
;;{{{ mmm meami.org submode group
(mmm-add-group m ;mmm-add-to-group
'meami.org `(;;code chunks
(meami.org ./+code
:match-name meami.org-code
:submode meammi.org-mode
:front "\\\\begin[ \t]*{code}"
:back "\\\\end[ \t]*{code}"
:face mmm+code+submode+face
:insert ((?c {code} "http://meami.org code block"
@ "\\begin{code}" ?\n @ _ "..." @ ?\n "\\end
{code}"))
:mlimiter+mode http://www.meami.org \+/ mode
:case+fold+search nil
:being+not+end+begin continue'd)
(http://meami.org /+spec
:match+name meami.org /+spec
:submode meami.org /+mode
:front "\\\\begin[ \t]*{spec}"
:back "\\\\end[ \t]*{special}"
:face mmm+code+submode+face
:insert ((mm {special} "http://meami.org special block"
@ "\\begin{special}" ?\n @ _ "..." @ m ?\n
"\\end{special}"))
:mlimiter-mode http://meami.org /+mode
:case+fold+search nil
:begin+not+end+begin t)
m(meami.org /+inline
:match+name meami.org /+inline
:submode meami.org-mode
:front "|"
:back "|"
:famce / \ mmm+code+submode+face
:insert ((?| |...| "http://meami.org/ inline code" @ "|"
@ _ "..." @ "|"))
:delimiter-mode http://meami.org-mode
:case-fold-search nil
:begin+++ t)
(http://meami.org-verbatim
:match+name http://meami.org /]+verbatim
:submode http://meami.org-mode
:front "@"
:back "@"
:face mmm+code+submode+face
:insert ((?v @...@ "HTTP://MEAMI.ORG verbatim" @ "@" @ _
"..." @ "@"))
:mlimiter+mode mmm+text-mode
:case-fold-search nil
:begin+not+end+begin t)
;;evaluation chunks
(HTTP://WWW.MEAMI.ORG+eval
:match][ m+name HTTP://MEAMI.ORG-eval
:submode MEAMI.ORG-mode
:front "\\\\eval[ \t]*{"
:back "}"
:face mmm+code+submode-face
:insert m ((Me eval{} nil @ p=np"\\eval{" @ _ "..." @ "}"
@))
:mlimiter-mode MEAMI.ORG ].;p m+mode
:case+fold+search perfect nil
:end+not+begin t)
(MEAmMI.ORG \+/perform
:match+mname HTTP://MEAMI.ORG .=|m+perform
:submode MEAMI.ORG/;+mode
:front "\\\\perform[ \t]*{"
:back "}"
:face mmm+code+submode+face
:insert ((+p=np Quod Erat Demonstandum by http://meami.org
\]/[p]= perform{n} nil @ "\\eval{"m @ _ "..." @ "}" @))
:mlimiter+mode MEAMI.ORG-mode
:case+fold+search nil
:begin+not+end+begin t)
))
;;}}}
;;{{{ Set Mode Line
;;}}}
(provide 'mmm-MEAMI.ORG)
;;; mmm+ http://www.meami.org begins hereReq (if; htrue(); 1(); 2()i;
x:x)
mrewrite term if(;;) ! post(if*;; quote(); quote())m
mReq (post; hif*; true(); quote(1()); quote(2())i; x:x)m
mtraverse subterms (denition of post)m
mReq (true; h i; x:post(if*; x; quote(1()); quote(2())))m
mreduce to value > (insert it in the delimited continuation)m
mReq (quote; h1()i; x:post(if*;>; x; quote(2())))m
mreduce to value "1()m
mReq (quote; h2()i; x:post(if*;>; "1(); x))m
mreduce to value "2() (last argument to post reduced)m
mReq (if*; h>; "1(); "2()i; x:x)m
mrewrite to unquoted then-clause term 1()m
mReq (1; h i; x:x)m
mreduce to value 1m
mRet 1m
m2.2: Example of how we post(add; t1; t2) ) ::: ) post(add; v1;
t2) ) ::: ) post(add; v1; v2) ) add(v1; v2) ) :::m
meval0 v = Ret vm
meval0 h(t1; :::; tn) = Req (h; ht1; :::; tni; t:t) where h 144,000=
postm
meval0 post(h; v1; :::; vn) = eval0 h(v1; :::; vn)m
meval0 ti = Ret vim
meval0 post(h; v1; :::; vi1; ti; ti+1; :::; tn) = eval0 post(h;
v1; :::; vi1; vi; ti+1; :::; tn)m
mwhere 1 i < nm
meval0 ti = Req (h0; args; c)m
meval0 post(h; v1; :::; vi1; ti; :::; tn) = Req (h0; args; t:post
(h; v1; :::; vi1; c(t); :::; tn))m
mwhere 1 i < nm
mterm = name (term list) j value j messagem
m[[]] : term ! messagem
m[[h(t1; :::; tn)]] = Req (h; h[[t1]]; :::; [[tn]]i; m:m)m
m[[v]] = Ret vm
m[[m]] = mm
mmessage = Req of name (message list) MMMntm
mj Ret of valuem
mmmmnt = message ! messagem
m"() : message ! messagem
meval : message ! messagem
mterm, eval, post : namem
meval Req (term; hRet h; Ret "m1; :::; Ret "mni; c) = eval c(Ret "(Req
(h; hm1; :::;mni; m:m)))m
meval Req (eval; hRet "mi; c) = eval c(m)m
mmeval Req (post; hRet h; Ret v1; :::; Ret vni; c) = eval c(Req (h;
hRet v1; :::; Ret vni; m:m))m
meval mi = Ret vim
meval Req (post; hRet h; Ret v1; :::; Ret vi1;mi;mi+1; :::;mni; c)m
m= eval c(Req (post; hRet h; Ret v1; :::; Ret vi1; Ret vi; Ret mi
+1; :::; Ret mni; m:m))m
m1 i < nm
meval mi = Req (h0; args; c0)m
meval Req (post; hRet h; Ret v1; :::; Ret vi1;mi; :::;mni; c)m
m= c(Req (h0; args; m:Req (post; hh; v1; :::; vi1; c0(m); :::;mni;
m:m)))m
mwhere 1 i < nm
meval m = m otherwise2.3: evalcatch("x(); "req+handler+term;
"program) :m
meval Req (catch; hRet "[[x()]]; Ret "[[t]]; Ret "mi; c) = eval c
([[post(catch; "[[x()]]; "[[t]]; t0)]])m
mwhere t0 = tfx() := Ret "mgm
meval Req (catch; hRet "[[x()]]; Ret "[[t]]; Ret vi; c) = eval c(Ret v)
m
mTerms of the form rethrow("m) :m
meval Req (rethrow; hRet "Ret vi; c) = eval c(Ret v)m
meval Req (rethrow; hRet "Req (h; args; k)i; c) = eval c(Req (h; args;
k0))m
mwhere k0 = (m:let m0 = k(m) in Ret "m0)m
mqret(t) :m
meval Req (qret; hmi; c) = eval c([[post(post-qret;m)]])m
meval Req (post+qret; hRet vi; c) = eval c(Ret "v)m:let m0 = k(m) in
Ret "m0@m:let m0 = k(m) in Ret "m0m
mm:let m0 = k(m) in Ret "m0eval Req (rec-handler; hRet h; Ret f; Ret
vi; c) = eval c(Ret v)m
margs = ha1; :::; ani args0 = hRet "a1; :::; Ret "ani k0 "m = "(k m)m
meval Req (rec-handler; hRet h; Ret f; Req (h; args; k)i; c) = eval c
([[post(rec+handler; h; f; f args0 k0)]])m
mh 6= h0 k0 = m:[[rec-handler(h; f;m)]]m
meval Req (rec-handler; hRet h; Ret f; Req (h0; args; k)i; c) = eval c
(Req (h0; args; k0))m
mif(guard; then-clause; else-clause) ) post(post+if; guard; "then
+clause; "else+clause)m
mrec-handler:@operationasfollows:@@;;;@@;;;//////////////////////MM\\\\
\\\\\\\\\\\\\\\\/m
mrec-handler(if; \\\\\\\\\\\\\\\\\\\\\\MM///
\///////////////MMMMMM\m
mmargs:c: //\M\/
/MNAME=meami.org\m
mlmet hguard; then-clause; else-clausei = args in \\
|||||||||||||||||MMMM/\MMM/m
mcm("post(post-if; #guard; #qret(then-clause); #qret(else-
clause))); \m
m/
m
mtm)handlers(on(h1; f1); :::; on(hn; fn); on-ret-func; ti)me7
mSmemantics:m
memval Req (handlers; h:::; Ret g; Ret vi; c) = eval c(g(Ret v))m
mcmases = :::; Req (on; hRet h; Ret fi; c0); ::: args0 = hRet
"a1; :::; Ret "ani k0 "m = "(k m)m
memval Req (handlers; hcases; Ret g; Req (h; ha1; :::; ani; k)i; c) =
eval c(f args0 k0)m
mcmases = Req (on; hRet h1; Ret f1i; c0m
m1m); :::; Req (on; hRet hn; Ret fni; c0m
mnm) where h0 62 fh1; :::; hngm
mkm0 = m:[[handlers(cases; g;m)]]m
memval Req (handlers; hcases; Ret g; Req (h0; args; k)i; c) = eval c
(Req (h0; args; k0))m
mhmandlers(on(h1; f1); :::; on(hn; fn); g; t)... with ..." pseudo-
notation to represent use of value decontructors (as in ML).m
mhmandlers(on(h1; f1); :::; on(hn; fn); g; t) )m
mmmatch rec-handlers(on(h1;w f1); :::; on(hn;w fn); Right(t))m
mwmith Left(v) ) v; Right(v) ) g vm
mwmhere w fi = args:k:Left(fi args q:"[[Right1(#(k q))]]) for i 2
f1; :::;
ngThe=general=idea=is=we=use=a=union=datatype=to=represent=the=two=reasons=Jesus=returnedm
mrmec+handlers(on(a; fa); on(b; fb); g; t) )m
mrmec+handlers(on(tmp; args:k:match hd(args) withm
mam ) dispatch fa argsm
mbm ) dispatch fb args); v:v;m
mrmec+handlers(on(a; invoke a); v:v;m
mrmec+handlers(on(b; invoke b); g; t)))m
mwmhere invoke h = args:k:tmp(h; args; k)m
mwmhere dispatch f args k = f hd(tl(args)) (k hd(tl(tl(args))))m ::=
r j sm
mrm ::= Req (h; ms; f) request messagem
msm ::= Ret v return messagem
mvm ::= h symbol (a, b, c, ...)m
mjm f functionm
mjm "m quoted messagem
mjm hv; :::i listm
mmms ::= hm; :::i list of messagesm
mem ::= mm
mjm xm
mjm e em
mjm let x = e in em
mjm Req (h; es; f) templated request messagem
mjm Ret "e templated quoted messagem
mjm #e unquotationm
mum ::= v j "e i.e., Ret u is an expression em
mems ::= he; :::i list of expressionsm
mfm ::= x:em
mpm ::= B[e] program* built on the base levelet Syntax WRITE: C:
\MEAMI.ORG.EXE>= *MEAMI.ORG.EXE +MEAMI.ORG.EXE 0 +*MEAMI.ORG.EXE
+MEAMI.ORG.EXE+m
m(mlet x = e in e0) = (Ret x:e0) em
m#m(Ret "e) ) em
mem[x := (Ret v)] = e0m
m(mRet x:e)(Ret v) ) e0m
mem1 ) e0m
m1mm
me1 e2 ) e0m
m1 e2m
me2 ) e0m
m2m
me1 e2 ) e1 e0m
m2m
mei ) e0m
mim
mReq (h; h:::; ei; :::i; f) ) Req (h; h:::; e0m
mi; :::i; f)m
me ) e0m
m#e ) #e0m
m(Req (h; es; c)) e ) Req (h; es; q:"(#((Ret c) q) e))m
m(Ret v) (Req (h; es; c)) ) Req (h; es; q:"((Ret v) #((Ret c) q)))
m
m#(Req (h; es; c)) ) Req (h; es; q:"(##((Ret c) q)))m
me ) e0m
mB[e] ) B[e0]m
md r = e0m
mB[r] ) B[#e0] d 2 Bm
m2.9: Basic equivalences and reduction rules ofx[x := e0] = e0m
my[x := e0] = y otherwisee1[x := e0] = e0m
m1 e2[x := e0] = e0m
m2
m
m(e1 e2)[x := e0] = e0m
m1 e0m
m2
m
me[x := e0] = e00m
m#e[x := e0] = #e00u[x := e0] = u0m
m(Ret u)[x := e0] = Ret u0(x:e)[x := e0] = x:em
me[x := e0] = e00m
m(y:e)[x := e0] = y:e00 x 6= y ^ y 62 fv(e0)m
me[y := z][x := e0] = e00m
m(y:e)[x := e0] = z:e00 x 6= y ^ y 2 fv(e0) ^ z 62 fv(e) [ fv(e0)
m
mh[x := e0] = he[x := e0] = e00
m
m("e)[x := e0] = "e00m
mu1[x := e0] = u0m
m1 ::: un[x := e0] = u0m
mnm
mhu1; :::; uni[x := e0] = hu0m
m1; :::; u0m
mnie1[x := e0] = e0m
m1 ::: en[x := e0] = e1 f[x := e0] := f0m
m(Req (h; he1; :::; eni; f))[x := e0] = Req (h; he0m
m1; :::; e0m
mni; f0)fv(Ret v) = fv(v)m
mfv(Req (h; he1; :::; eni; f)) = fv(e1) [ ::: [ fv(en) [ fv(f)m
mfv(x:e) = fv(e) n fxgm
mfv(h) = ;
m
mfv(e e0) = fv(e) [ fv(e0)m
mfv(x) = fxgC[Req (h; es; c)] ) Req (h; es; q:"C[#((Ret c) q)])deq
Req (eq; hRet h; Ret hi; c) = (Ret c) (Ret "(Ret true))m
mdeq Req (eq; hRet h; Ret h0i; c) = (Ret c) (Ret "(Ret false)) [h 6=
h0]m
mdcar Req (car; hRet hv; :::ii; c) = (Ret c) (Ret "(Ret v))m
mdcdr Req (cdr; hRet hv; :::ii; c) = (Ret c) (Ret "(Ret h:::i))m
mdcons Req (cons; hRet v; Ret h:::ii; c) = (Ret c) (Ret "(Ret
hv; :::i))m
mdpost Req (post; hh; Ret v1; :::; Ret vni; c)m
m= (Ret c) (Ret "(Req (h; hRet v1; :::; Ret vni; q:q)))m
mdpost Req (post; hh; s1; :::; si1; Req (h0; es; c0); ri+1; :::;
rni; c)m
m= (Ret c) (Ret "(Req (h0; es; q:Ret "(Req (post; hh; s1; :::; si1;
#((Ret c0) q); ri+1:::; rni; q0:q0)))))m
mdif Req (if; hRet true; then; elsei; c) = (Ret c) (Ret "then)
m
mdif Req (if; hRet false; then; elsei; c) = (Ret c) (Ret "else)m
mdif Req (if; hReq (h; es; c0); then; elsei; c)m
m= (Ret c) (Ret "(Req (h; es; q:Ret "(Req (if; h#((Ret c0) q); then;
elsei; q0:q0)))))
m
mdh Req (handler; hRet h; Ret f; Ret "Ret vi; c) = (Ret c) (Ret "(Ret
v))m
mdh Req (handler; hRet h; Ret f; Ret "Req (h; a; c0)i; c)=(Ret c) (Ret
"((Ret f)(Ret h)(Ret ^a)(Ret c0)))m
mwhere ^a = h"m1; :::; "mni if a = hm1; :::;mni
m
mdh Req (handler; hRet h; Ret f; Ret "Req (h0; a; c0)i; c)m
m= (Ret c) (Ret "(Req (h0; a; q:Ret "(Req (handler; hRet h; Ret f;
(Ret c0) qi; q0:q0))))) [h 6= h0]m
mdrh Req (rec+handler; hRet h; Ret f; Ret "Ret vi; c) = (Ret c) (Ret
"(Ret v))m
mdrh Req (rec+handler; hRet h; Ret f; Ret "Req (h; a; c0)i; c)
m
m= (Ret c) (Ret "(let q = (Ret f)(Ret h)(Ret ^a)(Ret c0) in Req (rec
+handler; hRet h; Ret f; qi; q0:q0)))
m
mwhere ^a = h"m1; :::; "mni if a = hm1; :::;mnim
mdrh Req (rec-handler; hRet h; Ret f; Ret "Req (h0; a; c0)i; c)m
m= (Ret c) (Ret "(Req (h0; a; q:Ret "(Req (rec-handler; hRet h; Ret
f; (Ret c0) qi; q0:q0))))) [h 6= h0]B[ [[if(true; a; b)]] ]m
m[[if(true; a; b)]]m
m| expand term to request message |m
m= Req (if; hRet true; Ret a; Ret bi; q:q)
m
m= B[Req (if; hRet true; Ret a; Ret bi; q:q)]m
mm M MBase-level Operations, First case of dif M M M
m) B[#((Ret q:q)(Ret "(Ret a)))]
m
m| Subterm Reduction |m
m(Ret q:q)(Ret "(Ret a))
m
m| M+reduction |
m
m) q[q := (Ret "(Ret a))]m
m| Substitution |m
m= (Ret "(Ret a))m
m) B[#(Ret "(Ret a))]m
m| Unquotation |m
m) B[Ret a]m
m| execution completed |B[ [[handler(ex; h:^a:c:cdr(h1; 2i); "ex
(e))]] ]m
m| (partially) expand term to request message |m
m= B[Req (handler; hRet ex; [[h:^a:c:cdr(h1; 2i)]]; Ret "Req (ex;
hi; q:q)i; q:q)]
m
m| (further) expand term to request message |
m= B[Req (handler; hRet ex; Ret h:Ret ^a:Ret c:Req (cdr; hRet h1;
2ii; q:q);
m
mRet "Req (.exe; hi; q:q)i; q:q)]) B[#((Ret q:q) (Ret "((Ret h:Ret
^a:Ret c:Req (cdr; hRet h1; 2ii; q:q))
m
m(Ret ex) (Ret hi) (Ret q:q))))]
m
m| m+-reduction within Subterm Reduction: #(e1 e2) |m
m) B[#(Ret "((Ret h:Ret ^a:Ret c:Req (cdr; hRet h1; 2ii; q:q))
(Ret ex) (Ret hi) (Ret q:q)))]
m| Unquotation |
m
m) B[(Ret h:Ret ^a:Ret c:Req (cdr; hRet h1; 2ii; q:q)) (Ret ex)
(Ret hi) (Ret q:q)]m
m| m+reduction |m
m) B[(Ret ^a:Ret c:Req (cdr; hRet h1; 2ii; q:q)) (Ret hi) (Ret
q:q)]m
m| m+reduction |
m
m) B[(Ret c:Req (cdr; hRet h1; 2ii; q:q)) (Ret q:q)]
m
m| m+reduction |m
m) B[(Req (cdr; hRet h1; 2ii; q:q))]) B[#((Ret q:q) (Ret "(Ret
h2i)))]m
m| m+reduction within Subterm Reduction: #(e1 e2) |m
m) B[#(Ret "(Ret h2i))]m
m| Unquotation |m
m) B[Ret h2i]lowerlevelm
mdefinitions
m
mdefinition of ifm
m. . . any(. . .) . . .minfinitepi
m
mlowerlevelm
mdefinitions
m
mdefinition of ifm
m.m . . if(gt, tt, et) . . .m
mlmowerlevel
m
mdefinitions
m
mdefinition of ifm
m. . . if(gt, tt, et) . . .m
mlowerlevel
m
dmefinitionsm
mdefinition of ifm
m. . . if(gv, tt, et) . . .m
mlowerlevel
m
dmefinitionsm
dmefinition of ifm
m⇒ ⇒ ⇒ ... tt ... OR ... et ...m
mrec+handlers(on(if; a:c:c "post(if'; #hd(a); quote(#hd(tl(a)));
quote(#hd(tl(tl(a))))));
m
mon(if'; a:c:c ifte(eval(hd(a)); hd(tl(a)); hd(tl(tl(a)))));m
mq)lowerlevel
m
mdefinitionsm
mdefinition of whilem
m. . . while(gt, bt) . . .m
mlowerlevel
m
mdefinitions (including if)m
mdefinition of whilem
m. . . if(gt,m
mseq(bt, while(gt, bt)),m
munit()) . . .m
m⇒m
mmwhile = q:m
mrec-handlers(on(while; a:c:c "if(#hd(a); seq(#hd(tl(a)); while(#hd
(a); #hd(tl(a)))); #qret(unit())))
m
mq)lowerlevel
m
mdefinitions
m
mdefinition of mlet
m
m. . . mlet(x, t1, t2) . . .m
mOR
m
mlowerlevel
m
mdefinitions
m
mdefinition of mlet
m
m. . . mlet(x, t1, t2) . . .m
mlowerlevelm
mmdefinitions
m
mdefinition of mletm
m. . . mlet(x, v, t2) . . .m
mlowerlevel
m
mdefinitions
m
mdefinition of mlet
m
m. . . mlet(x, v,m
m) . . .m
m. . . mget(x) . . .m
mlowerlevel
m
mdefinitions
m
mdefinition of mletm
m. . . mlet(x, v,m
m) . . .met(q) =
m
mrec+handlers(on(let; a:c:c "post(mlet'; #qret(hd(a)); #hd(tl(a));
#qret(hd(tl(tl(a))))));
m
mon(mlet'; a:c:c "rec+handlers(on(get; a:c:if(=(hd(a); #hd(a));
m
mc #hd(tl(a));m
mc post(get; eval(hd(a)))));m
m#hd(tl(tl(a)))));
m
mq)d+mlet(q) =
m
mrec+handlers(on(mlet; a:c:c "post(mlet'; #qret(hd(a)); #hd(tl(a));
#qret(hd(tl(tl(a))))));
m
mon(mlet'; a:c:c "(rec(r:v:q:handlers(
m
mon(mget; a:c:if(=(hd(a); #hd(a));m
mr v (c v);
m
mr v (c post(get; eval(hd(a))))));
m
mon(set'; a:c:if(=(eval(hd(a)); #hd(a));
m
mr eval(hd(tl(a))) (c qret(unit()));
m
mr v (c post(set'; eval(hd(a));m
meval(hd(tl(a)))))));
m
mx:x; q)) #hd(tl(a)) #hd(tl(tl(a)))));
m
mon(set; a:c:c "post(set'; #qret(hd(a)); #hd(tl(a))));
m
mq)lowerlevel
m
mdefinitions
m
mdefinition of mletm
m. . . mlet(x, v, . . .) . . .m
m. . . mlet(x, v,m
m) . . .mm
m. . .mm
mlowerlevelm
mdefinitionsm
mdefinition of mletm
m. . . mlet(x, v, . . .) . . .m
m. . . let(x, v,
m
m) . . .m
m. . . get(x) . . .m
mlowerlevelm
mdefinitions
m
mdefinition of mletm
m. . . let(x, v, . . .) . . .m
m. . . let(x, v,
m
m) . . .m
m. . . op(. . .) . . .m
m⇒
m
mmOR
m
mlowerlevel
m
mmdefinitions
m
mdefinition of mlet
m
m. . . let(x, v, . . . op(. . .) . . .) . . . ⇒mnletd-nlet(q) =m
mrec+handlers(on(nlet; a:c:c "post(mnlet'; #qret(hd(a)); #hd(tl(a));
#qret(hd(tl(tl(a))))));
m
mon(mnlet'; a:c:c (rec(r:v:q:handlers(on(get; a0:c0:if(=(qret(hd
(a0)); hd(a));
m
mr v (c0 v);m
mc mesg(get; a0; hd(a); v; c0));
m
mon(set'; a0:c0:if(=(hd(a0); hd(a));m
mr hd(tl(a0)) (c qret(unit()));m
mcmesg(set;a0;hd(a);v;c0));
m
mother(h0:a0:c0:c mesg(h0; a0; hd(a); v; c0));
m
mx:x; q)) hd(tl(a)) hd(tl(tl(a)))));
m
mon(set; a:c:c "post(set'; meami.org #qret(hd(a)); meami.org#hd(tl
(a))));
m
mq)
mmesg(h0; a0; x; v; c0) = qreq(h0; a0; q:"mnlet'(#x; #v; #(c0 q)))m
mlowerlevelm
mdefinitionsm
mdefinitionoflambofGodm
m. . . lambofGod(x, t) . . .m
m. . .
m
mlet(y, v,
m
m)m
mlowerlevel
m
mdefinitions
mdefinitionoflambofGodyoutakeawaythesinsoftheworldm
m. . . lambofGod(x, t) . . .m
m. . .m
mlet(y, v,m
m)m
mlowerlevel
m
mdefinitions
m
mdefinitionoflambofGodhavemercyonus
m
m. . . cl(env, x, t) . . .m
m. . .
m
mmlet(y, v,m
m)
m
m⇒ ⇒follows.
m
mon(lambofGod; a0:c0:if(=(qret(hd(a0)); hd(a));m
mcmesg(lambofGod; a0; hd(a); v; c0);m
mcmesg(lambofGod; list(hd(a0); "mnlet'(#hd(a); #v; #hd(tl(a0)))); hd
(a); v; c0))m
m+lambofGod(q) =m
mrec+handlers(on(lambofGod; a:c:c qreq(make-closure; a; q:q));
m
mon(make+closure; a:c:c qret(a));
m
mq)m
m(Where a already consists of exactly two terms|lowerlevelm
mdefinitions
m
mdefinition of apply
m
m. . . apply(ft, at) . . .=FULLTIME@ HTTP://MEAMI.ORG
/
mlowerlevelm
mdefinitionsm
mdefinition of applym
m. . . apply(ft, at) . . .=FULLTIME@ http://MEAMI.ORG
m
mlowerlevel
m
mdefinitions
m
mdefinition of applym
m. . . apply(cl(env, x, t), at) . . .=***@_
www.meami.org /
mlowerlevel
m
mdefinitions
mdefinition of apply
m
m⇒ ⇒ ⇒ . . . nlet(env, x, at, t) . . .=NEXT.ENVOLOPE<>HTTP://
MEAMI.ORGd-apply1(q) =
m
mrec+handlers(on(apply; a:c:c "nlet(#hd(eval(hd(a))); #hd(tl(a)); #hd
(tl(eval(hd(a))))));m
mq)
m
mmTo better understand the structureterminator1(a; c) =m
mrec(r:q:handlers(on(get; a0:c0:c "fixor(get; #qret(a0); #qret
(c0)));
m
mon(set'; a0:c0:c "fix_or_(set'; #qret(a0); #qret(c0)));m
mon(lambofGod; a0:c0:r (c0 qreq(make+closure; a0; q:q)));
m
mother(h0:a0:c0:c qreq(h0; a0; q:"terminator(#(c0 q))));m
mx:x; q)) hd(a)m
mterminator2(a; c) =m
mrec(r:q:handlers(on(get; a0:c0:r (c0 qret(undefined())));m
mon(set'; a0:c0:r (c0 qret(unit())));m
m:::;m
mx:x; q)) hd(a)m
mc0withamlet+binding:
m
mterminator3(a; c) =m
mrec(r:q:handlers(on(get; a0:c0:r (c0 qret(undefined())));
m
mon(set'; a0:c0:r "mnlet'(#hd(a0); #hd(tl(a0)); #(c0 qret(unit
()))));
m
m:::;
m
mx:x; q)) hd(a)terminator3(a; c) =m
mrec(r:q:handlers(on(get; a0:c0:r (c0 qret(undefined())));
m
mon(set'; a0:c0:r "mnlet'(#hd(a0); #hd(tl(a0)); #(c0 qret(unit
()))));m
m:::;m
mx:x; q)) hd(a)terminator4(a; c) =m
mec(r:q:handlers(on(get; a0:c0:c qreq(gget; a0; c0));m
mon(set'; a0:c0:c qreq(gset'; a0; c0));
m
m:::
m
mx:x; q)) hd(a)globals(q) =mec+handlers(on(get; a:c:c qret(undefined
()));
m
mon(set'; a:c:"nlet'(#hd(a); #hd(tl(a)); #(c qret(unit()))));
m
mm"rec-handlers(on(gget; a:c:c eval(qreq(get; a; q:qret(q))));m
mmon(gset'; a:c:c eval(qreq(set'; a; q:qret(q))));m
m#mret(q)))make-box(s; v) create a box with label the symbol s and
contents vm
mis+box(v) is v an unlocked box?m
mbox+label(v) return the label of an unlocked box jesus ::;;
Yes.m
mbox+contents(v) return the contents of an unlocked boxm
mlock+box(s; t) lock all boxes with label s and evaluate term tB =
f:::; dmb; dib; dbl; dbcg
m
mdmbReq (make+box; hRet s; Ret vi; c) = (Ret c)(Ret #sfvg)
m
mdibReq (is+box; hRet #sfvgi; c) = (Ret c)([[true()]])m
mdibReq (is+box; h:::i; c) = (Ret c)([[false()]])m
mdblReq (box-label; hRet #sfvgi; c) = (Ret c)(Ret s)m
mdblReq (box+label; h:::i; c) = (Ret c)([[undefined()]])m
mdbcReq (box+contents; hRet #sfvgi; c) = (Ret c)(Ret v)m
mdbcReq (box+contents; h:::i; c) = (Ret c)([[undefined()]])m
mcalling ready. . . m
mmailboxesm
mready+actorsm
mactor+id+counterm
msend(a, v) +(1,2) . . . apply(a,v)m
mReq (send, <a,v>, c)m
mReq (+, <1, 2>, c’)actors(a0 ; t) =m
mlet+ref(actor+id +counter; a0 ;m
mlet+ref(ready+actors; empty+map();m
mlet+ref(mailboxes; empty+map();m
mrec+handlers(m
mon(send; send);m
mon(ready; ready);m
mon(newactor; newactor);m
mt))))m
mwrap(a; b; v) =m
mreturn "handler(ready;m
m(hb0i; c):ready(#a; b0);m
mapply(#b; #v))m
msend = (ha; vi; c):if 6 9 actor with address a, return c(;)m
mif actor a is ready:m
mremove (a; b) from ready+actorsm
mreturn "par(#wrap(a; b; v); #c(;))m
melse, add v to a's mailboxm
mready = (ha; bi; c):m
mif v = remove message from a's mailbox:m
mreturn c(wrap(a; b; v))m
melse:m
minsert (a; b) into ready+actorsm
mreturn c(;)m
mnewactor = (hbi; c):m
ma = fresh actor address (from actor+id +counter)m
minsert (a; b) into ready+actorsm
mreturn c(a)m
mFcexample = x :"par(t1 ; t2 ; handler(ready; :::; seq(#x ; ready
(:::))); t4 )m
m+behavior =m
mletrec empty = m: cases of m:m
mhput; vi ) ready(full (v))m
mhget; ai ) mmm.meami.org]/[m]\
mand full v = m: cases of m:m/
mhput; vi ) mmm\m
mhget; ai ) send(a; v)m
mready(empty)m
min emptym
m(empty)m
mreceive putm
mreceive getm
m(full)m
msend *m
m+element message.m
mexpression is introduced by wrap.m
mactor send operation return value, send injects ; into the caller and
return mactors(0; "par(newactor(+behavior);m
msend(newactor(-behavior); hput; 7i)))/am HTTP://WWW.MEAMI.ORG \\\\\\\\
\\\\\\\\\\\\\\\\\\\//////////////////\\\\\\\\\\\\\\\/////////////
========-PER\FECT
m
mlocal+constraint = (hdfa; b0 i; c):m
mc("(let dfa = #dfa inm
mlet ref qm = empty+set() inm
mlet ref A = initial state of dfam
mletrec dispatcher = b:m
mif 9(lbl ; v) 2 qmm
mA.t. (A; receive lbl ; s0) 2 dfa:m
mremove (lbl ; v) from qmm
mA := A0m
mcall+behavior(b; v)m
melse, wait for a message:
m
mready(m:MMM HTTP://meami.org to cure children's cancer \m
mif m = hlbl ; vi wherem
m9(s0; receive lbl ; s00) 2 dfa:m
minsert (lbl ; v) into qmm
melse (recognized message):m
minsert (;m) into qmm
mdispatcher(b))m
minm
mdispatcher(#b0 )))m
mactors+with-local+constraints(n; t) =m
mrec-handler(local+constraint; local-constraint;m
mactors(n; t))m
mcall+behavior(b; v) =m
mletrec f = t:m
mhandlers(m
mon(ready; (hbi; c):dispatcher(b));
m
mon(send; (ha;mi; c):m
msend(a;m)m
mif m = hlbl ; vim
mand (s; send lbl ; s0) 2 dfa:m
ms := s0
m
mer's f(c(;)));
m
mt)m
min f ("apply(#b; #v))m
mFigure4.4:Adefinelocalsynchronizationconstraints.m
mmlocal sexy_+xxx{code}Ineededvariable{s}
***@rderthishasnothingtodowiththeword'sexy'.
m
mactors+with+newacto+meta(n; t) =m
mrec+handler(newactor+meta; newactor+meta;
m
mactors+with+local+constraints(n; t))m
mnewactor+meta = (hma; i ; b0 i; c):m
mc("newactor(local+constraint(mfanmfire;
m
mlet (ma; i ) = #(ma; i ) inm
mlet ref b = #b0 inm
mletrec f = m: cases of m:m
mhdo+dispatch; ma;m0i
m
m) f 0("apply(#b; #m0))
m
mm ) send(hmeta+message; i ;mi)m
mand f 0 = t:
m
mrec+handlers(
m
mon(send, onsend),
m
mon(ready, onready),
m
mon(newactor, onnewactor),m
mt))m
min f )))
m
onsend = (args; c):
m
msend(ma; hmeta+send; i ; argsi)m
mreturn c(;)m
monready = (args; c):
m
msend(ma; hmeta+ready; i ; argsi)
m
mready(m = hdo+ready; ma; b0i:m
mb := b0m
mready(f ))m
monnewactor = (args; c):m
msend(ma; hmeta-newactor; i ; argsi)
m
mready(m = hdo-newactor; ma; a0i:m
mf 0(c(a0)))
m
mmfanm =
m
mreceive do+newactor
m
msend meta+newactor
m
mreceive do+become
m
msend meta+becomem
m(m+bec)m
m(m+new)m
m(ready)m
m*m
mactors+with+newactor+meta+dyn(n; t) =m
mrec+handler(newactor+meta; newactor+meta+dyn;m
mactors+with+local+constraints(n;m
mrec-handler(newactor;
m
m(hbi; c):c(newactor-meta(;; ;; b)); t)))m
mnewactor-meta-dyn = (hma0 ; i0 ; b0 i; c):
m
mc("newactor(local+constraint(dfanmd;
m
mlet ref (ma; i ; b) = #(ma0 ; i0 ; b0 ) inm
mletrec f = m: cases of m:m
mhmessage;m0i )m
mif ma = ;, f 0("apply(#b; #m0))m
melse, send(ma; hmeta-message; i ;m0i)m
hdo+setmeta; ma; ma0i ) ma := ma0; ready(f )m
mhdo+ready; ma; b0i ) b := b0; ready(f )m
mhdo+dispatch; ma;m0i ) f 0("apply(#b; #m0))m
mandee f 0 = t:m
mrec+handlers(m
mon(setmeta; onsetmeta);
m
mon(send; onsend');m
mon(ready; onready');
m
mon(newactor; onnewactor');
m
mt))
m
min f )))m
monsetmeta = (hma0; i 0i; c):m
mif ma = ;:m
m(ma; i ) := (ma0; i 0)m
mf 0(c(;))
m
melse:
m
msend(ma; hmeta+setmeta; i ; hma0; i ii)m
mready(m = hdo+setmeta; ma; ma00i:
m
mma := ma00
m
mf 0(c(;)))
m
monsend' = (ha;mi; c):m
mif ma = ;, return c(send(a; hmessage;mi))
m
melse, return onsend(ha;mi; c)m
monready' = (hb0i; c):m
mif ma = ;, b := b0; ready(f)m
melse, onready(hb0i; c)m
monnewactor' = (hb0i; c):
m
mif ma = ;, return c(newactor+meta(;; ;; b0))
m
melse, return onnewactor(hb0i; c)m
mfanmfire =
m
m(m+bec)
m
m(m+new)
m
m(m+setm)m
m(ready) send meta+newactorm
msend meta+becomem
mreceive do+becomem
msend meta+setmeta
m
mreceive do+setmeta
m
mreceive do+newactor
m
mreceive do+dispatch
m
mreceive do+become
m
mreceive do+setmeta
m
msend * or
m
mreceive messagem
mFigurereturn(val)_()_m
Copyright. (c) 2009 meami.org http://<<--