[Info-vax] DCL's flaws (both scripting and UI)

Jan-Erik Soderholm jan-erik.soderholm at telia.com
Wed Jan 21 06:34:33 EST 2015


David Froble skrev den 2015-01-21 04:04:
> Jan-Erik Soderholm wrote:
>> David Froble skrev den 2015-01-20 18:50:
>>> Jan-Erik Soderholm wrote:
>>>
>>>> OK, so a similar data type exist in the base Basic distribution?
>>>> I thought not.
>>>
>>> If your position is dependent upon a particular data type existing, then I
>>> submit the following:
>>>
>>>
>>> 10    Dim L$(99,2)   ! Create an array of dynamic string descriptors
>>>
>>>      <some code to load L$(index,1) with a key value
>>>      and L$(index,2) with the associated data>
>>>
>>>      ! This would be the "tool" to retrive data based upon the key
>>>      String Function RetriveData( <key> )
>>>          For I% = 1% to 99%
>>>              If    <key> = L$(I%,1%)
>>>              Then    RetriveData = L$(I%,2%)
>>>                  Exit Function
>>>              End If
>>>          Next I%
>>>          RetriveData = ""
>>>      End Function
>>>
>>>      ! This would be a retrival
>>>      D$ = RetriveData( <some key> )
>>>
>>
>> Yes, but that uses a sequential search of the array, right?
>> The search time will grow in line with the size of the array.
>>
>> Python dict's are hashed on the key and has very fast search
>> on the key value for any reasonable size within your current
>> memory limits.
>>
>> Jan-Erik.
>
> You appear to not have consider this in the original post.
>
> "Ok, syntax may not be all correct, and it's over simplified"
>                                          ^^^^^^^^^^^^^^^^^^^^

Fine. I guess you had to do that to create an example. But then
it will not scale very well. Python lookup time is the same no
matter the size of the dictionary. For small dictionaries the
hash calculation might be longer then a seq search, though...

Of course I understand that you *could* build someting in Basic
that looks like the built-in "dict" datatype in Python, but it
will never be "built-in" and a part of the language standard.


>
> I was doing hashed keys back in 1974.  I understand many ways to do these
> things, from a simple binary search to B-tree structures, and such.
>

Apart from that hashed keys doesn't use either binary search or
B-three structures, you might very well understand them anyway.
No problem. The point is still that is is not part of the Basic
language standard.

> You've gone off on a tangent.  The original post was to show that the
> capability wasn't all that difficult in an older compiled language, and
> that yes, a data type that does the job does exist in Basic.

No, it doesn't! There is no data type like the Python "dict" i Basic!
You have to write your own routines using the available (simpler)
data types.

Jan-Erik.



More information about the Info-vax mailing list