Full Download Functional Python Programming: Use a functional approach to write succinct, expressive, and efficient Python code, 3rd Edition Lott PDF DOCX
Full Download Functional Python Programming: Use a functional approach to write succinct, expressive, and efficient Python code, 3rd Edition Lott PDF DOCX
com
https://textbookfull.com/product/functional-python-
programming-use-a-functional-approach-to-write-succinct-
expressive-and-efficient-python-code-3rd-edition-lott/
OR CLICK BUTTON
DOWNLOAD NOW
https://textbookfull.com/product/biota-grow-2c-gather-2c-cook-loucas/
textboxfull.com
https://textbookfull.com/product/functional-programming-in-c-how-to-
write-better-c-code-1st-edition-enrico-buonanno/
textboxfull.com
Function Python programming discover the power of
functional programming generator functions lazy evaluation
the built in itertools library and monads Second Edition
Lott
https://textbookfull.com/product/function-python-programming-discover-
the-power-of-functional-programming-generator-functions-lazy-
evaluation-the-built-in-itertools-library-and-monads-second-edition-
lott/
textboxfull.com
https://textbookfull.com/product/python-projects-for-beginners-a-ten-
week-bootcamp-approach-to-python-programming-milliken/
textboxfull.com
https://textbookfull.com/product/teach-your-kids-to-code-a-parent-
friendly-guide-to-python-programming-1st-edition-bryson-payne/
textboxfull.com
https://textbookfull.com/product/effective-python-90-specific-ways-to-
write-better-python-2nd-edition-brett-slatkin/
textboxfull.com
Functional Python
Programming
Third Edition
Steven F. Lott
BIRMINGHAM—MUMBAI
“Python” and the Python logo are trademarks of the Python Software Foundation.
Functional Python Programming
Third Edition
Copyright © 2022 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or
transmitted in any form or by any means, without the prior written permission of the publisher,
except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information
presented. However, the information contained in this book is sold without warranty, either express
or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held
liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and
products mentioned in this book by the appropriate use of capitals. However, Packt Publishing
cannot guarantee the accuracy of this information.
Python is an incredibly versatile language that offers a lot of perks for just about every
group. For the object-oriented programming fans, it has classes and inheritance. When
we talk about functional programming, it has functions as a first-class type, higher-order
functions such as map and reduce, and a handy syntax for comprehensions and generators.
Perhaps best of all, it doesn’t force any of those on the user – it’s still totally OK to write a
script in Python without a single class or function and not feel guilty about it.
Thinking in terms of functional programming, having in mind the goals of minimizing state
and side effects, writing pure functions, reducing intermediary data, and what depends on
what else will also allow you to see your code under a new light. It’ll also allow you to
write more compact, performant, testable, and maintainable code, where instead of writing
a program to solve your problem, you “write the language up”, adding new functions to
it until expressing the solution you designed is simple and straightforward. This is an
extremely powerful mind shift – and an exercise worth doing. It’s a bit like learning a
new language, such as Lisp or Forth (or German, or Irish), but without having to leave the
comfort of your Python environment.
Not being a pure functional language has its costs, however. Python lacks many features
functional languages can use to provide better memory efficiency and speed. Python’s
strongest point remains its accessibility – you can fire up your Python interpreter and
start playing with the examples in this book right away. This interactive approach allows
exploratory programming, where you test ideas easily, and only later need to incorporate
them into a more complex program (or not – like I said, it’s totally OK to write a simple
script).
This book is intended for people already familiar with Python. You don’t need to know
much about functional programming – the book will guide you through many common
approaches, techniques, and patterns used in functional programming and how they can
be best expressed in Python. Think of this book as an introduction – it’ll give you the basic
tools to see, think, and express your ideas in functional terms using Python.
Ricardo Bánffy
Steven has been working with Python since the ‘90s, building a variety of tools and
applications. He’s written a number of titles for Packt Publishing, include Mastering
Object-Oriented Python, Modern Python Cookbook, and Functional Python Programming.
He’s a technomad, and lives on a boat that’s usually located on the east coast of the US. He
tries to live by the words, “Don’t come home until you have a story.”
About the reviewers
Alex Martelli is a Fellow of the Python Software Foundation, a winner of the Frank
Willison Memorial Award for contributions to the Python community, and a top-page
reputation hog on Stack Overflow. He spent 8 years with IBM Research, then 13 years
at Think3 Inc., followed by 4 years as a consultant, and lately 17 years at Google. He
has taught programming languages, development methods, and numerical computing at
Ferrara University and other venues.
Books he has authored or co-authored include two editions of Python Cookbook, four
editions of Python in a Nutshell, and a chapter in Beautiful Teams. Dozens of his interviews
and tech talks at conferences are available on YouTube. Alex’s proudest achievement are
the articles that appeared in Bridge World (January and February 2000), which were hailed
as giant steps towards solving issues that had haunted contract bridge theoreticians for
decades, and still get quoted in current bridge-theoretical literature.
Tiago Antao has a BEng in Informatics and a PhD in Life Sciences. He works in the
Big Data space, analyzing very large datasets and implementing complex data processing
algorithms. He leverages Python with all its libraries to carry out scientific computing and
data engineering tasks. He also uses low-level programming languages like C, C++, and
Rust to optimize critical parts of algorithms. Tiago develops on an infrastructure based on
AWS, but has used on-premises computing and scientific clusters for most of his career.
While he currently works in industry, he also has exposure to the academic side of scientific
computing, with two data analysis postdocs at the universities of Cambridge and Oxford,
and a research scientist position at the University of Montana, where he set up, from
scratch, the scientific computing infrastructure for the analysis of biological data.
Preface xxi
Index 53
Preface
Functional programming offers a variety of techniques for creating succinct and expressive
software. While Python is not a purely functional programming language, we can do a
great deal of functional programming in Python.
Python has a core set of functional programming features. This lets us borrow many design
patterns and techniques from other functional languages. These borrowed concepts can
lead us to create elegant programs. Python’s generator expressions, in particular, negate
the need to create large in-memory data structures, leading to programs that may execute
more quickly because they use fewer resources.
We can’t easily create purely functional programs in Python. Python lacks a number of
features that would be required for this. We don’t have unlimited recursion, for example,
we don’t have lazy evaluation of all expressions, and we don’t have an optimizing compiler.
There are several key features of functional programming languages that are available
in Python. One of the most important ones is the idea of functions being first-class ob-
jects. Python also offers a number of higher-order functions. The built-in map(), filter(),
and functools.reduce() functions are widely used in this role, and less obvious are
functions such as sorted(), min(), and max().
In some cases, a functional approach to a problem will also lead to extremely high-
performance algorithms. Python makes it too easy to create large intermediate data
structures, tying up memory (and processor time). With functional programming de-
sign patterns, we can often replace large lists with generator expressions that are equally
expressive but take up much less memory and run much more quickly.
xxii Preface
We’ll look at the core features of functional programming from a Python point of view.
Our objective is to borrow good ideas from functional programming languages and use
those ideas to create expressive and succinct applications in Python.
This is not intended as a tutorial on Python. This book assumes some familiarity with the
language and the standard library. For a foundational introduction to Python, consider
Learn Python Programming, Third Edition: https://www.packtpub.com/product/learn-p
ython-programming-third-edition/9781801815093.
While we cover the foundations of functional programming, this is not a complete review of
the various kinds of functional programming techniques. Having an exposure to functional
programming in another language can be helpful.
• Library modules to help create functional programs. This is the subject of the
remaining chapters of the book. Chapter 12 includes both fundamental language and
library topics.
Chapter 2, Introducing Essential Functional Concepts, delves into central features of the
functional programming paradigm. We’ll look at each in some detail to see how they’re
implemented in Python. We’ll also point out some features of functional languages that
don’t apply well to Python. In particular, many functional languages have complex type-
matching rules required to support compiling and optimizing.
Chapter 3, Functions, Iterators, and Generators, will show how to leverage immutable Python
objects, and how generator expressions adapt functional programming concepts to the
Python language. We’ll look at some of the built-in Python collections and how we can
leverage them without departing too far from functional programming concepts.
Chapter 4, Working with Collections, shows how you can use a number of built-in Python
functions to operate on collections of data. This chapter will focus on a number of relatively
simple functions, such as any() and all(), which reduce a collection of values to a single
result.
Chapter 6, Recursions and Reductions, teaches how to design an algorithm using recursion
and then optimize it into a high-performance for statement. We’ll also look at some other
reductions that are widely used, including collections.Counter().
Chapter 7, Complex Stateless Objects, showcases a number of ways that we can use immutable
tuples, typing.NamedTuple, and the frozen @dataclass instead of stateful objects. We’ll
also look at the pyrsistent module as a way to create immutable objects. Immutable
objects have a simpler interface than stateful objects: we never have to worry about
abusing an attribute and setting an object into some inconsistent or invalid state.
Chapter 8, The Itertools Module, examines a number of functions in the itertools standard
library module. This collection of functions simplifies writing programs that deal with
collections or generator functions.
xxiv Preface
Chapter 9, Itertools for Combinatorics – Permutations and Combinations, covers the combina-
toric functions in the itertools module. These functions are more specialized than those
in the previous chapter. This chapter includes some examples that illustrate ill-considered
use of these functions and the consequences of combinatoric explosion.
Chapter 10, The Functools Module, focuses on how to use some of the functions in the
functools module for functional programming. A few functions in this module are more
appropriate for building decorators, and they are left for Chapter 12, Decorator Design
Techniques.
Chapter 11, The Toolz Package, covers the toolz package, a number of closely related
modules that help us write functional programs in Python. The toolz modules parallel
the built-in itertools and functools modules, providing alternatives that are often more
sophisticated and make better use of curried functions.
Chapter 12, Decorator Design Techniques, covers how we can look at a decorator as a way
to build a composite function. While there is considerable flexibility here, there are also
some conceptual limitations: we’ll look at ways that overly complex decorators can become
confusing rather than helpful.
Chapter 13, The PyMonad Library, examines some of the features of the PyMonad library.
This provides some additional functional programming features. It also provides a way to
learn more about monads. In some functional languages, monads are an important way to
force a particular order for operations that might get optimized into an undesirable order.
Since Python already has strict ordering of expressions and statements, the monad feature
is more instructive than practical.
Chapter 14, The Multiprocessing, Threading, and Concurrent.Futures Modules, points out
an important consequence of good functional design: we can distribute the processing
workload. Using immutable objects means that we can’t corrupt an object because of poorly
synchronized write operations.
Chapter 15, A Functional Approach to Web Services, shows how we can think of web services
as a nested collection of functions that transform a request into a reply. We’ll see ways to
Preface xxv
leverage functional programming concepts for building responsive, dynamic web content.
Chapter 16, A Chi-Squared Case Study, is a bonus, online-only case study applying a number
of functional programming techniques to a specific exploratory data analysis problem. We
will apply a 𝜒 2 statistical test to some complex data to see if the results show ordinary
variability, or if they are an indication of something that requires deeper analysis. You can
find the case study here: https://github.com/PacktPublishing/Functional-Python-P
rogramming-3rd-Edition/blob/main/Bonus_Content/Chapter_16.pdf.
Some of the examples use exploratory data analysis (EDA) as a problem domain to show
the value of functional programming. Some familiarity with basic probability and statistics
will help with this. There are only a few examples that move into more serious data science.
Python 3.10 is required. The examples have also been tested with Python 3.11, and work
correctly. For data science purposes, it’s often helpful to start with the conda tool to create
and manage virtual environments. It’s not required, however, and readers should be able
to use any available Python.
Additional packages are generally installed with pip. The command looks like this:
In some cases, the reader will notice that the code provided on GitHub includes partial
solutions to some of the exercises. These serve as hints, allowing the reader to explore
alternative solutions.
In many cases, exercises will need unit test cases to confirm they actually solve the problem.
These are often identical to the unit test cases already provided in the GitHub repository.
The reader should replace the book’s example function name with their own solution to
confirm that it works.
In some cases, the exercises suggest writing a response document to compare and contrast
multiple solutions. It helps to find a mentor or expert who can help the reader by reviewing
these small documents for clarity and completeness. A good comparison between design
approaches will include performance measurements using the timeit module to show the
performance advantages of one design over another.
Conventions used
There are a number of text conventions used throughout this book.
CodeInText: Indicates code words in the text, database table names, folder names, filenames,
file extensions, pathnames, dummy URLs, user input, and Twitter handles. For example:
“Python has other statements, such as global or nonlocal, which modify the rules for
variables in a particular namespace.”
Preface xxvii
Bold: Indicates a new term, an important word, or words you see on the screen, such as in
menus or dialog boxes. For example: “The base case states that the sum of a zero-length
sequence is 0. The recursive case states that the sum of a sequence is the first value plus
the sum of the rest of the sequence.”
print("Hello, World!")
Get in touch
Feedback from our readers is always welcome.
General feedback: Email feedback@packtpub.com, and mention the book’s title in the
subject of your message. If you have questions about any aspect of this book, please email
us at questions@packtpub.com.
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you have found a mistake in this book we would be grateful if you would
report this to us. Please visit https://subscription.packtpub.com/help, click on the
Submit Errata button, search for your book, and enter the details.
Piracy: If you come across any illegal copies of our works in any form on the Internet,
xxviii Preface
we would be grateful if you would provide us with the location address or website name.
Please contact us at copyright@packtpub.com with a link to the material.
If you are interested in becoming an author: If there is a topic that you have ex-
pertise in and you are interested in either writing or contributing to a book, please visit
http://authors.packtpub.com.
https://packt.link/r/1803232579
Your review is important to us and the tech community and will help us make sure we’re
delivering excellent quality content.
Random documents with unrelated
content Scribd suggests to you:
From the foregoing calculation, the quantity of rubble masonry is 3,209.2
cu. ft. Taking 25 cu. ft. to 1 perch, 3,209.2 ÷ 25 = 128.4 perches, which at
$5.23 per perch makes the total cost of rubble masonry $671.53.
Ashlar[9]
Square
Feet
Quantities
Facing for cellar walls, 79' 10" × 2' 2" 173.0
Porch piers, 29' 6" × 1' 6" 43.9
Total ashlar 216.9
Cost
The estimated cost of ashlar is based on the following analysis of the cost
of 1 square foot of ashlar:
Cost of stone, bluestone facing $.40
Hauling stone .03
Mortar .01
Labor, estimating 64 square feet per day of 8 hours,
for two masons and one laborer:
Two masons, at $3.20 per day .10
One laborer at $2 per day .03
Cost per square foot $.57
Summary
From the foregoing quantities, the ashlar amounts to 216.9 square feet,
which, at 57 cents per square foot, will make the total cost of ashlar $123.63.
Cut Stone
Cost
Per Total
Foot Cost
Quantities and Cost
Base, or ground sill, extending around
porches (except under stone steps) and
along exposed main walls, 172 ft., 5" × 11"
and 5" × 13" dressed and chamfered sandstone $1.00 $172.00
Cost
Per Total
Foot Cost
Water-table, extending around main walls, 181 ft. 2 in.,
6" × 10" dressed and chamfered sandstone .85 153.99
Lintel course, extending over brick walls,
125 ft., 6" × 10" dressed sandstone .85 106.25
Twelve dressed sandstone window sills, cut
with lug and drip, 55¾ ft., 5" × 8" .65 36.24
Cut-stone jambs and lintel for main door,
21½ ft., 10" × 12", sandstone 1.75 37.63
One front door sill, 5¾ ft., 6" × 10", sandstone 1.10 6.33
Coping on area walls, 9 ft., 3" × 16", sandstone .60 5.40
Front and side porch steps, 59 ft., 8" × 12",
8" × 12", dressed sandstone 1.25 73.75
Eight bluestone steps for cellar,
outside entrance, 4' × 12" × 2" .35 11.20
Bluestone lintel for kitchen fireplace, 6' × 12" × 6" 1.20 7.20
Cut stone for main chimney 25.00
Cost to set cut stone, 20 per cent. 127.00
Total cost of cut stone $761.99
Cubic
Quantities
Yard
Footings, as per Excavation for Wall Footings,
535.9 cu. ft. ÷ 27 19.8
Square Square
Feet Yard
Concrete floor:
Area of cellar excavation 1,740.0
Deduct area of footings 643.3
1,096.7
Add for 6-inch strip over inner projection
of wall footings, 165' × 6" 82.5
Add for projection on both sides of interior
walls, 126' × 6" 63.0
Add for projection over chimney footing,
33' × 6" 16.5
Total area of concrete floor 1,258.7 = 139.9
Cost
The estimate for concrete footings is based on the analyses of costs given
in Estimating and Calculating Quantities, Part 1, and is $5.10 per cubic yard for
a 1-3-5 mixture.
The estimate for the concrete floor is arrived at as follows:
The concrete will be a 1-3-6 mixture. According to Estimating
and Calculating Quantities, Part 1, this mixture costs $4.92 per
cubic yard. According to the same section, 25 cents must be
added to this cost for extra labor, bringing the total up to $5.17
per cubic yard. If the concrete floor is 4 inches thick, the cost
per square yard will be ⁴/₃₆ × 5.17 = 57 cents, approximately.
The top coat, according to Estimating and Calculating
Quantities, Part 1, is 40 cents. Therefore, the total cost of the
concrete floor per square yard is 57 + 40 = 97 cents.
Summary
Footing concrete, as per foregoing figures,
19.8 cu. yd. at $5.10 per cubic yard $100.98
Concrete floor, 139.9 sq. yd.
at 97 cents per square yard 135.70
Total cost of concrete $236.68
BRICKWORK
4. In estimating the brickwork, openings have been deducted, thus
practically giving “kiln count,” so that the analyses of prices given heretofore
will apply. If openings had not been deducted, the prices would be 15 per cent.
lower.
Pressed Brick
No .
Quantities
Brick
Facing exterior walls, same length as stone
lintel course, 125' × 8' = 1,000 sq. ft. at
7½ bricks per square foot 7,500
Square No.
Deduct for Openings:
Feet Brick
Nine windows, total width 32' X 6' 6" high 208.0
Two casement windows, total width
7' 4" × 8' high 58.7
One lavatory window, total width
2' X 6" × 5' 6" 13.8
Main door, 5' 5" × 8' 9" 47.4
Total deductions 327.9
327.9 × 7½ = 2,459
Number of brick 5,041
Add 5 per cent. for waste 252
Total pressed brick 5,293
Cost
The cost of pressed brickwork is based on the analysis given in Estimating
and Calculating Quantities, Part 1, and is $53.71 per thousand.
Summary
From the preceding estimate of quantities, the
number of pressed brick laid is 5,041, which,
at $53.71 per M, will cost $270.75
Pressed brick, not laid, 252, at $30 per M 7.56
Total cost of pressed brickwork $278.31
Common Brick
No .
Quantities
Brick
Backing exterior pressed-brick walls, 8½ in. thick,
5,041 × 2 = 10,082
Backing behind lintel course,
9" X 125' × 8" at 15 brick per sq. ft. 1,406
Interior cellar walls, 28' 4" × 8' = 226.7 sq. ft.
(17-inch wall) at 30 brick per square foot 6,801
Deduct for three openings, 12' 3" total width
× 6' 6" height = 79.6 sq. ft. at 30 brick per square foot 2,388 4,413
Interior wall, 8½" thick, 43' 9" × 8', 350 sq. ft.
at 15 brick per square foot 5,250
Chimney, principal (flues figured solid), approximately
920 cu. ft., at 22½ brick per cubic foot 20,700
Chimney, rear, approximately 245 cu. ft.,
at 22½ brick per cubic foot 5,513
Trap pits, 46 sq. ft., at 7½ brick per square foot 345
46,303
Add 5 per cent. for waste 2,315
Total common brick 48,618
Cost
The cost of the common brickwork is based on the analysis given in
Estimating and Calculating Quantities, Part 1, and is $16.68 per thousand for
lime-cement mortar.
Summary
According to the estimate of quantities,
the number of common brick laid is 46,303,
which, at $16.68, will cost $ 772.33
Common bricks, not laid, 2,315, at $8 18.52
Molded brick and terra-cotta cap for rear chimney 10.00
Total cost of common brickwork $ 800.85
CARPENTRY
5. In estimating carpentry work, it is advisable to make a tabulated list of
the various sizes of joists, rafters, etc., giving the number and dimensions of
each size. In this way, any error in calculation or change in price can be
corrected with little difficulty.
As house-framing timbers and boards are sold at the yards in even lengths,
as 10 feet, 12 feet, 14 feet, etc., uneven, or odd, measurements must be
figured in even lengths from which they can be cut. Thus, if a stick 14 feet 7
inches in length is required, a 16-foot stick must be ordered.
Usually, the price per thousand feet, board measure, increases as longer
sticks are used, although the practice varies in different localities. For example,
in most localities hemlock timber in 10-, 12-, or 14-foot lengths is all one price
per thousand, but a thousand feet, board measure, of 16-foot lengths costs
more, and 18-foot lengths is still more expensive. The price of yellow pine,
spruce, fir, etc. is usually constant up to 20-foot lengths, but from that length
on the prices increase. The price of white-pine boards in most localities
increases with their width. The hardwoods can be usually obtained in any
reasonable length, the price increasing with the quality of the lumber more
than with the length of the stick.
It can thus be seen that in house framing it is usually cheaper to use short
sticks than long ones. However, for long members, a long stick is cheaper,
because the extra cost that would be incurred in splicing two short sticks would
more than offset the cheapness of the material. Of course, when very long
sticks are required, say sticks 30 feet or more in length, a splice is cheaper,
owing to the difficulty of obtaining them and their very excessive price.
No set rules can be laid down as to what size timber should be ordered,
and every architect and builder should be governed by the prices in the locality
where the house is to be put up.
Floor Framing,
First Story
Linear Feet
Quantities
Feet B. M.
Joists, 3" × 10"; 2½ ft. B. M., per lin. ft.:
6 pieces, each 14' 6", order 16' 96
2 pieces, each 15' 3", order 16' 32
1 piece, 16' 3", order 18' 18
5 pieces, each 17' 6", order 18' 90
1 piece, 12' 6", order 14' 14
6 pieces, each 11' 0", order 12' 72
1 piece, 9' 6", order 10' 10
18 pieces, each 14', order 14' 252
1 piece, 11' 6", order 12' 12
3 pieces, each 10' 6", order 12' 36
1 piece, 9' 4", order 10' 10
6 pieces, each 24', order 24' 144
1 piece, 11' 4", order 12' 12
2 pieces, each 20' 6", order 22' 44
6 pieces, each 20', order 20' 120
4 pieces, each 21', order 22' 88
2 pieces, each 7', cut out of 14' 14
2 pieces, each 13', order 14' 28
1 piece, 10', order 10' 10
Total 1,102 2,755
Floor Framing,
Second Story
Linear Feet
Quantities
Feet B. M.
Girder, 6" × 12"; 6 ft. B. M., per lin. ft.:
1 piece, 8' 9", order 10' 10 60
Joists, 2" × 10"; 1⅔ft. B. M., per lin. ft.:
15 pieces, each 14', order 14' 210
2 pieces, each 15' 6", order 16' 32
5 pieces, each 17', order 18' 90
3 pieces, each 15', order 16' 48
14 pieces, each 16', order 16' 224
2 pieces, each 7', cut out of 14' 14
2 pieces, each 10', order 10' 20
4 pieces, each 11', order 12' 48
7 pieces, each 24', order 24' 168
3 pieces, each 20' 6", order 22' 66
4 pieces, each 12' 6", order 14' 56
2 pieces, each 13' 6", order 14 28
Total 1,004 1,673
Floor Framing,
Attic
Linear Feet
Quantities
Feet B. M.
Joists, 2" × 10"; 1⅔ ft. B. M., per lin. ft.:
15 pieces, each 14', order 14' 210
2 pieces, each 15' 6", order 16' 32
5 pieces, each 17', order 18' 90
3 pieces, each 15', order 16' 48
14 pieces, each 16', order 16' 224
2 pieces, each 7', cut out of 14' 14
2 pieces, each 10', order 10' 20
4 pieces, each 11', order 12' 48
7 pieces, each 24', order 24' 168
3 pieces, each 20' 6", order 22' 66
4 pieces, each 12' 6", order 14' 56
2 pieces, each 13' 6", order 14' 28
Total 1,004 1,673
Floor Framing,
Front Porch
Linear Feet
Quantities
Feet B. M.
Joists, 3" × 9"; 2¼ ft. B. M., per lin. ft.:
3 pieces, each 7', cut out of 14' 21
1 piece, 6' 9", cut out of 14' 7
2 pieces, each 10', order 10' 20
1 piece, 8' 6", order 10' 10
Total 58 131
Joists, 2" × 6"; 1 ft. B. M., per lin. ft.:
2 pieces, each 21' 6", order 22' 44
2 pieces, each 19' 3", order 20' 40
4 pieces, each 8', cut out of 16' 32
1 piece, 10' 3", order 12' 12
6 pieces, each 9', order 10' 60
2 pieces, each 4' 6", cut out of 10' 10
5 pieces, each 6', cut out of 12' 30
3 pieces, each 2', cut out of 12' 6
4 pieces, each 5', cut out of 10' 20
3 pieces, each 9', order 10' 30
Total 284 284
Floor Framing,
Back Porches
Linear Feet
Quantities
Feet B. M.
Joists, 2" × 6"; 1 ft. B. M., per lin. ft.:
2 pieces, each 21', order 22' 44
3 pieces, each 8', order 8' 24
Total 68 68
Bridging
Linear Feet
Quantities
Feet B. M.
2" × 4"; ⅔ ft. B. M., per lin. ft.:
First floor, 170 pieces, each 1' 6" 255
Second floor, 138 pieces, each 1' 6" 207
Third floor, 138 pieces, each 1' 6" 207
Total 669 446
Main-Roof Framing[11]
Linear Feet
Quantities
Feet B. M.
Rafters, 2" × 6"; 1 ft. B. M., per lin. ft.:
15 pieces, each 20', order 20' 300
14 pieces, each 19' 3", order 20' 280
1 piece, 18', order 18' 18
2 pieces, each 16', order 16' 32
2 pieces, each 14', order 14' 28
1 piece, 13' 4", order 14' 14
3 pieces, each 10' 6", order 12' 36
3 pieces, each 8' 6", order 10' 30
1 piece, 6' 9", order 8' 8
3 pieces, each 5', cut out of 16' 16
3 pieces, each 3', cut out of 10' 10
4 pieces, each 17', order 18' 72
1 piece, 12' 6", order 14' 14
1 piece, 10' 9", order 12' 12
2 pieces, each 9', order 10' 20
1 piece, 7', order 8' 8
18 pieces, each 9' 6", order 10' 180
2 pieces, each 13', order 14' 28
2 pieces, each 7' 9", cut out of 16' 16
2 pieces, each 6' 6", cut out of 14' 14
4 pieces, each 3' 6", cut out of 14' 14
4 pieces, each 8', cut out of 16' 32
2 pieces, each 11', order 12' 24
8 pieces, each 5' 3", cut out of 12' 48
1 piece, 6', cut out of 10' 6
2 pieces, each 2', cut out of 10' 4
8 pieces, each 11', order 12' 96
Total 1,360 1,360
Porch-Roof Framing
Linear Feet
Quantities
Feet B. M.
Rafters, 2" × 6"; 1 ft. B. M., per lin. ft.:
2 pieces, each 9' 6", order 10' 20
22 pieces, each 8' 6", order 10' 220
4 pieces, each 6' 6", cut out of 14' 28
8 pieces, each 7', cut out of 14' 56
2 pieces, each 11', order 12' 24
Total 348 348
Wall Studding
Linear Feet
Quantities
Feet B. M.
Wall plates, 4" × 11"; 3⅔ ft. B. M., per lin. ft.:
10 pieces, each 18', order 18' 180 660
Studs, 2" × 5"; ⁵/₆ ft. B. M., per lin. ft.:
[12]63 pieces, each 21', order 22' 1,386
106 pieces, each 12', order 12' 1,272
20 pieces, each 20', order 20' 400
10 pieces, each 8' 6", order 10' 100
Total 3,158 2,632
Partition Studding
Linear Feet
Quantities
Feet B. M.
First floor, 2" × 4"; ⅔ ft. B. M., per lin. ft.:
Studs, 160 pieces, each 9' 9", order 10' 1,600
Sills, 16 pieces, each 15', order 16' 256
Total 1,856 1,237
Second floor, 2" × 4"; ⅔ ft. B. M., per lin. ft.:
Studs, 180 pieces, each 9' 9", order 10' 1,800
Sills, 10 pieces, each 15', order 16' 160
Total 1,960 1,307
Attic, 2" × 4"; ⅔ ft. B. M., per lin. ft.:
Studs, 54 pieces, each 8' 9", order 10' 540
Studs, 133 pieces, each 6' 6", cut from 14' 938
Total 1,478 985
Miscellaneous
Linear Feet
Quantities
Feet B. M.
Lookouts:
50 pieces, each 3" × 1" × 2', cut from 8' 25
37 pieces, each 6" × 1" × 2', cut from 8' 37
Furring, for brick walls, 1" × 2"; ⅙ ft. B. M., per lin. ft.:
125 pieces, each 11', order 12' 1,500 250
Grand total of framing 18,578
Cost
The price of the framing is based on the following cost of 1,000
feet board measure of hemlock, which includes framing.
1,000 ft. of hemlock $28.00
Nails and spikes, allowing 100 lb. to 3,000 ft.
of lumber, at $2 per 100 pounds .67
[13]Cost of framing, per 1,000 feet of lumber 12.00
Cost per thousand feet B. M. $40.67
Summary
The amount of material, as previously estimated, is 18,578 ft.
B. M., which, at $40.67 per M, will make the total cost of
framing $755.57.
Sheathing
Feet
Quantities
B. M.
Main roof, 2,200 sq. ft. × 1 in 2,200
Tower roof, 370 sq. ft. × 1 in 370
Porch roof, 637 sq. ft. × 1 in 637
Outside walls, laid diagonally,
2,417 sq. ft. + 10 per cent. 2,659
Total sheathing 5,866
Shingles
Quantities
Area to be covered (see wall sheathing),
2,417 sq. ft.= 24.2 squares
Shingles, 4 in. wide, and 5 in. exposure,
number per square 720
Number of shingles required, 24.2 × 720 17,424
Add 5 per cent. for waste 871
Total shingles 18,295
Cost
The cost of sheathing in place is assumed to be the same
as that for hemlock lumber, $40.67 per M. The total sheathing
is 5,866 square feet, which, at $40.67 per M, will make the
cost of sheathing $238.57.
The cost of shingles is based on the following analysis of
the cost of 1,000 shingles in place:
1,000 shingles XXXX $ 5.50
[14]Labor: one man can lay about 700 shingles per day;
wages being $3.20, 1,000 will cost 4.57
Nails (about) .25
Cost per thousand $10.32
Flooring
Square
Quantities
Feet
First floor, area (net) 1,312
Second floor, area (net) 1,312
Attic floor, area (net) 1,071
Porch floors, area (net) 523
Hemlock Underflooring
Unmatched underflooring is used under the first and second
floor. Its quantity is 1,312 × 2 = 2,624 feet B. M.
Rift-Sawed Yellow-Pine
Finish Flooring
The total area of the first, second, and third floors is 3,695
square feet. Adding 25 per cent. for waste, the quantity of ⅞-
inch flooring is 3,695 square feet + (3,695 × .25) = 4,619 feet
B. M.
Yellow-Pine
Porch Flooring
Increasing the net area of the porch floor by 25 per cent.,
the flooring required is 523 square feet + (523 × .25) = 654
feet B. M.
Cost
The estimated cost of flooring may be analyzed as follows:
Cost of 1,000 Feet B. M., Rough Flooring
[15]1,000 ft. B. M., hemlock $27.00
Labor 10.00
Nails, 33 lb., at $2 per 100 pounds .67
Cost per thousand feet B. M. $37.67
Summary
Hemlock, 2,624 ft. B. M., at $37.67 per M $98.85
Rift-sawed yellow pine, 4,619 ft. B. M., at $71.67 per M 331.04
Yellow pine, 654 ft. B. M., at $62.17 per M 40.66
Total cost of flooring $470.55
Porch Ceiling,
Yellow Pine
Feet
Quantities
B. M.
Porch ceiling, same as porch flooring 654
Cost
The cost of yellow-pine ceiling is $45 per thousand feet B. M. Since there is
no white lead to be used and the joints are not struck, $11 will pay for laying
it. The nails will cost 67 cents, which will bring the cost per thousand feet B.
M., up to $56.67. Therefore, 654 feet B. M., yellow-pine ceiling, at $56.67 per
thousand, will cost $37.06.
Cornice, Spandrels, Etc.,
White-Pine Dressed Lumber
Cost
Cornice, 393 lin. ft., at 50 cents per foot $196.50
Spandrels, 357 lin. ft., at 12 cents per foot 42.84
Base, 128 lin. ft., at 6 cents per foot 7.68
16 porch posts, 8" × 8" × 9' at $4 each 64.00
Total $311.02
Summary
Yellow-pine ceiling $ 37.06
White-pine dressed lumber 311.02
Total $348.08
ROOFING
6. Roof framing and sheathing are included in the estimate for carpentry.
Following are given the estimates for slating and miscellaneous roof items:
Slating
Quantities Squares
Main and dormer roofs 22.0
Porch roof 6.4
Tower roof 3.7
32.1
Cost
The price of slating per square is given in Table XII, Estimating and
Calculating Quantities, Part 1. Bangor slating costs $8 per square. On account
of the curved tower and the number of hips and valleys, and because the
measurement just given is actual measurement, the price will be put at $10
per square. Thus, the cost of 32.1 squares at $10 will be $321.
Miscellaneous Items[16]
Three-Coat Work
Square Square
Quantities Feet Yards
First-story walls, 542' × 9' 9⅜" 5,284.5
First-story ceiling (take measurement of flooring) 1,312.0
Second-story walls, 609' × 9' 5,481.0
Second-story ceiling 1,312.0
Attic walls, 190' × 8' + 156' × 6' 2,456.0
Attic ceiling 831.0
Total of three-coat plastering 16,676.5 1,853
Two-Coat Work
Square Square
Quantities Feet Yards
Cellar ceiling, use same measurements
as for concrete cellar floor 139.9
Cornices
Linear
Quantities
Feet
Cornice, 147' of 2' girth 147
Cornice, 493' of 1' girth 493
Cost
The cost of three-coat plastering is given in Estimating and
Calculating Quantities, Part 1, as 31 cents per square yard, and
two-coat work, as 23 cents per square yard. According to the
same section, lathing costs 12 cents per square yard.
Therefore, lathing and plastering for three-coat work cost 43
cents per square yard, and for two-coat work, 35 cents per
square yard.
The assumed cost of plain, run stucco cornice per linear
foot of 2-foot girth is 31½ cents, and the cost per linear foot of
that having a 1-foot girth is 27 cents.
Summary
From the preceding estimates of quantities and costs, the
following figures are obtained:
1,853 sq. yd. of three-coat work,
at 43 cents per square yard $ 796.79
139.9 sq. yd. of two-coat work,
at 35 cents per square yard 48.97
147 ft. of cornice at 31½ cents 46.31
493 ft. of cornice at 27 cents 133.11
Total cost of plastering $1,025.18
JOINERY
8. As there are so many different sizes in the joinery work, no attempt has
been made to make detailed estimates of the cost of each; but the general
method of obtaining the costs is that given in the articles on Joinery, in
Estimating and Calculating Quantities, Part 1. Since the quality of the work
varies in different parts of the building it will be found that one unit price will
not be sufficient, but experience is needed to fix the unit price for different
classes of work.
Summary
First floor $ 77.13
Second floor 59.34
Attic 22.20
Total cost of door frames $158.67
Doors, Attic
Summary
First story $131.78
Second story 66.85
Attic 26.30
Total cost of doors $224.93
Window Frames,
First Story
Window Frames,
Attic
Summary
Cellar $ 9.97
First story in brick walls 80.51
First story in frame 18.04
Second story 93.86
Attic 51.94
Total cost of window frames $254.32
Window Sash,
Cellar
Quantities and Cost
1½-inch white pine, glazed (double American),
price not including hardware:
1 sash, 3 lights, 13" × 10" $ 1.14
2 sashes, single light, 16" × 10", at 47 cents each .94
4 sashes, 2 lights, 14" × 10", at 82 cents each 3.28
3 sashes, 2 lights, 11" × 10", at 64 cents each 1.92
2 sashes, 2 lights, 13" × 10", at 76 cents each 1.52
1 sash, 3 lights, 11" × 10" .96
Total $ 9.76
Window Sash,
First Story
Window Sash,
Second Story
Window Sash,
Attic
Screen Frames
for Porch
Summary
Cellar $ 9.76
First story 120.10
Second story 107.70
Attic 69.45
Screens 10.26
Total cost of window sash $ 317.27
Cellar Stairs
Back Stairs
Main Stairs
Miscellaneous
Interior Joinery
Baseboard
First story:
Chestnut, ⅞" × 6", with molding worked on face,
tongued into surbase, 1⅛" × 6", 139 ft.,
at 30 cents per linear foot $ 41.70
White pine, ⅞" × 9", plain, 90 ft.,
at 33 cents per linear foot 29.70
Second story:
White pine, ⅞" × 9", molded, 300 ft.,
at 33 cents per linear foot 99.00
Attic:
White pine, ⅞" × 6", molded, 290 ft., at 24 cents 69.60
Total $240.00
Wainscoting
First story:
Chestnut, ⅞" × 2½", beaded and matched boards,
4 ft. high, 33 ft. long, 132 sq. ft.,
at 8 cents per square foot, dining room $ 10.56
Molded cap, 1½" × 1½", 33 ft., at 3 cents per foot .99
Chestnut, paneled, 67' × 4' high = 268 sq. ft.,
at 35 cents per square foot 93.80
Molded cap, 1¼" × 4", 67 ft., at 10 cents per foot 6.70
Second story (bathroom):
White pine, ⅞" × 2½", matched boards, 4 ft. high,
128 sq. ft., at 8 cents per square foot 10.24
Molded cap, 1½" × 1½", 32 ft., at 3 cents per foot .96
Total $123.25
Picture Molding
Chestnut, 3" × 1½", 231 ft., at 9 cents $ 20.79
China Closet
Chestnut, dressed, 97 ft. B. M., at 10 cents per foot $ 9.70
Crown molding, 1" × 3", 8 ft., at 8 cents per foot .64
Labor: 1 man, 2 days, at $3.20 6.40
Total $ 16.74
Shelving
No. 2 white pine, 50 ft. B. M., at 4½ cents per foot $ 2.25
Labor: 1 man, 1 day, at $3.20 3.20
Total $ 5.45
Summary
Baseboard $240.00
Wainscoting 123.25
Picture molding 20.79
China closet 16.74
Shelving 5.45
Total cost of miscellaneous interior joinery $406.23
Moldings
356 ft. crown molding, 1" × 4", at 5½ cents $ 19.58
356 ft. bed molding, 1" × 3", at 4 cents 14.24
356 ft. bed molding, 1" × 1½", at 3 cents 10.68
74 ft. bed molding, 1" × 2", at 3 cents 2.22
356 ft. bed molding, ½" × ⅞", at 1½ cents 5.34
64 ft. neck molding, at 1 cent .64
36 ft. cove molding, ⅞" × 1⅛", at 3 cents 1.08
White pine:
35 ft. triglyphs, at 10 cents 3.50
207 turned balusters, 2" × 1' 6", for porches, at 10 cents 20.70
92 ft. molded hand rail, 5" × 3", at 11 cents 10.12
92 ft. bottom rail, 5" × 3", at 11 cents 10.12
200 dentils, 2" × 2" × 3", at 1½ cents 3.00
137 ft. window cap, 3" × 1½", at 3 cents 4.11
23 ft. B. M., for balustrade posts, at 4½ cents 1.04
Casing for circular window 1.00
Semicircular head-casing over outside door in dormer 2.00
Total cost of exterior work $109.37
HARDWARE
9. The prices given in the following list are based on the use of the best
quality of hardware in the market. Should inferior quality be used, these prices
would probably be 50 per cent. less. The cost of labor is assumed to be one-
fifth the cost of the hardware.
Locks
Hinges
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
textbookfull.com