Data set processing method and device in programming language, equipment and medium

By creating an operation queue and delaying the execution of operation functions, the memory consumption problem in dataset processing in programming languages ​​is solved, improving processing efficiency and performance.

CN121349564APending Publication Date: 2026-01-16TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410954272.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-16
Publication Date
2026-01-16

AI Technical Summary

Technical Problem

When performing multiple operations on a dataset in a programming language, the intermediate datasets generated by each operation need to be saved, which consumes a lot of memory, leading to insufficient memory and affecting processing speed and performance.

Method used

Create a queue of operations containing multiple operation functions and delay the execution of these functions until all operation functions are executed at once when the dataset needs to be processed, thus avoiding the need to save intermediate datasets.

Benefits of technology

It saves memory usage of intermediate datasets and improves the efficiency and performance of dataset processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121349564A_ABST
    Figure CN121349564A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, in particular to a method, a device and equipment for processing a data set in a programming language and a medium, which are used for saving memory occupation and improving the processing efficiency of the data set so as to improve the processing performance of the data set. The method comprises the following steps: aiming at a set data set, creating a set operation queue comprising a plurality of operation functions; wherein each operation function is used for executing a corresponding data conversion operation; creating an execution method of the set operation queue, wherein the execution method is used for calling a plurality of operation functions in the set operation queue in sequence; when the set data set is processed, an execution method is called, data conversion operations corresponding to the operation functions in the set operation queue are sequentially and accumulatively executed according to the set data set, and a processing result is obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of application development technology, and in particular to a method, apparatus, device and medium for processing datasets in a programming language. Background Technology

[0002] In related technologies, when setting up a programming language (e.g., JavaScript) and needing to perform setting operations on a dataset (e.g., an array), it is common practice to first define an operation function and then call that function to perform the corresponding operation on the dataset. When there are multiple setting operations, it is common practice to first define an operation function for the first operation, call that function to perform the operation on the dataset, obtain a new dataset (i.e., an intermediate dataset), and save the intermediate dataset. Then, define another operation function for the second operation, call that function to perform the operation on the intermediate dataset, obtain another intermediate dataset, and save it. This process continues until all operations have been performed.

[0003] For example, given a dataset [1,2,3,4,5], first perform a map operation on this dataset. Define a map operation function map(x=>x*2), which multiplies each element in the dataset by 2, resulting in an intermediate dataset [2,4,6,8,10], which is then saved. Next, perform a filter operation on the intermediate dataset. Define a filter operation function filter(x=>x>6), which filters out elements greater than 6 from the intermediate dataset, resulting in another intermediate dataset [8,10], and so on.

[0004] However, during the above operations on the dataset, each operation generates and saves an intermediate dataset. Saving the intermediate dataset requires a certain amount of memory. Therefore, when the amount of data in the intermediate dataset is large, the amount of memory required will also be larger. This may lead to insufficient memory, thereby affecting the processing speed of the dataset and resulting in poor processing performance. Summary of the Invention

[0005] This application provides a dataset processing method, apparatus, electronic device, and storage medium in a programming language to save memory usage and improve dataset processing efficiency, thereby enhancing dataset processing performance.

[0006] On one hand, embodiments of this application provide a dataset processing method in a programming language, the method comprising:

[0007] For a given dataset, create a defined operation queue containing multiple operation functions; each operation function is used to perform a corresponding data transformation operation.

[0008] An execution method for creating the defined operation queue, wherein the execution method is used to sequentially call the plurality of operation functions in the defined operation queue;

[0009] When processing the specified dataset, the execution method is invoked, and for the specified dataset, the data transformation operations corresponding to each of the multiple operation functions in the specified operation queue are executed sequentially and cumulatively to obtain the processing result.

[0010] On one hand, embodiments of this application provide a dataset processing apparatus in a programming language, the apparatus comprising:

[0011] The first creation unit is used to create a defined operation queue containing multiple operation functions for a given dataset; each operation function is used to perform a corresponding data transformation operation.

[0012] The second creation unit is used to create an execution method for the defined operation queue, wherein the execution method is used to sequentially call the plurality of operation functions in the defined operation queue;

[0013] The processing unit is used to call the execution method when processing the set dataset, and to sequentially and cumulatively execute the data transformation operations corresponding to the multiple operation functions in the set operation queue for the set dataset to obtain the processing result.

[0014] In some alternative embodiments, the apparatus further includes a merging unit for:

[0015] Determine whether the operation type of the operation function obtained this time is the same as that of the operation function obtained last time;

[0016] If they are the same, then in a new instance of the target class created this time, the operation function obtained this time will be merged with the operation function obtained last time to obtain a merged operation function.

[0017] In some optional implementations, the processing unit is specifically used for:

[0018] The multiple operation functions in the set operation queue are traversed sequentially according to a set order. Each time an operation function is traversed, the corresponding data transformation operation is performed on the current dataset using the operation function, and the transformed dataset is output. The current dataset is the set dataset or the transformed dataset output when the operation function was traversed last time.

[0019] When the newly obtained transformed dataset meets the set conditions, the newly obtained transformed dataset is used as the processing result.

[0020] In some optional implementations, when the newly obtained transformed dataset meets the set conditions and is used as the processing result, the processing unit is specifically used to perform any one of the following operations:

[0021] When the latest obtained transformation dataset is the transformation dataset output by the last operation function in the set operation queue, the latest obtained transformation dataset is used as the processing result;

[0022] When the latest obtained transformed dataset is an empty dataset, the latest obtained transformed dataset is used as the processing result;

[0023] When the newly obtained transformation dataset contains the specified element, the newly obtained transformation dataset is used as the processing result;

[0024] If the number of elements in the latest transformed dataset is not greater than the set number, the latest transformed dataset is used as the processing result.

[0025] In some optional implementations, the processing unit is specifically used for:

[0026] The multiple elements in the set dataset are traversed sequentially. For each element, the data transformation operation corresponding to the multiple operation functions in the set operation queue is executed sequentially and cumulatively to obtain a new element.

[0027] The dataset consisting of multiple new elements obtained is taken as the processing result.

[0028] In some optional implementations, the second creation unit is specifically used for:

[0029] Create the `evaluate` method of the defined operation queue, obtain the target function through the `evaluate` method, and use the target function to call the plurality of operation functions in the defined operation queue in sequence;

[0030] The processing unit is specifically used for:

[0031] When processing the specified dataset, the target function obtained by the evaluate method is called to execute the target function.

[0032] In some optional implementations, when the `evaluate` method is used to create the defined operation queue, the second creation unit is specifically used for:

[0033] The `evaluate` and `value` methods of the defined operation queue are created, and the `value` method is used to call the target function obtained by the `evaluate` method;

[0034] The processing unit is specifically used for:

[0035] When processing the specified dataset, the value method is called to execute the target function obtained by the evaluate method.

[0036] On one hand, an electronic device provided in this application includes a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the dataset processing method in any of the above-mentioned programming languages.

[0037] On one hand, embodiments of this application provide a computer-readable storage medium including a computer program, which, when run on an electronic device, causes the electronic device to perform the steps of a dataset processing method in any of the above-described programming languages.

[0038] On one hand, embodiments of this application provide a computer program product, the computer program product including a computer program stored in a computer-readable storage medium; when a processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, causing the electronic device to perform the steps of the dataset processing method in any of the above programming languages.

[0039] The solution proposed in this application has at least the following beneficial effects:

[0040] This application provides a dataset processing method, apparatus, device, and medium in a programming language. Before processing a set dataset, a set operation queue containing multiple operation functions is first created for the set dataset, and an execution method for the set operation queue is created. When the set dataset needs to be processed, the execution method is called to sequentially and cumulatively execute the data transformation operations corresponding to the multiple operation functions for the set dataset to obtain the processing result.

[0041] As can be seen, this embodiment of the application creates a set operation queue, in which each operation function can be executed late until the execution method is called. Then, the set dataset is executed sequentially and cumulatively to obtain the processing result. In this way, it is possible to avoid saving the intermediate dataset generated each time an operation function is executed, thus saving the memory occupied by the intermediate dataset and preventing the processing speed of the set dataset from being affected by insufficient memory. Furthermore, the sequential and cumulative execution of each operation function on the set dataset can improve the execution efficiency and thus improve the processing performance of the set dataset.

[0042] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description

[0043] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0044] Figure 1 This is a schematic diagram illustrating an application scenario of a dataset processing method in a programming language according to an embodiment of this application;

[0045] Figure 2 This is a flowchart of a dataset processing method in a programming language according to an embodiment of this application;

[0046] Figure 3 This is a schematic diagram illustrating the merging process of operation functions in one embodiment of this application;

[0047] Figure 4 This is a schematic diagram of another operation function merging process in an embodiment of this application;

[0048] Figure 5 This is a schematic diagram illustrating the execution process of setting an operation queue in an embodiment of this application;

[0049] Figure 6 This is a schematic diagram illustrating another execution process for setting an operation queue in an embodiment of this application;

[0050] Figure 7 This is a schematic diagram illustrating another execution process for setting an operation queue in an embodiment of this application;

[0051] Figure 8 This is a schematic diagram illustrating another execution process for setting an operation queue in an embodiment of this application;

[0052] Figure 9This is a schematic diagram of the overall logic of a dataset processing method in a programming language according to an embodiment of this application;

[0053] Figure 10 This is a schematic diagram of the composition structure of a dataset processing device in a programming language according to an embodiment of this application;

[0054] Figure 11 This is a schematic diagram of the composition structure of dataset processing in another programming language in an embodiment of this application;

[0055] Figure 12 This is a schematic diagram of the composition structure of an electronic device using an embodiment of this application;

[0056] Figure 13 This is a schematic diagram of the composition structure of an electronic device according to an embodiment of this application. Detailed Implementation

[0057] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments of this application. Obviously, the described embodiments are only some embodiments of the technical solutions of this application, and not all embodiments. Based on the embodiments recorded in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the technical solutions of this application.

[0058] The following describes some of the concepts involved in the embodiments of this application.

[0059] JavaScript is a lightweight, interpreted, just-in-time (JIT) programming language with a function-first approach. While it is best known as a scripting language for developing web pages, it is also used in many non-browser environments. JavaScript is a prototype-based, multi-paradigm dynamic scripting language that supports object-oriented, imperative, declarative, and functional programming paradigms.

[0060] JavaScript Chainable Operation Flow (JSCOF) is a method for implementing lazy evaluation in JavaScript. JSCOF allows developers to build an operation queue through chained calls, where operation functions are deferred until their execution results are explicitly requested. The operation queue described in this embodiment is the aforementioned operation queue.

[0061] Operation functions: These encapsulate data processing logic for specific operations, used to perform data transformations. For example, specified operations include map, filter, and sort operations. The map operation maps each element in the dataset to a new element, resulting in a new dataset; this mapping can be achieved through function transformations. The filter operation filters elements from the dataset that meet certain conditions, resulting in a new dataset. The sort operation sorts the elements in the dataset according to defined rules.

[0062] Lazy evaluation is a computation strategy that delays the evaluation of an operation function (such as an expression) until its value is actually needed. This contrasts with immediate evaluation, which evaluates the operation function as soon as it is created. Lazy evaluation can avoid unnecessary operations, especially when dealing with potentially infinite data structures (such as streams and iterators) or performing complex data transformations.

[0063] The word “exemplary” as used below means “serving as an example, embodiment, or illustration.” Any embodiment illustrated as an “exemplary” need not be construed as superior to or better than other embodiments.

[0064] The terms "first" and "second" used in this document are for descriptive purposes only and should not be construed as indicating relative importance or implying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.

[0065] The design concept of the embodiments of this application will be introduced below.

[0066] In related technologies, when setting up a programming language (e.g., JavaScript) and needing to perform setting operations on a dataset (e.g., an array), it is common practice to first define an operation function and then call that function to perform the corresponding operation on the dataset. When there are multiple setting operations, it is common practice to first define an operation function for the first operation, call that operation function to perform the operation on the dataset, obtain a new dataset (i.e., an intermediate dataset), and save the intermediate dataset. Then, define another operation function for the second operation, call that other operation function to perform the operation on the new dataset, obtain another intermediate dataset, and save it. This process continues until all operations have been performed.

[0067] However, during the above operations on the dataset, each operation generates and saves an intermediate dataset. Saving the intermediate dataset requires a certain amount of memory. Therefore, when the amount of data in the intermediate dataset is large, the amount of memory required will also be larger. This may lead to insufficient memory, thereby affecting the processing speed of the dataset and resulting in poor processing performance.

[0068] In view of this, embodiments of this application provide a dataset processing method, apparatus, device, and medium in a programming language. Before processing a given dataset, a set operation queue containing multiple operation functions is first created for the set dataset, and an execution method for the set operation queue is created. When processing of the set dataset is required, the execution method is called to sequentially and cumulatively execute the data transformation operations corresponding to each of the multiple operation functions on the set dataset to obtain the processing result. Since the operation functions in the set operation queue can be executed late until the execution method is called, the intermediate datasets generated each time an operation function is executed are not saved, thereby saving the memory occupied by the intermediate datasets and minimizing the impact of insufficient memory on the processing speed of the set dataset. Furthermore, sequentially and cumulatively executing the operation functions on the set dataset can improve execution efficiency, thereby improving the processing performance of the set dataset.

[0069] The preferred embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit this application. Furthermore, the embodiments and features in the embodiments of this application can be combined with each other without conflict.

[0070] like Figure 1 The diagram illustrates an application scenario according to an embodiment of this application. The application scenario diagram includes a terminal device 110 and a server 120. The terminal device 110 and the server 120 can communicate via a communication network. Optionally, the communication network can be a wired network or a wireless network.

[0071] In this embodiment, the terminal device 110 includes, but is not limited to, mobile phones, tablets, laptops, desktop computers, e-book readers, smart voice interaction devices, smart home appliances, and in-vehicle terminals. The server 120 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0072] It should be noted that the dataset processing method in the programming language in the various embodiments of this application can be executed by an electronic device, which can be a terminal device 110 or a server 120. That is, the method can be executed by a terminal device 110 or a server 120. The following uses JavaScript as an example to illustrate the specific scenarios in which the dataset processing method in the programming language of the embodiments of this application is applied.

[0073] In some application scenarios, a target application is installed on the terminal device 110. When a user interacts with the target application, such as clicking a button or switching pages, the terminal device 110 may need to obtain a dataset from the server 120. Then, it processes the dataset using JavaScript, performing some or all of the mapping, filtering, and sorting operations. Finally, the processed dataset is displayed on the page. For example, if the target application is a shopping website, when the shopping website needs to display a list of categorized products, it can process the product dataset from the server 120 using JavaScript. This dataset contains product information for each product (including name, category, price, and sales volume). First, it filters out in-stock products from the product dataset, obtaining a dataset of in-stock products. Then, it maps this dataset to a transformed dataset containing the product's name and price. Finally, based on this transformed dataset, the products are sorted by price and presented to the user.

