Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. — Jamie Zawinski
regular expressions
- stan_qaz
- Omniscient Kiwi
- Location: Gilbert, Arizona
Post
regular expressions
You know the famous quote about regular expressions?
I am not a Firetrust employee just a MW user.
--
First rule of computer consulting: Sell a customer a Linux computer and you'll eat for a day,
sell a customer a Windows computer and you'll eat for a lifetime.
--
First rule of computer consulting: Sell a customer a Linux computer and you'll eat for a day,
sell a customer a Windows computer and you'll eat for a lifetime.
- Ikeb
- Microsoft MVP with a slice of PITA
- Contact:
- Location: Ottawa, Ontario, Canada
Post
Re: regular expressions
Good one.
Actually even if the former is solved, the latter remains. These suckers are tough to maintain because they're not exactly self-documenting. They remind me of APL programming.
Actually even if the former is solved, the latter remains. These suckers are tough to maintain because they're not exactly self-documenting. They remind me of APL programming.
- stan_qaz
- Omniscient Kiwi
- Location: Gilbert, Arizona
Post
Re: regular expressions
I remember APL, beer usually makes it go away as I didn't have to actually use it, just read the code.
How Does APL Compare with other Languages?
APL is a very concise language. It is normal for APL programs to have one-fifth as many instructions as programs written in other languages, and one-tenth to one-twentieth the number of instruction lines. Among the reasons for this is that APL is a symbolic language, and single symbols often replace multiple lines of code. Here is a simple comparison of a numerical sort in BASIC, FORTRAN, and APL:
BASIC
----------------------------
10 DIM X(100), (100)
20 READ N
30 FOR I =1 TO N
40 READ X(I)
50 NEXT I
60 FOR I=1 TO N
70 LET A=X(I)
80 LET L=1
90 FOR J=1 TO 10
100 IF A<X(J) THEN 130
110 LET A=X(J)
120 LETL=J
130 NEXT J
140 LET Y(I)=A
150 LET X(L)=1000000.
160 PRINT Y(I)
170 NEXT I
180 DATA
...
...
...
XXX END
FORTRAN
--------------------------------
DIMENSION X(100),Y(100)
READ(5,10) N,(X(I),I=1,N)
10 FORMAT (15/(F10.2))
DO 20 I=1,N
A=X(I)
L=1
DO 15 J=1,N
IF(A-X(J))15,15,12
12 A=X(j)
L=J
15 CONTINUE
Y(I)=A
20 X(L)=100000.
WRITE(6,30) (Y(I),I=1,N)
30 FORMAT(E15.2)
END
APL
-----
Or a fully functional game of Conway's Life in APL
How Does APL Compare with other Languages?
APL is a very concise language. It is normal for APL programs to have one-fifth as many instructions as programs written in other languages, and one-tenth to one-twentieth the number of instruction lines. Among the reasons for this is that APL is a symbolic language, and single symbols often replace multiple lines of code. Here is a simple comparison of a numerical sort in BASIC, FORTRAN, and APL:
BASIC
----------------------------
10 DIM X(100), (100)
20 READ N
30 FOR I =1 TO N
40 READ X(I)
50 NEXT I
60 FOR I=1 TO N
70 LET A=X(I)
80 LET L=1
90 FOR J=1 TO 10
100 IF A<X(J) THEN 130
110 LET A=X(J)
120 LETL=J
130 NEXT J
140 LET Y(I)=A
150 LET X(L)=1000000.
160 PRINT Y(I)
170 NEXT I
180 DATA
...
...
...
XXX END
FORTRAN
--------------------------------
DIMENSION X(100),Y(100)
READ(5,10) N,(X(I),I=1,N)
10 FORMAT (15/(F10.2))
DO 20 I=1,N
A=X(I)
L=1
DO 15 J=1,N
IF(A-X(J))15,15,12
12 A=X(j)
L=J
15 CONTINUE
Y(I)=A
20 X(L)=100000.
WRITE(6,30) (Y(I),I=1,N)
30 FORMAT(E15.2)
END
APL
-----
Or a fully functional game of Conway's Life in APL
I am not a Firetrust employee just a MW user.
--
First rule of computer consulting: Sell a customer a Linux computer and you'll eat for a day,
sell a customer a Windows computer and you'll eat for a lifetime.
--
First rule of computer consulting: Sell a customer a Linux computer and you'll eat for a day,
sell a customer a Windows computer and you'll eat for a lifetime.
- Ikeb
- Microsoft MVP with a slice of PITA
- Contact:
- Location: Ottawa, Ontario, Canada
Post
Back to APL, while I was going to college, some of the computer sciences types had a contest to get the code down to one line for translating base 10 numbers into Roman Numerals. I chimed in with a version but was floored by someone's version that did it in a single line.
I recall that the computer center had several Selectric typewriters and I spent hours delving into APL nuances using up reams of trees. I now see that APL lives on so I'll have to check into this again ... now that fewer trees are needed.
Re: regular expressions
I remember that one! I think my version had three lines ... but couldn't figure out what I had done when I came back to it several weeks later. I actually programmed Life in several languages to get familiar with the coding methods.stan_qaz wrote: Or a fully functional game of Conway's Life in APL
Back to APL, while I was going to college, some of the computer sciences types had a contest to get the code down to one line for translating base 10 numbers into Roman Numerals. I chimed in with a version but was floored by someone's version that did it in a single line.
I recall that the computer center had several Selectric typewriters and I spent hours delving into APL nuances using up reams of trees. I now see that APL lives on so I'll have to check into this again ... now that fewer trees are needed.
- Pierre
- Knowledgeable Kea
- Location: Australia - North of the "Ditch".
Post
Re: regular expressions
You guys are giving your ages away. I remember working on IBM 650 computers. On them the O/S had to be loaded for every job in the form of 80 column cards.
IF IT AIN'T BROKE - DON'T FIX IT
I am only a ßeta Tester and getting older as well.
I am only a ßeta Tester and getting older as well.
- Ikeb
- Microsoft MVP with a slice of PITA
- Contact:
- Location: Ottawa, Ontario, Canada
Post
Re: regular expressions
Oh yeah!! The good old days when we were in intimate contact with our computers .... and GOTO instructions were the only way to get things done.