Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: regex and "Functional Programming"

by BrowserUk (Pope)
on Oct 22, 2004 at 23:13 UTC ( #401722=note: print w/ replies, xml ) Need Help??


in reply to regex and "Functional Programming"

In it's simplest terms, functional programming is programming without side-effects. Functions take inputs and produce outputs, but the inputs are not modifed. Crudely, pass by value rather than pass by reference.

Traditionally, regex modify their targets in-place rather then producing a modified copy of the original. I don't think that there is any technical reason why a regex-like find & replace facility couldn't be implemented in the functional style. Except maybe efficency, but as many will express, that can be a double edged sword.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon


Comment on Re: regex and "Functional Programming"
Re^2: regex and "Functional Programming"
by diotalevi (Canon) on Oct 26, 2004 at 15:20 UTC

    JavaScript does this already.

    ... = foo.replace( / regex /g, 'replacement' );

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2015-07-03 03:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (48 votes), past polls