JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.89k stars 5.49k forks source link

Unclear information on data structures #51342

Open ShalokShalom opened 1 year ago

ShalokShalom commented 1 year ago

Hi there :)

I find currently the following problems, when consulting the documentation on the topic of data structures.

  1. There is no dedicated page, that lists all the available data structures.
  2. The page, that is likely to be consulted first for that, Collections and Data structures, shows at the top something only mildly related. I don't care about the iterate functionality at this point. I do care about the availability of data structures, and how they differ from each other.
  3. Tuples, NamedTuples, and supposedly other data structures show up in places, where somebody who is not custom to Julia, would simply not expect them. Who looks into the documentation about functions, when they are looking for data structures?

I do suggest, that we have a page, (I can help) that compares all the available options, and adds information about them.

Specifically, I am interested into all the immutable data structures, and ideally also like to know, how they are implemented, and how well they perform. 😃

Currently, I see basically no way at all, to consult the docs in order to gain info about what data structures with structural sharing, support for memorization and caching are available.

It seems like Arrays are used by default, and everything else seems like a departure. Is this true?

ArchieCall commented 1 year ago

I asked ChatGPT this question "What are the Data Structures in the Julia Programming Language?" and it gave this answer:

Julia is a high-level, high-performance programming language designed for technical and numerical computing. It provides a variety of data structures to work with different types of data efficiently. Some of the common data structures in Julia include:

  1. Arrays: ◦ Julia's primary data structure for working with sequences of elements. ◦ Supports both one-dimensional and multi-dimensional arrays. ◦ Arrays can be homogeneous (containing elements of the same type) or heterogeneous (containing elements of different types).
  2. Tuples: ◦ Ordered, immutable collections of elements. ◦ Can contain elements of different types. ◦ Tuples are often used for grouping related values.
  3. Dictionaries (Dicts): ◦ Key-value pairs where keys are unique and associated with values. ◦ Efficient for looking up values by their corresponding keys. ◦ Keys can be of any type, and values can be of any type.
  4. Sets: ◦ Unordered collections of unique elements. ◦ Useful for tasks that require ensuring uniqueness, such as removing duplicates from a list.
  5. Strings: ◦ Sequences of characters. ◦ Unicode strings are fully supported in Julia, allowing for internationalization and handling of diverse character sets.
  6. Linked Lists (from the DataStructures package): ◦ Although Julia's standard library doesn't include native linked lists, you can use external packages like DataStructures.jl to work with linked lists.
  7. Queues and Stacks (from the DataStructures package): ◦ DataStructures.jl also provides implementations of queues (FIFO) and stacks (LIFO) that can be used for specific tasks.
  8. Heaps (from the DataStructures package): ◦ Priority queues and heaps are available for efficient priority-based data processing.
  9. Arrays of Structs: ◦ Julia allows you to define custom composite data types, often referred to as structs, which can be used to create arrays of structured data.
  10. Sparse Arrays (from the SparseArrays package): ◦ Julia offers support for working with sparse arrays, which are efficient for handling large arrays with mostly zero values.
  11. DataFrames (from the DataFrames package): ◦ DataFrames.jl provides a data structure similar to data frames in R and data tables in Python. It is useful for working with structured data and tabular data.
  12. Circular Buffers (from the CircularBuffer package): ◦ Circular buffers are useful for implementing streaming data processing applications, and the CircularBuffer package provides an implementation for Julia. These are some of the fundamental data structures available in Julia. Additionally, Julia's package ecosystem offers various other data structures and libraries tailored to specific use cases and application domains. You can extend Julia's functionality by importing these packages as needed for your projects.

This summary could be of help in further improving the docs.

ShalokShalom commented 1 year ago

Sure, I will do this!