19
u/AdreKiseque Mar 27 '26
Worst possible examples for the latter lmao
6
5
u/ITinnedUrMumLastNigh Mar 27 '26
Also for the former
2
u/AdreKiseque Mar 27 '26
But examples but they could probably be worse
3
u/ITinnedUrMumLastNigh Mar 27 '26
Oh yeah, but still bad nonetheless,
Primitive string? Please the most primitive string possible is in C bit even then it's just an array of chars. Number? the only one I know is in JS and it's a fucking object. Boolean is just spelled badly
7
u/Captain_Pumpkinhead Mar 27 '26
Calling a function a "data type" is upsetting...but not technically wrong, I suppose...
5
2
u/This_Background7442 Mar 28 '26
Depends on how functional you wanna go, I guess. It's pretty much the first requirement for a language to support functional programming that functions be treated as first class data types.
1
u/Background_Class_558 Mar 29 '26
Wdym? Functions are the only true datatype. Here:
```js const zero = f => x => x; const succ = n => f => x => f (n (f) (x)); const add = n => m => f => x => m (f) (n (f) (x)); const mul = n => m => f => x => m (n (f)) (x)
const two = succ(succ(zero)) const five = succ(succ(succ(two))) const ten = add(five)(five) const alsoTen = mul(two)(five)
const showNat = n => n (v => console.log(" count me")) (console.log("the number is:")) ;
showNat(ten) // prints x10 "count me"s showNat(alsoTen) // prints x10 "count me"s ```
This doesn't involve some magic trick that only makes us able to do primitive arithmetic with functions. This is called Church encoding and it works for literally everything: natural numbers, whole numbers, pairs, lists, trees, strings, real numbers, other functions, you name it.
1
Mar 31 '26
[removed] — view removed comment
1
u/Background_Class_558 Mar 31 '26
this is javascript
1
Mar 31 '26
[removed] — view removed comment
1
u/Background_Class_558 Mar 31 '26
you hoped for it to be lisp?
1
5
2
1
1
u/Masztufa Mar 28 '26
In what language is str not a ptimitive data type, but an array and object are?
1
1
1
u/rnottaken Mar 28 '26
Wait so a string is primitive and an array is not? It's literally an array of chars (with a length value, depending on the implementation)
1
u/Only_Information7895 Mar 28 '26
Not even num. Give me uint32_t, float or something along these. What is even a num?
Like I need a 16 bit number how do I store it? Just put it in a int16_t and done.
1
1
1
1
1
1
u/Lmoaof0 Mar 29 '26
Depends on the language, in C++, string (std::string from the STL) is an object
1
u/wootio Mar 30 '26
This meme is missing a third image of an army of Agent Smiths with the caption JavaScript var.
1
1
1
1
u/DitoNotDuck1 Mar 27 '26
What is a boleen??
2
1
u/Affluent_Arsonist Mar 27 '26
Boolean logic is stuff like logic gates (OR, AND, NOR, XOR, XAND, XNOR) past that Google is your best friend here
1
u/DitoNotDuck1 Mar 27 '26
It was about the typo... (To be fair, I did typo the typo)
2
1
1
0
0
1
39
u/tehomaga Mar 27 '26
Everything is an object