Ad
  • Custom User Avatar

    Yes, the input validation was removed.
    The tests now only pass valid inputs.

  • Custom User Avatar

    I refactored the description.

  • Custom User Avatar

    try to replace function snailArr by closure $snailArr = function(){} or declare the function function
    outside of the of the snail function. :)

  • Custom User Avatar

    Java programmer detected.

  • Custom User Avatar
  • Custom User Avatar

    I guess you should improve the tests and description.

    1. The description should be most specific which the 'a' is before 'm' in any position of array.

    The test should cover:

    • The case of 'a' is present but 'm' is not present in array.
      Ex: ['b','x','a','j']
    • The case of multiples 'm' one before and one after.
      Ex: ['m','i','a','j','m']
  • Custom User Avatar

    The kata was unclear and the houses was not preloaded by default.

    Houses should be passed to the function, to avoid access outter scope.

    function motto(name ,houses) {
    
    }
    
  • Custom User Avatar

    "Not the greatest description.":

    • Sorry.

    "Apparently, we are to implement function composition,":

    • Yes.

    "I don't even know if it's some variant of C or Java":

    • It is a PHP code.
    • I created this kata inspired in laravel's middleware.
    • Laravel is a PHP MVC framework based on Ruby on Rails.

    "I may not speak C, but I do speak Haskell, where function composition is right to left by default!":

    • The order of the createPipeline composition function is left to right, it's is not the default order.

    "The example tests introduce a requirement to silently ignore invalid input, which is wrong in several ways."

    • What can I do about this? Should I throw an Error?

    "..and finally there's something about making a request. I have no clue what that is about.":

    • The Laravel middleware process HTTP requests, I did a presumption, sorry.

    "Descriptions should be self-contained, so external references should not be essential...":

    • Thank you for the advice.
    • What do you think? Should I try to create a better description for this kata? Or it will reject because it is similar Pipelining and composing functions?
  • Custom User Avatar

    No, I didn't read the documentation.

    I unpublished the kata, I think I'm not prepared yet to publish it.

    I'm not a native english speaker, and my english is better at reading than writing.

  • Custom User Avatar

    It's similar Pipelining and composing functions, but the difference is: the function which is passed to the "createPipeliine" receive 2 params, the "value" and
    "next" param.
    The "next" param is a function that call the next step in pipeline. So the developer can abort the chain by simple not calling the "next" param, execute the code before or after call the "next".

  • Custom User Avatar

    No you shouldn't use operators "&&" "? :" "||" "+" only functions.

    Think the functions True and False as "if/else" statements.

    
    const True = _them => _else => _them;
     /*Always will return function _them*/
     console.log(True(true)('_A_RANDOM_VALUE'))); // true
     console.log(True(false)('_A_RANDOM_VALUE'))); // false
     console.log(True('_A_RANDOM_VALUE')(false))); // _A_RANDOM_VALUE
     console.log(True('_A_RANDOM_VALUE')(true))); // _A_RANDOM_VALUE
     /* 
       As you can see the function True always passing the two values always will return the first one    
    */
    const False = _them => _else => _them;
     /*Always will return function _else*/
     console.log(False(true)('_A_RANDOM_VALUE')); //_A_RANDOM_VALUE 
     console.log(False(false)('_A_RANDOM_VALUE')); //_A_RANDOM_VALUE 
     console.log(False('_A_RANDOM_VALUE')(false)); //false 
     console.log(False('_A_RANDOM_VALUE')(true)); //true
    
     /* 
       As you can see the function True always passing the two values always will return the second one    
    */
    //considering True and False as If Statements
    
    /** A True|False ? **/
    
    const TestFn = A => A /*IF*/ (/*THEM*/ True )  (/*Else*/ False)
    /** 
       Read this TestFn function as
       if(A){
         return True;
       }else{
         return False;
      }
    */
    TestFn(True) /*True function*/
    TestFn(False) /*False function*/