[33143] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4422 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 26 06:09:17 2015

Date: Sun, 26 Apr 2015 03:09:03 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 26 Apr 2015     Volume: 11 Number: 4422

Today's topics:
    Re: How do I use "when" to check for "one of two option <gamo@telecable.es>
    Re: How do I use "when" to check for "one of two option <see.my.sig@for.my.address>
    Re: How do I use "when" to check for "one of two option <rweikusat@mobileactivedefense.com>
    Re: How do I use "when" to check for "one of two option <rweikusat@mobileactivedefense.com>
    Re: How do I use "when" to check for "one of two option <gamo@telecable.es>
    Re: How do I use "when" to check for "one of two option <jurgenex@hotmail.com>
    Re: Mentifex Strong AI Perlmind Programming Journal: 20 <see.my.sig@for.my.address>
    Re: Mentifex Strong AI Perlmind Programming Journal: 20 mentificium@gmail.com
    Re: Mentifex Strong AI Perlmind Programming Journal: 20 <news@lawshouse.org>
    Re: Mentifex Strong AI Perlmind Programming Journal: 20 mentificium@gmail.com
    Re: running Perl scripts w/o extension on Windows 7 <see.my.sig@for.my.address>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sat, 25 Apr 2015 13:02:04 +0200
From: gamo <gamo@telecable.es>
Subject: Re: How do I use "when" to check for "one of two options"?
Message-Id: <mhfs7c$oh6$1@speranza.aioe.org>

El 24/04/15 a las 16:43, Rainer Weikusat escribió:
>> I think not, as you experiment with factorials without my
>> >reading my record in time script to computate the 10000!
> ... and I don't understand what this is supposed to communicate in the
> given context. As stated above, a recursive algorithm isn't necessarily
> slower than an iterative one. Further, I read the name you posted. It
> was "test.gmp", suggesting that it refers to some code you (AFAICT)
> didn't post which uses the GNU multiprecision arithmetic library. Pretty
> irrelevant in the context of a question about the Perl Math::Bigint
> module.
>
>
To not to post was my fault, but nobody was interested in.
It's *irrelevant* a better way, if you can do the same >50 times slower.
Fine.

-- 
http://www.telecable.es/personales/gamo/
The generation of random numbers is too important to be left to chance


------------------------------

Date: Sat, 25 Apr 2015 04:37:19 -0700
From: Robbie Hatley <see.my.sig@for.my.address>
Subject: Re: How do I use "when" to check for "one of two options"?
Message-Id: <CsWdnU4jm4rt4abInZ2dnUVZ57ydnZ2d@giganews.com>


On 4/23/2015 4:22 AM, Rainer Weikusat wrote:

> sub any_of
> {
>    my $it = $_;
>    return 1 if $it ~~ $_ for @_;
>    return;
> }

I get a syntax error on trying to run that as part of a program:

#! /usr/bin/perl
#  /rhe/scripts/test/dollar-score-dynamic-test.perl
use v5.14;
use strict;
use warnings;
sub any_of
{
    my $it = $_;
    return 1 if $it ~~ $_ for @_; # <<<<< SYNTAX ERROR
    return;
}
our @array = qw ( apple dog pear cow pig cheese rabbit cat );
foreach ( qw ( kumquat zelda pig market wrench cow celery ) )
{
    if (any_of(@array)) {say "$_ matches.";}
    else                {say "$_ does not match.";}
}
exit 0;

I think the problem is, the "for" and "if" are both being used as
"statement extenders" instead of "statements", on the same line,
so they conflict.

However, THIS works:
for (@_) {return 1 if $it ~~ $_;}

With that change, the above program prints:

kumquat does not match.
zelda does not match.
pig matches.
market does not match.
wrench does not match.
cow matches.
celery does not match.

Which shows that $_ carries over dynamically to a scope in which
it's "not in scope". Not what I expected. (I expected your
subroutine to not work at all.) Hmmm. $_ is a localizable
global instead of a lexical? Must be, else that sub wouldn't work.

I never really bothered looking that up; I just assumed it was
a lexical that sprang into being when one does something like
while (<>) {if ($_ eq 'dog') bark();}
But obviously that's wrong.

I wonder, does $_ then "resume previous value" after it gets
used in an inner block?

Let's find out......

#! /usr/bin/perl
#  /rhe/scripts/test/dollar-score-dynamic-test-2.perl
use v5.14;
use strict;
use warnings;
$_ = 'fuchsia';
foreach ( qw ( lamb pony kitten ) )
{
    say $_;
}
say $_;

lamb
pony
kitten
fuchsia

It's "localized". Cool. Now I see why you said
my $it = $_;
Saving a copy of $_ before assigning new local value.


-- 
Cheers,
Robbie Hatley
Midway City, CA, USA
perl -le 'print "\154o\156e\167o\154f\100w\145ll\56c\157m"'
http://www.well.com/user/lonewolf/
https://www.facebook.com/robbie.hatley


------------------------------

Date: Sat, 25 Apr 2015 14:43:11 +0100
From: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Subject: Re: How do I use "when" to check for "one of two options"?
Message-Id: <877ft09vdc.fsf@doppelsaurus.mobileactivedefense.com>

Robbie Hatley <see.my.sig@for.my.address> writes:
> On 4/23/2015 4:22 AM, Rainer Weikusat wrote:
>
>> sub any_of
>> {
>>    my $it = $_;
>>    return 1 if $it ~~ $_ for @_;
>>    return;
>> }
>
> I get a syntax error on trying to run that as part of a program:
>
> #! /usr/bin/perl
> #  /rhe/scripts/test/dollar-score-dynamic-test.perl
> use v5.14;
> use strict;
> use warnings;
> sub any_of
> {
>    my $it = $_;
>    return 1 if $it ~~ $_ for @_; # <<<<< SYNTAX ERROR
>    return;
> }
> our @array = qw ( apple dog pear cow pig cheese rabbit cat );
> foreach ( qw ( kumquat zelda pig market wrench cow celery ) )
> {
>    if (any_of(@array)) {say "$_ matches.";}
>    else                {say "$_ does not match.";}
> }
> exit 0;
>
> I think the problem is, the "for" and "if" are both being used as
> "statement extenders" instead of "statements", on the same line,
> so they conflict.

The usual perils of posting untested example code. 

> However, THIS works:
> for (@_) {return 1 if $it ~~ $_;}

As does this:

$it ~~ $_ and return 1 for @_;

[...]

> Which shows that $_ carries over dynamically to a scope in which
> it's "not in scope". Not what I expected. (I expected your
> subroutine to not work at all.) Hmmm. $_ is a localizable
> global instead of a lexical? Must be, else that sub wouldn't work.
>
> I never really bothered looking that up; I just assumed it was
> a lexical that sprang into being when one does something like
> while (<>) {if ($_ eq 'dog') bark();}
> But obviously that's wrong.

There's a pitfall here: For(each) localizes $_ but the 'while diamond'
loop doesn't, cf

--------
$_ = "Himmelblau\n";

print;

while (<>) {
    print;
}

print;
-------


------------------------------

Date: Sat, 25 Apr 2015 14:56:07 +0100
From: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Subject: Re: How do I use "when" to check for "one of two options"?
Message-Id: <87383o9urs.fsf@doppelsaurus.mobileactivedefense.com>

gamo <gamo@telecable.es> writes:
> El 24/04/15 a las 16:43, Rainer Weikusat escribió:
>>> I think not, as you experiment with factorials without my
>>> >reading my record in time script to computate the 10000!
>> ... and I don't understand what this is supposed to communicate in the
>> given context. As stated above, a recursive algorithm isn't necessarily
>> slower than an iterative one. Further, I read the name you posted. It
>> was "test.gmp", suggesting that it refers to some code you (AFAICT)
>> didn't post which uses the GNU multiprecision arithmetic library. Pretty
>> irrelevant in the context of a question about the Perl Math::Bigint
>> module.
>>
> To not to post was my fault, but nobody was interested in.
> It's *irrelevant* a better way, if you can do the same >50 times slower.
> Fine.

I'm sorry but you seem caught in some weird misunderstanding here: I
don't care in the slighest for 'factorial calculations' and didn't write
any posting specifically about them. Someone posted an observation about
the Math::Bigint bfac subroutine (namely, that it calculated factorials
faster as was possible by just multiplying 'bigint objects'). Because I
wanted to know how this worked, I first examined the source code and
then did some experiments with the _algorithm_ used by that. This ended
up producing two variants, an the iterative one I originally posted
whose speed roughly matched that of the bfac subroutine and a
functional/ recursive one inspired by Georg Bauhaus which - while being
a good deal slower than the iterative implementation - was still a good
deal faster than the 'just multiply the factors' algorithm, hinting at
the fact that the (instinctively) 'dreaded' function call overhead was -
at worst - about as much overhead as a bigint multiplication (using this
module).

If you wrote some code which calculates factorials "50 times faster"
than possible using the Math::Bigint implementation and algorithm,
fine. Get yourself a T-shirt which says so and send a copy to the
::Bigint maintainer, maybe, he'll see the error of his ways. Or
whatnot.

But unless you don't post this code, I surely don't care about it AND
this is not at all related to observation about 'function call overhead'
vs 'multiplaction' I (again) posted above.



------------------------------

Date: Sun, 26 Apr 2015 11:37:55 +0200
From: gamo <gamo@telecable.es>
Subject: Re: How do I use "when" to check for "one of two options"?
Message-Id: <mhibll$g2v$1@speranza.aioe.org>

El 25/04/15 a las 15:56, Rainer Weikusat escribió:
> If you wrote some code which calculates factorials "50 times faster"
> than possible using the Math::Bigint implementation and algorithm,
> fine. Get yourself a T-shirt which says so and send a copy to the
> ::Bigint maintainer, maybe, he'll see the error of his ways. Or
> whatnot.
>
> But unless you don't post this code, I surely don't care about it AND
> this is not at all related to observation about 'function call overhead'
> vs 'multiplaction' I (again) posted above.

What I see is that people, and you now, thinks the subject or what
the OP wants change as they thinks or the responses are generated.
Speed was in the topic for a particular case, a module was not.
BTW Math::BigInt accepts three types of library last time I read
about: 'Calc' is the name of the default. The others, GMP and PARI,
are accessible directly or indirectly. I opted to use them directly,
and the best was GMP::Mpz, and second Math::PARI, far better than 'Calc' 
in speed because the language used.

It could be argued there are not particular use of that case, but
I can't know at certain fields. I.e.
http://en.wikipedia.org/wiki/Poisson_distribution#Occurrence

-- 
http://www.telecable.es/personales/gamo/
The generation of random numbers is too important to be left to chance


------------------------------

Date: Sun, 26 Apr 2015 03:08:41 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: How do I use "when" to check for "one of two options"?
Message-Id: <o6epjahhf5vd46a5bu8ek8g65rckjp7ed7@4ax.com>

gamo <gamo@telecable.es> wrote:
>BTW, if you do
>
>	my $c = lc (Record_key());
>	given ($c) {
>	}
>
>you limit your alphabet from 52 to 26 possibilities. 

Did you by chance notice that this is _EXACTLY_ what the OP wanted?

>Do you comprehend that? Or you fail in the obvious again and again?

Apparently you didn't ....

jue


------------------------------

Date: Sat, 25 Apr 2015 05:24:48 -0700
From: Robbie Hatley <see.my.sig@for.my.address>
Subject: Re: Mentifex Strong AI Perlmind Programming Journal: 2015 April 12
Message-Id: <zvGdnU9dBPkMGqbInZ2dnUVZ57ydnZ2d@giganews.com>


On 4/24/2015 6:08 AM, mentificium@gmail.com wrote:

> When George posted his question, I had not even bought
> the Perl books yet, but I posted my purchases as a
> report of progress -- putting my money where my mouth is.
>
> Meanwhile, yesterday and again today I have uploaded
>
> http://ai.neocities.org/perlmind.txt

Ok. Interesting program. A few things are marginal, such as:

$engram = "a";   #2015apr24
# $pho = " ";    #2015apr24
@aud = "Andru";  #2015apr24
@en = " ";       #2015apr24
@psi = " ";      #2015apr24

Package variables (in this case in package main::) should be
declared with "our":

our $engram  = "a";
our $pho     = " ";
our $aud     = "Andru";  # Not "@aud", if single string
our $en      = " ";      # Not "@en",  if single string
our $psi     = " ";      # Not "@psi", if single string

