[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Maintenance is complete! We got more disk space.
Become a Patron!

/g/ - Technology


View post   

[ Toggle deleted replies ]
>> No.68139870 [DELETED]  [View]
File: 177 KB, 1920x1080, Illya 1200 (DI).jpg [View same] [iqdb] [saucenao] [google] [report]

*breaths in

btw in c++ this is just

auto hangman (const String word, const RBTree(char) guessed)
const newSet = guessed += promptChar();

if( stream(word) | map(unique) | collectSet == guessed) return true;
if( (guessed | filter( unContained(word) | collectList)eval().size() > 8) return false

return hangman (word, newSet);

all data structures are pure functional, structual sharing
uses pure functional lazy static range adapters
imlementation of the unique applicative and promptChar is trivial and left as an exercise to the reader

>> No.68082491 [DELETED]  [View]
File: 177 KB, 1920x1080, Illya 1200 (DI).jpg [View same] [iqdb] [saucenao] [google] [report]

in c++ this is just

template<class... Ts> struct overloaded : Ts... { using Ts::operator()...; };
template<class... Ts> overloaded(Ts...) -> overloaded<Ts...>;

int main (int argc, char** argv)
const auto isEven = [](const auto i) -> bool { return i%2 == 0;};
const auto sum = [](const auto i, const auto a){ return i + a;};
const auto fb = [](const auto i) -> std::variant<String, int>
if(i % 5 == 0 && i % 3 == 0) return String("fizzbuzz");
if(i % 3 == 0) return ("fizz");
if(i % 5 == 0) return ("buzz");
return i;

const auto fbExpr = Integers() | Map(fb);
const auto eval = fbExpr | Take(100) | CollectList();


typesafe, pure functional lazy evaluated
not going to bother doing the overloaded shit to print the output because its cancer

>> No.68065582 [DELETED]  [View]
File: 177 KB, 1920x1080, Illya 1200 (DI).jpg [View same] [iqdb] [saucenao] [google] [report]

you're a fucking retard c++ is the most expressive, most multi paradigm, zero cost abstraction having, pure functional enabled, meta programming capable language around. and just like the other freshmen and dropouts ITT that spam 'oop is bad' memes or think that pure functional means you use structs and free functions instead of methods you're really dumb and retarded. please tell me why a language that's constantly improving and making great strides in all directions makes you throw up. is it because it allows multiple inheritance or because you or because you're too dumb to parse the complicated syntax? which are you going to tell me to use instead? C99 or Idris? you havent written shit you are nothing fuck you

>> No.67905132 [View]
File: 177 KB, 1920x1080, .jpg [View same] [iqdb] [saucenao] [google] [report]

shared_ptr is litteraly 10x slower than decade old GC's though

unique_ptr spams allocations and free's everywhere and just pretends they dont exist
>inb4 write your own allocator

>> No.63483854 [View]
File: 177 KB, 1920x1080, Frame4474.jpg [View same] [iqdb] [saucenao] [google] [report]


View posts [+24] [+48] [+96]