q2K BHP
Black History Portal
THE BHP WIRE —
HIDDEN TRUTHS
What's New!
THE JOURNEY THROUGH TIME

Explore Black History

Explore the people, places, events, achievements, struggles and stories that shaped our journey.

✊🏾

Civil Rights

Movements, leaders, victories and the continuing fight for equality.

⚙️

Black Inventors

Innovation, patents, science, technology and world-changing contributions.

🏆

Sports

Pioneers, champions, Negro Leagues, records, activism and excellence.

♟️

People

Meet the people whose lives, choices and achievements shaped the journey.

📍

Places

Black towns, communities, institutions and places where history happened.

📜

Events

Moments that changed communities, movements, institutions and the nation.

Enter a person, place, event, or topic.
MY'STORY

The MOVE Fire

This is a personal recollection on the Move fire on May 13, 1985 Philadelphia police fired thousands of rounds at the MOVE house, city officials approved dropping an explosive device on the roof, the resulting fire was allowed to burn, 11 people—including five children—died, and 61 homes were destroyed. Philadelphia City Council later called it a “brutal attack carried out by the City of Philadelphia on its own citizens” and acknowledged that no individual faced criminal consequences for the bombing. One timeline correction worth preserving for the BHP record: the major previous MOVE-police confrontation was August 8, 1978, about seven years before the bombing, not a year or two earlier. Officer James Ramp was killed, other police and firefighters were wounded, nine MOVE members were later convicted, and television cameras recorded police beating Delbert Africa during his arrest. The 1985 MOVE Commission later specifically criticized city planners for failing to adequately use lessons from that 1978 confrontation. And that actually strengthens the point you’re making: 1985 did not happen without precedent or institutional memory. There had already been a deadly confrontation with MOVE, years of conflict, negotiations and police involvement before Osage Avenue.

MORE →
BLACK FACTS
The Truths They Never Taught You...

The Violence That Helped Spark the NAACP

In August 1908, a white mob attacked Springfield, Illinois’s Black community, destroying homes and businesses and lynching two Black men. National outrage over the violence helped spur the movement that created the NAACP the following year.

MORE →
BHP gathered finds from its connected research sources. Showing the 4 strongest Black History matches.
← BACK TO RESULTS
Wikipedia

Defunctionalization

In programming languages, defunctionalization is a compile-time transformation which eliminates higher-order functions, replacing them by a single first-order apply function. The technique was first described by John C. Reynolds in his 1972 paper, "Definitional Interpreters for Higher-Order Programming Languages". Reynolds' observation was that a given program contains only finitely many function abstractions, so that each can be assigned and replaced by a unique identifier. Every function application within the program is then replaced by a call to the apply function with the function identifier as the first argument. The apply function's only job is to dispatch on this first argument, and then perform the instructions denoted by the function identifier on the remaining arguments.

One complication to this basic idea is that function abstractions may reference free variables. In such situations, defunctionalization must be preceded by lambda lifting, so that any free variables of a function abstraction are passed as extra arguments to apply.[citation needed] In addition, if closures are supported as first-class values, it becomes necessary to represent these captured bindings by creating data structures.

Instead of having a single apply function dispatch on all function abstractions in a program, various kinds of control flow analysis (including simple distinctions based on arity or type signature) can be employed to determine which function(s) may be called at each function application site, and a specialized apply function may be referenced instead. Alternatively, the target language may support indirect calls through function pointers, which may be more efficient and extensible than a dispatch-based approach.

Besides its use as a compilation technique for higher-order functional languages, defunctionalization has been studied (particularly by Olivier Danvy and collaborators) as a way of mechanically transforming interpreters into abstract machines. Defunctionalization is also related to the technique from object-oriented programming of representing functions by function objects (as an alternative to closures).

Example

[edit]

The following is a Haskell translation of an example due to Olivier Danvy. Consider the Tree datatype and the following program.

data Tree a = Leaf a
            | Node (Tree a) (Tree a)
cons :: a -> [a] -> [a]
cons x xs = x : xs

o :: (b -> c) -> (a -> b) -> a -> c
o f g x = f (g x)

flatten :: Tree t -> [t]
flatten t = walk t []

walk :: Tree t -> [t] -> [t]
walk (Leaf x)     = cons x
walk (Node t1 t2) = o (walk t1) (walk t2)

