#higherorderfunctions

Python PeakPythonPeak
2026-01-02

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!

youtube.com/watch?v=jGc0YMGEKz8

Xerz πŸ’—xerz@fedi.xerz.one
2025-10-17

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?

Colin MacleodCGM@mastodon.scot
2024-06-28

@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

CuriousCoderchopsueey
2024-06-28

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.

2023-07-27

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

youtube.com/watch?v=bRFLKEfPvgk

nosh :fosstodon: (Κ˜β€ΏΚ˜)nosherwan@fosstodon.org
2022-11-28

:javascript:
Decorators:
Why is there so much fuss about #decorators (typescript) when #HigherOrderFunctions can do the same thing & have been available in #javaScript forever.

Being a functional or object based language the natural fit is HOF not Decorators.

If you want to simulate OOP in #js & use the elusion that inheritance is good for js code base then be my guest & use decorators. πŸ˜€

2020-12-20

Or use a simple shortcut:

str.map &:to_i

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

RT @ArityWolf@twitter.com

Map

str.map{|string| string.to_i}

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

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

πŸ¦πŸ”—: twitter.com/ArityWolf/status/1

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst