Skip to content

Instantly share code, notes, and snippets.

Java 3 mins █████████████████████ 100.0%
@simon300000
simon300000 / factorial.js
Last active September 18, 2019 22:40
wow Y combinator.js?
// Simple
const simpleRecursive = () => simpleRecursive()
simpleRecursive()
// "simpleRecursive" is undefined! (static check)
const notSoSimpleRecursive = me => me(me)
notSoSimpleRecursive(notSoSimpleRecursive)
// Don't run forever!
const factorial = (me, n) => n < 1 ? 1 : n * me(me, n - 1)
@simon300000
simon300000 / worker.js
Created September 14, 2019 00:41
make function a WebWorker
// 刚刚说的感觉很有意思
// 我做了个Demo2333
// 不过只能弄很简单的Function( 可见Functional是未来( 误)
const testFunction = num => num * 2
const slowFunction = time => {
const now = Date.now()
let round = 0
while (now + time > Date.now()) {
round++
@simon300000
simon300000 / kkomda.jpg
Last active August 11, 2023 02:12
→_→
kkomda.jpg