Defunctionalization replaces all higher-order functions (in this case, o is the only higher-order function) with a value of the Lam datatype. Instead of calling higher-order functions directly, it introduces an apply function that interprets the Lam datatype.

data Lam a = LamCons a
           | LamO (Lam a) (Lam a)

apply :: Lam a -> [a] -> [a]
apply (LamCons x)  xs = x : xs
apply (LamO f1 f2) xs = apply f1 (apply f2 xs)

cons_def :: a -> Lam a
cons_def x  = LamCons x

o_def :: Lam a -> Lam a -> Lam a
o_def f1 f2 = LamO f1 f2

flatten_def :: Tree t -> [t]
flatten_def t = apply (walk_def t) []

walk_def :: Tree t -> Lam t
walk_def (Leaf x)     = cons_def x
walk_def (Node t1 t2) = o_def (walk_def t1) (walk_def t2)

See also

[edit]

References

[edit]
  • Reynolds, John (August 1972). "Definitional Interpreters for Higher-Order Programming Languages". Proceedings of the ACM Annual Conference. Boston, Massachusetts. pp. 717–740. doi:10.1145/800194.805852.
  • Danvy, Olivier; Nielsen, Lasse R. (2001). "Defunctionalization at Work" (PDF). Proceedings of the ACM SIGPLAN Conference on Principles and Practice of Declarative Programming. pp. 162–174. doi:10.1145/773184.773202. Archived from the original (PDF) on 2011-09-27. Retrieved 2011-08-24. (More comprehensive version: Technical Report BRICS-RS-01-23)
  • Danvy, Olivier; Millikin, Kevin R. (June 2009). "Refunctionalization at Work". Science of Computer Programming. 74 (8): 534–549. doi:10.1016/j.scico.2007.10.007. (Also available as Technical Report BRICS-RS-07-7)
[edit]

Source: Wikipedia. Article content is retrieved live through the MediaWiki API.

No preview image
Wikipedia

Defunctionalization

In programming languages, defunctionalization is a compile-time transformation which eliminates higher-order functions, replacing them by a single first-order apply function. The technique was first described by John C. Reynolds in his 1972 paper, "Definitional Interpreters for Higher-Order Programming Languages". Reynolds' observation was that a given program contains only finitely many function abstractions, so that each can be assigned and replaced by a unique identifier. Every function application within the program is then replaced by a call to the apply function with the function identifier as the first argument. The apply function's only job is to dispatch on this first argument, and then perform the instructions denoted by the function identifier on the remaining arguments. One complication to this basic idea is that function abstractions may reference free variables. In such situations, defunctionalization must be preceded by lambda lifting, so that any free variables of a function abstraction are passed as extra arguments to apply. In addition, if closures are supported as first-class values, it becomes necessary to represent these captured bindings by creating data structures. Instead of having a single apply function dispatch on all function abstractions in a program, various kinds of control flow analysis (including simple distinctions based on arity or type signature) can be employed to determine which function(s) may be called at each function application site, and a specialized apply function may be referenced instead. Alternatively, the target language may support indirect calls through function pointers, which may be more efficient and extensible than a dispatch-based approach. Besides its use as a compilation technique for higher-order functional languages, defunctionalization has been studied (particularly by Olivier Danvy and collaborators) as a way of mechanically transforming interpreters into abstract machines. Defunctionalization is also related to the technique from object-oriented programming of representing functions by function objects (as an alternative to closures).

MORE →
No preview image
Wikipedia

Currying

