#Currying

Zuri (he/him) 🕐 CETshaedrich@mastodon.online
2025-02-04

Another #CodeGolf puzzle for #JavaScript #WebDev people:

I have n functions that type one argument of the same type and return a boolean.

The current usage is:
function a(b) {
return c(b) && d(b)
}

I boiled down a to
a = (b) => [c, d].every(fn => fn(x))

I assume, this can be further boiled down via bind/ #PartialApplication/ #Currying

What do you think?

#amCoding #amProgramming #webDevelopment #softwareDevelopment #softwareEngineering

CuriousCoderchopsueey
2025-01-02

What is Currying?

, named after Haskell Curry (1900-1982), is a technique of transforming a function that takes multiple arguments into a sequence of functions, each taking a single argument. For example, a function f(a, b, c) becomes f(a)(b)(c).

This is accomplished using closures. When you call f(a), it returns a new function that "remembers" the value of a. When you then call that returned function with b, it returns another function that remembers both a and b, and so on. This ...

Code example of Currying in JavaScript.
Alexander Bandukwalathekkid@fosstodon.org
2024-10-03

Currying in languages with implicit effects seems sketchy—effectful functions returning other functions obscure when effects are interleaved. Users see it as just multiple arguments, not realizing some parameter applications might be expensive. #ProgrammingLanguages #Currying #AutomaticCurrying

CuriousCoderchopsueey
2024-06-21

Currying Explained! 🌟

Named after Haskell Curry, it doesn't involve spices! 🍛

Currying transforms a function into a series of nested functions, each with access to variables via closures. This makes functions more modular and reusable.

Code example and explanation of Currying in javascript
2024-05-05

Расширение Функциональных Интерфейсов Java

За годы прошедшие с их появления в Java8 у меня набралась коллекция полезных решений и шаблонов, которые я переносил из проекта в проект, и которые в стандартной версии так и не были осуществлены. Недавно я решил собрать все вместе в небольшом проекте с открытым кодом. В первом релизе проекта расширения охватывают следующие аспекты:

habr.com/ru/articles/812451/

#Java #functional_interface #functional_programming #currying #multimethods #exception #exception_handling #extensions #interception #java_21

Nblix 👨‍💻🐶📘🇸🇪Nblix@burningboard.net
2023-11-10

Heute mal eingehender mit #Kotlin beschäftigen. Finde ich, als #Scala Dev, sehr spannend mal zu vergleichen... Hab gestern schonmal die "Tour of Kotlin" gemacht und bin jetzt auf die Detaills gespannt! v.a. gibt es sowas wie #partialFunctions, #Currying und sowas wie Option?

#nLab has an entry on #Currying, but it doesn't (seem to?) mention a sum type #dual. ncatlab.org/nlab/show/currying #CategoryTheory

sofia ☮️🏴sofia@chaos.social
2023-07-30

does any #programmingLanguage have something like partial evaluation based on named parameters? so like #currying, but you can add the parameters in any order, and get a function back that that evaluates the still missing parameters?
it seems pretty handy to me…

here is an example for how i think this could work in #JS:

// pseudo JS function for "name-based partial evaluation"
// ":>" signifies the sort of funtion i mean
// "//>>" signifies what would be returned

const speed = {time, distance} :>
	distance / time

speed {distance: 2, time: 4}
//>> .5

speed {time: 20}
//>> {distance} :> distance / 20

speed {distance: 10}
//>> {time} :> 10 / time

speed {distance: 5} {time: 2}
//>> 2.5
2023-07-02

"un- #currying, is useful in some situations. eg, let's say we want to split a list into two parts - elements that are smaller than 10 and the rest, and then concatenate those two lists. Splitting of the list is done by partition (< 10) (here we also use curried <). The result is of type ([Int],[Int]). Instead of extracting the result into its first and second part and combining them using ++, we can do this directly by uncurrying ++ as

uncurry (++) . partition (< 10)"
softwareengineering.stackexcha

Zelphir Kaltstahlzelphirkaltstahl
2022-12-25

Another interesting programming language: SML(NJ). Got a repo [1] for working through "Elements of ML Programming" by Ullman.

I like the currying and the pattern matching when defining functions. Would be cool to have a way of automatically making curried functions in Scheme & a simple way of calling those without going (((func a) b) c).

[1]: notabug.org/ZelphirKaltstahl/s (Linking the org-mode exercises file. It is probably the most relevant.)

SiavashCIAvash
2021-10-02

Curry - A Raku module for currying functions plus partially applying them
github.com/CIAvash/Curry

2021-04-09

*-> *
(->)* * #applied
((->) *) * #currying
How do you store information at run to me with a lifted #pointer?
Levity polymorphism #ghc

2021-04-09

*-> *
->(* * ) #applied
->((* *)) #currying
How do you store information at run to me with a lifted #pointer?
Levity polymorphism #ghc

2021-02-02

- { g:(X* Y)-> Z}, that is, { g\in [(X* Y)-> Z]}
[A->B]} :space of f: A-> B. By #currying, { {{curry}}(g):X-> [Y->Z]}
Apply -> #morphism
{{Apply}}:([Y-> Z]* Y)->Z},
so
{ {{Apply}}(f,y)=f(y)}
Ie commuting diagram

{ {Apply}}\circ \left({{curry}}(g)\times {{id}}_{Y}\right)=g}

Christian Kalkhoff 🇪🇺🌊🐰softmetz
2019-10-20
Ænðr E. Feldstrawaeveltstra
2019-03-07

Of course we could choose to avoid altogether. Avoid . Avoid retaining state. Just pass around argument parameters and recalculate function results every time.

It'll be safer.

And it'll be slower.

So we must come up with something better.

And that can't be achieved with the current version of the or the .

It can't be achieved on current o.s. kernels or any consumer computer chips.

is an illusion.

Client Info

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