1 USING: accessors compiler.units combinators fry generalizations io
2 io.encodings.binary io.sockets kernel namespaces
3 parser sequences serialize vocabs vocabs.parser words ;
8 : remote-quot ( addrspec vocabspec effect str -- quot )
9 '[ _ 5000 <inet> binary
11 _ serialize _ in>> length narray serialize _ serialize flush deserialize dup length firstn
15 : define-remote ( addrspec vocabspec effect str -- ) [
16 [ remote-quot ] 2keep create-in -rot define-declared word make-inline
17 ] with-compilation-unit ;
19 : with-in ( vocab quot -- vocab ) over
20 [ '[ _ set-in @ ] in get swap dip set-in ] dip vocab ; inline
22 : remote-vocab ( addrspec vocabspec -- vocab )
23 dup "-remote" append [
24 [ (( -- words )) [ "get-words" remote-quot ] keep call-effect ] 2keep
25 [ rot first2 swap define-remote ] 2curry each