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

Jan-Erik Soderholm jan-erik.soderholm at telia.com
Tue Jan 20 19:11:24 EST 2015


David Froble skrev den 2015-01-20 21:40:
> Simon Clubley wrote:
>> On 2015-01-20, David Froble <davef at tsoft-inc.com> wrote:
>>> 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> )
>>>
>> ;---
>>
>> Based on your previous message, what you don't seem to have picked up
>> on is that a dictionary is an associative data structure which means
>> that in a DCL which supported associative arrays/dictionaries the code
>> above between ";+++" and ";---" could be replaced with the following
>> single DCL line:
>>
>> $    value = L{some_string_containing_the_key}
>>
>> assuming you use "{" and "}" to denote an array index and L is the
>> associative array/dictionary. (You can't use "[" or "]" here as they
>> are already taken by DCL.)
>>
>> You could also dynamically add an element to or delete an element from
>> the dictionary in a single DCL line as well.
>>
>> Simon.
>>
>
> Some code similar to what's between the +++ and --- would have to exist
> somewhere.  If part of DCL, fine, but must exist.
>
> I was just showing that some new fangled data type in some new fangled
> language wasn't much different that what exists in one of the old compiled
> languages.

Oh, it is very different, as I wrote in another post.

The dict data type in Python is an assisitive array with
the key value in an hash table for very fast lookups.
Your example is just an old sequential search. Could
be done in any language but always unefficient.

Jan-Erik.






More information about the Info-vax mailing list