From c1f6705a5901e11ce50130974c737d11ea2b0e7e Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Tue, 29 Apr 2014 22:17:21 -0400 Subject: [PATCH] fix docs --- docs/components.md | 1 - docs/getting-started.md | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/components.md b/docs/components.md index 6be76e8a..66bc5006 100644 --- a/docs/components.md +++ b/docs/components.md @@ -136,7 +136,6 @@ dashboard.controller = function() { }; dashboard.view = function(ctrl) { - //assuming there's an element w/ id = "example" somewhere on the page return m("#example", [ new autocompleter.view(ctrl.autocompleter, {onchange: m.withAttr("value", console.log)}), ]); diff --git a/docs/getting-started.md b/docs/getting-started.md index a4a3e809..e02a4d97 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -264,7 +264,7 @@ In addition to bi-directional data binding, we can also bind parameterized funct m("button", {onclick: ctrl.add.bind(ctrl, ctrl.description)}, "Add") ``` -In the code above, we are simply using the native Javascript `Function::bind` method. This creates a new function with the parameter already set. In functional programming, this is called [*currying*](http://en.wikipedia.org/wiki/Currying). +In the code above, we are simply using the native Javascript `Function::bind` method. This creates a new function with the parameter already set. In functional programming, this is called [*partial application*](http://en.wikipedia.org/wiki/Partial_application). The `ctrl.add.bind(ctrl, ctrl.description)` expression above returns a function that is equivalent to this code: @@ -333,7 +333,7 @@ Here are the highlights of the template above: - The template is rendered as a child of the implicit `` element of the document - The text input saves its value to the `ctrl.description` getter-setter we defined earlier -- The button calls the `ctrl.add` method when clicked. The `.bind(ctrl, ctrl.description)` idiom is a [functional curry](http://en.wikipedia.org/wiki/Currying). +- The button calls the `ctrl.add` method when clicked. The `.bind(ctrl, ctrl.description)` idiom is a [partial application](http://en.wikipedia.org/wiki/Partial_application). In this example, it's only used to maintain the scope binding for the `this` parameter in the controller method, but typically it's also used to bind parameters to the function without the need to declare a wrapper anonymous function. - The table lists all the existing to-dos, if any. @@ -540,7 +540,7 @@ And because Mithril views are javascript, the developer has full freedom to abst Mithril templates are also more collision-proof than other component systems since there's no way to pollute the HTML tag namespace by defining ad-hoc tag names. -A more intellectually interesting aspect of the framework is that event handling is encouraged to be done via functional composition (i.e. by using tools like [`m.withAttr`](mithril.withAttr.md), [`m.prop`](mithril.prop.md) and the native `.bind()` method for currying). +A more intellectually interesting aspect of the framework is that event handling is encouraged to be done via functional composition (i.e. by using tools like [`m.withAttr`](mithril.withAttr.md), [`m.prop`](mithril.prop.md) and the native `.bind()` method for partial application). If you've been interested in learning or using Functional Programming in the real world, Mithril provides very pragmatic opportunities to get into it.