[0074] In other application scenarios, server 120 can process datasets queried from the database using JavaScript. This includes performing some or all of the mapping, filtering, and sorting operations on the dataset, and then sending the processed dataset to terminal device 110 or storing it in the database. For example, if the dataset queried from the database contains a product sales dataset, JavaScript can first map the price and sales quantity of each product in the product dataset to the sales amount of each product, obtaining a transformed dataset. Then, products whose sales amount reaches a set threshold can be filtered out from this transformed dataset and returned to terminal device 110 or stored in the database.

[0075] In addition, server 120 can also process the dataset returned by the Application Programming Interface (API) call via JavaScript. For example, it can perform some or all of the operations such as mapping, filtering, and sorting on the dataset, and then send the processed dataset to terminal device 110 or store it in a database. For example, a weather forecast API may return a dataset containing weather information (including temperature, humidity, etc.) for multiple locations. JavaScript can be used to map this dataset into a transformed dataset containing the temperatures of multiple locations. Then, locations with temperatures reaching a set temperature can be filtered out from the transformed dataset. Finally, the filtered locations can be sorted according to temperature from high to low and returned to terminal device 110 or stored in a database.

[0076] In the above application scenarios, when the terminal device 110 or the server 120 performs multiple operations on the dataset, the dataset processing method in the programming language of this application embodiment can be adopted.

[0077] It should be noted that the dataset processing method in the programming language of this application embodiment can be applied to any application scenario in which a programming language is used for dataset processing, including but not limited to front-end data display, back-end data processing, etc.

[0078] It should be noted that, Figure 1 The examples shown are merely illustrative; in reality, the number of terminal devices and servers is unlimited and is not specifically limited in the embodiments of this application.

[0079] The following describes the dataset processing method in a programming language provided by the exemplary embodiments of this application, in conjunction with the application scenarios described above and with reference to the accompanying drawings. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principles of this application, and the embodiments of this application are not limited in any way in this respect.

[0080] See Figure 2 The diagram shown is an implementation flowchart of a dataset processing method in a programming language provided in this application embodiment. Taking a terminal device as the execution subject, the specific implementation flow of this method includes the following S21-S23:

[0081] S21. For a given dataset, create a defined operation queue containing multiple operation functions; where each operation function is used to perform a corresponding data transformation operation.

[0082] The dataset can be in the form of an array, and the specific data in the array can be determined according to the application scenario. Before performing multiple operations on the dataset sequentially, a queue of operations containing multiple operation functions can be created. Each operation function corresponds to an operation, such as a map operation, a filter operation, a sort operation, etc. This embodiment does not limit the operation type.

[0083] Multiple operation functions in the operation queue are scheduled to be executed with a delay until an execution result is explicitly requested. Then, the multiple operation functions in the operation queue are executed sequentially and cumulatively. The first operation function is used to perform data transformation operations on the specified dataset, the second operation function is used to perform data transformation operations on the dataset output by the first operation function, and so on.

[0084] Taking JavaScript as an example, the above-mentioned operation queue adopts the chained call method of JavaScript chained operation flow (i.e., JSCOF), that is, the execution result of each operation function in the operation queue can be called by subsequent operation functions.

[0085] In some embodiments, a target class can be created, and an initial operation queue corresponding to the set dataset can be created through the constructor of the target class. Then, multiple operation functions applied to the set dataset can be obtained sequentially. Each time an operation function is obtained, a new instance of the target class is created. This new instance represents the updated operation queue after the initial operation queue is created, including the operation functions obtained previously and the operation functions obtained this time. The last new instance of the target class is used as the set operation queue.

[0086] Specifically, assuming the target class is named JSCOF, the JSCOF class constructor accepts an array of operation functions as a parameter, which is an empty array by default, i.e., the initial operation queue.

[0087] After identifying the multiple operations applicable to the given dataset, each operation is encapsulated as an operation function. This means encapsulating the data processing logic of each operation within a separate function, making each operation function independent. For example, the `map` operation is encapsulated as the operation function `transformFunction`, and the `filter` operation as the operation function `predicateFunction`. Once each operation function is obtained, it is added to the initial operation queue. Specifically, the operation addition method of the target class can be called to add the operation function to the initial operation queue; for example, calling the `map` method adds the operation function `transformFunction`, and calling the `filter` method adds the operation function `predicateFunction`.

[0088] In this embodiment of the application, the multiple operation functions applied to the set dataset are executed in a deferred manner. Each time an operation function is added, a new instance of the target class is returned (which can be understood as a new object, i.e., the operation queue after the initial operation queue is updated). The new instance contains the operation functions added previously and the operation functions added this time, and the new instance is used to represent a new state of the initial operation queue after the operation function is added this time.

[0089] In this embodiment, a new instance of the target class is created for each added operation function, maintaining the immutability of the new instance. That is, the state of each new instance remains unchanged after creation, making state management and error finding for each new instance simpler and more intuitive. This ensures the immutability of the new instance corresponding to each operation function. Since the state of the original instance is not modified, when multiple operation functions are chained, the state of the new instance corresponding to each operation function (which can be understood as the execution result of that operation function) is independent and will not affect the state of the new instances corresponding to other operation functions. This helps avoid vulnerabilities caused by changes in the state of the original instance, and the state of the new instance for each operation function can be easily found. Because each operation function is independent, each operation function can be tested and debugged individually, making it easier to find problems and fix vulnerabilities.

[0090] In some optional implementations, when the first operation function is obtained, a new instance of the target class is created, containing the obtained operation function. For each subsequent operation function obtained, a new instance of the target class is created, containing the previously obtained operation function, and the operation addition method of the target class is called to add the obtained operation function to the newly created instance. Essentially, after each operation function is obtained, the previously created instance is copied, and the obtained operation function is added to the copied instance.

[0091] For example, suppose an initial operation queue is created using the JSCOF class, which is an empty array by default. Specifically, the JSCOF class constructor accepts an array of operation functions as a parameter, which is also an empty array by default, thus forming the initial operation queue. After determining the multiple operations to be applied to the given dataset (including map, filter, and sort operations), when adding the map operation function `transformFunction`, a new instance of the JSCOF class, `new JSCOF1`, is created, containing the `transformFunction`. Next, when adding the filter operation function `predicateFunction`, another new instance of the JSCOF class, `new JSCOF2`, is created, containing both the `transformFunction` and `predicateFunction`. Finally, when adding the sort operation function `sortFunction`, another new instance of the JSCOF class, `new JSCOF3`, is created, containing the `transformFunction`, `predicateFunction`, and `sortFunction`. This last newly created instance, `new JSCOF3`, is used as the set operation queue.

[0092] In practice, you can first define a target class (such as the JSCOF class) and define the process of creating a set operation queue containing multiple operation functions. Then, you can use the target class to create the set operation queue corresponding to the set dataset.

[0093] In the above embodiments of this application, after each operation function is obtained, a new instance of the target class created last time is copied, and the operation function obtained this time is added to the copied new instance, which can quickly create a new instance of each operation function.

[0094] In some alternative implementations, considering that among the multiple operations applied to a given dataset, there may be consecutive operations with the same operation type, such as two consecutive map operations or two consecutive filter operations, in order to reduce the number of times the given dataset is traversed, consecutive operations with the same operation type can be merged.

[0095] After adding the first operation function to the initial operation queue, for each operation function retrieved, a new instance of the target class is created (containing the previously retrieved operation functions), and the currently retrieved operation function is added to this new instance. The following operations can then be performed:

[0096] Determine whether the operation type of the operation function obtained this time is the same as that of the operation function obtained last time. If they are the same, then in the new instance, merge the operation function obtained this time with the operation function obtained last time to obtain the merged operation function.

[0097] The operation type can be map, filter, sort, etc., without any restrictions.

[0098] For example, such as Figure 3 As shown, assume that the operation type of the operation function obtained this time and the operation function obtained last time are both map operations, such as map operation function 1: map(x=>x+1) and map operation function 2: map(x=>x*2), where x represents each element in the set dataset. After merging these two map operation functions, the resulting merged operation function is map(x=>(x+1)*2). This merged operation function first executes the first map operation, and then applies the second map operation to the result of the first map operation. That is, it first adds 1 to each element in the set dataset, and then multiplies each element after adding 1 by 2.

[0099] like Figure 4 As shown, assuming that the operation function obtained this time and the operation function obtained last time are both filter operations, such as filter operation function 1: filter(x=>x>10) and filter operation function 2: filter(x=>x<20), after merging these two filter operation functions, the merged operation function is filter(x=10) <x>20), this merge operation function will perform two filter operations in sequence, that is, first filter out elements greater than 10 from the set data, and then filter out elements greater than 20.

[0100] In the above embodiments of the application, when adding an operation function to the initial operation queue, it can be judged whether the operation function to be added currently and the operation function added last time belong to the same operation type, and if so, the two operation functions are merged into a new operation function (i.e. a merged operation function). In this way, continuous operations of the same operation type (such as continuous map operations or continuous filter operations) can be merged, so that multiple operations can be completed by traversing the set data set once, reducing the traversal times of the set data set and improving the processing efficiency of the set data set.

[0101] S22, create an execution method of the set operation queue, the execution method is used to call the multiple operation functions in the set operation queue in sequence.

[0102] In the embodiments of the application, the multiple operation functions in the set operation queue are executed in sequence, and when the execution method is called, the multiple operation functions are executed in sequence, for example, the execution method can be an evaluate method or a value method in JavaScript, and the evaluate method or the value method can trigger the multiple operation functions in the set operation queue to be executed in sequence.

[0103] For example, in JavaScript, after creating a set operation queue containing multiple operation functions by defining a JSCOF class, an evaluate method or a value method is added to the JSCOF class to trigger the multiple operation functions in the set operation queue to be executed in sequence, and the multiple operation functions will not be executed before the evaluate method or the value method is called. Specifically, the evaluate method can trigger all operation functions in the set operation queue to be executed in sequence, and the evaluate method can obtain a target function that accepts a set data set, such as lazyEvaluation(initialData), where initialData represents the set data set. The target function is a delayed execution function, that is, the call of the target function is delayed until the set data set actually needs to be processed, and the target function is called to accept the set data set and execute all operation functions in the set operation queue in sequence. In addition, the value method is a convenience method that directly calls the target function returned by the evaluate method and immediately executes all operation functions in the set operation queue in sequence.

[0104] S23. When processing a set dataset, the execution method is called. For the set dataset, the data transformation operations corresponding to multiple operation functions in the set operation queue are executed sequentially to obtain the processing result.

[0105] In some optional implementations, the programming language is JavaScript. When creating the execution method for the set operation queue, a specific `evaluate` method can be created for the set operation queue. The `evaluate` method obtains the target function, which is used to sequentially call multiple operation functions in the set operation queue. When processing the set dataset, the target function obtained by the `evaluate` method is called to execute the target function.

[0106] In some alternative implementations, the programming language is JavaScript, and an `evaluate` method and a `value` method are created to define an operation queue. The `value` method is used to call the target function obtained by the `evaluate` method. When the defined dataset is processed, the `value` method is called, and the target function obtained by the `evaluate` method is executed immediately.

[0107] In this embodiment, when processing a given dataset is required, on one hand, the `evaluate` method is called to obtain the target function and execute it, thereby sequentially and cumulatively executing multiple operation functions in the defined operation queue for the given dataset, thus achieving delayed execution of the defined operation queue. On the other hand, the `value` method can be called to directly execute the target function obtained by the `evaluate` method, thereby sequentially calling multiple operation functions in the defined operation queue and obtaining the processing result. This embodiment provides multiple triggering methods for the defined operation queue.

[0108] In some embodiments, when performing the data transformation operations corresponding to multiple operation functions in the set operation queue sequentially for a set dataset in S23, the first operation function in the set operation queue can be used to perform a data transformation operation on the set dataset to obtain a transformed dataset. Then, the second operation function can be used to perform a data transformation operation on the transformed dataset to obtain another transformed dataset, and so on, until the last operation function is executed and the processing result is obtained.

[0109] For example, such as Figure 5 As shown, assuming the dataset is set to [1, 2, 3, 4, 5], and the operation queue is set to [map operation function, filter operation function], where the map operation function is map(x=>x*2) and the filter operation function is filter(x=>x>6), then the above two operation functions are executed sequentially and cumulatively on the set dataset. That is, each element in the set dataset is first multiplied by 2 to obtain the transformed dataset, and then elements greater than 6 are filtered out from the transformed dataset, resulting in the processed result [8, 10]. In the above process, it is not necessary to save the transformed dataset, i.e., the intermediate dataset.

[0110] In other embodiments, when each operation function in the set operation queue can perform an independent data transformation operation for each element, for example, each operation function is used to perform operations such as mapping and filtering, in the above S23, when the data transformation operations corresponding to the multiple operation functions in the set operation queue are executed sequentially and cumulatively for the set dataset, the multiple elements in the set dataset can be traversed sequentially. For each element traversed, the data transformation operations corresponding to the multiple operation functions in the set operation queue are executed sequentially and cumulatively for each element to obtain a new element; the dataset composed of the multiple new elements obtained is used as the processing result.

[0111] For example, such as Figure 6 As shown, also Figure 5 Taking the set dataset and set operation queue as an example, for the first element 1 in the set dataset, first multiply 1 by 2, and then check if the result (i.e., 2) is greater than 6. Since it is less than 6, the output is empty. For the second element 2, first multiply 2 by 2, and then check if the result (i.e., 4) is greater than 6. Since it is less than 6, the output is empty. For the third element 3, first multiply 3 by 2, and then check if the result (i.e., 6) is greater than 6. Since it is equal to 6, the output is empty. For the fourth element 4, first multiply 4 by 2, and then check if the result (i.e., 8) is greater than 6. Since it is greater than 6, the result is output. For the fifth element 5, first multiply 5 by 2, and then check if the result (i.e., 10) is greater than 6. Since it is greater than 6, the result is output, and the processing result [8, 10] is obtained.

[0112] In this embodiment of the application, for each element in the set dataset, the data transformation operations corresponding to multiple operation functions in the set operation queue can be executed sequentially and cumulatively. In this way, multiple operation functions can be executed once the elements are traversed, reducing the number of traversals for each element and further improving the processing efficiency of the set dataset.

