2009-02-09 01:49:48 -05:00
|
|
|
! Copyright (C) 2008, 2009 Slava Pestov.
|
2008-07-11 01:47:16 -04:00
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2009-03-16 21:11:36 -04:00
|
|
|
USING: accessors models kernel ;
|
2009-02-26 17:15:10 -05:00
|
|
|
IN: models.arrow
|
2008-07-04 18:58:37 -04:00
|
|
|
|
2009-02-26 17:15:10 -05:00
|
|
|
TUPLE: arrow < model model quot ;
|
2008-07-04 18:58:37 -04:00
|
|
|
|
2009-02-26 17:15:10 -05:00
|
|
|
: <arrow> ( model quot -- arrow )
|
|
|
|
f arrow new-model
|
2008-07-11 01:47:16 -04:00
|
|
|
swap >>quot
|
|
|
|
over >>model
|
|
|
|
[ add-dependency ] keep ;
|
2008-07-04 18:58:37 -04:00
|
|
|
|
2009-02-26 17:15:10 -05:00
|
|
|
M: arrow model-changed
|
2009-02-09 01:49:48 -05:00
|
|
|
[ [ value>> ] [ quot>> ] bi* call( old -- new ) ] [ nip ] 2bi
|
|
|
|
set-model ;
|
2008-07-04 18:58:37 -04:00
|
|
|
|
2009-02-26 17:15:10 -05:00
|
|
|
M: arrow model-activated [ model>> ] keep model-changed ;
|