Those last three, if you want them to be arrays of strings
(such as, one line of text per array element), they should be
initialized like so:

our @aud     = ('Andru'); # Array with one element: 'Andru'
our @en      = (' '    ); # Array with one element: ' '
our @psi     = (' '    ); # Array with one element: ' '

Also, this is incorrect:

   @aud[0] = "H";  #2015apr24
   @aud[1] = "E";  #2015apr24
   @aud[2] = "L";  #2015apr24
   @aud[3] = "L";  #2015apr24
   @aud[4] = "O";  #2015apr24

That should actually be:

   $aud[0] = "H";  #2015apr24
   $aud[1] = "E";  #2015apr24
   $aud[2] = "L";  #2015apr24
   $aud[3] = "L";  #2015apr24
   $aud[4] = "O";  #2015apr24

The $ sigil is used on any scalar (singular) values, even
if they're elements of an array. The @ sigil is used only
for whole arrays.

Though, in this case, I'd write the whole string in a single
scalar, so so:

$aud = "HELLO";

or as the zeroth element of an array:

$aud[0] = "HELLO";

or, just "push" it onto an array:

push(@aud, "HELLO");

> http://ai.neocities.org/PMPJ.html and
> http://ai.neocities.org/AiSteps.html

Good luck trying to teach a digital computer to experience
emotions and free will. Emotions are glandular (chemical),
and computers don't have glands. And free will is, according
to most modern psychiatrists, neurologists, and philosophers,
a bogus concept that does not exist. Oh, humans do have will;
but it's not "free" in any sense: not free of cost, and not
free of entanglements. On the contrary it's heavily influenced
by unconscious memories, aka "hot buttons".

Logic and intuition you can probably program.
That's called "expert systems".

Emotion and will, not so likely to be successful. You might
try "analog gradation" and "fuzzy logic" (look up "Lotfi
Zadeh") as computer analogs to mammalian emotion; but you're
trying to emulate BILLIONS of years of evolution with a
mere 1 or 5 or 50 years of computer programming. That's a
steep hill to climb.

> > How many decades have you been working on your project?
>
> Since college sophomore year, i.e., December 1965.

Since I was 6. :-) I remember watching "Sound Of Music"
when it first came out in theaters that year. And "computers"
were just something I saw in science fiction shows on TV.
I didn't get to work with a real computer until 1973,
when I did my first programming, in Fortran, on an IBM 370.
Larry Wall was likely still in Junior High, and he wouldn't
invent Perl yet for another 14 years.



-- 
Cheers,
Robbie Hatley
Midway City, CA, USA
perl -le 'print "\154o\156e\167o\154f\100w\145ll\56c\157m"'
http://www.well.com/user/lonewolf/
https://www.facebook.com/robbie.hatley


------------------------------

Date: Sat, 25 Apr 2015 06:16:03 -0700 (PDT)
From: mentificium@gmail.com
Subject: Re: Mentifex Strong AI Perlmind Programming Journal: 2015 April 12
Message-Id: <a5267566-df88-448f-a9f7-8b22ff9942b3@googlegroups.com>

On Saturday, April 25, 2015 at 5:24:53 AM UTC-7, Robbie Hatley wrote:
> On 4/24/2015 6:08 AM, mentificium@gmail.com wrote:
> 
> > When George posted his question, I had not even bought
> > the Perl books yet, but I posted my purchases as a
> > report of progress -- putting my money where my mouth is.
> >
> > Meanwhile, yesterday and again today I have uploaded
> >
> > http://ai.neocities.org/perlmind.txt
> 
> Ok. Interesting program. A few things are marginal, such as:
> 
> $engram = "a";   #2015apr24
> # $pho = " ";    #2015apr24
> @aud = "Andru";  #2015apr24
> @en = " ";       #2015apr24
> @psi = " ";      #2015apr24
> 
> Package variables (in this case in package main::) should be
> declared with "our":

Indeed, Pearl by Example, 5th Edition, page 689 
has information on "our", which I must henceforth consider.
> 
> our $engram  = "a";
> our $pho     = " ";
> our $aud     = "Andru";  # Not "@aud", if single string
> our $en      = " ";      # Not "@en",  if single string
> our $psi     = " ";      # Not "@psi", if single string
> 
> Those last three, if you want them to be arrays of strings
> (such as, one line of text per array element), they should be
> initialized like so:
> 
> our @aud     = ('Andru'); # Array with one element: 'Andru'
> our @en      = (' '    ); # Array with one element: ' '
> our @psi     = (' '    ); # Array with one element: ' '

