News for hackers. Stuff that matters.
Re:Decision Tables by rdtsc on Thursday October 18, 2018 @05:25PM (#18252268)
That's why I like Erlang, it allows for multiple function heads and pattern matching. So these kind of tables are very easy to represent without too much noise:

    f(t, t, t) -> 1;
    f(t, t, f) -> 3;
    f(t, f, t) -> 7;
    f(t, f, f) -> "cucumber";
    f(f, _, _) -> null.
Pretty close to the table, no?

The other example:

    fizzbuzz(N) ->
        case {N rem 3, N rem 5} of
            {0, 0} -> "FizzBuzz";
            {0, _} -> "Fizz";
            {_, 0} -> "Buzz";
            {_, _} -> N
       end.
Here I used a case statement, but it also matches the shape pretty well.

That's valid code, not pseudocode, you can compile it in a module an run it.

Notice how multiple function clauses separated by ; allow much nicer code patches. If a function wasn't working well, instead of adding an if statement inside, you can add another function clause instead.

Re:Decision Tables by pdimitar on Thursday October 18, 2018 @06:54PM (#18252932)
I personally prefer Elixir but I have to say that the more I use Erlang libraries (like for state machines, trees and graphs) the more I grow fond of it and the more I view both languages as what they really are: a brother and a sister. ^_^
Re:Decision Tables by pka on Friday October 19, 2018 @05:42AM (#18255431)
Most, if not all, functional languages support pattern matching: Haskell, OCaml, Clojure, Erlang/Elixir, Purescript, Idris, Elm, etc.
Re:Decision Tables by rdtsc on Friday October 19, 2018 @09:05AM (#18256418)
Sure. I just like Erlang in particular and thought it approximated the table format pretty well.