[0113] This application embodiment creates a set operation queue, in which each operation function can be executed late until the execution method is called. Then, the set dataset is executed sequentially and cumulatively to obtain the processing result. In this way, it can avoid saving the intermediate dataset generated when each operation function is executed, saving the memory occupied by the intermediate dataset and minimizing the impact of insufficient memory on the processing speed of the set dataset. Furthermore, the sequential and cumulative execution of each operation function on the set dataset can improve execution efficiency and thus improve the processing performance of the set dataset.

[0114] In some embodiments, during the process of sequentially and cumulatively executing the data transformation operations corresponding to multiple operation functions in the set operation queue for a given dataset in S23 above, multiple operation functions can be executed completely, or the operation can be terminated early according to the actual situation. Specifically, the following steps A1-A2 can be executed:

[0115] A1. Iterate through multiple operation functions in the set operation queue in a set order. For each operation function, perform the corresponding data transformation operation on the current dataset and output the transformed dataset. The current dataset is the set dataset or the transformed dataset output during the last iteration of the operation function.

[0116] A2. When the latest obtained transformation dataset meets the set conditions, the latest obtained transformation dataset will be used as the processing result.

[0117] The conditions can be set as needed. The following describes several possible scenarios for setting conditions.

[0118] In this embodiment of the application, for all elements in a set dataset, the data transformation operations of multiple operation functions in a set operation queue are executed sequentially and cumulatively, which can improve the processing efficiency of the set dataset and thus improve the processing performance of the set dataset.

[0119] In some optional implementations, step A2 above, where the newly obtained transformed dataset meets the set conditions, uses the newly obtained transformed dataset as the processing result, which may include any of the following cases:

[0120] In the first case, when the latest obtained transformation dataset is the transformation dataset output by the last operation function in the set operation queue, the latest obtained transformation dataset is used as the processing result.

[0121] In this case, all operation functions in the set operation queue are executed sequentially to obtain the processing result.

[0122] In the second scenario, when the latest obtained transformed dataset is empty, the latest obtained transformed dataset is used as the processing result.

[0123] In this case, before executing the last operation function, the latest obtained transformation dataset may be an empty dataset. No subsequent operation will change this result. In this case, there is no need to continue executing the next operation function, but the operation is terminated in advance.

[0124] For example, such as Figure 7 As shown, assuming the dataset is set to [1, 2, 3, 4, 5], and the operation queue is set to [map operation function 1, filter operation function, map operation function 2], where map operation function 1 is map(x=>x*2), filter operation function is filter(x=>x>10), and map operation function 2 is map(x=>x+1), then after executing map operation function 1 and filter operation function sequentially on the set dataset, an empty dataset is obtained. At this time, the empty dataset is used as the processing result, and it is not necessary to continue executing map operation function 2.

[0125] In the third case, when the newly obtained transformed dataset contains the specified elements, the newly obtained transformed dataset is used as the processing result.

[0126] The set element can be a set value (one or more values), an element greater than or less than the set value, or an element within the set value range. Before executing the last operation function, the resulting transformed dataset may contain the set value. In this case, it is not necessary to continue executing the next operation function; instead, the operation is terminated prematurely.

[0127] For example, such as Figure 8 As shown, taking the set element as the set value 100 as an example, assuming the set dataset is [10, 20, 30, 40, 50], multiple operation functions in the set operation queue are executed on this set dataset. When the resulting transformed dataset contains the set value 100, the operation can be terminated early. The set operation queue is [filter operation function 1, map operation function, filter operation function 2], where filter operation function 1 is filter(x=>x>20), map operation function is map(x=>x*2), and filter operation function 2 is filter(x=>x>50). After executing the filter operation function and map operation function sequentially on the set dataset, the transformed dataset [60, 80, 100] is obtained. At this time, the transformed dataset contains the set value 100. Therefore, the transformed dataset is used as the processing result, and there is no need to continue executing the sort operation function.

[0128] In the fourth case, when the number of elements in the latest obtained transformed dataset is not greater than the set number, the latest obtained transformed dataset is used as the processing result.

[0129] In some application scenarios, it may be required that the number of elements in the output processing result is no greater than (i.e., equal to or less than) a set number. The set number can be set as needed and is not limited.

[0130] For example, taking a set quantity of 5 as an example, suppose the set dataset is [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]. Multiple operation functions in a set operation queue are executed on this set dataset. The set operation queue is [map operation function 1, filter operation function, map operation function 2]. Map operation function 2 is map(x=>x*2), filter operation function is filter(x=>x>10), and map operation function 2 is map(x=>x+1). After sequentially executing map operation function 1 and filter operation function on the set dataset, the transformed dataset is obtained as [12, 14, 16, 18, 20]. At this point, the number of elements in the transformed dataset is no greater than 5. Therefore, this transformed dataset is used as the processing result, and it is not necessary to continue executing map operation function 2.

[0131] In this embodiment, during the sequential execution of all operation functions in the defined operation queue for a given dataset, on the one hand, when the latest obtained transformed dataset is the transformed dataset output by the last operation function, it is considered to meet the defined conditions; on the other hand, the transformed dataset obtained before executing the last operation function may also meet the defined conditions, for example, the defined conditions may be an empty dataset or contain defined elements, etc. In this case, there is no need to continue executing the next operation function, and the operation can be terminated early, with the transformed dataset that meets the defined conditions being used as the processing result. This reduces unnecessary data traversal and computation, allowing for more efficient processing of the defined dataset.

[0132] For the second to fourth cases mentioned above, when creating the execution method for setting the operation queue in S22, the above-mentioned setting conditions can be defined in the execution method.

[0133] In some optional implementations, the programming language is JavaScript. When creating the execution method for setting the operation queue, a `evaluate` method for setting the operation queue can be specifically created. The `evaluate` method obtains the target function, which is used to call multiple operation functions in the set operation queue in sequence. When calling the target operation function among multiple operation functions, if the transformed dataset output by the target operation function meets the set conditions, the calling stops.

[0134] Furthermore, when processing the set dataset, the target function obtained by the evaluate method is called to execute the target function, that is, multiple operation functions in the set operation queue are called in sequence. If the obtained transformed dataset meets the set conditions during the process of calling multiple operation functions, the calling stops.

[0135] The conditions for setting the conditions are described in the second to fourth cases of the above embodiments of this application.

[0136] For example, in JavaScript, after creating a queue of operations containing multiple operation functions, calling the `evaluate` or `value` method triggers the sequential execution of the multiple operation functions in the queue. For instance, if the above-mentioned condition is an empty dataset, the `evaluate` method can be configured to terminate the operation early if the obtained dataset is empty or has a length of 0 during the sequential calling of multiple operation functions in the queue.

[0137] Optionally, when creating the evaluate method for setting up the operation queue, you can specifically create an evaluate method and a value method for setting up the operation queue. The value method is used to call the target function obtained by the evaluate method. Furthermore, when processing the set dataset, you can call the value method to execute the target function obtained by the evaluate method, so as to immediately execute multiple operation functions in the set operation queue in sequence.

[0138] In this embodiment, the `evaluate` method iterates through multiple operation functions in the set operation queue and applies them one by one. If the transformed dataset obtained at any time meets the set conditions, the iteration terminates. Specifically, if the latest obtained transformed dataset meets the set conditions before executing the last operation function, the next operation function is not executed; instead, the operation terminates early. This approach significantly improves the performance when processing set datasets, especially when the number of operation functions in the set operation queue is large. It reduces unnecessary data traversal and computation, thus processing the set dataset more efficiently.

