find-shape ( seq shape -- shape' )

Vocabulary
tensors.private

Inputs
seqan object
shapean object
Outputs
shape'an object
Definition
USING: arrays kernel sequences ;
IN: tensors.private
:: find-shape ( seq shape -- shape' )
seq empty?
[ { 0 } ] [
shape seq length 1array append
:> shape' seq first :> 1st 1st sequence?
[ 1st shape' find-shape ] [ shape' ] if
] if ;