Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I am thinking that Perl is (probably) the computer language which uses the most operators, but not everyone believes this is a good thing.

I mean, it seems there is somewhere a sweet spot between lack of expressiveness and overcomplication.



No, that crown would almost certainly go to one of the variants of APL, which have more operators than ASCII has symbols. https://en.wikipedia.org/wiki/APL_(programming_language)


I've always thought that if you learn one programming language, you can probably pick up any other language quite easily, except for APL/J/K.


Many claim that Haskell is easiest to learn as a first language.


I don't know Haskell, but from what I've seen, it doesn't look like a beginner-friendly language. I think Python is the undisputed king of introductory languages.


It means that the easiest time to learn Haskell is as a first language, not that it's the easiest of all first languages!


Ohh I see. That makes sense!


The strange syntax of Haskell is what's turning me off from learning it. With Lisp, the syntax was strange still, sure, but it wasn't confusing, it made sense. I feel like I can't even get in to reading Haskell or even OCaml.

However if Haskell had macros (like Perl 6's or even Lisp's), I'd jump ship from Lisp quite quickly. It's a mature language with the libraries I want.


> if Haskell had macros

What are you wanting that's missing from Template Haskell?


Or even lazy evaluation.


I think implementing lazy evaluation is a common use case of macros in languages that don't support it otherwise, but there are plenty of other uses (some questionable on balance, but all with their upsides).


Perl6 can be written as beautifully as any language, but can also be written to look similar to APL (more so than P5), but obviously not as terse as APL.


Interestingly, the same might be true with languages.

Quechua (from the Andean Mountains) only has three vowels (a, i, u). I can't find a reference, but AFAIK the main hypothesis was that a 3-vowel system made it easier to communicate across longer distances (i.e. across a canyon or valley in the Andes).


Perl might have a lot of operators but Haskell's ability to define your own operators leads to a ton of operators in the standard library and third party packages.


That's one of the things keeping me away from Haskell. It seems that to be proficient I would need to know way more beyond the "standard library", but go into the String vs Text debates, and the huge amounts of common knowledge out there.


String is a type alias for a lazy linked list of characters: not very high performance, but easy to work with using all the basic list manipulation tools.

Text is a compact and efficient representation, more similar to strings in other languages.

As far as learning libraries: its not mandatory and you can code as well as anywhere else without them, but the "language enhancing libraries" are undeniably useful, and can do some incredibly useful things. Monad transformers let you merge computational contexts, Conduit lets you cleanly define stream transformations, Lens lets you manipulate specific aspects of some state in a context, etc.


Except for Lens, most packages shy away from operator soup. The basic set you need to know to read most Haskell code is quite small, and tied to the core concepts you need to know anyway, such as:

    Functor (<$>)
    Applicative (<*>, <*, *>)
    Monad (>>=, =<<, >=>, <=<)
    Monoid (<>)
    Alternative (<|>)


Also ++, $, ., and some others. But yeah, you don't need to know too many to be able to read 90% of Haskell code.


I feel your pain. Haskell makes it possible to write very powerful libraries which change how you think about your program, like MTL or conduits, and has APIs like Data.Text which change how you think about string processing. However, the language and community is quite mature.

Most of the debates either have answers (use Text instead of String, most of the time) or don't matter to most people (MTL vs transformers or monadLib). In my mind, it's no worse than trying to pick a JavaScript framework. If you're interested, give it a shot some day.


Perl 6 has a similar ability to define custom operators. In addition to the rich selection of normal operators, there are the meta operators like summation [+] and the bat operator ^..^ and a full range of set operators like ∈.


Like Perl 6?


So does Perl 6 (it may be because initial Perl 6 implementation was made in Haskell).


Programming language operators seem more analogous to words like prepositions and pronouns in natural languages than to sounds. I think the analogous concept to a NL sound in a PL is a token (ASCII or Unicode).


> which uses the most operators, but not everyone believes this is a good thing

You cannot really have too much builtin operators, they are basically functions that don't depend on context (i.e. on type of the object). The only side effect is that some of them are not going to be used often and you'll need a quick way to look them up to be able to understand the code in those cases.

However, having too few of them is a problem that leads to contextual dual meaning operators (like '+' in many languages), related cognitive overhead and bugs.


Not everything has to be about programming.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: