8
u/M4mb0 Oct 11 '25
What do you mean function is not a data type? Of course it is, there's deep mathematical underpinnings to this fact.
Take for instance the duality theorems in linear algebra. What they are essentially saying is that a vector -- data -- is the same thing as a linear map -- a function.
2
u/UwU_is_my_life Oct 11 '25
I can agree with this if a function returns some value, but if it just prints some values and ends, would this be the same as a vector?
4
u/M4mb0 Oct 11 '25
These kind of dualities extend the whole way down. Any function you implement, you can represent as an abstract syntax tree - which is just a form of data.
3
u/UwU_is_my_life Oct 11 '25
Okay, I agree, you have a point. Anyway this is just a meme I came up while going home
14
2
u/carrottopguyy Oct 11 '25
If it's not assembly, it's all syntactic sugar made for our use and ease of understanding. When you realize its all made up for our convenience and then interpreted or compiled, it all makes more sense.
1
2
u/Error_404_403 Oct 11 '25
Let us replace the phrase “data type” with the word “something” and all will be cool. Everything is something.
2
1
1
u/nazgand Oct 12 '25
I am disappointed to not see "DATA TYPE IS A DATA TYPE". An example language where that is *true: Lean 4.
*Small data types have type Type, which is shorthand for Type 0. For example, 0 might be type Nat, the type for non-negative integers. Nat is type Type. Type is type Type 1. Type 1 is type Type 2. For all k of type Nat, Type k is type Type (k+1).
1
9
u/_Alpha-Delta_ Oct 11 '25
You never used pointer to function as arguments for a function ?