d > rust

Serg Gini kornburn at yandex.ru
Wed Jun 24 06:41:54 UTC 2026


On Wednesday, 24 June 2026 at 02:36:12 UTC, monkyyy wrote:
> apparently its very very hard in c++ and impossible for rust to 
> replicate; feel free to use it in any future arguments

GPT suggested

for C++:
```cpp
template <template<class...> class F, class... Args>
struct static_curry {
     template<class... S>
     struct apply {
         template<class T>
         auto operator()(T&& t) {
             return F<Args..., S...>{}(std::forward<T>(t));
         }
     };
};
```

For Nim:
```nim
template staticCurry(F: untyped, args: varargs[untyped]): untyped 
=
   template inner(s: varargs[untyped]): untyped =
     proc call[T](t: T) =
       F(args, s, t)
```

For Haskell:
```haskell
type StaticCurry f args s = f args s
```

For Zig:
```zig
fn staticCurry(comptime F: anytype, comptime Args: anytype) type {
     return struct {
         pub fn apply(comptime S: anytype, t: anytype) void {
             F(Args, S, t);
         }
     };
}
```

Don't know if any from above will work :)


More information about the Digitalmars-d mailing list