Skip to content

Instantly share code, notes, and snippets.

@tomatophobia
Created August 22, 2025 15:11
Show Gist options
  • Select an option

  • Save tomatophobia/a2df45c357c5397f169528b640956b7e to your computer and use it in GitHub Desktop.

Select an option

Save tomatophobia/a2df45c357c5397f169528b640956b7e to your computer and use it in GitHub Desktop.
// 프로그램의 대부분은 아래와 같이 순수한 함수들의 연결로 표현합니다.
const join = (a: string, b: string) => a + ", " + b
// print는 문자열을 받아 함수를 반환하므로 순수한 함수입니다.
const print = (message: string) => {
return () => { console.log(message) }
}
// 함수 합성
const program = print(join("hello", "world!"))
// 부수 효과를 한 번에 터뜨립니다.
program()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment