USING: combinators kernel math math.parser sequences sets ; IN: bugtest : squares ( n -- i ) number>string [ CHAR: 0 - sq ] [ + ] map-reduce ; : (happy?) ( n set -- ? ) { { [ over 1 = ] [ 2drop t ] } { [ 2dup in? ] [ 2drop f ] } [ [ adjoin ] [ [ squares ] [ (happy?) ] bi* ] 2bi ] } cond ; : happy? ( n -- ? ) HS{ } clone (happy?) ;