Domain Specific Languages in R Advanced Statistical Programming 1st Edition Thomas Mailund all chapter instant download
Domain Specific Languages in R Advanced Statistical Programming 1st Edition Thomas Mailund all chapter instant download
com
https://textbookfull.com/product/domain-specific-languages-
in-r-advanced-statistical-programming-1st-edition-thomas-
mailund/
OR CLICK BUTTON
DOWNLOAD NOW
https://textbookfull.com/product/domain-specific-languages-in-r-
advanced-statistical-programming-1st-edition-thomas-mailund-2/
textboxfull.com
https://textbookfull.com/product/functional-data-structures-in-r-
advanced-statistical-programming-in-r-thomas-mailund/
textboxfull.com
https://textbookfull.com/product/functional-data-structures-in-r-
advanced-statistical-programming-in-r-mailund/
textboxfull.com
https://textbookfull.com/product/domain-specific-languages-made-easy-
meap-v04-meinte-boersma/
textboxfull.com
https://textbookfull.com/product/practical-scala-dsls-real-world-
applications-using-domain-specific-languages-1st-edition-pierluigi-
riti/
textboxfull.com
https://textbookfull.com/product/the-joys-of-hashing-hash-table-
programming-with-c-1st-edition-thomas-mailund/
textboxfull.com
Thomas Mailund
Domain-Specific Languages in R
Advanced Statistical Programming
Thomas Mailund
Aarhus N, Staden København, Denmark
While the advice and information in this book are believed to be true
and accurate at the date of publication, neither the authors nor the
editors nor the publisher can accept any legal responsibility for any
errors or omissions that may be made. The publisher makes no
warranty, express or implied, with respect to the material contained
herein.
Domain-Specific Languages
Parsing Expressions
Meta-Programming Parsing
Expression Manipulation
Optimizing Multiplication
Expression Rewriting
Expression Evaluation
Specifying a Grammar
Designing Semantics
Generic Functions
Operator Overloading
Group Generics
Code Blocks
Exploring Expressions
Manipulating Expressions
Anonymous functions
Quosures
Quasi-quoting
Traces
Computing Likelihoods
Constructors
Pattern Matching
Lists
Search Trees
Parsing Expressions
Evaluating Expressions
Chapter 13:Conclusion
References
Index
About the Author and About the
Technical Reviewer
About the Author
Thomas Mailund
is an associate professor in bioinformatics at Aarhus University,
Denmark. He has a background in math and computer science. For
the past decade, his main focus has been on genetics and
evolutionary studies, particularly comparative genomics, speciation,
and gene flow between emerging species. He has published
Beginning Data Science in R , Functional Programming in R , and
Metaprogramming in R , all from Apress, as well as other books.
1. Introduction
Thomas Mailund1
(1) Aarhus N, Staden København, Denmark
Domain-Specific Languages
With domain-specific languages we often distinguish between
“external” and “embedded” languages. Regular expressions and SQL
are typically specified as strings when you use them in a program,
and these strings must be parsed and interpreted when your
program runs. In a sense, they are languages separated from the
programming language you use them in. They need to be compiled
separately and then called by the main programming language. They
are therefore considered “external” languages. In contrast,
embedded domain-specific languages provide domain-specific
languages expressed in the general-purpose language in which they
are used. In R, the grammar of graphics implemented in ggplot2
or the data transformation operations implemented in dplyr
provides small languages—domain-specific languages—that you can
use from within R, and you write the programs for these languages
in R as well.
Embedded DSLs extend the programming language in which you
are working. They provide more than what you usually find in a
framework in the form of functions and classes as they offer a high
level of flexibility in what you can do with them. They are
programming languages, after all, and you can express complex
ideas and tasks in them. They provide a language for expressing
thoughts in a specific domain, so they do not give you a general
programming language as the language you use them from, but
they do extend that surrounding language with new expressive
power. However, being embedded in the general-purpose language
means that they will follow the rules you are familiar with there—or
mostly, at least, since in languages such as R it is possible to modify
the rules a bit using so-called non-standard evaluation . You can
expect the syntax of the embedded DSL to follow the rules of the
general-purpose language. The semantics will be determined by the
DSL, but when you write programs in the DSL, the syntax is already
familiar to you. If you implement a DSL yourself, embedding it in a
general-purpose language lets you reuse the parsing and evaluation
done by the general-purpose language so that you can focus on
designing the domain-specific language.
Implementing embedded domain-specific languages often
involves meta-programming ; that is, it consists of treating the
program you are writing as data that you can manipulate from within
the language itself. This might sound more complicated than it is,
but quite often, it is reasonably straightforward to achieve. Using
classes and operator overloading, we can use R’s parser to parse
embedded languages by simply designing the language such that
evaluating expressions automatically parse them. This leaves us with
data structures we, ourselves, have defined, without us having to
parse anything, and we can rewrite the results of such parsed
expressions in various ways before we evaluate them to run the
embedded program. Evaluating expressions can be relatively
straightforward or involve a deeper analysis of the parsed
expressions.
To get a feel for what we can do with embedded domain-specific
languages, let’s consider a simple DSL: matrix multiplication (an
example we cover in more detail in Chapter 2). You might not think
of matrix expressions as much of a programming language, but the
arithmetic notation is highly efficient for expressing ideas in a limited
domain. Just imagine having to do mathematics without this
notation. Of course, R already supports this language—it has infix
operators and the semantics we associate with arithmetic
expressions when we write them in an R program. However, since
matrix multiplication is a well-known task, it serves as an excellent
example to illustrate some of the things we can do if we extend R
with other smaller programming languages.
R already supports arithmetic with matrices, and if you use the
operator %*%, you can do matrix multiplication (if you use *, you will
do component-wise multiplication instead). Multiplications are done
one at a time, so if you have a series of them, such as this:
then the product will be computed from left to right, like this:
library(microbenchmark)
res <- microbenchmark(A %*% B %*% C %*% D,
((A %*% B) %*% C) %*% D,
(A %*% (B %*% C)) %*% D,
(A %*% B) %*% (C %*% D),
A %*% (B %*% (C %*% D)),
A %*% ((B %*% C) %*% D))
options(microbenchmark.unit="relative")
print(res, signif = 3, order = "mean")
## Unit: relative
## expr min lq mean
median
## (A %*% B) %*% (C %*% D) 1.00 1.00
1.00 1.00
## A %*% (B %*% (C %*% D)) 3.92 3.87
3.49 3.84
## A %*% B %*% C %*% D 6.13 6.06
5.42 6.03
## ((A %*% B) %*% C) %*% D 6.12 6.05
5.51 6.04
## A %*% ((B %*% C) %*% D) 7.71 7.62
6.75 7.57
## (A %*% (B %*% C)) %*% D 9.88 9.76
8.73 9.69
## uq max neval
## 1.00 1.00 100
## 3.62 1.41 100
## 5.57 2.06 100
## 5.61 2.35 100
## 7.00 2.30 100
## 8.99 3.71 100
Here, I’ve computed the matrix product in the five different
possible ways. There are six expressions, but the first two will
compute the matrix multiplication in the same order. With
microbenchmark we compute each expression 100 times and
collect the time each evaluation takes. We collect the time it takes to
compute each expression, and here I have displayed the running
time relative to the fastest expression, sorted by the mean
evaluation time.
On average, there is almost a factor of ten between the fastest
and the slowest evaluation (for the slowest evaluations in the two
cases the difference is a factor of two, which is still a substantial
relative difference). There is something to be gained by setting
parentheses optimally if we multiply together several large matrices.
The dimensions of matrices are not necessarily known before
runtime, however, so ideally we want to set the parentheses when
we evaluate expressions in an optimal way.
The approach we take in Chapter 2 is to delay the evaluation of
matrix multiplication and instead build a data structure for matrix
expressions, one we can evaluate later when we have the entire
matrix multiplication expression constructed. It is a simple DSL, but
it contains all the components we typically need in one: we need
code for parsing an expression and creating a representation of it,
we need to do some manipulation of expressions, and then we need
to evaluate them.
For parsing expressions, we need to capture matrices and
multiplications. We wrap matrices in a class to make them objects of
our language, rather than plain R data.
m <- function(data) {
structure(data,
nrow = nrow(data),
ncol = ncol(data),
class = c("matrix_expr",
class(data)))
}
matrix_mult(matrix_mult(m(A), m(B),
matrix_mult(m(C), m(D))))
v <- function(expr)
eval_matrix_expr(rearrange_matrix_expr(expr)
)
We can compare this automatic parentheses setting procedure
with the default evaluation and the optimal evaluation order we saw
earlier.
options(microbenchmark.unit="relative")
print(res, signif = 3, order = "mean")
## Unit: relative
## expr min lq mean
## (A %*% B) %*% (C %*% D) 1.00 1.00 1.00
## v(m(A) * m(B) * m(C) * m(D)) 1.13 1.19 1.37
## A %*% B %*% C %*% D 6.13 6.09 5.65
## median uq max neval
## 1.00 1.00 1.00 100
## 1.23 1.26 1.19 100
## 6.08 5.99 2.19 100
2. Matrix Expressions
Thomas Mailund1
(1) Aarhus N, Staden København, Denmark
library(microbenchmark)
Parsing Expressions
To keep things simple, we will only consider matrix multiplication and
matrix addition. We do not include scalar multiplication or inverting
or transposing matrices or any other functionality. Adding more
components of the expression language in the example will follow
the same ideas as we need for multiplication and addition. It will not
teach us anything new regarding embedding DSLs in R. When you
understand the example, you will be able to do this easily yourself.
With these restrictions, we can say that a matrix expression is
either just a matrix, the product of two matrix expressions, or the
sum of two matrix expressions. We can represent this as a class
hierarchy with one (abstract) superclass representing expressions
and three (concrete) subclasses for actual data, products, and sums.
If you are not familiar with object-oriented programming in R, we
will have a short guide to everything you need to know in Chapter 4.
Constructors for creating objects of the three concrete classes can
look like these:
m <- function(data) {
structure(list(data = data),
nrow = nrow(data),
ncol = ncol(data),
def_expr =
deparse(substitute(data)),
class = c("matrix_data",
"matrix_expr"))
}
matrix_mult <- function(A, B) {
structure(list(left = A, right = B),
nrow = nrow(A),
ncol = ncol(B),
class = c("matrix_mult",
"matrix_expr"))
}
matrix_sum <- function(A, B) {
structure(list(left = A, right = B),
nrow = nrow(A),
ncol = ncol(B),
class = c("matrix_sum",
"matrix_expr"))
}
We just wrap the parameters of the constructors in a list and set
the appropriate class attributes, and we store the number of rows
and number of columns because we will need them when optimizing
matrix multiplication, as we saw in Chapter 1.
The only purpose of the def_expr attribute we set in the m
function is pretty printing. It makes the output of the expressions we
manipulate in the following pages easier to follow. Strictly speaking,
we do not need any pretty printing for manipulating expressions, but
it does make debugging easier, so I tend always to write some code
for that. For the matrix expressions, we can use the following code:
A * B + C
Meta-Programming Parsing
Using an explicit function such as m to bootstrap us into the matrix
expression language is the simplest way to use R’s own parser for
our benefits, but it is not the only way. In R, we can manipulate
expressions as if they were data, a feature known as meta-
programming and something we return to in Chapter 5. For now, it
suffices to know that an expression can be explored recursively. We
can use the predicate is.name to check whether the expression
refers to a variable, and we can use the predicate is.call to check
whether it is a function call—and all operators are function calls. So,
given an expression that does not use the m function and thus does
not enter our DSL, we can transform it into one that goes like this:
if (is.call(expr)) {
if (expr[[1]] == as.name("("))
return(build_matrix_expr(expr[[2]]))
if (expr[[1]] == as.name("*") ||
expr[[1]] == as.name("%*%")) {
return(call('*',
build_matrix_expr(expr[[2]
]),
build_matrix_expr(expr[[3]
])))
}
if (expr[[1]] == as.name("+")) {
return(call('+',
build_matrix_expr(expr[[2]
]),
build_matrix_expr(expr[[3]
])))
}
}
stop(paste("Parse error for", expr))
}
In this implementation, we consider both * and %*% matrix
multiplication so that we would consider an R expression that uses
matrix multiplication as such. Notice also that we consider calls that
are parentheses. Parentheses are also function calls in R, and if we
want to allow our language to use parentheses, we have to deal with
them—like here, where we just continue the recursion. We did not
have to worry about that when we explicitly wrote expressions using
m and operator overloading because there R already took care of
giving parentheses the right semantics.
For this function to work, it needs a so-called quoted expression.
If we write a raw expression in R, then R will try to evaluate it
before we can manipulate it. We will get an error before we even get
to rewrite the expression.
build_matrix_expr(A * B)
build_matrix_expr(quote(A * B))
## m(A) * m(B)
## m(A) * m(B)
This isn’t a perfect solution, and there are some pitfalls, among
which is that you cannot use this function from other functions
directly. The substitute function can be difficult to work with. The
further problem is that we are creating a new expression, but it’s an
R expression and not the data structure we want in our matrix
expression language. You can think of the R expression as a literate
piece of code; it is not yet evaluated to become the result we want.
For that, we need the eval function, and we need to evaluate the
expression in the right context. Working with expressions, especially
evaluating expressions in different environments, is among the more
advanced aspects of R programming, so if it looks complicated right
now, do not despair. We cover it in detail in Chapter 7. For now, we
will just use this function:
parse_matrix_expr(A * B)
## ([A] * [B])
Expression Manipulation
Our goal for writing this matrix DSL is to optimize evaluation of these
matrix expressions. There are several optimizations we can consider,
but R’s matrix implementation is reasonably efficient already. It is
hard to beat if we try to replace any computations by our own
implementations—at least as long as we implement our alternatives
in R. Therefore, it makes sense to focus on the arithmetic rewriting
of expressions.
We can rewrite expressions recursively and use a generic
function with specializations for the three concrete classes we have.
A template (that does not do anything yet) would look like this:
Optimizing Multiplication
Before we start rewriting multiplication expressions, though, we
should figure out how to find the optimal order of multiplication.
Let’s assume that we have this matrix multiplication: A1 × A2 × … ×
A n . We need to set parentheses somewhere, say (A1 × A2 × …A i )
× (Ai+1…× A n ), to select the last matrix multiplication. If we first
multiply together, in some order, the first i and the last n – i
matrices, the last multiplication we have to do is the product of
those two. If the dimensions of (A1 × …A i ) are n × k and the
dimensions of (Ai+1…× A n ) are k × m, then this approach will
involve n × k × m operations plus how long it takes to produce the
two matrices. Assuming that the best possible way of multiplying the
first i matrices involves N1,i operations and assuming the best
possible way of multiplying the last n – i matrices together involves
Ni+1,n operations, then the best possible solution that involves
setting the parentheses where we just did involves N1,i + Ni+1,n +n
× k × m operations. Obviously, to get the best performance, we
must pick the best i for setting the parentheses at the top level, so
we must minimize this expression for i. Recursively, we can then
solve for the sequences 1 to i and i + 1 to n to get the best
performance.
Put another way, the minimum number of operations we need to
multiply matrices A i ,Ai+1,…,A j can be computed recursively as Ni,j =
0 when i = j and
Random documents with unrelated
content Scribd suggests to you:
respect of each person so employed, must be entered immediately
on commencement of work in the process named.
Various methods of noting the state of health of the workers have
been adopted. Use of the words “Good,” “Very fair,” and “Fair,” is
common as indicating the state of general health, with special note in
addition, often in the form of a symbol, of the presence and character
of definite ill-effects. The object of the register, however, is to keep a
record intelligible not only to the Certifying Surgeon, Factory
Inspector, and occupier, but also to the workers. Entries, therefore,
on a uniform system are desirable, taking account of the two aspects
of the health of every lead-worker, which must be considered (a) that
indicative of specific effects from the occupation, and (b) that of
general health uninfluenced by the employment. With this in mind,
the following system of entry in the health register has been adopted:
The entries should be made upon a uniform system, as below, indicating
degrees of deviation from normal health, and distinguishing (by use of numerals)
those attributable (or possibly attributable, in whole or part) to work in lead, from
those not so attributable, for which latter letters should be used. The conclusion is
1 2
perhaps best expressed as a fraction , , and so on.
A C
The numerals should be taken to mean:
1. Passed without comment (no observed effect of lead).
2. Blue line (or indication thereof).
3. Marked (quasi-pathognomonic) anæmia, or other signs of impairment of
health. (Albuminuria, or slight deficiency in tone of the extensor
muscles of the forearm, would, and miscarriage, or other suspicious
history of illness between examinations, might, come under this head.)
4. Suspension or transfer, by reason of impairment of health from effects of
work in lead. (In such cases the surgeon would be prepared to
entertain an application for a certificate under the Workmen’s
Compensation Act.)
Except in the case of a worker whose exposure to lead is only recent, renal
disease should always be indicated by a numeral.
Letters should bear the following meaning:
a. No comment (i.e., fair general health).
b., c. Increasing degrees of impairment of general health. (Pregnancy, if
without suspension, should be entered as c.)
d. Suspension or transfer, for reasons other than impairment of health from
effects of work in lead.
x. Carelessness, or neglect of precautions, or unsuitability for work in lead.
(Suspensions for such reasons should be marked dx.)
Such entries of numerals and letters will in general suffice for the intended
purpose; but the surgeon may, of course, find it desirable to make other notes for
his own information, and it is within his discretion to supply further details to
occupiers or workers concerned.
REFERENCES.
[1], [2] S. King Alcock, B. M. Bond, A. Scott, and others, in discussion on
the Value of Systematic Examination of Workers in Dangerous Trades. Brit.
Med. Journ., vol. ii., pp. 741-749, 1902.
[3] King Alcock: The Early Diagnosis of Industrial Lead Poisoning. Paper
contributed to the Second International Congress for the Study of Industrial
Diseases held at Brussels, 1910.
CHAPTER XIV
PREVENTIVE MEASURES AGAINST LEAD
POISONING—Continued
REFERENCES.
[1] George Reid: Memorandum on Mess-room Accommodation: Appendix
XXV. of the Potteries Committee’s Report, vol. ii., 1910. Cd. 5278.
[2] Th. Sommerfeld: Die Bekämpfung der Bleigefahr, edited by Leymann,
p. 76.
CHAPTER XV
DESCRIPTION OF PROCESSES
Lead smelting—Red and orange lead and litharge—Letterpress printing—File-cutting—File-hardening—
Tinning of metals—Plumbing and soldering—Brass.
Lead Smelting and Silver Refining.—Lead poisoning very rarely occurs in lead
mining in Europe, as galena (sulphide of lead), the principal ore in which the metal is
found, is insoluble. Galena always, and other lead ores very often, contain a small
proportion of silver, ranging from 0·001 to 1 per cent., and at times traces of gold.
Owing to the great affinity of lead for silver, lead smelting is necessarily a process
preliminary to the extraction of silver and gold from it[1].
Lead ores, drosses, etc., on arrival at the factory, are, after sampling, deposited in
bins or heaps (often in the open air), and watered to prevent dust. All ores may, and
refractory ores (containing over 4 per cent. silica) and dross must, be smelted in a blast
furnace by aid of coke. The bulk of the charge in a blast furnace may consist of more
or less complex ores of the precious metals, especially silver.
When galena is treated in a blast furnace, preliminary roasting is indispensable, and
in many smelting works its treatment takes place in a reverberatory or open-hearth
furnace, and not in a blast furnace.
The three principal methods applicable to extraction of lead from ores are—(1) The
roast and reaction method; (2) the roast and reduction method; and (3) the
precipitation process.
By the roast and reaction method a part of the galena is first converted into oxide
and sulphate of lead with access of air. Subsequently, on shutting off the air-supply and
increasing the temperature, a reaction takes place. The sulphur in the unchanged
sulphide combines with the oxygen of the oxide and sulphate to form sulphur dioxide,
which is carried away by the draught into the bricked flue, leaving metallic lead behind.
The process is carried on in a reverberatory or open-hearth furnace.
In the roast and reduction method the first portion of the process is carried out in a
reverberatory furnace, the galena being roasted pretty completely to lead oxide and
sulphate, which are then—usually in a blast furnace—reduced to the metallic state with
coke and other reducing agents, such as iron.
By the precipitation process galena was decomposed at a high temperature by
means of metallic iron, forming a mixture of iron and lead sulphide. This method was
only applicable to rich lead ores, and is now given up.
The three methods are hardly ever independent of one another, as the rich slag or
residues, for instance, which are obtained by the first method are retreated by the
second, and the second is, as has been stated, almost always combined with the first.
On tapping the blast or reverberatory furnace, the lead is drawn off into a lead well or
sump, from which, when cool, it is ladled into moulds, while the slag is run into
movable metal pots or along specially-prepared channels. The slag run off from the
reverberatory furnace contains much lead locked up as silicate, which requires to be
retreated, usually in the blast furnace. During the roasting process much raking of the
material is necessary. The slag from the blast furnace should contain less than 1 per
cent. of lead.
On the Continent and in America, the Huntingdon-Heberlein process has been
extensively adopted, with lessened incidence of poisoning, the result of mechanical
methods of working, obviating hand labour, and the low temperature (diminishing risk
from lead fume) at which the roasting is carried on. In this process the crushed ore is
desulphurized by first mixing with lime and heating in presence of air in a revolving
furnace, provided with automatic rabble, at moderate temperature (about 700° C.).
Subsequently the roasted material is conveyed from closed bins, into which it falls
automatically, by dust-proof elevators to a converter, in which atmospheric air at slight
pressure is forced through it. The agglomerated mass so formed, when tipped out of
the converter (in doing which there is risk from dust), is well damped, broken by hand,
and charged with coke in the usual way into the blast furnace.
In some lead-smelting works the material arrives on the premises in the form of
ingots of base bullion—i.e., impure lead rich in silver—the product of previous smelting
of the ore where it is mined in Australia or Spain. And one of the main objects of the
blast-furnace smelting of galena in the factory is to produce a base bullion rich in
precious metals. The lead so obtained requires further softening or refining to get rid of
copper, antimony, arsenic, and tin. This is effected in a reverberatory furnace, first at a
low temperature to allow of formation of furnace dross, which is removed through the
working doors, and secondly with increase of heat and access of air to oxidize, in the
order named, the tin, arsenic, and antimony. Finally the lead is tapped into kettles or
pots. If free from silver, such lead, when poured into moulds, is ready for the market;
but if rich in silver, it is treated for the recovery of that metal either by (a) Pattinson’s
process, depending on the higher temperature of crystallization of lead than of an alloy
of lead and silver, which enables a separation of one from the other to be made by a
process of ladling the crystalline from the liquid portion; or, much more commonly, by
(b) Parkes’s process, depending on the formation, on addition of zinc to a pot of molten
lead, of crusts consisting of an alloy of silver, lead, and zinc. The crusts obtained in the
latter process, after cooling, are broken up, placed in a crucible, and the zinc driven off
at a temperature of 1,000° C. in a dezincing Faber du Faur retort. The rich bullion,
retained either in the last kettle by the Pattinson process, or remaining in the crucible
after dezincing, next undergoes cupellation—i.e., exposure to a blast of air in a
furnace. The lead is oxidized into litharge, which drops into a receptacle below the
furnace, leaving the silver behind. In all lead-smelting works the draught from the
furnace carries much dust of ore and fuel, and fume, consisting of sulphide, sulphate,
and oxides of lead, into the flues. The dust is easily collected in dust chambers, but the
fume requires ducts of great length—sometimes a mile or more—in which to deposit.
Dangers and Prevention.—The risk from dust in general labouring work, in
depositing the ores in bins, in removing them to, and charging them into, the furnace,
can only be controlled by watering, preferably by a spray. From the blast furnace lead
fume and carbon monoxide may escape at the point where charging is done, if there is
back pressure from blockage in the flues, or if the furnace blast is not working perfectly.
In tapping the lead and in manipulations such as charging, drossing, and skimming,
conducted through the doors of furnaces of all descriptions, hoods, extending at the
sides down to the floor level, require to be arranged over the working doors, and
connected either with ducts passing vertically through the roof or directly with the
exhaust created in the furnace or flue itself. Dross and skimmings removed through the
working doors should be received into iron trolleys capable of being covered, and not
be allowed to fall on to the floors, to be shovelled up later on to barrows. Before such
dross or slag from reverberatory furnaces is broken up for further treatment it should
be well watered.
Lead absorption among the men actually employed in the Pattinson and Parkes’s
processes is comparatively rare, as the temperature of the molten metal does not
exceed 450° to 500° C. When, however, the zinc-silver-lead and gold alloy is removed
for treatment in special furnaces for distillation off of the zinc, prior to cupellation, the
lead from the Parkes’s pot, now free from silver, but containing traces of zinc,
antimony, and other impurities, is run in some works into what are termed “market
pots” for a final refining. Air and steam are blown through to oxidize the impurities. The
pot is skimmed twice, the first dross containing antimony, etc., and the second a fine
dust consisting of lead (60 per cent.) and zinc. The risk of poisoning at this point is
considerable, although an exhaust fan connects up the cover of the pot with a cyclone
separator, to carry away the fume when the steam is blown through. In other works this
dezincing is done in a refining furnace, the material being then in a slaggy state, thus
hindering development of fumes. After the condensation of the zinc in the distillation of
the silver-lead and zinc crust the cover of the pot is raised, and the remaining metal,
containing 80 per cent. of lead at a temperature of about 2,000° F., is ladled out into
moulds for treatment in the cupelling furnace. The temperature at which this ladling
operation has to be done makes the work impossible for those unaccustomed to it.
Exhaust ventilation in the operation of emptying the pot, and cutting off the heat by a
water-cooled jacket, suggest themselves as means to combat the undoubted risk.
In cupellation the temperature is high (about 2,000° C.), and fume will escape from
the working door and from the opening where the rich lead is fed into the furnace. The
danger here is sufficiently recognized by hoods and ducts placed in front of the
furnace, but the draught, unless the ducts are connected up with a high-pressure fan,
may prove inadequate to carry away all the fume.
Flue-cleaning, carried out usually at quarterly or half-yearly periods, is dusty work, as
much of the dust is in so fine a state of division as to repel contact with water.
Smelting of other metals when the ores contain appreciable amounts of lead is
equally productive of plumbism. Thus, in the year 1901 fourteen cases were reported
from an iron works for the manufacture of spiegeleisen, the ore (now no longer used)
coming from Greece[2]. In previous years it would appear to have been even greater. A
remarkable feature of all the reported cases from this factory was that the form
assumed was colic, and never paralysis. The poisoning was due to vaporization of the
molten lead by the very high temperature to which it was raised as the molten iron
flowed out of the furnace on tapping. The danger from fume was limited to the first few
feet of the channel, as the heavier molten lead gravitated down between loose
brickwork into a pit. Dust collected above the point where the furnace was tapped
contained 39·77 per cent. of lead monoxide, and the flue dust 4·22 per cent.[3]. A
flannel respirator worn once only by one of the furnace men contained lead equal to 16
milligrammes of lead monoxide. In 1906 three cases were reported in the extraction of
copper. The persons affected were employed in charging ore into the cupola[4].
Heavy incidence of poisoning (twelve cases in two months) in a smelting works (now
closed) led to examination of sixteen men. The gums of only one man were free of a
blue line—in most it was particularly dense—eight were anæmic, one had paralysis of
the wrists, and five others weakness. Analysis of the air was made at different points in
the factory by the chemist of the works, G. D. Cowan, with the following results:
The samples from the cupola were taken from inside the hood (about 5 feet above the men’s heads).
The gas was filtered through cotton-wool, so that all solid particles were retained, and the remaining gas
was treated separately. The solid particles will be called “dust,” and the gas, after filtration, “fume.”
The cupola samples on being examined gave—
Dust, first sample 0·08152 grain of lead per cubic foot.
„ second sample 0·07297 „ „ „
Fume, first sample
- 0·00526 „ „ „
„ second sample
The samples from the lead well were taken 12 inches above the molten metal at the end of the lead
siphon, and gave the following results:
Dust 0·05653 grain per cubic foot.
Fume Nil.
The briquetting machine samples were taken from the platform where all the ore and fluxes are mixed
before briquetting.
The results obtained here were as follows:
Dust 0·95715 grain of lead per cubic foot.
Fume, or fine dust that passed through filter 0·01314 „ „ „
The reason for these high results was owing to dust raised when waggons of ore were tipped prior to
mixing.
Assuming that 20 cubic inches of air pass in and out of the lungs at each respiration,
a man in eight hours would inhale and exhale 94·4 cubic feet. This amount of air,
inhaled at the position in the cupola where the sample was taken, would contain
7·3818 grains of lead; at the lead well, 5·3064 grains; and at the briquetting machines,
91·5953 grains. Although the condition of the air where the men actually worked must
have contained much less than these amounts, the analyses quite serve to explain the
heavy incidence.
Collis[5] quotes the following analysis of dust and fumes from Hofman’s “Metallurgy
of Lead.”
Lead Smelting: Analyses of Dust and Fumes (from Hofman’s “Metallurgy of
Lead”).
Percentage of—
Material Arsenious Lead Lead
Analysed. Arsenic. Oxide. Lead. Monoxide. Sulphate.
(1) (2) (3) (4) (5) (6)
All dust collected in ten years, average — — 25·6 — —
Dust from—
Downcomers of eleven blast furnaces — — 47·5 — —
Roof of blast-furnace building — — 27·1 — —
Fumes from—
Slag pot while boiling — 4·8 — 41·0 26·2
Reverberatory settling furnace 2·3 — — 31·0 —
Flue dust—
Friedrichshütte, Silesia — — — 62·8 —
A 7·5 — 26·2 — —
Freiberg, Saxony - B 37·5 — 21·3 — —
C 46·4 — 16·2 — —
Pribram, Bohemia — 1·0 — 45·5 —
Collis[6] estimated the attack rate in lead-smelting works at 30, and in spelter works
at 10, per 1,000 per annum. In one factory he found it 80 per 1,000, and in a spelter
works five cases occurred in a few months among seven workers.
The distribution of the reported cases from year to year was as follows:
Process. 1900. 1901. 1902. 1903. 1904. 1905. 1906. 1907. 1908. 1909. 1910. 1911. Total.
Lead
smelting 21 26 13 13 7 10 16 21 31 28 21 33 240
Desilverizing 1 3 9 10 16 6 9 4 3 6 — 3 70
Spelter 5 11 3 4 4 5 9 2 31 25 12 11 122
Other
(copper,
iron, etc.) 7 14 3 10 6 3 4 1 5 7 1 1 62
34 54 28 37 33 24 38 28 70 66 34 48 494
Spelter (Zinc) Manufacture.—Lead is present in zinc ores in a proportion of from
1 to 10 per cent. (usually 3 per cent.). Despite this small proportion, incidence of
chronic plumbism among those engaged in the manufacture is high, as in the present
state of knowledge the lead fume given off in distillation of the zinc cannot be efficiently
removed. Blende (zinc sulphide) is first calcined, and the residue, after mixture with
calamine (zinc ashes) and anthracite, forms the charge for the furnace. The retorts are
arranged in long rows one above the other, and frequently back to back in the furnace,
so that there may be 250 or more to each furnace, and of the furnaces there may be
several in a shed. Attached to the retort is a fireclay receptacle (condenser) into which
the zinc distils, and an iron nozzle (prolong) to prevent oxidation in the condenser.
While distillation goes on the carbonic oxide gas evolved burns brightly, tinged with the
greenish-white colour imparted by the zinc. The products of combustion, with traces of
lead fume from the hundreds of prolongs, are discharged into the atmosphere of the
sheds, where temperature is high. The latest design of prolongs, however, has an exit
at which the products of combustion escape near the furnace, so that the greater
portion pass up into the ventilating hoods. Periodically—three times to each charge—
the workman removes the prolong, ladles out such zinc as has condensed, and pours
it into moulds. Finally, when distillation is completed, the contents of the retorts are
raked out, and it is in the fuming hot residues so deposited on the floors that much of
the danger arises. In distilling furnaces of modern design the hot residues fall through
openings in the window of the furnaces into “pockets,” in which they cool off
considerably before they are drawn out into iron skips. In another form of furnace used
in the manufacture of spelter (Silesian), the workman after charging can leave the
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
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