Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions 01-blocks-scripts-and-sprites.md
Original file line number Diff line number Diff line change
Expand Up @@ -1424,8 +1424,8 @@ blocks:
{img alt="image389.png" width="1.04444in"}`images/01-blocks-scripts-and-sprites/image389.png`

`Catch` and `throw` provide a nonlocal exit facility. You can drag the tag from a `catch` block to a `throw` inside
its C-slot, and the throw will then jump directly out to the matching
catch without doing anything in between.
its C-slot, and the `throw` will then jump directly out to the matching
`catch` without doing anything in between.
:::{index} `catch` block
`throw` block
:::
Expand All @@ -1445,7 +1445,7 @@ a script to time how long the reporter takes.)

The `cascade` blocks take an initial value and call
a function repeatedly on that value, *f*(*f*(*f*(*f*…(*x*)))).
:::{index} cascade blocks
:::{index} `cascade` blocks
:::

The `compose` block takes two functions and reports
Expand Down Expand Up @@ -1548,7 +1548,7 @@ words) and one to make a list (sentence).

The selector names come from Logo, and should be self-explanatory.
However, because in a block language you don’t have to type the block
name, instead of the terse butfirst or the cryptic bf we spell out “all
name, instead of the terse `butfirst` or the cryptic `bf` we spell out “all
but first of” and include “word” or “sentence” to indicate the intended
domain. There’s no first letter of block because `letter 1 of` serves that
need. `Join words` (the sentence-as-string constructor) is like the
Expand Down Expand Up @@ -1837,7 +1837,7 @@ costume made from another costume by coloring its background, taking a
color input like the `set pen color to RGB(A)` block and a number of
turtle steps of padding around the original costume. These two blocks
work together to make even better buttons:
:::{index} costume with background block
:::{index} `costume with background` block
:::

{img alt="image448.png" width="5.51in"}`images/01-blocks-scripts-and-sprites/image448.png`
Expand All @@ -1853,7 +1853,7 @@ This library
interfaces with a capability in up-to-date browsers, so it might not
work for you. It works best if the accent matches
the text!
:::{index} speak block
:::{index} `speak` block
:::

The {index}`parallelization library` contains
Expand All @@ -1866,7 +1866,7 @@ The two `do in parallel`blocks
Those scripts will be run in parallel, like ordinary independent scripts
in the scripting area. `The do in parallel and wait` version waits until all of those
scripts have finished before continuing the script below the block.
:::{index} do in parallel block
:::{index} `do in parallel` block
:::

The create variables library
Expand Down Expand Up @@ -1895,7 +1895,7 @@ elements, such as the settings menu {inline alt="image453.png"}`images/01-blocks
yes-or-no options that have checkboxes in the user interface, while the
`set value` block controls settings with numeric
or text values, such as project name.
:::{index} set flag block
:::{index} `set flag` block
`set value` block
:::

Expand All @@ -1919,8 +1919,8 @@ digits (limited only by the memory of your computer) and, in fact, the
entire Scheme numeric tower, with exact rationals and with complex
numbers. The `Scheme number` block has a list
of functions applicable to Scheme numbers, including subtype predicates
such as rational? and infinite?, and selectors such as numerator and
real-part.
such as `rational?` and `infinite?`, and selectors such as `numerator` and
`real-part`.
:::{index} BIGNUMS block
`Scheme number` block
:::
Expand All @@ -1943,23 +1943,23 @@ resulting picture in a browser window and scroll through it. (These
values end with a bunch of zero digits. That’s not roundoff error; the
prime factors of 100! and 200! include many copies of 2 and 5.) The
block with no name is a way to enter things
like 3/4 and 4+7i into numeric input slots by converting the slot to Any
like `3/4` and `4+7i` into numeric input slots by converting the slot to Any
type.
:::{index} block with no name
:::

The strings, multi-line input library
provides these blocks:
:::{index} string processing library
case-independent comparisons block
`case-independent comparisons` block
:::

{img alt="image463.png" width="3.9375in"}`images/01-blocks-scripts-and-sprites/image463.png`

All of these could be written in Snap<em>!</em> itself, but these are implemented
using the corresponding JavaScript library functions directly, so they
run fast. They can be used, for example, in scraping data from a web
site. The command use case-independent comparisons applies only to this
site. The command `use case-independent comparisons` applies only to this
library. The {index}`\`multiline\` block<`multiline` block>` accepts and reports
a text input that can include newline characters.

Expand Down Expand Up @@ -2039,7 +2039,7 @@ in the sound and by changing the sampling rate at which the sound is
reproduced. Many of the blocks are helpers for the `plot sound` block,
used to plot the waveform of a sound. The `play sound` (primitive) block plays a sound. \_\_ `Hz for`
reports a sine wave as a list of samples.
:::{index} plot sound block
:::{index} `plot sound` block
`play` block
`Hz for` block
:::
Expand All @@ -2059,7 +2059,7 @@ list. `Value at key` looks up a key-value pair
in a (listified) JSON dictionary. The `key:value:` block
is just a constructor for an abstract data
type used with the other blocks
:::{index} value at key block
:::{index} `value at key` block
single: `key\:value\:` block
:::

Expand All @@ -2085,8 +2085,8 @@ States; a zoom of 5 fits Germany. The zoom can be changed in half steps,
i.e., 5.5 is different from 5, but 5.25 isn’t.

The next five blocks convert between stage coordinates (pixels) and
Earth coordinates (latitude and longitude). The change by x: y: block
shifts the map relative to the stage. The distance to block measures the
Earth coordinates (latitude and longitude). The `change by x: y:` block
shifts the map relative to the stage. The `distance to` block measures the
map distance (in meters) between two sprites. The three reporters with
current in their names find *your* actual location, again supposing that
geolocation is enabled on your device. Update redraws the map; as
Expand Down
8 changes: 4 additions & 4 deletions 02-saving-and-loading-projects-and.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ If you saved projects in an earlier version of Snap<em>!</em> using the
to allow you to retrieve those projects. But you can save them only with
the Computer and Cloud options.

:::{index} Restore unsaved project option
:::{index} `Restore unsaved project` option
:::

## If you lose your project, do this first!
Expand All @@ -152,19 +152,19 @@ If you are still in **Snap<em>!</em>** and realize that you’ve loaded another
project without saving the one you were working on: _**Don’t edit the new project.**_
From the File menu {inline alt="image384.png" width="0.31944in"}`images/02-saving-and-loading-projects-and/image384.png` choose the "`Restore unsaved project`" option.

Restore unsaved project will also work if you log out of Snap<em>!</em> and
`Restore unsaved project` will also work if you log out of Snap<em>!</em> and
later log back in, as long as you don’t edit another project meanwhile.
Snap<em>!</em> remembers only the most recent project that you’ve edited (not
just opened, but actually changed in the project editor).

If your project on the cloud is missing, empty, or otherwise broken and
isn’t the one you edited most recently, or if Restore unsaved project
isn’t the one you edited most recently, or if `Restore unsaved project`
fails: ***Don’t edit the broken project.*** In the "`Open…`" box, enter your
project name, then push the {index}`Recover button`. *Do
this right away,* because we save only the version before the most
recent, and the latest before today. So don’t keep saving bad versions;
Recover right away. The Recover feature works only on a project version
that you actually saved, so Restore unsaved project is your first choice
that you actually saved, so `Restore unsaved project` is your first choice
if you switch away from a project without saving it.

To help you remember to save your projects, when you’ve edited the
Expand Down
6 changes: 3 additions & 3 deletions 05-typed-inputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ should be on that line. Submenus may be nested to arbitrary depth.
{img alt="image693.png" width="0.50in"}`images/05-typed-inputs/image693.png`

Alternatively, instead of giving a menu listing as described above, you
can put a JavaScript function that returns the desired menu in the
can put a `JavaScript function` that returns the desired menu in the
textbox. This is an experimental feature and requires that JavaScript be
enabled in the Settings menu.

Expand Down Expand Up @@ -302,8 +302,8 @@ But I’d like the arrow symbol bigger, and yellow, so I edit its name:

{img alt="image690.png" width="2.03in"}`images/05-typed-inputs/image690.png`

This makes the symbol 1.5 times as big as the letters in the block text, using a color with
red-green-blue values of 255-255-150 (each between 0 and 255). Here’s
This makes the symbol `1.5` times as big as the letters in the block text, using a color with
red-green-blue values of `255-255-150` (each between 0 and 255). Here’s
the result:

{img alt="image691.png" width="1.20in"}`images/05-typed-inputs/image691.png`
Expand Down
4 changes: 2 additions & 2 deletions 06-procedures-as-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ list as input; it takes numbers as inputs! So this would be wrong:
:::{index} name, input
`#1`
formal parameters
crossproduct
`crossproduct`
nested calls
higher order function
empty input slots, filling
Expand Down Expand Up @@ -448,7 +448,7 @@ numbers.) What we’d like is a `reporter-if` that *behaves* like this one,
delaying the evaluation of its inputs, but *looks* like our first
version, which was easy to use except that it didn’t work.

[^6]: There is a primitive id function in the menu of the sqrt of block,
[^6]: There is a primitive `id` function in the menu of the `sqrt of` block,
but we think seeing its (very simple) implementation will make this
example easier to understand.

Expand Down
42 changes: 21 additions & 21 deletions 07-object-oriented-programming-with-sprites.md
Original file line number Diff line number Diff line change
Expand Up @@ -401,24 +401,24 @@ the message was delegated.
{img alt="image780.png" width="0.79in"}`images/07-object-oriented-programming-with-sprites/image780.png`

:::{index} attributes, list of
self (in my block)
neighbors (in my block)
other sprites (in my block)
stage (in my block)
clones (in my block)
other clones (in my block)
parts (in my block)
children (in my block)
anchor (in my block)
parent (in my block)
name (in my block)
costumes (in my block)
sounds (in my block)
dangling? (in my block)
rotation x (in my block)
rotation y</code> (in my block)
center x (in my block)
center y (in my block)
`self` (in `my` block)
`neighbors` (in `my` block)
`other sprites` (in `my` block)
`stage` (in `my` block)
`clones` (in `my` block)
`other clones` (in `my` block)
`parts` (in `my` block)
`children` (in `my` block)
`anchor` (in `my` block)
`parent` (in `my` block)
`name` (in `my` block)
`costumes` (in `my` block)
`sounds` (in `my` block)
`dangling?` (in `my` block)
`rotation x` (in `my` block)
`rotation y` (in `my` block)
`center x` (in `my` block)
`center y` (in `my` block)
:::

## List of attributes
Expand Down Expand Up @@ -562,7 +562,7 @@ costume by combining a bitmap, a width, and a height. But, as in the
example above, <code>switch to costume ( )</code> will accept a bitmap as input and will
automatically use the width and height of the current costume. Note that
there’s no <var>name</var> input; costumes computed in this way are all named
<var>costume</var>. Note also that the use of switch to costume does *not* add the
<var>costume</var>. Note also that the use of `switch to costume` does *not* add the
computed costume to the sprite’s wardrobe; to do that, say

{img alt="image790.png" width="2.26in"}`images/07-object-oriented-programming-with-sprites/image790.png`
Expand All @@ -586,7 +586,7 @@ It’s the {inline alt="image804.png" width="0.95833in"}`images/07-object-orient
determines the rearrangement of colors: green➔red, red➔green, and the
other two unchanged. That <code>list</code> is inside another <code>list</code> because otherwise
it would be selecting *rows* of the pixel array, and we want to select
columns. We use <code>(pixels) of costume (current)</code> rather than costume apple
columns. We use <code>(pixels) of costume (current)</code> rather than `costume apple`
because the latter is always a red apple, so this little program would
get stuck turning it green, instead of alternating colors.

Expand Down Expand Up @@ -777,7 +777,7 @@ sound. But the <code>microphone ( )</code> block has other, simpler options also

- <code>volume</code>: the instantaneous volume when the block is called

- <code>note</code>: the MIDI note number (as in play note) of the main note heard
- <code>note</code>: the MIDI note number (as in `play note`) of the main note heard

- <code>frequency</code>: the frequency in Hz of the main note heard

Expand Down
2 changes: 1 addition & 1 deletion 08-oop-with-procedures.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ The script below demonstrates how this prototyping system can be used to
make counters. We start with one prototype <var>counter</var>, called <var>counter1</var>. We
count this counter up a few times, then create a child <var>counter2</var> and give
it its own <var>count</var> variable, but *not* its own <var>total</var> variable. The <code>next</code>
method always sets counter1’s <var>total</var> variable, which therefore keeps
method always sets `counter1`’s <var>total</var> variable, which therefore keeps
<var>count</var> of the total number of times that *any* <var>counter</var> is incremented.
Running this script should <code>say</code> and <code>think</code> the following lists:

Expand Down
Loading
Loading