This (Saturday) morning I coded inconclusively -- 
because perl was objecting to my use of "my $1" in a loop, 
so I did not have any stable code to upload. 
Perhaps if I use "our" tonight, the code will work better.

> 
> Also, this is incorrect:
> 
>    @aud[0] = "H";  #2015apr24
>    @aud[1] = "E";  #2015apr24
>    @aud[2] = "L";  #2015apr24
>    @aud[3] = "L";  #2015apr24
>    @aud[4] = "O";  #2015apr24
> 
> That should actually be:
> 
>    $aud[0] = "H";  #2015apr24
>    $aud[1] = "E";  #2015apr24
>    $aud[2] = "L";  #2015apr24
>    $aud[3] = "L";  #2015apr24
>    $aud[4] = "O";  #2015apr24
> 
> The $ sigil is used on any scalar (singular) values, even
> if they're elements of an array. The @ sigil is used only
> for whole arrays.

Oh, you're right! I used $aud for fetching phonemes 
from the @aud auditory array, but I did not realize 
that I should use $aud also in _storing_ phonemes.
> 
> Though, in this case, I'd write the whole string in a single
> scalar, so so:
> 
> $aud = "HELLO";
> 
> or as the zeroth element of an array:
> 
> $aud[0] = "HELLO";
> 
> or, just "push" it onto an array:
> 
> push(@aud, "HELLO");
> 
> > http://ai.neocities.org/PMPJ.html and
> > http://ai.neocities.org/AiSteps.html
> 
> Good luck trying to teach a digital computer to experience
> emotions and free will. Emotions are glandular (chemical),
> and computers don't have glands. 

No, but _robots_ do. The emotion module of the AI 
will require installation in robots with the analog of 
tears, or heart palpitations, or cold sweats.
                                    And free will is, according
> to most modern psychiatrists, neurologists, and philosophers,
> a bogus concept that does not exist. Oh, humans do have will;
> but it's not "free" in any sense: not free of cost, and not
> free of entanglements. On the contrary it's heavily influenced
> by unconscious memories, aka "hot buttons".

Agreed.
> 
> Logic and intuition you can probably program.
> That's called "expert systems".

InFerence at Amazon USA:
http://www.amazon.com/dp/B00FKJY1WY 
is the Kindle e-book on how MindForth and the 
JavaScript AiMind.html engage in automated reasoning 
with logical inference. The Perl AI should do the same. 
> 
> Emotion and will, not so likely to be successful. You might
> try "analog gradation" and "fuzzy logic" (look up "Lotfi
> Zadeh") as computer analogs to mammalian emotion; but you're
> trying to emulate BILLIONS of years of evolution with a
> mere 1 or 5 or 50 years of computer programming. That's a
> steep hill to climb.
> 
> > > How many decades have you been working on your project?
> >
> > Since college sophomore year, i.e., December 1965.
> 
> Since I was 6. :-) I remember watching "Sound Of Music"
> when it first came out in theaters that year. And "computers"
> were just something I saw in science fiction shows on TV.
> I didn't get to work with a real computer until 1973,
> when I did my first programming, in Fortran, on an IBM 370.
> Larry Wall was likely still in Junior High, and he wouldn't
> invent Perl yet for another 14 years.
> 
> 
> 
> -- 
> Cheers,
> Robbie Hatley
> Midway City, CA, USA
> perl -le 'print "\154o\156e\167o\154f\100w\145ll\56c\157m"'
> http://www.well.com/user/lonewolf/
> https://www.facebook.com/robbie.hatley

Yesterday on Fri.24.APR.2015 I coded Perl AI 
briefly in the morning and longer in the evening. 
I hope to repeat the sessions this (Saturday) evening.

Thank you for the suggestions, shich I hace coopied into 
C:\APR01Y15\Usenet\clpm0412.txt for deeper study.

Cheers,
Arthur
-- 
http://code.google.com/p/mindforth 


------------------------------

