5 kyu

Combining predicates

Description
Loading description...
Decorator
Functional Programming
Object-oriented Programming
  • Please sign in or sign up to leave a comment.
  • scarecrw Avatar

    Fun kata! I'm always impressed at the clever things you can do with decorators.

  • Expurple Avatar

    I don't know how, but I've lost a revision with a lot of additional tests. In this published revision, test sets 2 and 3 don't even list the arguments yet and aren't used anywhere. I'll close this issue when I restore my work

    • Expurple Avatar

      Done

      Issue marked resolved by Expurple 3 years ago
    • AveAsuka Avatar

      hi!

      can you please give a hint how to solve this kata? I don't understand how to implement the syntax, as an example: "is_even & is_positive"

      I have already studied the topic of predicates and bitwise operations

    • Expurple Avatar

      Hi. You need to look up "operator overloading" and "magic methods"

    • AveAsuka Avatar

      I've studied the topics you've given me, but I can't figure out how a function, a class, and just a variable with the same name should be combined with themselves. Can you please suggest the structure of the solution?

    • Expurple Avatar

      I'm not sure what you mean by "combined with themselves". Can you provide a code example?

  • Blind4Basics Avatar

    Hi,

    the Test random logical expressions declaration needs to be a describe block, not a it one (since it's not a "leaf test block")

    Cheers

    • Blind4Basics Avatar

      actually, you should get rid of that block and the test_compound_predicates function and just run the loop isnide the "random tests" describe block

    • Expurple Avatar

      test_compound_predicates is actually necessary and it's called three times with different arguments, but that revision got lost somehow. After I fix that, I'll return to your issue and eliminate that non-leaf it

    • Expurple Avatar

      Done

      Issue marked resolved by Expurple 3 years ago
    • Blind4Basics Avatar

      oh, yeah. I didn't read the full test suite (just saw that this block was in red in the output panel)

  • Expurple Avatar

    While the & | ~ interface is the same, I beleive that it's not a duplicate. Readable Specification Pattern focuses on class hacks, and this kata focuses on flexible interface not limited to 1 argument