This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Fact { | |
implicit class RichInt(val n : Int) { | |
def ! : Int = (1 to n).product | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TakePrintLn ( | |
takePrintLn | |
) where | |
takePrintLn :: Int -> [String] -> IO () | |
takePrintLn n = putStrLn . unlines . take n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Integer | |
def ! | |
(1..self).inject(1, :+) | |
end | |
end | |
puts 3.! # => 6 | |
puts 0.! # => 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class JapaneseCalendar { | |
private String era; | |
private String eto; | |
private final String [] ETO_A = {"子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"}; | |
private final String [] ETO_B = {"甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"}; | |
public JapaneseCalendar(int year) { | |
setEra(year); | |
setEto(year); | |
} |
NewerOlder