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
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

Johnius
Copy link

@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
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