1 ! Copyright (C) 2008 Slava Pestov.
\r
2 ! See http://factorcode.org/license.txt for BSD license.
\r
3 USING: accessors models kernel assocs ;
\r
6 TUPLE: mapping < model assoc ;
\r
8 : <mapping> ( models -- mapping )
\r
10 over values >>dependencies
\r
13 M: mapping model-changed
\r
14 nip [ assoc>> [ value>> ] assoc-map ] keep set-model ;
\r
16 M: mapping model-activated
\r
19 M: mapping update-model
\r
20 [ value>> ] [ assoc>> ] bi
\r
21 [ swapd at set-model ] curry assoc-each ;
\r