Retired

truth tables (retired)

Description
Loading description...
Algorithms
Booleans
Data Types
Parsing
Logic
Strings
  • Please sign in or sign up to leave a comment.
  • JohanWiltink Avatar

    Please:

    • use Test.assertDeepEquals
    • get your datatypes straight
    • actually specify everything that will be required ( in the description )
    • write random tests before publishing
    • you specify. user implements. do not require the helpers you use, unless you're building towards a climax in a guided tour of a much more difficult subject than this kata's

    This list is not intended to be complete. But it would be a start.

    Oh, and eval is not a good idea. Never. Nor is stringifying everything. ( Maybe just pass functions instead of strings? They're first class citizens, you know? )

    • pointbazaar Avatar

      thanks for your feedback. I assume not using eval is good practise because it's not available in some languages?

    • JohanWiltink Avatar

      Its unavailability is a good point. A Haskell translation would require a parser / evaluator, because there is no eval.

      But the usual reason is (a) speed and (b) security ( not necessarily in that order ).

      eval is necessarily slow, because things have to be done at runtime instead of at compiletime, and very much a security risk. Imagine you'd pass "format C:" instead of "a&&b" .. and you could, you know. :P Writing a parser / evaluator would be the safe option for production code, but that would be quite the project. Better to just generate ([a,b]) => a && b and pass that. ( JS could probably format your harddrive in a function, but in Haskell, that would be actually impossible [ for a pure function. and you can force purity ]. )

    • JohanWiltink Avatar

      Hmmm .. that parser / evaluator would not even be that much of a project. And it would be ( my ) kind of fun.

      Tell you what, you redo the JavaScript kata, I'll do the Haskell translation. :]

    • Unnamed Avatar

      but in Haskell, that would be actually impossible [ for a pure function. and you can force purity ]

      There's unsafePerformIO and functions written in other languages can be called too. There's enough real-world stuff in Haskell to shoot yourself in a foot when you really want to.

    • Voile Avatar

      functions written in other languages can be called too

      Oh man, that reminds me of a certain solution in the linear egg kata...

  • Voile Avatar

    Please, as usual, actually finish writing a kata before publish it. There's no point publishing a half-completed kata.

    • JohanWiltink Avatar

      This ^

      The idea is good, the execution less than brilliant, the parts that at least are there. ( reinventing === as eq ? really ?!? )

      The only points a half-completed kata will score are negative, in the form of ratings.