Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    Are Tuples list and dictonaries in fuze

    Comments & Feedback
    6
    14
    617
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      petermeisenstein F @pianofire last edited by

      @pianofire So there are only lists[]
      Wow thats interesting

      pianofire 1 Reply Last reply Reply Quote 0
      • pianofire
        pianofire Fuze Team @petermeisenstein last edited by

        @petermeisenstein I implemented a simple dictionary in this: https://fuzearena.com/forum/topic/781/persistent-data but it only sequentially searches the keys ( there is no hashing)

        P 1 Reply Last reply Reply Quote 0
        • P
          petermeisenstein F @pianofire last edited by

          @pianofire And tuples are also not in fuze.And let guess they are not on the priority list what i can totaly understand because you dont really need tuples in fuze.Very cool your implementation.

          1 Reply Last reply Reply Quote 0
          • C
            chiizujin last edited by

            You can use vectors as tuples of floats if you only need up to 4 elements. And since they're floats you can also store ints and boolean values. I've been doing this in my project. Other than that you could use a struct.

            1 Reply Last reply Reply Quote 3
            • R
              rubiks14 last edited by

              I implemented a very rudimentary hash table with some example code on usage. I may work on it some more if people like it. The code is SUK736X9SM.

              Let me know what you think. There are no comments because I have been up way too late working on this. You may also notice that I had to use arrays to handle collisions as there are no pointers or reference values that I could figure out how to implement. Keep that in mind because you can quickly eat up a lot of memory if you make the table too large.

              1 Reply Last reply Reply Quote 3
              • vinicity
                vinicity F last edited by

                Thank you, @rubiks14, for this really useful hash table! It seems to be working fine, except that it needs one simple change to work in Fuze 2.15:

                Change row 14 by adding the ref keyword like this:

                function addKeyValue(ref hashTable, key, value)
                

                This should perhaps be added to the Functions section?

                1 Reply Last reply Reply Quote 3
                • vinicity
                  vinicity F last edited by

                  OK, I just realised that you also need to change line 26 to this:

                  function getValue(ref hashTable, key)
                  

                  Otherwise a copy of the whole hash table is created for each call to getValue(), which slows everything down a lot, especially when you have large hash tables.

                  Also, line 38 should be:

                  function removeKeyValue(ref hashTable, key)
                  

                  I hope @rubiks14 doesn't mind, but I will share the updated version for others who might need it.

                  pianofire 1 Reply Last reply Reply Quote 0
                  • pianofire
                    pianofire Fuze Team @vinicity last edited by

                    @vinicity They haven't logged in for a few weeks but I guess they wouldn't have shared it if they didn't want people to use it

                    1 Reply Last reply Reply Quote 1
                    • T
                      tony7059 last edited by tony7059

                      I've not worked with the lower-level workings of a hash table, so maybe I'm missing something about the implementation provided in the shared code. This still looks like its looping a collection to find the key, while my assumption was that the table would allow you to directly use the key without having to do any looping whatsoever, so I'm confused : ) If someone can give me a clue I'd appreciate it... perhaps @pianofire Thanks!

                      EDIT: Perhaps what I'm seeing now is that chaining is only being used for collisions, thus looping only rarely occurs??? : )

                      1 Reply Last reply Reply Quote 0
                      • vinicity
                        vinicity F last edited by

                        Yes, it’s only looping when collisions occur.

                        1 Reply Last reply Reply Quote 0
                        • vinicity
                          vinicity F last edited by

                          I had forgotten about this, but here is the hash function, with fixes to make it work in Fuze 2.15:

                          ID: 1P8Q3MND5C

                          T 1 Reply Last reply Reply Quote 0
                          • T
                            tony7059 @vinicity last edited by

                            @vinicity Thanks... I'll grab that! : )

                            1 Reply Last reply Reply Quote 1
                            • First post
                              Last post