Velocity Reviews > Perl > what do you call funct ( funct())

# what do you call funct ( funct())

Ken Sington
Guest
Posts: n/a

 07-08-2004
ok it works, but what do you call this:

the eq test in this ternary op.
$answer =$test eq "value" ? "true" : "false";

or

the function in this if:
if ( myFnct("blah") ){
# it works
}

or

the uc($a) in the split. or squeezing all that inside the sort @temp = sort { my$aa=(split '\|',uc($a),$colW)[$colZ]; my$bb=(split '\|',uc($b),$colW)[$colZ];$aa=~ s/\W+//g;
$bb=~ s/\W+//g;$aa cmp $bb; } @db; Gunnar Hjalmarsson Guest Posts: n/a  07-08-2004 Ken Sington wrote: > ok it works, Excuse me, but exactly *what* is it that works? You may not have noticed, but there are more than one thread going on in this group... > but what do you call this: <various code snippets out of context snipped> -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl Brad Baxter Guest Posts: n/a  07-08-2004 On Wed, 7 Jul 2004, Ken Sington wrote: > ok it works, but what do you call this: > > the eq test in this ternary op. >$answer = $test eq "value" ? "true" : "false"; A test for equality. > or > > the function in this if: > if ( myFnct("blah") ){ > # it works > } A function call. > or > > > the uc($a) in the split.

A builtin function call.

> [ ... ] or squeezing all that inside
> the sort

A code block.

> @temp = sort {
> my $aa=(split '\|',uc($a), $colW)[$colZ];
> my $bb=(split '\|',uc($b), $colW)[$colZ];
> $aa=~ s/\W+//g; >$bb=~ s/\W+//g;
> $aa cmp$bb;
> } @db;

Regards,

Ken Sington
Guest
Posts: n/a

 07-08-2004

> On Wed, 7 Jul 2004, Ken Sington wrote:
>

....
>
> But what are you asking?
>

I mean, the fact that you can run a function inside that ternary, inside
that if. the fact that you can run a function inside a control structure.

is there a name for the concept?
If I wanted to explain to someone that you can do those things, what would I call this topic?

> Regards,
>

Josef Moellers
Guest
Posts: n/a

 07-08-2004
Ken Sington wrote:
>
>> On Wed, 7 Jul 2004, Ken Sington wrote:
>>

> ...
>
>>
>> But what are you asking?
>>

>
> I mean, the fact that you can run a function inside that ternary, inside
> that if. the fact that you can run a function inside a control structure.
>
> is there a name for the concept?
> If I wanted to explain to someone that you can do those things, what
> would I call this topic?

orthogonality?

This means that there are rules that describe what you can do and there
are very few (down to "no") exceptions to these rules.
Like: "a function can return a value and this value can be used in an
expression" and "the condition of a conditional operator is an expression".
--
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett

Malcolm Dew-Jones
Guest
Posts: n/a

 07-08-2004
Ken Sington (ken_sington@nospam_abcdefg.com) wrote:

: > On Wed, 7 Jul 2004, Ken Sington wrote:
: >
: ...
: >
: > But what are you asking?
: >

: I mean, the fact that you can run a function inside that ternary, inside
: that if. the fact that you can run a function inside a control structure.

: is there a name for the concept? : If I wanted to explain to someone
that you can do those things, what would I call this topic?

perhaps you want words like

grammar

syntax

semantics

expressions

operators

operator precedence

LL(1) LALR(1) (and some other similar acronyms)

parsers

gnari
Guest
Posts: n/a

 07-08-2004
"Ken Sington" <ken_sington@nospam_abcdefg.com> wrote in message
news:(E-Mail Removed)...
>
> > On Wed, 7 Jul 2004, Ken Sington wrote:
> >

> ...
> >
> > But what are you asking?
> >

>
> I mean, the fact that you can run a function inside that ternary, inside
> that if. the fact that you can run a function inside a control structure.
>
> is there a name for the concept?
> If I wanted to explain to someone that you can do those things, what would

I call this topic?

you are thinking on expressions.

the if() test is a boolean expression. funtion calls are allowed
in expressions. some languages differentiate between procedures and
functions. the difference is that the functions return a value and
can thus be used in expressions.

gnari

Ken Sington
Guest
Posts: n/a

 07-09-2004
Josef Moellers wrote:
> Ken Sington wrote:

....

....

>
> orthogonality?
>

I almost dismissed it. never knew there was such a word.

I looked it up in the dictionary:
...sum of two products...

then google.com, and found lots of references to mathmatics.

then passed it around to my peers; almost no one had a clue.
the one who had a clue once again steered towards mathmatics.
and of course, to comp.sci.

> This means that there are rules that describe what you can do and there
> are very few (down to "no") exceptions to these rules.
> Like: "a function can return a value and this value can be used in an
> expression" and "the condition of a conditional operator is an expression".

Josef Moellers
Guest
Posts: n/a

 07-09-2004
Ken Sington wrote:
> Josef Moellers wrote:
>
>> Ken Sington wrote:

>
> ...
>
> ...
>
>>
>> orthogonality?
>>

> I almost dismissed it. never knew there was such a word.
>
> I looked it up in the dictionary:
> ...sum of two products...
>
> then google.com, and found lots of references to mathmatics.

Yes, in mathematics I'd read it as being "at right angles" or whatever
linear algebra makes out of that. It then also bears the notion of two
vectors being independent of each other so they span a plane where you
can construct points out of both vectors independently, which probably
led to the adoption of this term in CS:

>> This means that there are rules that describe what you can do and
>> there are very few (down to "no") exceptions to these rules.
>> Like: "a function can return a value and this value can be used in an
>> expression" and "the condition of a conditional operator is an
>> expression".

I.e. what you can construct an expression of is one vector and what you
can put into a condition is another.

I've seen this term used very often in describing the architecture of
processors. There it e.g. refers to the addressing modes where some
processors allow arbitrary sources and destinations (e.g. PDP11, VAX,
M68K, NS32K) while others just allow certain combinations only.
The former call themselves "orthogonal".
--
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett

Dale Henderson
Guest
Posts: n/a

 07-09-2004
>>>>> "JM" == Josef Moellers <(E-Mail Removed)> writes:

JM> Ken Sington wrote:
>> Josef Moellers wrote:
>>> Ken Sington wrote:

>> ... ...
>>
>>> orthogonality?
>>>

>> I almost dismissed it. never knew there was such a word. I
>> looked it up in the dictionary: ...sum of two products... then
>> google.com, and found lots of references to mathmatics.

JM> Yes, in mathematics I'd read it as being "at right angles" or
JM> whatever linear algebra makes out of that.

"at right angles" is a fair description. The most technical
definition is that the inner product (dot product) of two vectors
is zero.

And since inner product and vector have very broad definitions so
to can orthogonality. For example:

If f,g are real-valued functions over the reals (i.e. f:R->R
g:R->R).

We can defined the inner product:

<f,g>=\int_R f(x)g(x) dx where \int_R is the integral over all
real numbers that is from -infinity to infinity.

So that f,g are orthogonal if <f,g>=0.

JM> It then also bears the notion of two vectors being independent
JM> of each other so they span a plane where you can construct
JM> points out of both vectors independently, which probably led
JM> to the adoption of this term in CS:

Vectors needn't be orthogonal to be linearly independent. For
example (0,1) and (1,1) are linearly independent and span the
plane but are not orthogonal, <(0,1),(1,1)>=1!=0.

This is all WAY off topic and further discussion should be moved
to sci.math.

--
Dale Henderson

"Imaginary universes are so much more beautiful than this stupidly-
constructed 'real' one..." -- G. H. Hardy