table single storage works for f
parent
611b3638f4
commit
b7c719c844
|
@ -11,7 +11,14 @@ IN: inverse.vectors
|
|||
|
||||
\ peek [ 1vector ] define-inverse
|
||||
|
||||
! if is too general to undo, but its derivatives aren't
|
||||
|
||||
:: undo-if-empty ( result a b -- seq )
|
||||
a call( -- b ) result = [ V{ } clone ] [ result b [undo] call( a -- b ) ] if ;
|
||||
|
||||
:: undo-if* ( result a b -- boolean )
|
||||
b call( -- b ) result = [ f ] [ result a [undo] call( a -- b ) ] if ;
|
||||
|
||||
\ if-empty 2 [ swap [ undo-if-empty ] 2curry ] define-pop-inverse
|
||||
|
||||
\ if* 2 [ swap [ undo-if* ] 2curry ] define-pop-inverse
|
||||
|
|
|
@ -56,9 +56,9 @@ GENERIC: (>>selected-value) ( val table -- )
|
|||
: >>selected-value ( table val -- table ) over (>>selected-value) ;
|
||||
|
||||
M: table selected-value>> selected-values>> [ [ f ] [ peek ] if-empty ] <illusion> ;
|
||||
M: table (>>selected-value) [ [ 1vector ] <illusion> ] dip (>>selected-values) ;
|
||||
M: table (>>selected-value) [ [ [ 1vector ] [ V{ } clone ] if* ] <illusion> ] dip (>>selected-values) ;
|
||||
M: table selected-index>> selected-indices>> [ f ] [ peek ] if-empty ;
|
||||
M: table (>>selected-index) [ 1vector ] dip (>>selected-indices) ;
|
||||
M: table (>>selected-index) [ [ 1vector ] [ V{ } clone ] if* ] dip (>>selected-indices) ;
|
||||
|
||||
IN: ui.gadgets.tables
|
||||
: push-selected-index ( table n -- table ) 2dup swap selected-indices>> index [ drop ] [ over selected-indices>> push ] if ;
|
||||
|
|
Loading…
Reference in New Issue