regular expressions

General discussion about anything you like. Except Religion, US Politics and Midget discrimination.
User avatar
stan_qaz
Omniscient Kiwi
Location: Gilbert, Arizona
Posts: 8671
Joined: Fri Jul 25, 2008 5:13 am

regular expressions

Wed Nov 12, 2008 4:36 pm

You know the famous quote about regular expressions?
Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. — Jamie Zawinski
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.
Ikeb
Microsoft MVP with a slice of PITA
Contact:
Location: Ottawa, Ontario, Canada
Posts: 455
Joined: Thu Jul 24, 2008 3:56 pm

Re: regular expressions

Thu Nov 13, 2008 4:31 am

:lol: 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. ;)
User avatar
stan_qaz
Omniscient Kiwi
Location: Gilbert, Arizona
Posts: 8671
Joined: Fri Jul 25, 2008 5:13 am

Re: regular expressions

Thu Nov 13, 2008 5:40 am

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
-----
Image

Or a fully functional game of Conway's Life in APL
Image
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.
Ikeb
Microsoft MVP with a slice of PITA
Contact:
Location: Ottawa, Ontario, Canada
Posts: 455
Joined: Thu Jul 24, 2008 3:56 pm

Re: regular expressions

Thu Nov 13, 2008 6:11 pm

stan_qaz wrote: Or a fully functional game of Conway's Life in APL
Image
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.

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. :evil:

I recall that the computer center had several Selectric typewriters and I spent hours delving into APL nuances using up reams of trees. :roll: I now see that APL lives on so I'll have to check into this again ... now that fewer trees are needed. :D
User avatar
Pierre
Knowledgeable Kea
Location: Australia - North of the "Ditch".
Posts: 1073
Joined: Thu Jul 24, 2008 4:57 pm

Re: regular expressions

Thu Nov 13, 2008 7:41 pm

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. :lol:
IF IT AIN'T BROKE - DON'T FIX IT

I am only a ßeta Tester and getting older as well.
Ikeb
Microsoft MVP with a slice of PITA
Contact:
Location: Ottawa, Ontario, Canada
Posts: 455
Joined: Thu Jul 24, 2008 3:56 pm

Re: regular expressions

Fri Nov 14, 2008 3:39 am

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. ;)

Return to “Chit Chat”