Ad
  • Custom User Avatar

    In most of imperative languages like Java recursion works slower than iteration because lot call stack entries must be created and than you'll have to run through the call stack to collect your calculations results. that could be quite expensive.

    Functional languages are languages like Haskell, Scala, Erlang, Closure, etc. The difference is that in imperative languages your programm is some number of states that change each other, and in functional languages you have no state but only a number functions. The word 'function' should be understood in the way we understand it in maths. Function in functional language is just a relation betwenn inputs and results, and it's result depends only on input, but not any environment conditions. In imperative languges function can return you different result in different moment of time, depending on some external conditions like configs, database, etc. In purely functinal languages function will allways return you the same result as long as you give it the same input.

    Actually, the best way to understand what functional languges really are is to try them. Elm is a brilliant choice as your first functional language :)

  • Custom User Avatar

    ooh. why is that? something to do with JVM? What do you mean by a functional language?

  • Default User Avatar

    I agree with you, I've just wanted to show that it doesn't have enough test cases. So it's a normal bug in the Kata:)

  • Custom User Avatar

    I think this solution is not correct.
    It does not (properly) check whether the elements of sys are coprime.
    Instead it just checks if sys contains more than one even number - which is just a special case.

    The solution would for example fail to return "Not applicable" for [3, 6].

  • Custom User Avatar

    I like this iterative solution.
    Recursion might be the "right" way to do factorial() in a functional language, but in Java it's just slower.