def tokens(code_str, xmap_str):
# lines from code_str. remove \n and attach
lines = fp.go(
code_str,
F.curry(F.partition_by)(lambda s: s == '\n'),
fp.lmap(''.join),
# Ignore newlines in beginning of source code
lambda xs: F.rest(xs) if '\n' in xs[0] else xs,
# join ['source line', '\n\n\n']
F.curry(F.chunks)(2),
fp.lmap(''.join),
)
# slice_idxs from xmap_str. indexes for each lines.
slice_idxs = fp.go( #TODO: change to map and pipe
xmap_str.splitlines(),
fp.map(fp.pipe(
lambda s: s.strip(),
lambda s: s.split(),
fp.map(int),
fp.lmap(fp.dec), # TODO: list or tuple?
# Make tokens from the beginning of the line
lambda xs: [0] + xs[1:] if xs else xs,
)),
#fp.remove(fp.is_empty)
fp.lremove(fp.is_empty)
)
return fp.tmapcat(
fp.tsplit_with, slice_idxs, lines
)
const pipe2 = (a, b) => (arg) => b(a(arg));
const pipe = (...ops) => ops.reduce(pipe2)
const tup = f => argtup => f(...argtup)
tap = x => {console.log(x); return x}
function scroll(div, lineno, max,min) {
const real_h = div.scrollHeight - div.clientHeight
a = real_h / (max - min) // 913, 26 is
b = -min * a
div.scrollTop = a * lineno + b
}
[...document.querySelectorAll('.comp_table tr')].slice(1).forEach(
tr => tr.addEventListener('click', (() => {
const [a_mid, b_mid] =
[...tr.children]
.map(x => x.textContent)
.slice(1,3) // idx 0 is no, 1,2 are A,B. dict would be better..
.map(pipe(
s => s.split(' ~ '),
arr => arr.map(Number),
//tup( (b,e) => (b+e)/2 )))
tup( (b,e) => Math.trunc( (b+e)/2 ) )))
const [a_div,b_div] =
[...document.querySelectorAll('.row .column')].slice(0,2);
const [min, bottom_offset] = [22, 29] // FIXED!
const [a_max, b_max] =
[...document.querySelectorAll('.linenos')]
.map(pipe(
x => x.textContent,
s => s.split('\n'),
ns => ns[ns.length -1],
Number,
n => n - bottom_offset
))
scroll(a_div, a_mid, a_max, min) // same view line
scroll(b_div, b_mid, b_max, min)
}
)))
파이썬이나 js로 함슬람을 하라 이말이야
함수형 js = 인싸들이 아싸개그 뺏어가서 만든거
그거 고인물이 하는 말이 인싸들은 표현이나 따라 하지 정작 사이드 이펙트를 그대로 둔다고
그런 떡을 쳐놓는데 어케 돌아 가게 만드는 거 보면 신기하다고 함
함수형이 뭐냐고 물었을때 순수성을 떠올리면 진짜 함슬람, 고차함수를 떠올리면 인싸쉑임 ㅋㅋㅋㅋ
ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ
누가 컴퓨터 감속기 만드냐 - return 0;
함슬람 하나 안 하나 비슷함 함정만 좀 피하면
지랄노
삼다수통제조사