#NEWLINE# @ lower_builtin ( min , types . VarArg ( types . Any ) ) #NEWLINE# def min_impl( context , builder , sig , args ) : #NEWLINE# #INDENT# argtys = sig . args #NEWLINE# for a in argtys : #NEWLINE# #INDENT# if ( a not in types . number_domain ) : #NEWLINE# #INDENT# raise AssertionError ( 'only implemented for numeric types' ) #NEWLINE# #UNINDENT# #UNINDENT# def domax( a , b ) : #NEWLINE# #INDENT# ( at , av ) = a #NEWLINE# ( bt , bv ) = b #NEWLINE# ty = context . typing_context . unify_types ( at , bt ) #NEWLINE# assert ( ty is not None ) #NEWLINE# cav = context . cast ( builder , av , at , ty ) #NEWLINE# cbv = context . cast ( builder , bv , bt , ty ) #NEWLINE# cmpsig = typing . signature ( types . boolean , ty , ty ) #NEWLINE# le = context . get_function ( '<=' , cmpsig ) #NEWLINE# pred = le ( builder , ( cav , cbv ) ) #NEWLINE# res = builder . select ( pred , cav , cbv ) #NEWLINE# return ( ty , res ) #NEWLINE# #UNINDENT# typvals = zip ( argtys , args ) #NEWLINE# ( resty , resval ) = reduce ( domax , typvals ) #NEWLINE# return impl_ret_borrowed ( context , builder , sig . return_type , resval )