Handbook
Glossary
(model-changed) ( model observer -- )
Vocabulary
models
.
combinators
Inputs
model
an
object
observer
an
object
Outputs
None
Definition
IN:
models.combinators
GENERIC:
(model-changed)
( model observer -- )
Methods
USING:
accessors
combinators
kernel
models.combinators
;
M:
(when-model)
(model-changed)
[
quot>>
]
2keep
[
value>>
]
[
cond>>
]
bi*
( a -- ? )
call-effect
[
( model -- )
call-effect
]
[
2drop
]
if
;
USING:
accessors
combinators
kernel
models
models.combinators
;
M:
action
(model-changed)
[
[
value>>
]
[
quot>>
]
bi*
( a -- b )
call-effect
]
keep
value>>
[
swap
add-connection
]
2keep
model-changed
;
USING:
accessors
kernel
models
models.combinators
;
M:
basic-model
(model-changed)
[
value>>
]
dip
set-model
;
USING:
accessors
kernel
models
models.combinators
models.product
sequences
;
M:
collection
(model-changed)
nip
dup
dependencies>>
[
value>>
]
all?
[
dup
[
value>>
]
product-value
swap
set-model
]
[
drop
]
if
;
USING:
accessors
combinators
kernel
models
models.combinators
;
M:
filter-model
(model-changed)
[
value>>
]
dip
2dup
quot>>
( a -- ? )
call-effect
[
set-model
]
[
2drop
]
if
;
USING:
accessors
combinators
kernel
models
models.combinators
models.combinators.private
sequences
;
M:
fold-model
(model-changed)
2dup
base>>
=
[
[
[
value>>
]
[
[
values>>
]
[
quot>>
]
bi
]
bi*
swapd
reduce*
]
keep
set-model
]
[
[
[
value>>
]
[
values>>
]
bi*
push
]
[
[
[
value>>
]
[
[
value>>
]
[
quot>>
]
bi
]
bi*
( val oldval -- newval )
call-effect
]
keep
set-model
]
2bi
]
if
;
USING:
accessors
combinators
kernel
models
models.combinators
;
M:
mapped-model
(model-changed)
[
[
value>>
]
[
quot>>
]
bi*
( old -- new )
call-effect
]
[
nip
]
2bi
set-model
;
USING:
accessors
combinators
kernel
models
models.combinators
;
M:
quot-model
(model-changed)
nip
[
quot>>
( -- b )
call-effect
]
keep
set-model
;
USING:
accessors
combinators
kernel
models
models.combinators
;
M:
side-effect-model
(model-changed)
[
value>>
]
dip
[
quot>>
( old -- )
call-effect
]
2keep
set-model
;
USING:
accessors
kernel
models
models.combinators
;
M:
switch-model
(model-changed)
2dup
switcher>>
=
[
[
value>>
]
dip
over
switch
=
[
nip
[
original>>
]
keep
f
>>on
model-changed
]
[
t
>>on
set-model
]
if
]
[
dup
on>>
[
2drop
]
[
[
value>>
]
dip
over
[
set-model
]
[
2drop
]
if
]
if
]
if
;
USING:
accessors
kernel
models
models.combinators
;
M:
updater-model
(model-changed)
[
tuck
updates>>
=
[
[
values>>
value>>
]
keep
set-model
]
[
drop
]
if
]
keep
f
swap
value<<
;