Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://401722]
[Corion]: ambrus: Well, for mathematical notation, I find blackboard much more convenient than a computer. But when inserting text or moving text around, the computer wins obviously
[ambrus]: But either of these is a big problem in practice, so I'd need to spend like thirty years of my life to solve (a) and five more years to solve (b)
[ambrus]: Corion: yes, CURRENTLY the blackboard is more convenient
[ambrus]: and it's not like I want to ban blackboards anyway
[ambrus]: you already have blackboards and a canvas for projector or overhead transparencies (or positive film slide projector, not used for maths) canvas in the same lecture halls today, and switch in a few minutes between presentations,
[ambrus]: they're only difficult to use together.
[ambrus]: overhead transparencies are a nice convenience by the way that mix the two slides, because you can write them in advance and edit them during the presentation easily. but they're not very much in fasion these days.
[ambrus]: you can even print them.
[Discipulus]: ambrus i'm trying out MremoteNG which wrap putty and rdp and many other things..
[Corion]: ambrus: Yes, ideally you would have the ease of overhead projection transparencies and pens drawing on them, combined with the computer generated slide text...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2017-09-26 10:26 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (293 votes). Check out past polls.