functional-javascript / functionales Goto Github PK
View Code? Open in Web Editor NEWES6+, 함수형 프로그래밍, 비동기, 동시성 프로그래밍
ES6+, 함수형 프로그래밍, 비동기, 동시성 프로그래밍
좋은 강의 감사합니다.
컨커런시 부분에서 아래 내용 중
async/await는 병렬적으로 일어나는 일을 처리하지 못합니다. 하나씩 순차적으로 기다리는 경우에만 사용할 수 있습니다. 동시성 프로그래밍을 하기 위해서는 헬퍼 함수가 반드시 필요합니다.
// 동시에 users와 posts 출발
const res1 = awiat concurrency({
users: _=> query(...),
posts: _=> query(...)
});
//{
// users: [row, row, row, ...]
// posts: [row, row, row, ...]
//}
// await를 만날 때마다 하나씩 출발
const res2 = {
users: await query(...),
posts: await query(...)
}
//{
// users: [row, row, row, ...]
// posts: [row, row, row, ...]
//}
두 번째 코드 중
const res2 = 무엇 {
// ...
}
저 무엇에 해당하는 series 나 concurrency 같은 함수가 있어야 하는 것 같습니다.
안녕하세요, 인동님.
너무나 좋은 글, 감사히 읽고 있습니다.
글을 보다가 궁금한 점이 생겨서 질문을 드리고 싶습니다
링크 1에 나오는 아래 코드에 대한 질문입니다.
function *valuesIter(obj) {
for (const key in obj) yield obj[key];
}
const users = {
5: { id: 5, name: 'YB' },
19: { id: 19, name: 'BX' },
27: { id: 27, name: 'MD' }
};
for (const val of valuesIter(users)) log(val.name);
// YB
// BX
// MD
링크 2에도 유사한 코드가 있습니다
Object.assign(ObjIter, {
values: ObjIter(function *(coll) {
if (!coll) return;
for (const key in coll) yield coll[key];
}),
entries: ObjIter(function *(coll) {
if (!coll) return;
for (const key in coll) yield [key, coll[key]];
})
});
Generator 내부에서 for-in
을 사용하고 있는데, hasOwnProperty
에 대한 체크는 필요하지 않은지 여쭙고 싶습니다.
함수형에 관하여 좋은 콘텐츠들을 거듭 제공해주셔서, 늘 감사드립니다!
어떤 분께서 동기/비동기를 테스트 할 수 있는 테스트를 작성해주신다면 정말 감사할 것 같습니다.
마수걸이를 해주시면 저도 해당 파일에 여러 테스트도 올리도록 하겠습니다.
감사합니다.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.