In mathematics and computer science, currying (named after Haskell Curry) is the technique of translating a function that takes multiple arguments into a sequence of families of functions, each taking a single argument. In the prototypical example, one begins with a function f : ( X × Y ) → Z {\displaystyle f:(X\times Y)\to Z} that takes two arguments, one from X {\displaystyle X} and one from Y , {\displaystyle Y,} and produces objects in Z . {\displaystyle Z.} The curried form of this function treats the first argument as a parameter, so as to create a family of functions f x : Y → Z . {\displaystyle f_{x}:Y\to Z.} The family is arranged so that for each object x {\displaystyle x} in X , {\displaystyle X,} there is exactly one function f x {\displaystyle f_{x}} , such that for any y {\displaystyle y} in Y {\displaystyle Y} , f x ( y ) = f ( x , y ) {\displaystyle f_{x}(y)=f(x,y)} . In this example, curry {\displaystyle {\mbox{curry}}} itself becomes a function that takes f {\displaystyle f} as an argument, and returns a function that maps each x {\displaystyle x} to f x . {\displaystyle f_{x}.} The proper notation for expressing this is verbose. The function f {\displaystyle f} belongs to the set of functions ( X × Y ) → Z . {\displaystyle (X\times Y)\to Z.} Meanwhile, f x {\displaystyle f_{x}} belongs to the set of functions Y → Z . {\displaystyle Y\to Z.} Thus, something that maps x {\displaystyle x} to f x {\displaystyle f_{x}} will be of the type X → [ Y → Z ] . {\displaystyle X\to [Y\to Z].} With this notation, curry {\displaystyle {\mbox{curry}}} is a function that takes objects from the first set, and returns objects in the second set, and so one writes curry : [ ( X × Y ) → Z ] → ( X → [ Y → Z ] ) . {\displaystyle {\mbox{curry}}:[(X\times Y)\to Z]\to (X\to [Y\to Z]).} This is a somewhat informal example; more precise definitions of what is meant by "object" and "function" are given below. These definitions vary from context to context, and take different forms, depending on the theory that one is working in. Currying is related to, but not the same as, partial application. The example above can be used to illustrate partial application; it is quite similar. Partial application is the function apply {\displaystyle {\mbox{apply}}} that takes the pair f {\displaystyle f} and x {\displaystyle x} together as arguments, and returns f x . {\displaystyle f_{x}.} Using the same notation as above, partial application has the signature apply : ( [ ( X × Y ) → Z ] × X ) → [ Y → Z ] . {\displaystyle {\mbox{apply}}:([(X\times Y)\to Z]\times X)\to [Y\to Z].} Written this way, application can be seen to be adjoint to currying. The currying of a function with more than two arguments can be defined by induction. Currying is useful in both practical and theoretical settings. In functional programming languages, and many others, it provides a way of automatically managing how arguments are passed to functions and exceptions. In theoretical computer science, it provides a way to study functions with multiple arguments in simpler theoretical models which provide only one argument. The most general setting for the strict notion of currying and uncurrying is in the closed monoidal categories, which underpins a vast generalization of the Curry–Howard correspondence of proofs and programs to a correspondence with many other structures, including quantum mechanics, cobordisms, and string theory. The concept of currying was introduced by Gottlob Frege, developed by Moses Schönfinkel, and further developed by Haskell Curry. Uncurrying is the dual transformation to currying, and can be seen as a form of defunctionalization. It takes a function f {\displaystyle f} whose return value is another function g {\displaystyle g} , and yields a new function f ′ {\displaystyle f'} that takes as parameters the arguments for both f {\displaystyle f} and g {\displaystyle g} , and returns, as a result, the application of f {\displaystyle f} and subsequently, g {\displaystyle g} , to those arguments. The process can be iterated.

MORE →
Wikipedia

Capsaicin

Capsaicin (8-methyl-N-vanillyl-6-nonenamide) (, commonly ) is a toxin that is the main active component of chili peppers and gives them their distinct pungent, "spicy" or "hot" taste. It is a potent irritant for mammals for which it produces a sensation of burning in any tissue with which it comes into contact. Capsaicin and several related amides (capsaicinoids) are produced as secondary metabolites by chili peppers, likely as deterrents against eating by mammals and against the growth of fungi. Pure capsaicin is a hydrophobic, highly pungent (i.e., spicy) crystalline solid.

MORE →
Wikipedia

John C. Reynolds

John Charles Reynolds (June 1, 1935 – April 28, 2013) was an American computer scientist.

MORE →
TOPIC OF THE DAY

Greenwood / Black Wall Street

Before the 1921 destruction of Tulsa’s Greenwood District, Black residents had created a remarkable center of business and community life. The district included stores, professional offices, entertainment venues and homes owned by Black citizens. Understanding Greenwood means learning what was built—not only what was burned.

MORE →
TRIVIA QUESTION OF THE DAY

Which Supreme Court case ruled state-sponsored public-school segregation unconstitutional?

Brown v. Board of Education in 1954.