Skip to content

Implementation of Map Function(s) in C - #49

Open
oduvall wants to merge 2 commits into
OregonStateUniversity:mainfrom
oduvall:feature
Open

Implementation of Map Function(s) in C#49
oduvall wants to merge 2 commits into
OregonStateUniversity:mainfrom
oduvall:feature

Conversation

@oduvall

@oduvall oduvall commented Nov 30, 2023

Copy link
Copy Markdown

Since C does not (at least easily) allow a way to pass arguments of an arbitrary type to a function, I decided that the simplest course of action was to split the map function into three separate map functions, each corresponding to a different type. Each function is identical in implementation, and only differs in the type of data it is able to manipulate. Each map function takes a function, applies it to each element of an array of input data, and then stores the results in an output array that is big enough to hold each result. A unit test for these functions is also included. This unit test maps some basic functions to some randomly generated data held in arrays of varying sizes, and compares the results with the correct outcome to ensure that each value was computed correctly.

… allow for functions to take arguments of arbitrary type, I decided the simplest course of action was to implement separate map functions for int, char, and float data types.
… allow for functions to take arguments of arbitrary type, I decided the simplest course of action was to implement separate map functions for int, char, and float data types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant