Skip to content

Commit

Permalink
Update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtkp9993 authored Apr 26, 2018
1 parent f929fe7 commit 15d828e
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,41 +115,31 @@ __Daha Fazla Bilgi İçin__

## Partial Application

Partially applying a function means creating a new function by pre-filling some of the arguments to the original function.

Kısmi uygulama, bir fonksiyonun bazı argümanlarını önceden doldurarak yeni bir fonksiyon oluşturmaktır.

```js
// Helper to create partially applied functions
// Takes a function and some arguments
const partial = (f, ...args) =>
// returns a function that takes the rest of the arguments
(...moreArgs) =>
// and calls the original function with all of them
f(...args, ...moreArgs)

// Something to apply
// Orjinal fonksiyonumuz
const add3 = (a, b, c) => a + b + c

// Partially applying `2` and `3` to `add3` gives you a one-argument function
//`2` ve `3` argümanlarını `add3` fonksiyonumuza vererek `fivePlus` fonksiyonumuzu oluşturuyoruz
const fivePlus = partial(add3, 2, 3) // (c) => 2 + 3 + c

fivePlus(4) // 9
```

You can also use `Function.prototype.bind` to partially apply a function in JS:
Kısmi uygulama için `Function.prototype.bind` de kullanılabilir:

```js
const add1More = add3.bind(null, 2, 3) // (c) => 2 + 3 + c
```

Partial application helps create simpler functions from more complex ones by baking in data when you have it. [Curried](#currying) functions are automatically partially applied.

Kısmi uygulama, kompleks fonksiyonlardan daha basit fonksiyonlar oluşturmaya yardım eder. [Curried](#currying) fonksiyonlar otomatik olarak kısmi uygulanmış fonksiyonlardır.

## Currying

The process of converting a function that takes multiple arguments into a function that takes them one at a time.
Birden çok parametre alan bir fonksiyonu, her defasında sadece bir parametre alan bir fonksiyona dönüştürmektir.

Each time the function is called it only accepts one argument and returns a function that takes one argument until all arguments are passed.
Fonksiyon her çağrıldığında sadece bir argüman kabul eder ve tüm argümanlar verilene kadar sadece bir argüman alan bir fonksiyon döndürür.

```js
const sum = (a, b) => a + b
Expand Down

0 comments on commit 15d828e

Please sign in to comment.