Skip to content

Commit f28c8e0

Browse files
committed
markdown source builds
Auto-generated via `{sandpaper}` Source : a8beaa1 Branch : main Author : Tim Dennis <tdennis@library.ucla.edu> Time : 2026-01-22 01:54:07 +0000 Message : Merge pull request #34 from LibraryCarpentry/feat/inputs-outputs Add section on Defining Inputs and Outputs
1 parent d7431d2 commit f28c8e0

File tree

6 files changed

+191
-129
lines changed

6 files changed

+191
-129
lines changed

computation_programming.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,23 @@ exercises: 10
2424

2525
*Decomposition* is crucial in any kind of problem breakdown, but especially so in programming. The computer must be told **precisely** what to do, and in what order, so problems must be broken down into discrete parts and each section coded appropriately.
2626

27-
Suppose we want to find the ten words most commonly used in a text. How might we go about that?
27+
#### Defining Inputs and Outputs
28+
29+
Before we can tell the computer *what* to do (the algorithm), we must clarify *what data* we are working with. Every computational problem involves a transformation:
30+
31+
1. **Input:** What is the starting state? What data do we have? What format is it in?
32+
2. **Output:** What is the desired goal? What should the result look like?
33+
34+
If we don't define these clearly, we cannot design effective steps to bridge the gap.
35+
36+
Suppose we want to find the ten words most commonly used in a text.
37+
38+
**Input:** A digital text file (e.g., a book chapter).
39+
**Output:** A list of the top 10 most frequent words.
40+
41+
The *process* (or algorithm) is the series of steps that turns that specific Input into that specific Output.
42+
43+
How might we go about that?
2844

2945
#### Linear code
3046

config.yaml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#------------------------------------------------------------
2+
# Values for this lesson.
3+
#------------------------------------------------------------
4+
5+
# Which carpentry is this (swc, dc, lc, or cp)?
6+
# swc: Software Carpentry
7+
# dc: Data Carpentry
8+
# lc: Library Carpentry
9+
# cp: Carpentries (to use for instructor training for instance)
10+
# incubator: The Carpentries Incubator
11+
carpentry: 'lc'
12+
13+
# Overall title for pages.
14+
title: 'Introducing Computational Thinking'
15+
16+
# Date the lesson was created (YYYY-MM-DD, this is empty by default)
17+
created: "2022-08-12"
18+
19+
# Comma-separated list of keywords for the lesson
20+
keywords: 'software, data, lesson, The Carpentries'
21+
22+
# Life cycle stage of the lesson
23+
# possible values: pre-alpha, alpha, beta, stable
24+
life_cycle: 'alpha'
25+
26+
# License of the lesson materials (recommended CC-BY 4.0)
27+
license: 'CC-BY 4.0'
28+
29+
# Link to the source repository for this lesson
30+
source: 'https://github.com/LibraryCarpentry/lc-computational-thinking/'
31+
32+
# Default branch of your lesson
33+
branch: 'main'
34+
35+
# Who to contact if there are any issues
36+
contact: 'team@carpentries.org'
37+
38+
# Navigation ------------------------------------------------
39+
#
40+
# Use the following menu items to specify the order of
41+
# individual pages in each dropdown section. Leave blank to
42+
# include all pages in the folder.
43+
#
44+
# Example -------------
45+
#
46+
# episodes:
47+
# - introduction.md
48+
# - first-steps.md
49+
#
50+
# learners:
51+
# - setup.md
52+
#
53+
# instructors:
54+
# - instructor-notes.md
55+
#
56+
# profiles:
57+
# - one-learner.md
58+
# - another-learner.md
59+
60+
# Order of episodes in your lesson
61+
episodes:
62+
- intro.md
63+
- exercise.md
64+
- computation_practice.md
65+
- computation_programming.md
66+
- pseudocode.md
67+
68+
69+
# Information for Learners
70+
learners:
71+
72+
# Information for Instructors
73+
instructors:
74+
75+
# Learner Profiles
76+
profiles:
77+
78+
# Customisation ---------------------------------------------
79+
#
80+
# This space below is where custom yaml items (e.g. pinning
81+
# sandpaper and varnish versions) should live
82+
83+
url: 'https://library-carpentry.org/lc-computational-thinking'
84+
analytics: carpentries
85+
lang: en
86+
87+
88+

md5sum.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@
22
"AUTHORS.md" "543321041272a545f730a8fbec4d66fc" "site/built/AUTHORS.md" "2026-01-22"
33
"CODE_OF_CONDUCT.md" "c93c83c630db2fe2462240bf72552548" "site/built/CODE_OF_CONDUCT.md" "2026-01-22"
44
"LICENSE.md" "b24ebbb41b14ca25cf6b8216dda83e5f" "site/built/LICENSE.md" "2026-01-22"
5-
"config.yaml" "3e3ee236bb414febb63304d020f3fcea" "site/built/config.yaml" "2026-01-22"
5+
"config.yaml" "c7f18a7fa3ac579e78cfe81367bb2b9e" "site/built/config.yaml" "2026-01-22"
66
"index.md" "bd2d349d4978ed3c68bb2b301a671bdc" "site/built/index.md" "2026-01-22"
77
"search.md" "2d215d6e5c915ce30f5a5072d986609f" "site/built/search.md" "2026-01-22"
88
"episodes/intro.md" "e176eef6a3acadfca8817bf38d46bb9f" "site/built/intro.md" "2026-01-22"
99
"episodes/exercise.md" "a2aa30d792c70d1cf39f740a85e108c5" "site/built/exercise.md" "2026-01-22"
1010
"episodes/computation_practice.md" "ddb122e2e242e1587011dea9aba364fb" "site/built/computation_practice.md" "2026-01-22"
11-
"episodes/computation_programming.md" "7e69751fdb0fc9d7d74fb641ae898f0a" "site/built/computation_programming.md" "2026-01-22"
12-
"episodes/pseudocode.md" "0ea2e3e7d977ad7245d0df4868503439" "site/built/pseudocode.md" "2026-01-22"
13-
"episodes/solutions.Rmd" "3c9c1e7239d7d5f5fc849c1d53530b5a" "site/built/solutions.md" "2026-01-22"
11+
"episodes/computation_programming.md" "1ab7575ff080aa8e5cae77579eb08a88" "site/built/computation_programming.md" "2026-01-22"
12+
"episodes/pseudocode.md" "4d40f6d967401096851da13f3cca7eb7" "site/built/pseudocode.md" "2026-01-22"
1413
"instructors/instructor-notes.md" "3e3dd7c81b260ed9ea96b3f927a3dbe0" "site/built/instructor-notes.md" "2026-01-22"
1514
"learners/jargon_busting.md" "28f639571863b330f8d791d02b226821" "site/built/jargon_busting.md" "2026-01-22"
1615
"learners/reference.md" "406421cb0e6eef1d001ebe4c82f0b9e2" "site/built/reference.md" "2026-01-22"
1716
"learners/setup.md" "2ce211390c1f4929a8ce5bb0479031ca" "site/built/setup.md" "2026-01-22"
1817
"profiles/learner-profiles.md" "60b93493cf1da06dfd63255d73854461" "site/built/learner-profiles.md" "2026-01-22"
19-
"renv/profiles/lesson-requirements/renv.lock" "8f6f76231aa047218ce8f4759c854ffd" "site/built/renv.lock" "2026-01-22"
18+
"renv/profiles/lesson-requirements/renv.lock" "31cf7907c75c145ec5732da29620c713" "site/built/renv.lock" "2026-01-22"

pseudocode.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ One way to do that is to check we have coded the workflow correctly *before* we
140140

141141
Write some pseudocode for that step of the process.
142142

143+
::: solution
144+
To prevent accidental deletion of files, we could introduce a step to check whether or not to delete a file, e.g., by using the remove command `rm` in the Unix shell with an `-i` flag. The `-i` flag forces the system to ask for confirmation on whether or not to delete a file. One can answer either **Y** or **N** to the example below.
145+
146+
![Confirming a remove command](fig/code-in-shell.png){alt="RM command in the shell", width="75%"}
147+
:::
148+
143149
::::::::::::::
144150

145151
::: challenge
@@ -175,10 +181,6 @@ Again, a shell script could be used to automate this work. Given that these task
175181

176182
-------------------
177183

178-
Some potential solutions to these practice coding exercises can be found on the [Solutions](/solutions.html) page.
179-
180-
---------------------------------
181-
182184
#### Learning to program
183185

184186
This lesson should help you prepare to learn to code by understanding the process that coders use to break complex problems down into programmable parts.

renv.lock

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"R": {
3+
"Version": "4.5.2",
4+
"Repositories": [
5+
{
6+
"Name": "carpentries",
7+
"URL": "https://carpentries.r-universe.dev"
8+
},
9+
{
10+
"Name": "carpentries_archive",
11+
"URL": "https://carpentries.github.io/drat"
12+
},
13+
{
14+
"Name": "CRAN",
15+
"URL": "https://cran.rstudio.com"
16+
}
17+
]
18+
},
19+
"Packages": {
20+
"renv": {
21+
"Package": "renv",
22+
"Version": "1.1.6",
23+
"Source": "Repository",
24+
"Type": "Package",
25+
"Title": "Project Environments",
26+
"Authors@R": "c( person(\"Kevin\", \"Ushey\", role = c(\"aut\", \"cre\"), email = \"kevin@rstudio.com\", comment = c(ORCID = \"0000-0003-2880-7407\")), person(\"Hadley\", \"Wickham\", role = c(\"aut\"), email = \"hadley@rstudio.com\", comment = c(ORCID = \"0000-0003-4757-117X\")), person(\"Posit Software, PBC\", role = c(\"cph\", \"fnd\")) )",
27+
"Description": "A dependency management toolkit for R. Using 'renv', you can create and manage project-local R libraries, save the state of these libraries to a 'lockfile', and later restore your library as required. Together, these tools can help make your projects more isolated, portable, and reproducible.",
28+
"License": "MIT + file LICENSE",
29+
"URL": "https://rstudio.github.io/renv/, https://github.com/rstudio/renv",
30+
"BugReports": "https://github.com/rstudio/renv/issues",
31+
"Imports": [
32+
"utils"
33+
],
34+
"Suggests": [
35+
"BiocManager",
36+
"cli",
37+
"compiler",
38+
"covr",
39+
"cpp11",
40+
"curl",
41+
"devtools",
42+
"generics",
43+
"gitcreds",
44+
"jsonlite",
45+
"jsonvalidate",
46+
"knitr",
47+
"miniUI",
48+
"modules",
49+
"packrat",
50+
"pak",
51+
"R6",
52+
"remotes",
53+
"reticulate",
54+
"rmarkdown",
55+
"rstudioapi",
56+
"shiny",
57+
"testthat",
58+
"uuid",
59+
"waldo",
60+
"yaml",
61+
"webfakes"
62+
],
63+
"Encoding": "UTF-8",
64+
"RoxygenNote": "7.3.3",
65+
"VignetteBuilder": "knitr",
66+
"Config/Needs/website": "tidyverse/tidytemplate",
67+
"Config/testthat/edition": "3",
68+
"Config/testthat/parallel": "true",
69+
"Config/testthat/start-first": "bioconductor,python,install,restore,snapshot,retrieve,remotes",
70+
"NeedsCompilation": "no",
71+
"Author": "Kevin Ushey [aut, cre] (ORCID: <https://orcid.org/0000-0003-2880-7407>), Hadley Wickham [aut] (ORCID: <https://orcid.org/0000-0003-4757-117X>), Posit Software, PBC [cph, fnd]",
72+
"Maintainer": "Kevin Ushey <kevin@rstudio.com>",
73+
"Repository": "CRAN"
74+
}
75+
}
76+
}

solutions.md

Lines changed: 0 additions & 119 deletions
This file was deleted.

0 commit comments

Comments
 (0)