Skip to content

Instantly share code, notes, and snippets.

Avatar

Michihito Shigemura shigemk2

View GitHub Profile
View 03-170432.py
# coding:utf-8
def λ(a):
return a
def ほげ(a):
return a
print λ(5)
print ほげ(5)
View 03-165657.php
<?php
function λ($a) {
return $a;
}
function ほげ($a) {
return $a;
}
echo λ(5);
View 03-004240.scala
def ほげ(n: Int): Int = {
n
}
println(ほげ(3))
type ほげ = Int
def α(n: ほげ): ほげ = {
n
View pierre.hs
type Birds = Int
type Pole = (Birds, Birds)
--
landLeft :: Birds -> Pole -> Pole
landLeft n (left, right) = (left + n, right)
landRight :: Birds -> Pole -> Pole
landRight n (left, right) = (left, right + n)
-- バランス棒
View applyMaybe.hs
-- オレオレバインド(>>=)の実装
applyMaybe :: Maybe a -> (a -> Maybe b) -> Maybe b
applyMaybe Nothing f = Nothing
applyMaybe (Just x) f = f x
main = do
print $ Just 3 `applyMaybe` \ x -> Just (x+1)
print $ Just "smile" `applyMaybe` \ x -> Just (x ++ " :)")
print $ Nothing `applyMaybe` \ x -> Just (x+1)
print $ Nothing `applyMaybe` \ x -> Just (x ++ " :)")
View 28-164209.scala
class A {
class B
def f(b: B) = println("Got my B!")
}
val a1 = new A
println(a1)
val a2 = new A
println(a2)
View 28-164209.scala
class A {
class B
def f(b: B) = println("Got my B!")
}
val a1 = new A
println(a1)
val a2 = new A
println(a2)
View mikutter-misakura.rb
# -*- coding: utf-8 -*-
def AheGaoDoublePeace(text)
str = text
str = str.gsub(/(気持|きも)ちいい/,'ぎも゛ぢい゛い゛ぃ')
str = str.gsub(/(大好|だいす)き/,'らいしゅきいぃっ')
str = str.gsub(/(ミルク|みるく|牛乳)/,'ちんぽミルク')
str = str.gsub(/お(願|ねが)い/,'お願いぃぃぃっっっ゙')
str = str.gsub(/ぁ/,'ぁぁ゛ぁ゛')
str = str.gsub(/あ/,'ぁあああ あぉ')
View 24-202513.js
function a() { return "hoge"; }
function b() { "use strict"; eeee; eeee }
(5 <= 6) ? console.log(a()) : console.log(b());
// (5 >= 6) ? console.log(a()) : console.log(b()); // エラー
View 24-202513.js
function a() { return "hoge"; }
function b() { eeee; eeee }
(5 <= 6) ? console.log(a()) : console.log(b());
// (5 >= 6) ? console.log(a()) : console.log(b()); // エラー
You can’t perform that action at this time.