- ラムダは超便利。無いというのはあり得ない。
- streamは便利だけど、メソッドが意外に少なくて物足りない
- Optional型は便利なので使っていきたい
関数型要素が増えててかなり書きやすくなってる。が、Scala や Ruby に比べて無理がある感は否めない。
RxJavaの感想
#! /usr/bin/env coffee | |
assert = require('assert') | |
Rx = require('rx') | |
collectionAssert = (expected, actual) -> | |
if expected.length != actual.length | |
assert(false, 'Not eual length.') | |
isOk = true |
#! /usr/bin/env coffee | |
p4 = (lists) -> | |
lists.sort((a, b) -> b.toString()[0] - a.toString()[0]).map((n) -> n.toString()).join('') | |
console.log(p4([50, 2, 1, 9])) |
#! /usr/bin/env coffee | |
solver = (n, s)-> | |
if n == 10 | |
console.log(s) if eval(s) == 100 | |
return | |
solver(n + 1, s + '+' + n) | |
solver(n + 1, s + '-' + n) | |
solver(n + 1, s + n) |
#! /usr/bin/env coffee | |
p4 = (lists) -> | |
lists.sort((a, b) -> (b.toString() + a.toString()) - (a.toString() + b.toString())).map((n) -> n.toString()).join('') | |
console.log(p4([50, 2, 1, 9])) | |
console.log(p4([50, 2, 1, 5, 56])) | |
console.log(p4([42, 423, 420])) |
#! /usr/bin/env ruby | |
# coding: utf-8 | |
words = [] | |
n = STDIN.gets.strip.to_i | |
(0 ... n).each do | |
words << STDIN.gets.strip | |
end | |
words = words.sort do |a, b| |
#!/usr/bin/env ruby | |
# coding: utf-8 | |
sum = 0 | |
num = 0 | |
STDIN.gets #discard | |
STDIN.gets.strip.each_byte do |ch| | |
sum += 69 - ch if ch < 69 | |
num += 1 | |
end |
#! /usr/bin/env ruby | |
# coding: utf-8 | |
n = STDIN.gets.to_i | |
pt = [] | |
max = 0 | |
sum = 0 | |
list = [] | |
(0...n).each do |i| |
#! /usr/bin/env ruby | |
# coding: utf-8 | |
n = STDIN.gets.to_i | |
x = [] | |
y = [] | |
(0 ... n).each do |i| | |
x[i], y[i] = STDIN.gets.strip.split(' ') | |
x[i] = x[i].to_i | |
y[i] = y[i].to_i |
# coding: utf-8 | |
class Fluent::InTailMysql < Fluent::Input | |
Fluent::Plugin.register_input('tail_mysql', self) | |
require 'mysql' | |
config_param :host, :string | |
config_param :user, :string | |
config_param :password, :string |