- esehara shigeo
- プログラミング言語オタク
- 近況については悲しいことがあり、飛ばします(現時点では無職です)
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 Mahou | |
DIMENSION = 7 | |
def self.column_check a, b | |
0.upto(DIMENSION - 1) do |i| | |
sum = 0 | |
0.upto(DIMENSION - 1) do |j| | |
sum += a[j][i] | |
end | |
raise "縦の行: #{j + 1} が #{sum} なので定和性を満しません" if sum != b |
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
defmodule FizzBuzzDefine do | |
def define_taple do | |
[{"fizz", 3}, {"Buzz", 5}] | |
end | |
end | |
defmodule FizzBuzzHelper do | |
import FizzBuzzDefine |
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
open System | |
let message ans user = | |
if (ans > user) then | |
"答えはもっと大きいよ" | |
elif (ans < user) then | |
"答えはもっと小さいよ" | |
else | |
"You won !" |
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 String | |
def ml2_value | |
self | |
end | |
end | |
class Fixnum | |
def ml2_value | |
self |
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 Dame | |
def initialize | |
@x = [] | |
end | |
def add(x) | |
@x << x | |
end | |
def get |
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 Env | |
def initialize | |
@values = {} | |
end | |
def plus(x, y) | |
return x + y | |
end | |
def get_value(x) |
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
package main | |
import ( | |
"flag" | |
"fmt" | |
"os" | |
"runtime" | |
"sort" | |
"strconv" | |
"strings" |
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
import Data.List | |
import Control.Parallel.Strategies | |
collatz :: Int -> (Int, Int) | |
collatz n = collatz_prosess n 0 n | |
collatz_prosess :: Int -> Int -> Int -> (Int, Int) | |
collatz_prosess n t f | |
| n == 1 = (f, t) | |
| even n = collatz_prosess even_n (t + 1) f |
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
let max_binary_list n = | |
let rec generate_binary_list n m sum xs = | |
if sum >= n then xs | |
else generate_binary_list n (m * 2) (m + sum) (m :: xs) in | |
generate_binary_list (abs n) 2 1 [1] | |
let rec generate_flag_list n xs ys = | |
match xs with | |
[] -> ys | |
| x :: next_xs -> |