Re: Typing tutor help script needed, please
Throw <[EMAIL PROTECTED]> wrote in comp.lang.perl.misc: > > G'day everyone! > > I would like to design typing tutor exercises for Afrikaans (and other > languages possibly). This is for a GPL project. For this, I need a > script that can extract words from a long list of words, based on which > letters those words contain, and write then write output to a file. > Does anyone know of an existing script for this, or can anyone write me > one, please? For the letters a, d, f and g: perl -ne 'print if /^[adfg]+$/' < /list/of/words > words_with_adfg For other combinations, change both occurrences of "adfg". Anno -- If you want to post a followup via groups.google.com, don't use the broken "Reply" link at the bottom of the article. Click on "show options" at the top of the article, then click on the "Reply" at the bottom of the article headers. -- http://mail.python.org/mailman/listinfo/python-list
Re: complex numbers
It's me <[EMAIL PROTECTED]> wrote in comp.lang.perl.misc: [reply moved to bottom into context] > "Jürgen Exner" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > [EMAIL PROTECTED] wrote: > > > #python supports complex numbers. > > [...] > > > > So? > > > > The world would come to a halt if all of a sudden nobody understands complex > numbers anymore. :-) > > > > # Perl doesn't support complex numbers. But there are packages that > > > supports it. > > > > The Math::Complex module is part of the standard installation already, no > > need for any "packages" (whatever that might be). > > Did you check "perldoc Math::Complex" > > > > NAME > > Math::Complex - complex numbers and associated mathematical functions > > [...] > For those of us that works with complex numbers, having complex number as a > natively supported data type is a big advantage. Non-native add-ons are not > sufficient and lead to very awkward program code. Like this? use Math::Complex; my $z = sqrt( -1); print 1 + $z, "\n"; # prints "1+i" Operator overloading makes it possible to work with complex numbers as if they were a native data type. Anno -- http://mail.python.org/mailman/listinfo/python-list
Re: complex numbers
It's me <[EMAIL PROTECTED]> wrote in comp.lang.perl.misc: [reply moved into context] > "Anno Siegel" <[EMAIL PROTECTED]> wrote in message > news:cs145l$8d6 > > > > > > > Like this? > > > > use Math::Complex; > > > > my $z = sqrt( -1); > > print 1 + $z, "\n"; # prints "1+i" > > > > Operator overloading makes it possible to work with complex numbers as if > > they were a native data type. > Operator overloading (and function overloading) helps but not enough.You > have to be aware of the complex type *everywhere* you go and that's very > annoying and error prone. I've been the works with C++, and later with > Modelica. I am very happy that Python included *native* complex number > support. What kind of awareness do you mean? There are some operations (as comparison) that work for reals, but not for complex numbers. If you want your program to run with complex input, you have to avoid such operations, whether the data type is native or not. What other considerations are there? A typical numeric program should just run and give complex output when fed complex input. I made the experiment with the Perl module Statistics::Descriptive, which was certainly written without concern for complex input, and it works without a hitch. I'm not sure if the (complex) variance of several complex numbers is a reasonably interpretable quantity, but I'm certain the maths is done right. What else do you want? Anno -- http://mail.python.org/mailman/listinfo/python-list
Re: Xah's Edu Corner: accountability & lying thru the teeth
Xah Lee <[EMAIL PROTECTED]> wrote in comp.lang.perl.misc: > ...a mechanism, so that any fuckhead tech geekers with their > loud cries will hurt badly when they open their mouths in public... Yeah, good idea! Anno -- If you want to post a followup via groups.google.com, don't use the broken "Reply" link at the bottom of the article. Click on "show options" at the top of the article, then click on the "Reply" at the bottom of the article headers. -- http://mail.python.org/mailman/listinfo/python-list
Re: What are OOP's Jargons and Complexities?
Tassilo v. Parseval <[EMAIL PROTECTED]> wrote in comp.lang.perl.misc: > Also sprach Dale King: > > > David Formosa (aka ? the Platypus) wrote: > >> On Tue, 24 May 2005 09:16:02 +0200, Tassilo v. Parseval > >> <[EMAIL PROTECTED]> wrote: > >> > >>> [...] I haven't yet come across a language that is both statically and > >>>strongly typed, in the strictest sense of the words. I wonder whether > >>>such a language would be usable at all. > >> > >> > >> Modula2 claims to be both statically typed and strongly typed. And > >> your wonder at its usablity is justified. > > > > I used a variant of Modula-2 and it was one of the best languages I have > > ever used. That strong, static type checking was a very good thing. It > > often took a lot of work to get the code to compile without error. > > Usually those errors were the programmers fault for trying to play fast > > and loose with data. But once you got it to compile it nearly always worked. > > I am only familiar with its successor Modula-3 which, as far as I > understand, is Modula-2 with uppercased keywords and some OO-notion > bolted onto it (I still recall 'BRANDED' references). > > I have to say that doing anything with this language was not exactly a > delight. I've been through Pascal, Modula2 and Oberon, and I agree. These languages had an axe to grind. They were designed (by Niklas Wirth) at a time of a raging discussion whether structured programming (goto-less programming, mostly) is practical. Their goal was to prove that it is, and in doing so the restrictive aspects of the language were probably a bit overdone. In the short run they succeeded. For a number of years, languages of that family were widely used, primarily in educational programming but also in implementing large real-life systems. In the long run, the languages have mostly disappeared from the scene. It has been discovered that "structured programming" is possible in about any language. It turns out that programmers prefer the self-discipline it takes to do that in a liberal language over the enforced discipline exerted by Papa Pascal and his successors. Anno -- http://mail.python.org/mailman/listinfo/python-list