Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Re: Resources for Functional Programming?

by ambrus (Abbot)
on Mar 17, 2004 at 22:46 UTC ( [id://337545]=note: print w/replies, xml ) Need Help??


in reply to Re: Resources for Functional Programming?
in thread Resources for Functional Programming?

  1. Do you call this
    sub tail (@) { shift; @_ }
    functional programming? You clearly rely on the side effect of shift here. Better use
    sub tail (@) { @_[1..@_-1] }
    or something like that.
  2. Please do not make links to your scratchpad from your post. The data from will most probably disappear eventually from the scrartchpad, but the post will live forever so if someone reads it years later he'll be upset than he cannot see the code.

Replies are listed 'Best First'.
Re: (3) Resources for Functional Programming?
by stvn (Monsignor) on Mar 17, 2004 at 23:09 UTC

    re: #1
    You are absolutely correct. Good eyes there. Of course if we are gonna be picky, then head should be:

    sub head (@) { $_[0] }
    to also avoid the "side-effect" effect of shift.

    re: #2
    I see what you are saying here, but approx. 300 lines of code IMO, is not really appropraite to post in a node. As for posting the code elsewhere (website/CPAN/whatever), it was really just an exercise for fun, to see how far i could push Perl into the realm of functional programming, I have no delusions that it is good for anything outside of that.

    -stvn
      The desire to have more data in a node than people want to see scrolling over it is what READMORE is for.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://337545]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-25 08:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found