f python?

Terry Reedy tjreedy at udel.edu
Sun Apr 15 20:59:37 EDT 2012


On 4/15/2012 6:59 PM, Ian Kelly wrote:
> On Sun, Apr 15, 2012 at 4:49 PM, Terry Reedy<tjreedy at udel.edu>  wrote:
>> On 4/15/2012 12:16 PM, Ian Kelly wrote:
>>>
>>> On Sat, Apr 14, 2012 at 8:57 PM, Shmuel  Metz
>>> <spamtrap at library.lspace.org.invalid>    wrote:
>>>>
>>>> In<87aa2iz3l1.fsf at kuiper.lan.informatimago.com>, on 04/11/2012
>>>>    at 05:32 PM, "Pascal J. Bourguignon"<pjb at informatimago.com>    said:
>>>>
>>>>> You're confused. C doesn't have arrays.  Lisp has arrays. C only has
>>>>> vectors

According to the authors of C, the C standard committee, and probably 
hundreds of C authors, C has 'arrays', not 'vectors'. Fortran also has 
'arrays', with some systems having hardware or software extensions for 
vector (and matrix) processing (where vectors have the operations I 
specify below and matrixes have *their* operations).
(See for instance https://en.wikipedia.org/wiki/Fortran )

>>>> Neither C nor any other programming language has vectors ;-)

Generally not as a built-in type, though vector functions that treat 1-d 
arrays as vectors are common. So are added matrix classes and functions.

>>> AFAIK, C++ nomenclature notwithstanding, a vector is just an array
>>> with only one or indices, so all languages that have arrays have
>>> vectors.

Confusing representation with concept is not very helpful. In biology, a 
vector is something that carries something from here to there. That is 
related to the astronomical/geometric/mathematical meaning.

>> Vectors are magnitude with direction, often represented by 1-d array of
>> projections on coordinate axes. If a = 1,2,3 and b = 3,2,1 are
>> (mathematical) vectors, then a+b = 4,4,4; 2*a = 2,4,6; and a*b = (3+4+3) =
>> 10.

> I'm referring to the programming usage, not the mathematical usage.
> See definition #4 at dictionary.com, or definition #8 at wiktionary.

But you will not find that meaning in
http://www.merriam-webster.com/dictionary/vector

The mathematical usage *is* the programming usage in many programming 
languages and communities -- including Python. CPython lists are 
implemented as C arrays.

===
Terry Jan Reedy



More information about the Python-list mailing list