Decorators vs Higher-Order Functions: Function Enhancement Battle

Python decorators vs JavaScript higher-order functions. Which approach to function enhancement is more elegant? Mind-blowing comparison!

#python #javascript #pythonvsjavascript #decorators #higherorderfunctions #functioncomposition #programmingcomparison #codecomparison #pythontricks #javascripttricks #functionalprogramming #viralcoding

https://www.youtube.com/watch?v=jGc0YMGEKz8

Decorators vs Higher-Order Functions: Function Enhancement Battle #pythontricks

YouTube

just decided to get to some dumb Rust code I wrote a while ago (did I share it in here? canโ€™t recall) and make it as #functional (with #higherOrderFunctions and stuffs) as possible

use std::{ env, ops::Add }; fn main() { let args: Vec<u8> = env::args() .skip(1) .map(|x| x.parse().unwrap()) .collect(); if args.len() >= 2 { println!("{}", args .into_iter() .fold(0, Add::add)); } }

โ€ฆ.and I canโ€™t help but wonder: arenโ€™t these too many steps?

@chopsueey Tcl gets a lot of hate for its loosely-typed "Everything Is A String" approach, but one of the consequences of this is that Higher-Order Functions become very natural, and are widely used. ๐Ÿ˜‰
#tcl #tcltk #programming #higherorderfunctions

Higher-order functions (HOF) explained! ๐Ÿ’ก

HOFs take one or more functions as arguments or
return a function as a result.

HOFs leverage the concept of functions as first-class citizens. This allows for more abstract, modular, and reusable code.

#programming #javascript #python #webdev #higherorderfunctions

Check out this brand new video from ACCU 2023

And Then() Some(T): C++ Combinators โ€“ Higher-Order Functions in Cpp โ€“ by Victor Ciura โ€“ ACCU 2023

https://www.youtube.com/watch?v=bRFLKEfPvgk

#cpp #Haskell #higherorderfunctions #programming #softwareengineering

And Then() Some(T): C++ Combinators - Higher-Order Functions in Cpp - Victor Ciura - ACCU 2023

ACCU Membership: https://tinyurl.com/ydnfkcynhttps://accu.orghttps://www.accuconference.org/And Then() Some(T): Don't Look in the Box! - Practical Higher-Ord...

YouTube

Or use a simple shortcut:

http://str.map &:to_i

You can find more details in Ary's post.
It has obvious advantages in comparison to the Ruby version.

RT @[email protected]

Map

http://str.map{|string| http://string.to_i}

Convert an array of strings to integers in Ruby; more useful in Crystal

#crystallang #rubylang #crystal #ruby #higherorderfunctions #coding #programming

๐Ÿฆ๐Ÿ”—: https://twitter.com/ArityWolf/status/1340349568865587206