mirror of
				https://github.com/DanilaFe/abacus
				synced 2025-11-03 18:33:41 -08:00 
			
		
		
		
	Add type aliases for Kotlin and a simple extension function.
This commit is contained in:
		
							parent
							
								
									7a296e4e8b
								
							
						
					
					
						commit
						453cd0ea77
					
				
							
								
								
									
										10
									
								
								core/src/main/kotlin/org/nwapw/abacus/number/NumberUtils.kt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								core/src/main/kotlin/org/nwapw/abacus/number/NumberUtils.kt
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,10 @@
 | 
			
		||||
@file:JvmName("NumberUtils")
 | 
			
		||||
package org.nwapw.abacus.number
 | 
			
		||||
 | 
			
		||||
typealias PromotionFunction = java.util.function.Function<NumberInterface, NumberInterface>
 | 
			
		||||
typealias PromotionPath = List<PromotionFunction>
 | 
			
		||||
typealias NumberClass = Class<NumberInterface>
 | 
			
		||||
 | 
			
		||||
fun PromotionPath.promote(from: NumberInterface): NumberInterface {
 | 
			
		||||
    return fold(from, { current, function -> function.apply(current) })
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user