Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: New implementations in Dictionary module

  1. #1
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    New implementations in Dictionary module

    Hi all,

    I'm working on Dictionary module to apply the following changes:
    • case insensitive keys DONE. Present in current release
    • key exists function DONE. Present in current release
    • dictionary count to get number of keys stored DONE. Present in current release
    • key list, to have the list of keys stored inside a dictionary DONE. Present in current release
    • data type, to be able to store data different from string: numbers or entire UDT TYPE
    • dictionary size to be able to know the total amount of data stored into a dictionary DONE. Will be present in next release
    • possibility to save/load Dictionary to/from disk file
    • APPEND in order to append new data to current one stored under a key
    • REMOVE in order to remove a key/data pair from the dictionary
    • Resize a dictionary
    • create a new dictionary merging other two
    • create a new dictionary with only common keys of other two
    • create a new dictionary with only not common keys
    • ...
    • ...
    • ...
    • ...


    If you have any urgent request let me know here and I will try to give higher priority.

    Regards
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732

    Re: New implementations in Dictionary module

    Hi Eros,

    your plan seems pretty good!
    Maybe key list could use wildcart ( "rockets*" ... ) ?


    Bye,
    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #3
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: New implementations in Dictionary module

    Nice idea.
    No easy to implement but worth to try.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  4. #4
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: New implementations in Dictionary module

    I don't quite understand what it does, but sounds interesting and will wait for the demos to see what goes on.
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: New implementations in Dictionary module

    Theory of Dictionary can be found at http://en.wikipedia.org/wiki/Hash_table
    or also http://en.wikipedia.org/wiki/Associative_array
    That is what's behind the scene.

    Dictionary is also called in other languages in the following way:
    • hash table
    • collection
    • associative array

    but all do (more or less) the same thing:
    • store data under a text key name
    • fast storing
    • superfast retrieving
    • efficient memory handling


    In Dictionary every key is unique.
    It means that every time you add a new key/data pair the Dictionary automatically check if the key is already present or not.
    If key is not present it will be added to the dictionary and relevant data stored.
    If key is already present no new duplicated key will be added but previous data will be replaced by new one.
    All memory handling is done by the Dictionary so programmer doen not need to warry about it (unless data stored is a structure referencing other dynamic memory blocks).

    Every single key/data pair can store up to 2Gb of data.
    Of course this is theory because limits are imposed by physical memory present in the computer and by limits of some OS version but in any case can give you an idea of the power of a Dictionary.

    ... will continue
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  6. #6
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732

    Re: New implementations in Dictionary module

    Eros,

    another idea, what about DICTIONARY_ASSIGN( pDict, keyName, Value ) ?
    This would allow to overwrite data already present for key.

    Useful could be also DICTIONARY_APPEND( pDict, keyName, Value ) to just append new data to those hidden under keyName.

    To remove items there could be DICTIONARY_REMOVE( pDict, keyName ), and to empty whole dictionary just DICTIONARY_EMPTY( pDict ).


    Bye,
    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  7. #7
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: New implementations in Dictionary module

    Petr

    In Dictionary every key is unique.
    It means that every time you add a new key/data pair the Dictionary automatically check if the key is already present or not.
    If key is not present it will be added to the dictionary and relevant data stored.
    If key is already present no new duplicated key will be added but previous data will be replaced by new one.
    All memory handling is done by the Dictionary so programmer doen not need to worry about it (unless data stored is a structure referencing other dynamic memory blocks).

    I will add REMOVE functionality, very interesting.
    Also APPEND is quite interesting. I will see what I can do.

    Thanks a lot
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  8. #8
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732

    Re: New implementations in Dictionary module

    Thanks Eros,

    that would be nice !


    Bye,
    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  9. #9

    Re: New implementations in Dictionary module

    Eros wrote:
    In Dictionary every key is unique.
    It means that every time you add a new key/data pair the Dictionary automatically check if the key is already present or not.
    If key is not present it will be added to the dictionary and relevant data stored.
    If key is already present no new duplicated key will be added but previous data will be replaced by new one.
    All memory handling is done by the Dictionary so programmer doen not need to warry about it (unless data stored is a structure referencing other dynamic memory blocks).
    Very interesting. I like it. And I like the autocheck - that will make life easier for programmer. Good work, Eros.

    catventure.
    http://tab.thinbasic.com - Home Of The ThinBasic Adventure Builder Project. (Interactive Fiction/Text Adventure Maker)

  10. #10
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: New implementations in Dictionary module

    When I see words like "Auto" and "Memory Handled" it always makes me Happy!!
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

Page 1 of 2 12 LastLast

Similar Threads

  1. Introduction to Dictionary module
    By ErosOlmi in forum Dictionary module
    Replies: 1
    Last Post: 22-04-2007, 09:22

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •