
Show HN: Functional programming on Perl 5 - pflanze
http://functional-perl.org/
======
pflanze
I'm the author. I have just released the first alpha. I've been programming
Scheme for close to a decade now after about the same amount of time using
Perl, and I've written this to be able to like programming Perl 5 again, when
I have reason to use it. It works pretty well for me for that purpose,
although I guess I'm biased.

I guess the layout is pretty old-fashioned, and I might have too much text;
I'm trying to cater to people who are not used to functional programming yet,
but I'm not sure I'm achieving that. I guess it's also a rather difficult sell
when many Perlers prefer to use the upcoming Perl 6 instead, and others decide
to leave for a more proper functional programming language implementation.

I'm rather proud that I've managed to base lazy sequences on lazily evaluated
linked lists, i.e. based on purely functional principles down to the cells,
instead of using iterators as many function libraries for sequences for non-
functional languages (like JavaScript or C#) do. Not sure how much it matters
in practice, but at least you can write lazy sequences with this the same way
you do in Haskell (see fibs and primes examples).

There are some good points doing FP in Perl 5 compared to some other non-FP
languages (you can do optimized tail-calls pretty cleanly), and some bad
points (you have to care about memory handling in some places). I've got ideas
how to improve on both fronts but that will depend on the uptake of the
project.

~~~
Mithaldu
> I guess it's also a rather difficult sell when many Perlers prefer to use
> the upcoming Perl 6 instead

That is definitely not a thing.

Also, i recommend putting it on cpan. It's perfectly fine to put alpha modules
on there.

~~~
pflanze
Ok, I'll look into that.

------
tbirdz
Another interesting book in this same functional perl genre is Higher Order
Perl, available free online here:
[http://hop.perl.plover.com/](http://hop.perl.plover.com/)

Edit: I see now that it was mentioned on the page. Consider this comment
another recommendation then. If you are interested in perl and functional
programming, check this book out!

------
supster
General question: what are some pros and cons of Perl compared to other
languages like Python, Ruby, Java, Clojure, Haskell? What makes Perl unique
and people so enthusiastic about it?

~~~
vezzy-fnord
It reifies the process of munging and pattern matching on text streams in a
way few other dynamic languages do. Perl 6 particularly so with grammars
(similar to lex) as a first-class construct.

It's more appropriate to compare it to SNOBOL and AWK.

~~~
latenightcoding
Yeah let's compare Perl with AWK lol

~~~
Mithaldu
You may find it funny, but one of the motivators for Perl being made was to
get a better awk, which is why it's highly compatible with awk syntax.

