Eryq <····@enteract.com> writes:
>
> >
> > * As a sidenote he says: Prolog blurs the distinction
> > between program and data.
>
> I think in this regard, Prolog is in the class of "most blurry",
> Lisp/Scheme the next class down, and Perl somewhere between them
> and C/C++.
Actually Lisp lacks Perl's context sensitivity: Lisp aims to be
definitional, Perl contextual. An expression in Lisp is always that
expression, they aren't evaluated in a (scalar|array|hash) context.
--
o============o Sending unsolicited commercial e-mail (UCE) to this address
Legal Notice is indication of your consent to pay me $120/hour for 1 hour
o============o minimum for professional proofreading & technical assessment.
terrence brannon * ·······@kappa.usc.edu * http://rana.usc.edu:8376/~brannon
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
·······@bufo.usc.edu (Terrence M. Brannon) writes:
:Actually Lisp lacks Perl's context sensitivity: Lisp aims to be
:definitional, Perl contextual. An expression in Lisp is always that
:expression, they aren't evaluated in a (scalar|array|hash) context.
There is no such thing as a "hash context", and an "array context"
is just a quaint way of saying "list context". So there are only
two contexts, singular and plural. C shares this.
--tom
--
Tom Christiansen ·······@jhereg.perl.com
But you have to allow a little for the desire to evangelize when you
think you have good news.
--Larry Wall in <······················@netlabs.com>
From: Michael Iles
Subject: Re: Perl as its own metalanguage?
Date:
Message-ID: <335CC591.7FD6@dra.com>
Tom Christiansen wrote:
> There is no such thing as a "hash context", and an "array context"
> is just a quaint way of saying "list context". So there are only
> two contexts, singular and plural. C shares this.
Can you elaborate on this? In C++, at least, you can't overload based on
return type. I'm having trouble thinking of a construct in C that would
act differently based on a 'singular' or 'plural' context.
Mike.
--
Michael Iles, ········@dra.com
Ceci n'est pas une .sig
In article <·············@dra.com>,
Michael Iles <········@dra.com> writes:
> Tom Christiansen wrote:
>> There is no such thing as a "hash context", and an "array context"
>> is just a quaint way of saying "list context". So there are only
>> two contexts, singular and plural. C shares this.
>
> Can you elaborate on this? In C++, at least, you can't overload based on
> return type. I'm having trouble thinking of a construct in C that would
> act differently based on a 'singular' or 'plural' context.
>
> Mike.
>
Would a C array vs. non-array count as plural vs. singular, respectively?
From my understanding, you can only have a limited set of types in C,
generally speaking: built-in types (int, float, char, struct, union,
pointer, etc), typedef'd types, pointers to a value of a given type, or
arrays of a given type. So, I can see how arrays would be called "plural",
but what about structs or unions?
For that matter, how would you precisely define a "plural type"?
(I 'spose this question invalidates the first paragraph -- so sue me.)
--
O'Shaughnessy Evans
UNIX/Internet Systems Administrator, GST-Call America; SLO, CA
mailto: ·····@callamer.com; http://gromit.callamer.com
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, ········@dra.com writes:
:Can you elaborate on this? In C++, at least, you can't overload based on
:return type. I'm having trouble thinking of a construct in C that would
:act differently based on a 'singular' or 'plural' context.
int i = (1,2);
int j[] = { 1, 2 };
f(1,2);
--tom
--
Tom Christiansen ·······@jhereg.perl.com
I'll say it again for the logic impaired.
--Larry Wall
Tom Christiansen <·······@mox.perl.com> writes:
>
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc, ········@dra.com writes:
> :Can you elaborate on this? In C++, at least, you can't overload based on
> :return type. I'm having trouble thinking of a construct in C that would
> :act differently based on a 'singular' or 'plural' context.
>
> int i = (1,2);
is this C syntax? what does it mean?
--
o============o Sending unsolicited commercial e-mail (UCE) to this address
Legal Notice is indication of your consent to pay me $120/hour for 1 hour
o============o minimum for professional proofreading & technical assessment.
terrence brannon * ·······@kappa.usc.edu * http://rana.usc.edu:8376/~brannon
In article <················@bufo.usc.edu>,
Terrence M. Brannon <·······@bufo.usc.edu> wrote:
=>Tom Christiansen <·······@mox.perl.com> writes:
=>
=>>
=>> [courtesy cc of this posting sent to cited author via email]
=>>
=>> In comp.lang.perl.misc, ········@dra.com writes:
=>> :Can you elaborate on this? In C++, at least, you can't overload based on
=>> :return type. I'm having trouble thinking of a construct in C that would
=>> :act differently based on a 'singular' or 'plural' context.
=>>
=>> int i = (1,2);
=>is this C syntax? what does it mean?
In an expression, the "," is a sequencing operator, evaluating the LHS,
then the RHS, and returning the value on the RHS as the expression result.
So, except for evaluating and throwing away the 1, the above is the same
as:
int i = 2;
The parentheses are just there for fun, and provide the usual
subexpression context.
I believe the point was that just by looking at a bunch of values
separated by commas inside parentheses you can't tell if the values
are being kept and passed to a function or thrown away except for the
last one, i.e. "'singular' or 'plural' context."
Gary D. Duzan
Humble Practitioner of the Computing Arts
In article <················@bufo.usc.edu>,
Terrence M. Brannon <·······@bufo.usc.edu> wrote:
>> int i = (1,2);
>is this C syntax? what does it mean?
Nothing useful. It means "evaluate 1", "evaluate 2" "set i to the second".
This is a really bad attempt to try to ascribe a property to C which it
does not have. This is a simple overloaded operator (",") which is
competely resolved at compile time. Perl's "array context" is in fact a
runtime feature of much greater complexity.
Paul Prescod
Ronald L. Parker wrote:
>
> On 23 Apr 1997 17:05:41 -0700, ·······@bufo.usc.edu (Terrence M.
> Brannon) wrote:
>
> >Tom Christiansen <·······@mox.perl.com> writes:
> >
> >> int i = (1,2);
> >is this C syntax? what does it mean?
>
> It's a slightly obfuscated way of saying "int i = 2;"
>
> The comma operator executes its operands in order, then takes its
> value from the value of the second operator.
But it isn't all that obscure because many C programs use a
fgets/feof construct, something like
while ( fgets(buffer, LEN, file) , !feof(file) )
{ ... }
Which calls fgets(), ignores that return code, and then call feof().
The return of feof() is the value of the expression. This is the
same as
while ( !feof(file) )
{ ... }
other than the side effects of fgets (setting the EOF flag, copying
data to buffer, moving the file pointer, stuff like that).
- doug
On 23 Apr 1997 17:05:41 -0700, Terrence M. Brannon <·······@bufo.usc.edu> wrote:
> Tom Christiansen <·······@mox.perl.com> writes:
>
> >
> > [courtesy cc of this posting sent to cited author via email]
> >
> > In comp.lang.perl.misc, ········@dra.com writes:
> > :Can you elaborate on this? In C++, at least, you can't overload based on
> > :return type. I'm having trouble thinking of a construct in C that would
> > :act differently based on a 'singular' or 'plural' context.
> >
> > int i = (1,2);
> is this C syntax? what does it mean?
It means the same as ...
int i = 2;
In C, the comma operator returns what's on its right.
--
Lloyd Zusman
···@asfast.com