2 ms·
Your OCaml function example looks like feature I call conditional parameters in KatLang (inspired from Erlang). In mathematics exists many different concepts wh
by rabarbers 5y ago
Your OCaml function example looks like feature I call conditional parameters in KatLang (inspired from Erlang).
In mathematics exists many different concepts which are called perfect. For example, perfect numbers. God called Lucifer a perfect. I provided a definition for symbols perfectness and tokens perfectness. You can call it unprofessional, but I did my best. I do not call my work perfect to make it more significant. I use term perfect as an attribute of the code expressions. Imagine identity function:
function(x) {return x; }
In KatLang You can define it as:
x
The question is: can you remove one more symbol without changing the meaning of the expression? If no, then, the identity function definition 'x' is symbols perfect according to my definition. Of course, I rely on the usage context and it allows me to hide some part of critical information and focus only on the short lambda expression.
Thanks for the elixir examples.
- Zababa 5y ago> Your OCaml function example looks like feature I call conditional parameters in KatLang (inspired from Erlang). It does! Elixir (coming from Erlang) and Haskell have the same thing, both through pattern matching of a function to different definitions. OCaml (and most other languages using pattern matching) pattern match inside a single definition. > In mathematics exists many different concepts which are called perfect. For example, perfect numbers. I personally only know about perfect numbers. I'm not sure if it's a great name for them, or if it's just a "fun" name like sexy prime https://en.wikipedia.org/wiki/Sexy_prime https://en.wikipedia.org/wiki/Sexy_prime that doesn't mean much. For your example about the identity function, I think it's great, but I'm personally more in favour of positional lambdas like &1 in Elixir. > The question is: can you remove one more symbol without changing the meaning of the expression? If no, then, the identity function definition 'x' is symbols perfect according to my definition. Maybe "minimal" would be a better name then? Or "shortest"? Many people could argue on what makes the perfect lambda, but it's hard to argue that yours isn't the most minimal or shortest.
- rabarbers 5y agoProbably picking the term "perfect" was not the best think I could do. Seems, that others actively fight against it. I still believe that the perfect syntax has both attributes: 1) it is the shortest 2) it is expressive - you can express any expression in it. Picking that name made my life much more difficult.