: 4wayIf ( flag flag both neither first second ) heap [ cons &cons dip [ [ cons ] dip ] dip rot ] preserve [ do [ -1 = ] bi@ and ] [ 2drop do drop do ] when [ do [ 0 = ] bi@ and ] [ 2drop do nip do ] when [ do 0 = swap -1 = and ] [ drop nip do drop do ] when [ do -1 = swap 0 = and ] [ drop nip do nip do ] when drop 2drop ;