Date: Sat, 25 Apr 2015 14:46:01 +0100
From: Henry Law <news@lawshouse.org>
Subject: Re: Mentifex Strong AI Perlmind Programming Journal: 2015 April 12
Message-Id: <-O2dnXNpdZgAB6bInZ2dnUVZ8vydnZ2d@giganews.com>

Some people have a clue; I'm not convinced that you are yet one of them.

On 25/04/15 14:16, mentificium@gmail.com wrote:
> On Saturday, April 25, 2015 at 5:24:53 AM UTC-7, Robbie Hatley wrote:
>> Package variables (in this case in package main::) should be
>> declared with "our":
>
> Indeed, Pearl by Example, 5th Edition, page 689
> has information on "our", which I must henceforth consider.

There is no book of that name but I do recommend you read "Perl by 
Example".

>>
>> our $engram  = "a";
> This (Saturday) morning I coded inconclusively --
> because perl was objecting to my use of "my $1" in a loop,
> so I did not have any stable code to upload.
> Perhaps if I use "our" tonight, the code will work better.

"our $1" will not work any better, because the names of variables (after 
the initial character which shows what type they have) must be "a string 
beginning with a letter or underscore, and containing letters, 
underscores, and digits."  (perldata)

>> The $ sigil is used on any scalar (singular) values, even
>> if they're elements of an array. The @ sigil is used only
>> for whole arrays.
>
> Oh, you're right! I used $aud for fetching phonemes
> from the @aud auditory array, but I did not realize
> that I should use $aud also in _storing_ phonemes.

This discussion is nothing whatever to do with whether you are 
"fetching" or "storing"; it's to do with fundamental data types and the 
ways that they are referred to in a program.   Again, read perldata. 
You will make no progress until you understand this basic point.

-- 

Henry Law            Manchester, England


------------------------------

Date: Sat, 25 Apr 2015 16:01:17 -0700 (PDT)
From: mentificium@gmail.com
Subject: Re: Mentifex Strong AI Perlmind Programming Journal: 2015 April 12
Message-Id: <8567d21d-d6f4-405f-95f4-677a3297cfdd@googlegroups.com>

On Saturday, April 25, 2015 at 6:46:08 AM UTC-7, Henry Law wrote:
> Some people have a clue; I'm not convinced that you are yet one of them.

I should state my "clue" right here and now. 
The main feature of the Mentifex AI Minds is 
that they establish nouns and verbs and other words 
as longitudinal (diachronic) concepts, so that 
an idea such as "Boys play games" can be represented 
internally as an associative node on the "boy" concept 
tagged orthogonally over to a node on the "play" concept, 
which leads further by associative tag over to the "game" concept. 

These AI Minds in Forth and in JavaScript have already 
shown the ability to infer new knowledge from old knowledge. 
For instance, a human being may input "boys play games" 
and sometime later input "john is a boy". The AI Mind 
will infer that John, being a boy, perhaps play games, 
and will ask the user, "DOES JOHN PLAY GAMES". 

I am now trying to create the same level of AI in Perl, 
while streamlining the AI codebase and removing what 
to me is like "Junk DNA" in the Forth AI code.

> 
> On 25/04/15 14:16, mentificium@gmail.com wrote:
> > On Saturday, April 25, 2015 at 5:24:53 AM UTC-7, Robbie Hatley wrote:
> >> Package variables (in this case in package main::) should be
> >> declared with "our":
> >
> > Indeed, Pearl by Example, 5th Edition, page 689
> > has information on "our", which I must henceforth consider.
> 
> There is no book of that name but I do recommend you read "Perl by 
> Example".

OK, you got me. I was in a rush after coding this morning 
and I made at least two mistakes in my post upthread. 
The book is "Perl by Example," and in a commented line like 

sub sensorium;  #2015apr24 PbEx5e p. 351: Forward declaration.

I am starting to refer to the book as "PbEx5e" w. page number. 
Since that book has a copyright in this same year of 2015 
when I am finally coding the AI in Perl, I may try to give 
a lot of page-number references to things I find in that book, 
so that other Perl newbies like myself may purchase the book 
and follow along with the AI coding. 

I am also taking pains to change a line of code as done below:

# print "Think: ", $message, " is okay \n";  # 2015apr24
  print " comes from auditory memory. \n";   # 2015apr24 

where I comment out the old line and put the new line below. 
But I leave in the commented-out line for at least one 
iteration of coding and Web-uploading, so that anyone 
trying to follow the genesis of the AI may see the change. 
> 
> >>
> >> our $engram  = "a";
> > This (Saturday) morning I coded inconclusively --
> > because perl was objecting to my use of "my $1" in a loop,
> > so I did not have any stable code to upload.
> > Perhaps if I use "our" tonight, the code will work better.
> 
> "our $1" will not work any better, because the names of variables (after 
> the initial character which shows what type they have) must be "a string 
> beginning with a letter or underscore, and containing letters, 
> underscores, and digits."  (perldata)

There was my second mistake this morning. I accidentally 
did not type $i as I found on PbEx5e p. 197.
> 
> >> The $ sigil is used on any scalar (singular) values, even
> >> if they're elements of an array. The @ sigil is used only
> >> for whole arrays.
> >
> > Oh, you're right! I used $aud for fetching phonemes
> > from the @aud auditory array, but I did not realize
> > that I should use $aud also in _storing_ phonemes.
> 
> This discussion is nothing whatever to do with whether you are 
> "fetching" or "storing"; it's to do with fundamental data types and the 
> ways that they are referred to in a program.   Again, read perldata. 
> You will make no progress until you understand this basic point.
> 
OK, thank you for the sound advice. I have been runnng around 
Seattle all morning and afternoon. Now I must nap before coding. 
> -- 
> 
> Henry Law            Manchester, England

Arthur T. Murray


------------------------------

Date: Sat, 25 Apr 2015 06:12:45 -0700
From: Robbie Hatley <see.my.sig@for.my.address>
Subject: Re: running Perl scripts w/o extension on Windows 7
Message-Id: <wpydncjYj4FTD6bInZ2dnUVZ57ydnZ2d@giganews.com>


On 3/24/2015 10:00 AM, jomarbueyes@hotmail.com wrote:

> I wrote several Perl scripts under Linux (using X11 on Mac OS X).
> Because Linux does not require an extension, I did not use one.
> Now I need to use those scripts on Windows 7 computers with the
> Perl that comes with Strawberry.. I added my scripts directory
> to the path and PERL5LIB environment variables and restarted
> the computer. However, when I tried to run a script from a
> command-line window by simply typing
>
> commandName <CR>
>
> I got the error message:
>
> 'commandName' is not recognized as an internal or external
> command, operable program or batch file.
>
> Is there a way to make Perl scripts w/o extension be
> recognized as executable? Adding the extension .pl is not
> a good option because most of the time I do the development
> under Linux and 'rsync' the script directories to the Windows
> machine.
>
> Thank you in advance for any help,

Sorry I missed this when you first posted it 31 days ago.

The answer to your question is "Cygwin & Notepad++". Both are
free.

Cygwin is a Linux-like interface to Windows, and comes with
Bash shell, and a host of compilers and interpreters for
various programming languages (C, C++, Perl, Python, Ruby, etc).
And it recognizes the #! "shebang" first line notation:

#! /usr/bin/perl
#  /home/jb/scripts/myscript
print "Hello, World!\n";

So you can run Perl scripts in Cygwin's Bash by just typing the
name of the script, even if the script's name has no extention:

%myscript
Hello, World!

Get Cygwin HERE:
https://www.cygwin.com/

NotePad++ is an excellent text editor for programming on
Windows + Cygwin. For one thing, unlike Notepad, it doesn't
force you to use the Windows 0x0D0A line ending; you can
set it to always use the Linux 0x0A line ending instead.
That way Perl/Shell/Python/Sed/Awk scripts written on
Linux can be used in Windows, and vice versa, without
running into line-end errors.

Get NotePad++ HERE:
http://notepad-plus-plus.org/


I'll post this to the group and also send it to you by email.


-- 
Cheers,
Robbie Hatley
Midway City, CA, USA
perl -le 'print "\154o\156e\167o\154f\100w\145ll\56c\157m"'
http://www.well.com/user/lonewolf/
https://www.facebook.com/robbie.hatley


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 4422
***************************************


home help back first fref pref prev next nref lref last post