[0139] In addition, the value method provides a convenient way to directly execute multiple operation functions in a set operation queue and obtain the processing results.

[0140] The following describes, with specific examples, the dataset processing method in the programming language of this application embodiment.

[0141] For example, such as Figure 9 As shown, in an e-commerce platform (such as a video account store), the e-commerce platform's client sends a product data retrieval request to the backend server. This request is used to retrieve products with sales exceeding 300, and to sort these products in descending order of price. Upon receiving the product data retrieval request, the backend server retrieves the product dataset from the database and processes the product dataset (i.e., the set dataset in this embodiment) using the dataset processing method in the programming language of this application. For example, it performs filtering, sorting, and mapping operations on the product dataset to facilitate client display. A specific example is given below.

[0142] Suppose the product dataset contains information on all products in the e-commerce platform's video store, including fields such as product ID, name, price, sales volume, and category. Suppose we need to filter out products with sales exceeding a threshold of 300, sort them in descending order by price, and finally output a formatted summary of the product information. The specific implementation is as follows:

[0143] For example, a product dataset can be represented as follows:

[0144] const products = [

[0145] {id:1,name:'Smartwatch',price:1299,sales:200,category:'Electronic Products'},

[0146] {id:2,name:'Wireless Headphones',price:399,sales:500,category:'Electronic Products'},

[0147] {id:3,name:'Sports Shoes',price:499,sales:300,category:'Sports Equipment'}

[0148] {id:4,name:'T-shirt',price:99,sales:1000,category:'clothing'},...]

[0149] First, create a set of operations for the above product dataset, represented as [filter operation function, sort operation function, map operation function]. The filter operation function is filter(product=>product.sales>300), the sort operation function is sort((a,b)=>b.price-a.price), and the map operation function is map(product=>({name:product.name, price:product.price, sales:product.sales, category:product.category). First, use the filter method to filter out products with sales exceeding 300. Then, use the sort method to sort the products in descending order of price. Finally, use the map method to format and output a brief information about each product, including product name, price, sales, and category.

[0150] The final output is:

[0151] [{name:'T-shirt',price:99,sales:1000,category:'clothing'},{name:'wireless headphones',price:399,sales:500,category:'electronics'},{name:'sneakers',price:499,sales:300,category:'sports equipment'},...].

[0152] The dataset processing method of the programming language in this application has the following advantages:

[0153] Deferred execution (i.e., lazy evaluation): Multiple operation functions in the setup operation queue are not executed immediately, but only when the execution results of the setup dataset are needed. This avoids unnecessary calculations and eliminates the need to save intermediate datasets during the execution of multiple operation functions, significantly reducing memory usage and improving the execution efficiency of the setup dataset.

[0154] Performance optimization: By merging consecutive operation functions of the same type (such as consecutive map operation functions or consecutive filter operation functions), the number of times the set dataset is traversed is reduced, thereby improving the processing performance of the set dataset.

[0155] Maintainability: Encapsulating the data processing logic of each operation in a separate operation function helps maintain and update the code, because each operation function is independent.

[0156] Scalability: More operation functions can be easily added to the operation queue, making the operation queue more powerful and flexible.

[0157] Functional programming style: Using pure functions that do not modify the original data is one of the core principles of functional programming, which helps to avoid side effects and state management problems.

[0158] Debugging and testing: Since each operation function is independent, each operation function can be tested and debugged individually, which makes it easier to find problems and fix vulnerabilities.

[0159] Reusability: The created operation queue can be saved and reused, which means that the same processing flow can be applied to different datasets, improving code reusability.

[0160] Integrated optimization strategy: Optimization strategies can be customized based on specific application scenarios and dataset characteristics. For example, when executing multiple operation functions in a set operation queue on a set dataset, if the obtained dataset meets the set conditions, the operation can be terminated in advance to avoid unnecessary operations.

[0161] Based on the same inventive concept, this application also provides a dataset processing device in a programming language. The principle of this device in solving the problem is similar to the method in the above embodiments. Therefore, the implementation of this device can refer to the implementation of the above method, and repeated details will not be described again.

[0162] like Figure 10 The diagram shown is a structural schematic of a dataset processing device in a programming language, which may include:

[0163] The first creation unit 1001 is used to create a defined operation queue containing multiple operation functions for a defined dataset; wherein each operation function is used to perform a corresponding data transformation operation;

[0164] The second creation unit 1002 is used to create an execution method for setting an operation queue. The execution method is used to call multiple operation functions in the setting operation queue in sequence.

[0165] The processing unit 1003 is used to call the execution method when processing a set dataset, and sequentially execute the data transformation operations corresponding to multiple operation functions in the set operation queue to obtain the processing result.

[0166] This application embodiment creates a set operation queue, in which each operation function can be executed late until the execution method is called. Then, the set dataset is executed sequentially and cumulatively to obtain the processing result. In this way, it can avoid saving the intermediate dataset generated when each operation function is executed, saving the memory occupied by the intermediate dataset and minimizing the impact of insufficient memory on the processing speed of the set dataset. Furthermore, the sequential and cumulative execution of each operation function on the set dataset can improve execution efficiency and thus improve the processing performance of the set dataset.

[0167] In some optional implementations, the first creation unit 1001 is specifically used for:

[0168] Create a target class, and create the initial operation queue corresponding to the specified dataset through the constructor of the target class;

[0169] Multiple operation functions applied to a given dataset are retrieved sequentially. For each operation function retrieved, a new instance of the target class is created. This new instance represents the updated operation queue after the initial operation queue is retrieved, and includes the operation functions retrieved previously and the operation functions retrieved this time.

[0170] Use a newly created instance of the target class as the set operation queue.

[0171] In some optional implementations, when a new instance of the target class is created each time an operation function is obtained, the first creation unit 1001 is specifically used for:

[0172] When the first operation function is obtained, a new instance of the target class is created, and the new instance contains the operation function obtained in this instance.

[0173] For each operation function obtained after the first one, a new instance containing the previously obtained operation functions is created for the target class. The operation addition method of the target class is then called to add the obtained operation function to the newly created instance of the target class.

[0174] In some alternative implementations, such as Figure 11 As shown, the device also includes a merging unit 1004, used for:

[0175] Determine whether the operation type of the operation function obtained this time is the same as that of the operation function obtained last time;

[0176] If they are the same, then in a new instance of the target class created this time, the operation function obtained this time will be merged with the operation function obtained last time to obtain a merged operation function.

[0177] In some alternative implementations, the processing unit 1003 is specifically used for:

[0178] The system iterates through multiple operation functions in the set operation queue in a set order. Each time an operation function is traversed, it performs a corresponding data transformation operation on the current dataset and outputs the transformed dataset. The current dataset is either the set dataset or the transformed dataset output during the last iteration of the operation function.

[0179] When the newly obtained transformed dataset meets the set conditions, the newly obtained transformed dataset is used as the processing result.

[0180] In some optional implementations, when the newly obtained transformed dataset meets the set conditions and is used as the processing result, the processing unit 1003 is specifically used to perform any of the following operations:

[0181] When the latest obtained transformation dataset is the transformation dataset output by the last operation function in the set operation queue, the latest obtained transformation dataset is used as the processing result;

[0182] When the latest obtained transformation dataset is an empty dataset, the latest obtained transformation dataset will be used as the processing result;

[0183] When the latest obtained transformation dataset contains the specified elements, the latest obtained transformation dataset will be used as the processing result;

[0184] If the number of elements in the latest transformed dataset is not greater than the set number, the latest transformed dataset will be used as the processing result.

[0185] In some alternative implementations, the processing unit 1003 is specifically used for:

[0186] The system iterates through multiple elements in a given dataset. For each element, it executes the corresponding data transformation operations of multiple operation functions in a given operation queue in sequence to obtain a new element.

[0187] The dataset consisting of multiple new elements obtained is used as the processing result.

[0188] In some optional implementations, the second creation unit 1002 is specifically used for:

[0189] Create an `evaluate` method to define an operation queue. The `evaluate` method retrieves the target function, which is used to sequentially call multiple operation functions in the defined operation queue.

[0190] The processing unit 1003 is specifically used for:

[0191] When processing a given dataset, the target function obtained by the evaluate method is called to execute the target function.

[0192] In some optional implementations, when creating the `evaluate` method to set the operation queue, the second creation unit 1002 is specifically used for:

[0193] Create and define the `evaluate` and `value` methods for the operation queue. The `value` method is used to call the target function obtained by the `evaluate` method.

[0194] Processing unit 1003 is specifically used for:

[0195] When processing the given dataset, the `value` method is called, which executes the target function obtained by the `evaluate` method.

[0196] For ease of description, the above sections are divided into modules (or units) according to their functions and described separately. Of course, in implementing this application, the functions of each module (or unit) can be implemented in one or more software or hardware components.

[0197] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.

[0198] Having introduced the dataset processing method and apparatus in a programming language according to exemplary embodiments of this application, we will now introduce an electronic device according to another exemplary embodiment of this application.

[0199] Based on the same inventive concept as the above-described method embodiments, this application also provides an electronic device. In one embodiment, the electronic device may be a server, such as... Figure 1 The server 120 is shown. In this embodiment, the structure of the electronic device can be as follows: Figure 12 As shown, it includes a memory 1201, a communication module 1203, and one or more processors 1202.

[0200] The memory 1201 is used to store computer programs executed by the processor 1202. The memory 1201 may mainly include a program storage area and a data storage area. The program storage area may store the operating system and programs required to run instant messaging functions, etc.; the data storage area may store various instant messaging information and operation instruction sets, etc.

[0201] Memory 1201 may be volatile memory, such as random-access memory (RAM); memory 1201 may also be non-volatile memory, such as read-only memory, flash memory, hard disk drive (HDD), or solid-state drive (SSD); or memory 1201 may be any other medium capable of carrying or storing a desired computer program having the form of instructions or data structures and accessible by a computer, but is not limited thereto. Memory 1201 may be a combination of the above-described memories.

[0202] Processor 1202 may include one or more central processing units (CPUs) or digital processing units, etc. Processor 1202 is used to implement the dataset processing method in the above-mentioned programming language when calling the computer program stored in memory 1201.

[0203] The communication module 1203 is used to communicate with terminal devices and other servers.

[0204] This application embodiment does not limit the specific connection medium between the memory 1201, communication module 1203, and processor 1202. This application embodiment... Figure 12 The memory 1201 and the processor 1202 are connected via a bus 1204, and the bus 1204 is in Figure 12 The diagram uses thick lines to describe the connections between other components; these are for illustrative purposes only and should not be considered limiting. The 1204 bus can be divided into address bus, data bus, control bus, etc. For ease of description, Figure 12 It is described using only a thick line, but does not indicate that there is only one bus or one type of bus.

[0205] In another embodiment, the electronic device may also be other electronic devices, such as... Figure 1 The terminal device 110 is shown. In this embodiment, the electronic device can be structured as follows: Figure 13 As shown, it includes components such as: communication component 1310, memory 1320, display unit 1330, camera 1340, sensor 1350, audio circuit 1360, Bluetooth module 1370, processor 1380, etc.

[0206] The communication component 1310 is used to communicate with the server. In some embodiments, it may include a Circuit-Wireless Fidelity (WiFi) module, which is a short-range wireless transmission technology. Electronic devices can use the WiFi module to help users send and receive information.

[0207] The memory 1320 can be used to store software programs and data. The processor 1380 executes various functions of the terminal device 130 and performs data processing by running the software programs or data stored in the memory 1320. The memory 1320 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. The memory 1320 stores an operating system that enables the terminal device 130 to run. In this application, the memory 1320 may store the operating system and various application programs, and may also store computer programs that execute the dataset processing methods in the programming language of the embodiments of this application.

[0208] The display unit 1330 can also be used to display information input by the user or information provided to the user, as well as a graphical user interface (GUI) for various menus of the terminal device 130. Specifically, the display unit 1330 may include a display screen 1332 disposed on the front of the terminal device 130. The display screen 1332 may be configured as a liquid crystal display, a light-emitting diode, or the like. The display unit 1330 can be used to display the processing results of the set dataset in the embodiments of this application.

[0209] The display unit 1330 can also be used to receive input digital or character information and generate signal inputs related to user settings and function control of the terminal device 130. Specifically, the display unit 1330 may include a touch screen 1331 disposed on the front of the terminal device 130, which can collect touch operations of the user on or near it, such as clicking buttons, dragging scroll boxes, etc.

[0210] The touchscreen 1331 can be placed on top of the display screen 1332, or the touchscreen 1331 and the display screen 1332 can be integrated to realize the input and output functions of the terminal device 130. After integration, it can be referred to as a touch display screen. In this application, the display unit 1330 can display the application and the corresponding operation steps.

[0211] Camera 1340 can be used to capture still images, which users can then share via an application. There can be one or multiple cameras 1340. An object is projected onto a photosensitive element through a lens, generating an optical image. This photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then transmitted to the processor 1380 for conversion into a digital image signal.

[0212] The terminal device may also include at least one sensor 1350, such as an accelerometer 1351, a proximity sensor 1352, a fingerprint sensor 1353, and a temperature sensor 1354. The terminal device may also be equipped with other sensors such as a gyroscope, barometer, hygrometer, thermometer, infrared sensor, light sensor, and motion sensor.

[0213] Audio circuitry 1360, speaker 1361, and microphone 1362 provide an audio interface between the user and terminal device 130. Audio circuitry 1360 converts received audio data into electrical signals, which are then transmitted to speaker 1361, where they are converted into sound signals for output. Terminal device 130 may also be equipped with volume buttons for adjusting the volume of the sound signal. Conversely, microphone 1362 converts collected sound signals into electrical signals, which are then received by audio circuitry 1360, converted back into audio data, and output to communication component 1310 for transmission to, for example, another terminal device 130, or to memory 1320 for further processing.

[0214] The Bluetooth module 1370 is used to interact with other Bluetooth devices that also have a Bluetooth module via the Bluetooth protocol. For example, a terminal device can establish a Bluetooth connection with a wearable electronic device (such as a smartwatch) that also has a Bluetooth module through the Bluetooth module 1370, thereby exchanging data.

[0215] The processor 1380 is the control center of the terminal device, connecting various parts of the terminal through various interfaces and lines. It executes various functions and processes data by running or executing software programs stored in the memory 1320 and calling data stored in the memory 1320. In some embodiments, the processor 1380 may include one or more processing units; the processor 1380 may also integrate an application processor and a baseband processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the baseband processor mainly handles wireless communication. It is understood that the baseband processor may not be integrated into the processor 1380. In this application, the processor 1380 can run the operating system, applications, user interface display and touch response, and the dataset processing method in the programming language of this application embodiment. Furthermore, the processor 1380 is coupled to the display unit 1330.

[0216] In some possible implementations, embodiments of this application provide a computer-readable storage medium including a computer program. When the computer program is run on an electronic device, it causes the electronic device to perform the steps of a dataset processing method in a programming language according to embodiments of this application, such as... Figure 2 As shown.

[0217] In some possible implementations, embodiments of this application provide a computer program product, which includes a computer program stored in a computer-readable storage medium. When the processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, causing the electronic device to perform the steps of the dataset processing method in any of the above-described programming languages. For example, the electronic device can perform... Figure 2 The steps are shown in the figure.

[0218] Computer program products may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0219] The computer program product of the embodiments of this application may employ a portable compact disc read-only memory (CD-ROM) and include a computer program, and may run on an electronic device. However, the program product of this application is not limited thereto. In this document, the readable storage medium may be any tangible medium that contains or stores a program that may be used by or in conjunction with a command execution system, apparatus, or device.

[0220] A readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying a readable computer program. This propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting a program for use by or in conjunction with a command execution system, apparatus, or device.

[0221] Computer programs contained on readable media may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0222] Computer programs for performing the operations of this application can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The computer program can execute entirely on the user's electronic device, partially on the user's electronic device, as a standalone software package, partially on the user's electronic device and partially on a remote electronic device, or entirely on a remote electronic device or server. In cases involving remote electronic devices, the remote electronic device can be connected to the user's electronic device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external electronic device (e.g., via the Internet using an Internet service provider).

