DataStructureQ[ds]
gives True if ds is a valid data structure, and False otherwise.
DataStructureQ[ds,type]
gives True if ds is a valid data structure of the specified type, and False otherwise.
DataStructureQ
DataStructureQ[ds]
gives True if ds is a valid data structure, and False otherwise.
DataStructureQ[ds,type]
gives True if ds is a valid data structure of the specified type, and False otherwise.
Examples
open all close allBasic Examples (2)
Create an instance of a DataStructure object:
ds = CreateDataStructure["Stack"]Test that this is a valid data structure:
DataStructureQ[ds]An expression with head DataStructure that is not a valid data structure object:
DataStructureQ[DataStructure["MyDynamicArray", {}]]Scope (1)
Create an instance of a DataStructure object:
ds = CreateDataStructure["DynamicArray"]Include a test for the data structure type:
DataStructureQ[ds, "DynamicArray"]Test that this is not a linked list:
DataStructureQ[ds, "LinkedList"]Applications (1)
A simple function that carries out an in-place reverse of a "DynamicArray":
ArrayReverse[ds_] /; DataStructureQ[ds, "DynamicArray"] :=
Module[{start = 0, end = ds["Length"] + 1},
While[++start < --end,
ds["SwapPart", start, end]
];
ds
];Reverse the elements of a sample dynamic array:
ds = CreateDataStructure["DynamicArray", {9, 2, 7, 0}];
Normal[ArrayReverse[ds]]The same function will not work on other data structures:
ArrayReverse[CreateDataStructure["ImmutableVector", {9, 2, 7, 0}]]Related Guides
History
Text
Wolfram Research (2020), DataStructureQ, Wolfram Language function, https://reference.wolfram.com/language/ref/DataStructureQ.html.
CMS
Wolfram Language. 2020. "DataStructureQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DataStructureQ.html.
APA
Wolfram Language. (2020). DataStructureQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DataStructureQ.html
BibTeX
@misc{reference.wolfram_2026_datastructureq, author="Wolfram Research", title="{DataStructureQ}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/DataStructureQ.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_datastructureq, organization={Wolfram Research}, title={DataStructureQ}, year={2020}, url={https://reference.wolfram.com/language/ref/DataStructureQ.html}, note=[Accessed: 13-June-2026]}