- Elixirがどこかで流行っているプログラミング言語だということがわかった
- 動的型付けの関数型言語だった
- Elixirの文法の雰囲気がちょっとわかった
- 色々なことがほんのりとわかった気になれた
- OTP
This file contains hidden or 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
/* | |
四則演算器プログラムです. | |
ex.) caluculate('1+2*3'); // => 7 | |
caluculate('(1+2)*3') // => 9 | |
* 有理数は未実装 | |
*/ | |
// 演算子たち |
This file contains hidden or 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 CircleGraphView extends View { | |
static class Data { | |
int value; | |
int color; | |
Data(int value, int color) { | |
this.value = value; | |
this.color = color; | |
} |
This file contains hidden or 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
if (BuildConfig.DEBUG) { | |
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() | |
.detectAll() | |
.penaltyLog() | |
.build()); | |
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() | |
.detectAll() | |
.penaltyLog() | |
.build()); | |
} |
This file contains hidden or 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 Prac1 do | |
def fib(0) do 0 end | |
def fib(1) do 1 end | |
def fib(n) do fib(n-1) + fib(n-2) end | |
def qsort([]) do [] end | |
def qsort([h|tail]) do | |
{left, right} = Enum.partition(tail, &(&1 < h)) | |
qsort(left) ++ [h] ++ qsort(right) | |
end |
This file contains hidden or 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 Prac2 do | |
def prime?(2) do true end | |
def prime?(n) when n < 2 do false end | |
def prime?(n) when rem(n, 2) == 0 do false end | |
def prime?(n) do check(3, n) end | |
defp check(a, b) do | |
if a * a <= b do | |
if rem(b, a) == 0 do | |
false |
This file contains hidden or 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 UIKit | |
import RxSandbox | |
import RxSwift | |
import PlaygroundSupport | |
func which() -> String { | |
return Thread.isMainThread ? "main" : "background" | |
} | |
let disposeBag = DisposeBag() |
This file contains hidden or 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 BeatDetector { | |
constructor(holdTime, decayRate, minLevel) { | |
this.holdTime = holdTime // the number of frames to hold a beat | |
this.decayRate = decayRate | |
this.minLevel = minLevel // a volume less than this is no beat | |
this.cutOff = 0.0 | |
this.time = 0 | |
} |
This file contains hidden or 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 Fireball { | |
constructor(position, velocity, size) { | |
this.position = position | |
this.velocity = velocity | |
this.size = size | |
this.acceleration = createVector(0, 0) | |
this.radius = size / 2 | |
this.mass = this.size / 100 | |
this.lifespan = 50 |
This file contains hidden or 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 'pixi.js' | |
import { | |
GlowFilter | |
} from '@pixi/filter-glow' | |
import noiseMap from "../assets/images/noise_map.png" | |
function startApp() { | |
const app = new PIXI.Application({ | |
width: 800.0, |
OlderNewer