# what do you call funct ( funct())

Discussion in 'Perl Misc' started by Ken Sington, Jul 8, 2004.

1. ### Ken SingtonGuest

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; Ken Sington, Jul 8, 2004 1. ### Advertising 2. ### Gunnar HjalmarssonGuest 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 Gunnar Hjalmarsson, Jul 8, 2004 1. ### Advertising 3. ### Brad BaxterGuest 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,

4. ### Ken SingtonGuest

> 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,
>
Ken Sington, Jul 8, 2004
5. ### Josef MoellersGuest

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
Josef Moellers, Jul 8, 2004
6. ### Malcolm Dew-JonesGuest

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
Malcolm Dew-Jones, Jul 8, 2004
7. ### gnariGuest

"Ken Sington" <ken_sington@nospam_abcdefg.com> wrote in message
news:...
>
> > 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
gnari, Jul 8, 2004
8. ### Ken SingtonGuest

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".
Ken Sington, Jul 9, 2004
9. ### Josef MoellersGuest

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
Josef Moellers, Jul 9, 2004
10. ### Dale HendersonGuest

>>>>> "JM" == Josef Moellers <> 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
Dale Henderson, Jul 9, 2004
11. ### Joe SmithGuest

Dale Henderson wrote:

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

Dale,
Whenever I see one of your postings, it takes more brain power to
parse, since you don't put your text at the left margin like everybody
else does. Is there a particular reason why you use this non-standard
style?
-Joe
Joe Smith, Jul 10, 2004
12. ### Josef MoellersGuest

Dale Henderson wrote:
>>>>>>"JM" == Josef Moellers <> writes:

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

As I'm already known to be a pedant and trying to show off:
I was using an implication:

"at right angles" -> "linearly independency"

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

I don't really want to discuss this particular subject.

<EOD>
--
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
Josef Moellers, Jul 12, 2004