FORTRAN (was Re: indentation)

Christian Tismer tismer at appliedbiometrics.com
Thu Dec 9 18:08:59 EST 1999


While we are at it :-)

Curtis Jensen wrote:
> 
> Mitch Chapman wrote:
> >
> > Mike Steed wrote:
> > > > From: aahz at netcom.com [mailto:aahz at netcom.com]
> > > > ...
> > > > Hmmm...  I wonder who the youngest person in this group is who has
> > > > actually used FORTRAN on the job.  I'm 32; I did the work twelve years
> > > > ago.
> > >
> > > I'm 31.  I used FORTRAN for a (mercifully brief) project, also 12 years ago.
> >
> > Thanks for making me feel like both an old man and a member of a
> > 12-step program:  I'm Mitch, I'm 35, and I used Fortran eight years ago.
> >
> > We once had a programmer who thought C was a dialect of Fortran.
> > He wrote the second 1000+-line C function I'd ever seen.
> > (The first was an interrupt service routine (!) from Ultrix,
> > for the Vaxstation console device.  Unfortunately, I've seen many
> > examples since then.)
> >
> > --
> > Mitch
> 
> I'm 22, I've been working on a 15+ year old legacy program in Fortran,
> for the past six months.  There is a another guy here who just turned 22
> and he has been working on this program for over a year and a half.
> It's a huge Finite Element Modeling program.  I ended up turning a 2000
> line Fortran function into 11000+ lines.  We've shrunk it to 7000 now.
> I'm not sure how many lines and files there are total, but it's probably
> over 25000 lines.  The entire program is currently a mix of C and
> Fortran.  We're mixing in Python now.  We're planning on eventualy
> converting the entire thing to C and Python.
> You can visit our web page at:
> http://cmrg.ucsd.edu/modelling/modelling.html

I'm 43, and I learned FORTRAN IV right after Algol 64 in the late 70s.
Can't remember if it was this, or an earlier Fortran version which
had no dynamic variables but just statics?

Well, this is now also possible in Python. With version 0.5 of my
continuations module, you can do brain dead stuff like this:

def rectest(n=3):
	this = continuation.current()
	k = this.update(n)
	if n:
		n=n-1
		print n, k
		this.call(k+1)
		n=n+1
		print n
		return
	return k

>>> rectest()
2 3
1 4
0 5
1
2
3
>>> 

What that is?? That is a single incarnation of that function
rectest(), and its current continuation is captured in "this",
which in turn is a callable object by itself.
The line "k = this-update.n" is the entry point into the
running frame of rectest, at that place. k receives the current
value of the expression.

And I call this same bound frame recursively, by this.call(k+1).
Why I tell this? Since the fast local variables are shared
between all the incarnations of this frame, they appear as
globals in this context, and so I think we are back in Fortran.
Of course this was not my primary goal to write continuations. :)
Last but not least it is some percent faster than the proper
recursive formulation with a function.

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101   :    *Starship* http://starship.python.net
10553 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     we're tired of banana software - shipped green, ripens at home


From: Preston Landers <prestonlanders at my-deja.com>
Newsgroups: comp.lang.python
Subject: Re: exchanging data btwn Python and lesser languages
Date: Thu, 09 Dec 1999 22:53:42 GMT
Organization: Deja.com - Before you buy.
Lines: 24
Message-ID: <82pbtl$of4$1 at nnrp1.deja.com>
References: <82jau6$e72$1 at nnrp1.deja.com> <x3bt82vgct.fsf at voodoo.pandhm.co.uk>
NNTP-Posting-Host: 205.238.143.132
To: Dom.Mitchell at palmerharvey.co.uk
X-Article-Creation-Date: Thu Dec 09 22:53:42 1999 GMT
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)
X-Http-Proxy: 1.1 x41.deja.com:80 (Squid/1.1.22) for client 205.238.143.132
X-MyDeja-Info: XMYDJUIDprestonlanders
Path: news!uunet!ffx.uu.net!newsfeed.mathworks.com!news.maxwell.syr.edu!nntp2.deja.com!nnrp1.deja.com!not-for-mail
Xref: news comp.lang.python:78027
Sender: python-list-admin at python.org
Errors-To: python-list-admin at python.org
X-BeenThere: python-list at python.org
X-Mailman-Version: 1.2 (experimental)
Precedence: bulk
List-Id: General discussion list for the Python programming language <python-list.python.org>