[0223] It should be noted that although several units or sub-units of the device have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of this application, the features and functions of two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided and embodied by multiple units.

[0224] Furthermore, although the operations of the method of this application are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.

[0225] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing a computer-usable computer program.

[0226] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, produce a machine for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0227] These computer program commands may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the commands stored in the computer-readable storage medium produce an article of manufacture including command means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0228] These computer program commands can also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing the commands executed on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0229] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.

[0230] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.< / x>

Claims

1. A method of processing a data set in a programming language, characterized by, The method comprises: creating a set operation queue comprising a plurality of operation functions for a set data set, wherein each operation function is used to perform a corresponding data conversion operation; creating an execution method of the set operation queue, the execution method being used to sequentially call the plurality of operation functions in the set operation queue; when processing the set data set, calling the execution method, sequentially accumulating the execution of the data conversion operation corresponding to each of the plurality of operation functions in the set operation queue for the set data set, and obtaining a processing result.

2. The method of claim 1, wherein, The method comprises: creating a target class, and creating an initial operation queue corresponding to the set data set through a constructor of the target class; sequentially obtaining the plurality of operation functions applied to the set data set, wherein each time an operation function is obtained, a new instance of the target class is created, the new instance representing an updated operation queue of the initial operation queue, comprising the operation function obtained before this time and the operation function obtained this time; the last created new instance of the target class is taken as the set operation queue.

3. The method of claim 2, wherein, The method comprises: when the first operation function is obtained, a new instance of the target class is created, the new instance comprising the operation function obtained this time; each time an operation function is obtained after the first operation function, a new instance of the target class is created, comprising the operation function obtained before this time, and an operation adding method of the target class is called to add the operation function obtained this time to the new instance of the target class created this time.

4. The method of claim 3, wherein, The method further comprises: judging whether the operation type of the operation function obtained this time is the same as that of the operation function obtained last time; if the operation types are the same, the operation function obtained this time and the operation function obtained last time are merged to obtain a merged operation function in the new instance of the target class created this time.

5. The method according to any one of claims 1 to 4, characterized in that, The method comprises: sequentially traversing the plurality of operation functions in the set operation queue in a set order, each time an operation function is traversed, a corresponding data conversion operation is performed on a current data set using the operation function, and a converted data set is output; wherein the current data set is the set data set or the converted data set output when the operation function was last traversed; when the latest obtained converted data set meets a set condition, the latest obtained converted data set is taken as the processing result.

6. The method of claim 5, wherein, The method comprises: any one of the following operations is performed when the latest obtained converted data set meets a set condition, and the latest obtained converted data set is taken as the processing result. when the newly obtained conversion dataset is a conversion dataset output by a last operation function in the set operation queue, taking the newly obtained conversion dataset as the processing result; when the newly obtained conversion dataset is an empty dataset, taking the newly obtained conversion dataset as the processing result; when the newly obtained conversion dataset contains a set element, taking the newly obtained conversion dataset as the processing result; when the number of elements in the newly obtained conversion dataset is not greater than a set number, taking the newly obtained conversion dataset as the processing result.

7. The method according to any one of claims 1 to 4, characterized in that, The method further includes: iterating through the elements in the set dataset one by one, wherein for each element, data conversion operations corresponding to the operation functions in the set operation queue are sequentially accumulated and executed to obtain a new element; a dataset composed of the obtained new elements is taken as the processing result.

8. The method according to any one of claims 1 to 4, characterized in that, The method further includes: creating an evaluate method of the set operation queue, and obtaining a target function through the evaluate method, wherein the target function is used to sequentially call the operation functions in the set operation queue. When the set dataset is processed, the target function obtained through the evaluate method is called to execute the target function. The method further includes:

9. The method of claim 8, wherein, creating the evaluate method and a value method of the set operation queue, wherein the value method is used to call the target function obtained through the evaluate method. When the set dataset is processed, the value method is called to execute the target function obtained through the evaluate method. The apparatus includes: a first creating unit configured to create, for a set dataset, a set operation queue containing a plurality of operation functions, wherein each operation function is used to execute a corresponding data conversion operation; 10. A data set processing apparatus in a programming language, characterized by comprising: a second creating unit configured to create an execution method of the set operation queue, wherein the execution method is used to sequentially call the operation functions in the set operation queue; a processing unit configured to, when the set dataset is processed, call the execution method, sequentially accumulate and execute data conversion operations corresponding to the operation functions in the set operation queue for the set dataset, and obtain a processing result. The first creating unit is specifically configured to: create a target class, and create an initial operation queue corresponding to the set dataset through a constructor of the target class; 11. The apparatus of claim 10, wherein, ​ ​ sequentially acquiring the plurality of operation functions applied to the set data set, wherein each time an operation function is acquired, a new instance of the target class is created, the new instance representing an updated operation queue of the initial operation queue and containing the operation functions acquired before this time and the operation function acquired this time; taking the last created new instance of the target class as the set operation queue.

12. The apparatus of claim 11, wherein, When the first created unit creates a new instance of the target class each time an operation function is acquired, the first created unit is specifically configured to: when the first operation function is acquired, a new instance of the target class is created, the new instance containing the operation function acquired this time; each time an operation function is acquired after the first operation function, a new instance of the target class containing the operation function acquired before this time is created, and an operation adding method of the target class is called to add the operation function acquired this time to the new instance of the target class created this time.

13. An electronic device, comprising: The electronic device comprises a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the method in any one of claims 1-9.

14. A computer-readable storage medium, characterized in that, The electronic device comprises a computer program, and when the computer program is executed on the electronic device, the computer program is used to make the electronic device execute the steps of the method in any one of claims 1-9.

15. A computer program product, characterised in that, The electronic device comprises a computer program, and when the computer program is executed on the electronic device, the computer program is used to make the electronic device execute the steps of the method in any one of claims 1-9.