# \[ANN\] DelayedEvaluation.jl: A package fix function arguments with \`getindex\` syntax

**URL:** <https://discourse.julialang.org/t/ann-delayedevaluation-jl-a-package-fix-function-arguments-with-getindex-syntax/89358>\
**Category:** Package Announcements\
**Created:** [October 27, 2022, 10:58am UTC](https://discourse.julialang.org/t/ann-delayedevaluation-jl-a-package-fix-function-arguments-with-getindex-syntax/89358 "2022-10-27T10:58:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![flipgthb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/flipgthb/32/29080_2.png) [@flipgthb](https://discourse.julialang.org/u/flipgthb)\
**Post date:** [October 27, 2022, 10:58am UTC](https://discourse.julialang.org/t/ann-delayedevaluation-jl-a-package-fix-function-arguments-with-getindex-syntax/89358/1 "2022-10-27T10:58:04Z")

</div>

Hello all,

I created a small package extending the functionality of `Base.Fix1` and `Base.Fix2` to any function and provides a syntax analogous to array or `DataFrame` indexing to fix function arguments using `!` (instead of `:`) as a placeholder:

[https://github.com/flipgthb/DelayedEvaluation.jl](https://github.com/flipgthb/DelayedEvaluation.jl)

Usage examples:

```julia
getindex[!,1]([1,2,3]) == [1,2,3][1]

sin[0.0]() == sin(0.0)

mapfoldl[x->x+1,!,[1,2,3]](*) == mapfoldl(x->x+1,*,[1,2,3])

```

It works by creating a `DelayEval <: Function` object when indexing a function. Composition and chaining also works:

```julia
getindex[!,1][[1,2,3]]() = getindex([1,2,3],1)

(first ∘ getindex[!,2])([(1,:a),(2,:b)]) == first(getindex([(1,:a),(2,:b)],2))

```

Is this useful? Maybe… Probably it is just dumb, but I did anyway 😅

---

<div class="post-metadata">

**Author:** ![aplavin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aplavin/32/222056_2.png) [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Post date:** [October 27, 2022, 11:17am UTC](https://discourse.julialang.org/t/ann-delayedevaluation-jl-a-package-fix-function-arguments-with-getindex-syntax/89358/2 "2022-10-27T11:17:58Z")

</div>

Other packages doing similar stuff, but without type piracy: ChainedFixes.jl and FixArgs.jl.