In article <x3bt82vgct.fsf at voodoo.pandhm.co.uk>,
  Dominic Mitchell <Dom.Mitchell at palmerharvey.co.uk> wrote:
> An obvious quick hack suggests itself:  Write out data as Perl code so
> that it can be eval'd in the Perl world.  Perl itself can do this with
> it's Data::Dumper module.
>
> Reading it back into python would be harder, though.

That is a pretty interesting idea.  It's kinda cool, but unfortunately
I was looking for a language independent way to do it.  Thanks for the
idea, though.

> "vi has two modes the one in which it beeps and the one in which it
doesnt."
> 	-- Anon.

Hilarious!

--
|| Preston Landers <prestonlanders at my-deja.com> ||


Sent via Deja.com http://www.deja.com/
Before you buy.

From: Preston Landers <prestonlanders at my-deja.com>
Newsgroups: comp.lang.python
Subject: Re: some random reflections of a "Python newbie": (1) books, and free sites
Date: Thu, 09 Dec 1999 23:06:43 GMT
Organization: Deja.com - Before you buy.
Lines: 40
Message-ID: <82pcm0$p6t$1 at nnrp1.deja.com>
References: <82o0to$6eq$1 at serv1.iunet.it>
NNTP-Posting-Host: 205.238.143.132
To: alex at magenta.com
X-Article-Creation-Date: Thu Dec 09 23:06:43 1999 GMT
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)
X-Http-Proxy: 1.1 x30.deja.com:80 (Squid/1.1.22) for client 205.238.143.132
X-MyDeja-Info: XMYDJUIDprestonlanders
Path: news!uunet!ffx.uu.net!newsfeed.mathworks.com!news.maxwell.syr.edu!nntp2.deja.com!nnrp1.deja.com!not-for-mail
Xref: news comp.lang.python:78030
Sender: python-list-admin at python.org
Errors-To: python-list-admin at python.org
X-BeenThere: python-list at python.org
X-Mailman-Version: 1.2 (experimental)
Precedence: bulk
List-Id: General discussion list for the Python programming language <python-list.python.org>

In article <82o0to$6eq$1 at serv1.iunet.it>,
  "Alex Martelli" <alex at magenta.com> wrote:

> 1. what put me off Python for so long?
>     Short answer: the book "Programming Python" did.

"Programming Python" indeed sucks.  I hear a revised edition is in the
works, but don't hold your breath.  Avoid this book like the plague.
I'm sorry it put you off Python.  No one needs a turgid, out of date
rehash of the material on python.org.

I recently aquired Beazley's "Essential Python Reference."  I've been
using it quite a bit over the last week, and I'll be posting a fuller
review shortly.  2 cent review: it's pretty much a rehash of the
material on python.org with a few little goodies that make it
worthwhile for me.  They say as much in the preface, so I'm not
faulting anyone.  It's not bad, but not compelling either.  If you are
on a tight budget, give it a miss, otherwise check it out.  I would
have recommended this book more whole-heartedly if it had doubled the
size by including extensive examples.  Which leads me to...

In my opinion, what the Python community *really* needs is an
equivilent to O'Reilly's "Perl Cookbook."  A really solid, well written
book like this would probably sell like hotcakes within the community
and also prompt new developers to give the language a try.

Something like "Mastering Algorithms in Python" would be cool too, but
it's not really neccesary.  If you can grok the Perl algorithm book,
you should have little problem translating.  Assuming you can read Perl
syntax, that is.  However, basic literacy in Perl is not such a bad
thing.

---Preston

--
|| Preston Landers <prestonlanders at my-deja.com> ||


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list