Skip to content

Commit

Permalink
Minor wording changes/spelling fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdeisenberg committed Feb 22, 2017
1 parent 805ddbd commit e1be7db
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion _sources/filter_function.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ There’s only one problem with this: the predicate function to ``filter`` takes
because you don’t know the average in advance. You *could* use ``def`` to bind ``avg`` to some value and then change it later with ``set!``, but that goes counter to the principles of functional programming |---| you don’t want to re-bind a symbol to a new value if you don’t have to, and in this case, you don’t have to.

Instead, you can use ``partial``. Before showing you how it is written, here’s the idea behind it. You know how you login to an e-commerce site you’ve used before and you purchase a new item? The checkout form shows up with much of the information already filled in (name, shipping/billing address) and all you need to do is complete one or two items. In essence, the form is *partially* filled in.
Instead, you can use ``partial``. Before showing you how it is written, here’s the idea behind it. When you log in to an e-commerce site you’ve used before to purchase a new item, the checkout form shows up with much of the information already filled in (name, shipping/billing address). All you need to do is complete one or two items. In essence, the form is *partially* filled in.

So here’s the trick: we’re going to give ``partial`` the two-parameter function and the first argument. The result will be a partially-called function that is waiting to be called with the second argument, much as the web site sends you a partially-completed form that is waiting to be completed with extra information.

Expand Down
2 changes: 1 addition & 1 deletion _sources/js_interact1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Exercises
.. _radians: https://en.wikipedia.org/wiki/Radian

Then use your ``to-radians`` function to calculate the sine of 30 degrees.
Due to accuracy of math, the result of running
Because computations have a limited number of digits of accuracy, the result of running
your code will be something like 0.4999999... instead of exactly 0.5

.. activecode:: radians_q
Expand Down
2 changes: 1 addition & 1 deletion _sources/map_function.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Manipulating Collections
::::::::::::::::::::::::::

The previous two pages gave you the fundamentals of lists and vectors, but if you think there was something missing, you are correct
You may have een wondering how you work with the items in a collection one after another. In this page and the next pages, we will show you three of the most important functions for manipulating collections: ``map``, ``reduce``, and ``filter``.
You may have been wondering how you work with the items in a collection, one after another. In this page and the next pages, we will show you three of the most important functions for manipulating collections: ``map``, ``reduce``, and ``filter``.


The ``map`` function
Expand Down
6 changes: 3 additions & 3 deletions _sources/reduce_function.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Here is the general form of the ``reduce`` function that we will use:
where

* ``f`` is a function that has two parameters: the current accumulated value and the item under consideration
* ``initial`` is the initial value of the accumulated value
* ``f`` is a function that has two parameters: the current accumulated result and the item under consideration
* ``initial`` is the initial value of the accumulated result
* ``collection`` is the collection to be reduced

As an example, here is ``reduce`` used to calculate the sum of squares of a set of numbers:
Expand Down Expand Up @@ -52,7 +52,7 @@ Here’s a video that shows how it works:
:align: center

If you do not provide an initial value, ``reduce`` will use the first two values in the collection as input to the reducing function. So, if you
wanted to find the sum of all the values in a vector, you could simply do this. I’m using a longer vector for clarity:
wanted to find the sum of all the values in a vector, you could simply do the following, which uses a longer vector for clarity:

.. activecode:: sum_vector
:caption: Sum a vector
Expand Down
4 changes: 2 additions & 2 deletions _sources/reduce_multi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ high temperatures and one of low temperatures::
[[3 2 4 4 4 9 16]
[9 13 10 9 12 20 21]]
Now that you know that ``reduce`` can yield a result of any sort, you can write a function that you can use with ``reduce`` to split up the tempetature vector.
The result is going to be a vector of two vectors, so, the initial result is ``[[][]]``, and the call will be::
Now that you know that ``reduce`` can yield a result of any sort, you can write a function that ``reduce`` will use to split up the tempetature vector.
The result is going to be a vector of two vectors, so the initial result is ``[[][]]``, and the call will be::
(reduce split-temperatures [[][]] temperatures)

Expand Down
2 changes: 1 addition & 1 deletion _sources/threading.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ This is more in line with a description of the algorithm as “Take the numbers
Use whichever method makes the algorithm more clear to you; that will make it clear to other people |---| and when you come back to code you wrote a few months ago, *you* will be “other people.”

.. reveal:: reveal_singlethread
:showtitle: Learn about ->
:showtitle: Learn about the -> form
:hidetitle: Hide Information

There is also a ``->`` form, known as “thread first”; it works the same as ``->>`` except it inserts the list as the first item in the subsequent expressions.
Expand Down

0 comments on commit e1be7db

Please sign in to comment.