Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Create Y-combinator function#191

Open
Johnius wants to merge 2 commits into
rmurphey:masterfrom
Johnius:master
Open

Create Y-combinator function#191
Johnius wants to merge 2 commits into
rmurphey:masterfrom
Johnius:master

Conversation

@Johnius
Copy link
Copy Markdown

@Johnius Johnius commented Jun 27, 2016

This function might have a good fit here to see if testee knows how to implement recursion without having it natively in a language. Yes, it's more theoretical question.

Correct answer is

{
  yCombinator: function (fn) {
    return function (n) {
      return fn(n, fn)
    }
  }
}

@Johnius
Copy link
Copy Markdown
Author

Johnius commented Jun 27, 2016

  150:14  error  Do not nest ternary expressions           no-nested-ternary
  150:14  error  Ternary operator used                     no-ternary
  150:26  error  Gratuitous parentheses around expression  no-extra-parens
  150:27  error  Ternary operator used                     no-ternary

Ok...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant